Browse Source

Readme changes.

Kr Younger 6 years ago
parent
commit
0b343f8e50
2 changed files with 29 additions and 3 deletions
  1. 7
    2
      Client/src/main/java/SimpleShell.java
  2. 22
    1
      README.md

+ 7
- 2
Client/src/main/java/SimpleShell.java View File

7
 
7
 
8
 public class SimpleShell {
8
 public class SimpleShell {
9
 
9
 
10
+
11
+    public static void prettyPrint(String output) {
12
+        // yep, make an effort to format things nicely, eh?
13
+        System.out.println(output);
14
+    }
10
     public static void main(String[] args) throws java.io.IOException {
15
     public static void main(String[] args) throws java.io.IOException {
11
 
16
 
12
         YouAreEll webber = new YouAreEll();
17
         YouAreEll webber = new YouAreEll();
56
                 // ids
61
                 // ids
57
                 if (list.contains("ids")) {
62
                 if (list.contains("ids")) {
58
                     String results = webber.get_ids();
63
                     String results = webber.get_ids();
59
-                    System.out.println(results);
64
+                    SimpleShell.prettyPrint(results);
60
                     continue;
65
                     continue;
61
                 }
66
                 }
62
 
67
 
63
                 // messages
68
                 // messages
64
                 if (list.contains("messages")) {
69
                 if (list.contains("messages")) {
65
                     String results = webber.get_messages();
70
                     String results = webber.get_messages();
66
-                    System.out.println(results);
71
+                    SimpleShell.prettyPrint(results);
67
                     continue;
72
                     continue;
68
                 }
73
                 }
69
                 // you need to add a bunch more.
74
                 // you need to add a bunch more.

+ 22
- 1
README.md View File

8
 You are to write a command interpreter using the provided SimpleShell class. You're going to create a way for 
8
 You are to write a command interpreter using the provided SimpleShell class. You're going to create a way for 
9
 commands to be typed into your shell, read the typed commands and arguments, send them off to the Under-A-Rock 
9
 commands to be typed into your shell, read the typed commands and arguments, send them off to the Under-A-Rock 
10
 server using a REST API over the HTTP protocol, read the JSON data returned from the URL call, and print it out 
10
 server using a REST API over the HTTP protocol, read the JSON data returned from the URL call, and print it out 
11
-nicely formatted for your user. 
11
+nicely formatted for your user. If you manage to get this all done in a reasonable time, attempt parts 2 and 3.
12
 
12
 
13
 Under-A-Rock acts a little (very little) like a twitter server or chat server. 
13
 Under-A-Rock acts a little (very little) like a twitter server or chat server. 
14
 
14
 
49
 You should also create some unit tests for your REST API handlers.
49
 You should also create some unit tests for your REST API handlers.
50
 
50
 
51
 It's possible you may also need to understand some of what the Jackson package does for you. 
51
 It's possible you may also need to understand some of what the Jackson package does for you. 
52
+
52
 * jackson json https://github.com/FasterXML/jackson
53
 * jackson json https://github.com/FasterXML/jackson
53
 
54
 
55
+And you may wish to create a couple classes `public class Message` and `public class Id` to make handling
56
+the abstractions implied by the API easier.
57
+
58
+Jackson can help you parse the json into objects,and objects back into JSON strings. Be sure to research how you can
59
+dependencies in the `pom.xml` so that Jackson, well, so that you can use Jackson in the project.
60
+
54
 ## IDs
61
 ## IDs
55
 
62
 
56
 #### ID commands in shell
63
 #### ID commands in shell
159
  ```
166
  ```
160
 and send it as the body of a POST request to  `http://zipcode.rocks:8085/ids/xt0fer/messages/`
167
 and send it as the body of a POST request to  `http://zipcode.rocks:8085/ids/xt0fer/messages/`
161
 
168
 
169
+## Part Two
170
+
171
+What's that ProcessBuilder stuff about? In the SimpleShell class, take a look. How can that be used
172
+as a pattern to use threads to make the API calls and wait for the response? Maybe launch a new thread on every request?
173
+
174
+## Part Three
175
+
176
+Build a better set of commands. Make the "fromid" intrinsic, so it isn't needed on the various shell commands.
177
+Add a feature where you can send messages by someone's name. Create a means where the client watches the server for 
178
+any private messages to you and only prints them once. 
179
+Add another command that watches the global stream and only prints messages once.
180
+
181
+
182
+
162
 
183