incubator-droids-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thors...@apache.org
Subject svn commit: r758279 - /incubator/droids/trunk/droids-spring/src/main/java/org/apache/droids/dynamic/Cli.java
Date Wed, 25 Mar 2009 14:51:35 GMT
Author: thorsten
Date: Wed Mar 25 14:51:31 2009
New Revision: 758279

URL: http://svn.apache.org/viewvc?rev=758279&view=rev
Log:
Adding more feedback for the dynamic cli.

Modified:
    incubator/droids/trunk/droids-spring/src/main/java/org/apache/droids/dynamic/Cli.java

Modified: incubator/droids/trunk/droids-spring/src/main/java/org/apache/droids/dynamic/Cli.java
URL: http://svn.apache.org/viewvc/incubator/droids/trunk/droids-spring/src/main/java/org/apache/droids/dynamic/Cli.java?rev=758279&r1=758278&r2=758279&view=diff
==============================================================================
--- incubator/droids/trunk/droids-spring/src/main/java/org/apache/droids/dynamic/Cli.java
(original)
+++ incubator/droids/trunk/droids-spring/src/main/java/org/apache/droids/dynamic/Cli.java
Wed Mar 25 14:51:31 2009
@@ -64,12 +64,18 @@
     
     if (droid == null) {
       log.error("Droid " + name + " is not defined");
+      log.error(getUsage());
       return;
     }
     
     log.info("A p a c h e    D r o i d s - an intelligent robot framework");
     if (droid instanceof CrawlingDroid) {
       List<String> locations = new ArrayList<String>();
+      if (location == null) {
+        log.error("Droid " + name + " is a crawler, however you have not defined a starting
location.");
+        log.error(getUsage());
+        return;
+      }
       locations.add(location);
       ((CrawlingDroid) droid).setInitialLocations(locations);
     }
@@ -78,4 +84,16 @@
     droid.getTaskMaster().awaitTermination(0, TimeUnit.MILLISECONDS);
   }
 
+  private static String getUsage() {
+    StringBuffer message = new StringBuffer();
+    message.append("Please start Droids like follows. ");
+    message.append("\n");
+    message.append("The first argument should define the name of " +
+    		"the droid you want to start (e.g. \"hello\"). ");
+    message.append("\n");
+    message.append("The second argument may be a starting location. " +
+    		"This initial location is mandatory for crawler and walker, so you need to define it.");
+    return message.toString();
+  }
+
 }



Mime
View raw message