in uima-ducc-database/src/main/java/org/apache/uima/ducc/database/lifetime/DbDaemonLifetimeUI.java [172:271]
private int mainline(String[] args) {
int rc = RC_Failure;
Long tod = System.currentTimeMillis();
String kw = null;
if(args.length > 0) {
kw = DbDaemonLifetimeCommon.normalize_kw(args[0]);
}
String host = null;
if(args.length > 1) {
host = DbDaemonLifetimeCommon.normalize_host(args[1]);
}
String daemon = null;
if(args.length > 2) {
daemon = DbDaemonLifetimeCommon.normalize_daemon(args[2]);
}
//
if(args.length < 1) {
String message = "no arguments specified";
System.out.println(message);
help();
}
//
if(args.length == 1) {
if(!is_valid_kw(kw)) {
System.out.println(message_specify);
help();
}
if(kw.equalsIgnoreCase(__query)) {
rc = query(host,daemon);
}
else if(kw.equalsIgnoreCase(__stop)) {
rc = stop(host,daemon,tod);
}
else {
String message = "specify host and daemon";
System.out.println(message);
help();
}
}
//
else if(args.length == 2) {
if(!is_valid_kw(kw)) {
System.out.println(message_specify);
help();
}
if(!is_valid_host(host)) {
help();
}
if(kw.equalsIgnoreCase(__query)) {
rc = query(host,daemon);
}
else if(kw.equalsIgnoreCase(__stop)) {
rc = stop(host,daemon,tod);
}
else {
String message = "specify host and daemon";
System.out.println(message);
help();
}
}
//
else if(args.length == 3) {
if(!is_valid_kw(kw)) {
System.out.println(message_specify);
help();
}
if(!is_valid_host(host)) {
help();
}
if(!is_valid_daemon(daemon)) {
help();
}
if(kw.equalsIgnoreCase(__query)) {
rc = query(host,daemon);
}
else if(kw.equalsIgnoreCase(__delete)) {
rc = delete(host,daemon);
}
else if(kw.equalsIgnoreCase(__quiesce)) {
rc = quiesce(host,daemon,tod);
}
else if(kw.equalsIgnoreCase(__start)) {
rc = start(host,daemon,tod);
}
else if(kw.equalsIgnoreCase(__stop)) {
rc = stop(host,daemon,tod);
}
else {
System.out.println(message_specify);
help();
}
}
//
else {
String message = "too many arguments";
System.out.println(message);
help();
}
return rc;
}