Selaa lähdekoodia

Readme changes.

Kr Younger 6 vuotta sitten
vanhempi
commit
0b343f8e50
2 muutettua tiedostoa jossa 29 lisäystä ja 3 poistoa
  1. 7
    2
      Client/src/main/java/SimpleShell.java
  2. 22
    1
      README.md

+ 7
- 2
Client/src/main/java/SimpleShell.java Näytä tiedosto

@@ -7,6 +7,11 @@ import java.util.List;
7 7
 
8 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 15
     public static void main(String[] args) throws java.io.IOException {
11 16
 
12 17
         YouAreEll webber = new YouAreEll();
@@ -56,14 +61,14 @@ public class SimpleShell {
56 61
                 // ids
57 62
                 if (list.contains("ids")) {
58 63
                     String results = webber.get_ids();
59
-                    System.out.println(results);
64
+                    SimpleShell.prettyPrint(results);
60 65
                     continue;
61 66
                 }
62 67
 
63 68
                 // messages
64 69
                 if (list.contains("messages")) {
65 70
                     String results = webber.get_messages();
66
-                    System.out.println(results);
71
+                    SimpleShell.prettyPrint(results);
67 72
                     continue;
68 73
                 }
69 74
                 // you need to add a bunch more.

+ 22
- 1
README.md Näytä tiedosto

@@ -8,7 +8,7 @@
8 8
 You are to write a command interpreter using the provided SimpleShell class. You're going to create a way for 
9 9
 commands to be typed into your shell, read the typed commands and arguments, send them off to the Under-A-Rock 
10 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 13
 Under-A-Rock acts a little (very little) like a twitter server or chat server. 
14 14
 
@@ -49,8 +49,15 @@ Be prepared to defend your choice if which HTTP client library you chose, with r
49 49
 You should also create some unit tests for your REST API handlers.
50 50
 
51 51
 It's possible you may also need to understand some of what the Jackson package does for you. 
52
+
52 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 61
 ## IDs
55 62
 
56 63
 #### ID commands in shell
@@ -159,4 +166,18 @@ send xt0fer 'Hello old buddy!' to torvalds
159 166
  ```
160 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