avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scottca...@apache.org
Subject svn commit: r1064397 [2/2] - in /avro/trunk: ./ lang/java/ lang/java/avro/src/main/java/org/apache/avro/ lang/java/avro/src/main/java/org/apache/avro/io/ lang/java/avro/src/main/java/org/apache/avro/ipc/ lang/java/avro/src/main/java/org/apache/avro/ref...
Date Fri, 28 Jan 2011 01:04:56 GMT
Modified: avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/Main.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/Main.java?rev=1064397&r1=1064396&r2=1064397&view=diff
==============================================================================
--- avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/Main.java (original)
+++ avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/Main.java Fri Jan 28 01:04:53
2011
@@ -23,9 +23,6 @@ import java.util.TreeMap;
 
 import java.io.InputStream;
 
-import org.apache.avro.reflect.InduceSchemaTool;
-import org.apache.avro.specific.SpecificCompiler.SpecificCompilerTool;
-
 /** Command-line driver.*/
 public class Main {
   /**

Modified: avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/RpcReceiveTool.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/RpcReceiveTool.java?rev=1064397&r1=1064396&r2=1064397&view=diff
==============================================================================
--- avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/RpcReceiveTool.java (original)
+++ avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/RpcReceiveTool.java Fri
Jan 28 01:04:53 2011
@@ -29,14 +29,14 @@ import joptsimple.OptionParser;
 import joptsimple.OptionSet;
 import joptsimple.OptionSpec;
 
+import org.apache.avro.AvroRemoteException;
 import org.apache.avro.Protocol;
 import org.apache.avro.Protocol.Message;
 import org.apache.avro.generic.GenericDatumWriter;
-import org.apache.avro.generic.GenericResponder;
 import org.apache.avro.io.JsonEncoder;
-import org.apache.avro.ipc.AvroRemoteException;
 import org.apache.avro.ipc.Ipc;
 import org.apache.avro.ipc.Server;
+import org.apache.avro.ipc.generic.GenericResponder;
 import org.codehaus.jackson.JsonEncoding;
 import org.codehaus.jackson.JsonFactory;
 import org.codehaus.jackson.JsonGenerator;
@@ -96,6 +96,7 @@ public class RpcReceiveTool implements T
       }
       out.println();
       new Thread() {
+        @Override
         public void run() {
           try {
             Thread.sleep(1000);

Modified: avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/RpcSendTool.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/RpcSendTool.java?rev=1064397&r1=1064396&r2=1064397&view=diff
==============================================================================
--- avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/RpcSendTool.java (original)
+++ avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/RpcSendTool.java Fri Jan
28 01:04:53 2011
@@ -32,10 +32,10 @@ import org.apache.avro.Protocol;
 import org.apache.avro.Schema;
 import org.apache.avro.Protocol.Message;
 import org.apache.avro.generic.GenericDatumWriter;
-import org.apache.avro.generic.GenericRequestor;
 import org.apache.avro.io.DatumWriter;
 import org.apache.avro.io.JsonEncoder;
 import org.apache.avro.ipc.Ipc;
+import org.apache.avro.ipc.generic.GenericRequestor;
 
 import org.codehaus.jackson.JsonEncoding;
 import org.codehaus.jackson.JsonFactory;

Added: avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/SpecificCompilerTool.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/SpecificCompilerTool.java?rev=1064397&view=auto
==============================================================================
--- avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/SpecificCompilerTool.java
(added)
+++ avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/SpecificCompilerTool.java
Fri Jan 28 01:04:53 2011
@@ -0,0 +1,47 @@
+package org.apache.avro.tool;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.util.List;
+
+import org.apache.avro.compiler.specific.SpecificCompiler;
+
+/**
+ * A Tool for compiling avro protocols or schemas to Java classes using the Avro
+ * SpecificCompiler.
+ */
+
+public class SpecificCompilerTool implements Tool {
+  @Override
+  public int run(InputStream in, PrintStream out, PrintStream err,
+      List<String> args) throws Exception {
+    if (args.size() != 3) {
+      System.err
+          .println("Expected 3 arguments: (schema|protocol) inputfile outputdir");
+      return 1;
+    }
+    String method = args.get(0);
+    File input = new File(args.get(1));
+    File output = new File(args.get(2));
+    if ("schema".equals(method)) {
+      SpecificCompiler.compileSchema(input, output);
+    } else if ("protocol".equals(method)) {
+      SpecificCompiler.compileProtocol(input, output);
+    } else {
+      System.err.println("Expected \"schema\" or \"protocol\".");
+      return 1;
+    }
+    return 0;
+  }
+
+  @Override
+  public String getName() {
+    return "compile";
+  }
+
+  @Override
+  public String getShortDescription() {
+    return "Generates Java code for the given schema.";
+  }
+}



Mime
View raw message