Skip to content

Commit

Permalink
cli input==null with check
Browse files Browse the repository at this point in the history
  • Loading branch information
dido18 committed May 19, 2016
1 parent 1639e57 commit fe55002
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 35 deletions.
2 changes: 1 addition & 1 deletion app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.dido.pad.PadFsNode</mainClass>
<mainClass>com.dido.pad.app.AppRunner</mainClass>
</manifest>
</archive>
</configuration>
Expand Down
71 changes: 37 additions & 34 deletions cli/src/main/java/com/dido/pad/cli/client/Cli.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,49 +101,52 @@ public void runCli() {
"\t nodes : shows the nodes active inthe system \n";

System.out.print("\nInsert a command (h for usage message)");
String input = null;
while(true){

System.out.print("\n>> ");
String input = null;

try {
input = bufferReader.readLine();
} catch (IOException e) {
e.printStackTrace();
}
if( input !=null) {
String[] cmds = input.split("\\s+"); //splits white spaces

switch (cmds[0]) {
case ("get"):
String key = cmds[1];
sendGetAndWait(key);
break;
case ("put"):
String k = cmds[1];
String v = cmds[2];
sendPutAndWait(k, v);
break;
case ("list"):
String ip = cmds[1];
sendListAndWait(ip);
break;
case ("rm"):
String Rmkey = cmds[1];
sendRmAndWait(Rmkey);
break;
case ("nodes"):
System.out.print(getcHasher().getAllNodes());
break;
case ("force"):
String kk = cmds[1];
String vv = cmds[2];
String Ip = cmds[3];
sendForce(kk, vv, Ip);
;
break;
case ("h"):
System.out.print(help);
break;

String[] cmds = input.split("\\s+"); //splits white spaces

switch (cmds[0]) {
case ("get"):
String key = cmds[1];
sendGetAndWait(key);
break;
case ("put"):
String k = cmds[1];
String v = cmds[2];
sendPutAndWait(k,v);
break;
case ("list"):
String ip = cmds[1];
sendListAndWait(ip);
break;
case ("rm"):
String Rmkey = cmds[1];
sendRmAndWait(Rmkey);
break;
case ("nodes"):
System.out.print(getcHasher().getAllNodes());
break;
case ("force"):
String kk = cmds[1];
String vv = cmds[2];
String Ip = cmds[3];
sendForce(kk, vv, Ip);;
break;
case ("h"):
System.out.print(help);
break;

}
}
}
}
Expand Down
Empty file modified runDocker.sh
100644 → 100755
Empty file.

0 comments on commit fe55002

Please sign in to comment.