incubator-hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r707324 - in /incubator/hama/trunk: CHANGES.txt src/java/org/apache/hama/shell/HamaShellParser.java src/java/org/apache/hama/shell/parser/script/HamaScriptParser.jj
Date Thu, 23 Oct 2008 09:25:00 GMT
Author: edwardyoon
Date: Thu Oct 23 02:24:59 2008
New Revision: 707324

URL: http://svn.apache.org/viewvc?rev=707324&view=rev
Log:
Shell Exception Handling.

Modified:
    incubator/hama/trunk/CHANGES.txt
    incubator/hama/trunk/src/java/org/apache/hama/shell/HamaShellParser.java
    incubator/hama/trunk/src/java/org/apache/hama/shell/parser/script/HamaScriptParser.jj

Modified: incubator/hama/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/CHANGES.txt?rev=707324&r1=707323&r2=707324&view=diff
==============================================================================
--- incubator/hama/trunk/CHANGES.txt (original)
+++ incubator/hama/trunk/CHANGES.txt Thu Oct 23 02:24:59 2008
@@ -28,6 +28,7 @@
     
   IMPROVEMENTS
     
+    HAMA-89: Exception Handling of a ParseException (samuel)
     HAMA-77: clear the matrices in hbase after quiting the shell (samuel via edwardyoon)
     HAMA-28: Implement Vector.add() method (edwardyoon)
     HAMA-78: Separate Interface and Implementation for HamaAdmin (edwardyoon)

Modified: incubator/hama/trunk/src/java/org/apache/hama/shell/HamaShellParser.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/shell/HamaShellParser.java?rev=707324&r1=707323&r2=707324&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/shell/HamaShellParser.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/shell/HamaShellParser.java Thu Oct 23 02:24:59
2008
@@ -90,13 +90,40 @@
 
   @Override
   protected void printHelp() {
-    System.out.println("Operations:");
-    System.out.println("<hama operation>;");
-    System.out.println("such as : \"A = B + C\" or \"save A as file\"");
+    System.out.println("HAMA V1.0 SHELL COMMANDS");
+    System.out.println("all the supported commands in hama shell will be:");
+    System.out.println("'<hama expression> ;',");
+    System.out.println("'quit',");
+    System.out.println("'help'.");
+    System.out.println();
+    System.out.println("Hama Expressions:");
+    System.out.println("Load\t\tload a matrix from a specified source. but now is unsupported.");
+    System.out.println();
+    System.out.println("Save\t\tsave a matrix to a specified target. but now is unsupported.");
+    System.out.println();
+    System.out.println("Add\t\tMatrix Addition.");
+    System.out.println("\t\thama> a = b + c;");
+    System.out.println();
+    System.out.println("Sub\t\tMatrix Subtraction.");
+    System.out.println("\t\thama> a = b - c;");
+    System.out.println();
+    System.out.println("Multiply\tMatrix Multiplication.");
+    System.out.println("\t\thama> a = b * c;");
+    System.out.println();
+    System.out.println("Random\t\tGenerate a random matrix.");
+    System.out.println("\t\thama> a = matrix.random 10 10;");
+    System.out.println();
+    System.out.println("Examples");
+    System.out.println("hama> a = matrix.random 10 10;");
+    System.out.println("hama> b = matrix.random 10 10;");
+    System.out.println("hama> c = a + b;");
+    System.out.println("hama> d = (a + c) * ( b + a * c );");
     System.out.println();
     System.out.println("Commands:");
     System.out.println("quit -- exit the hama shell");
     System.out.println("help -- dispaly the usage informations");
+    System.out.println();
+    System.out.println("For more on the Hama Shell, see http://wiki.apache.org/hama/Shell");
   }
 
   /**

Modified: incubator/hama/trunk/src/java/org/apache/hama/shell/parser/script/HamaScriptParser.jj
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/shell/parser/script/HamaScriptParser.jj?rev=707324&r1=707323&r2=707324&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/shell/parser/script/HamaScriptParser.jj
(original)
+++ incubator/hama/trunk/src/java/org/apache/hama/shell/parser/script/HamaScriptParser.jj
Thu Oct 23 02:24:59 2008
@@ -161,7 +161,8 @@
 	ParseException e = generateParseException();  // generate the exception object.
 	
 	if (mInteractive) {
-		System.out.println(e.toString());  // print the error message
+		printGuide();
+		
 		Token t = getNextToken();
 
 		while (t.kind != kind)
@@ -170,3 +171,15 @@
 		throw e;
 	}
 }
+
+JAVACODE
+private void printGuide()
+{
+	System.out.println("HAMA V1.0 SHELL COMMANDS");
+    System.out.println("all the supported commands in hama shell will be:");
+    System.out.println("'<hama expression> ;',");
+    System.out.println("'quit',");
+    System.out.println("'help'.");
+    System.out.println();
+    System.out.println("Try type 'help' to see details.");
+}



Mime
View raw message