You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2008/11/12 18:42:28 UTC

svn commit: r713432 [2/2] - in /activemq/sandbox/activemq-protobuf: activemq-protobuf-test/ activemq-protobuf-test/src/test/java/com/google/protobuf/ activemq-protobuf-test/src/test/java/org/apache/activemq/protobuf/ activemq-protobuf/ activemq-protobu...

Modified: activemq/sandbox/activemq-protobuf/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/JavaGenerator.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-protobuf/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/JavaGenerator.java?rev=713432&r1=713431&r2=713432&view=diff
==============================================================================
--- activemq/sandbox/activemq-protobuf/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/JavaGenerator.java (original)
+++ activemq/sandbox/activemq-protobuf/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/JavaGenerator.java Wed Nov 12 09:42:27 2008
@@ -16,12 +16,12 @@
  */
 package org.apache.activemq.protobuf.compiler;
 
-import static org.apache.activemq.protobuf.WireInfo.WIRETYPE_FIXED32;
-import static org.apache.activemq.protobuf.WireInfo.WIRETYPE_FIXED64;
-import static org.apache.activemq.protobuf.WireInfo.WIRETYPE_LENGTH_DELIMITED;
-import static org.apache.activemq.protobuf.WireInfo.WIRETYPE_START_GROUP;
-import static org.apache.activemq.protobuf.WireInfo.WIRETYPE_VARINT;
-import static org.apache.activemq.protobuf.WireInfo.makeTag;
+import static org.apache.activemq.protobuf.WireFormat.WIRETYPE_FIXED32;
+import static org.apache.activemq.protobuf.WireFormat.WIRETYPE_FIXED64;
+import static org.apache.activemq.protobuf.WireFormat.WIRETYPE_LENGTH_DELIMITED;
+import static org.apache.activemq.protobuf.WireFormat.WIRETYPE_START_GROUP;
+import static org.apache.activemq.protobuf.WireFormat.WIRETYPE_VARINT;
+import static org.apache.activemq.protobuf.WireFormat.makeTag;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -446,56 +446,56 @@
         	postMergeProcessing="";
         }
         
-        p("public static "+className+" parseUnframed(com.google.protobuf.CodedInputStream data) throws com.google.protobuf.InvalidProtocolBufferException, java.io.IOException {");
+        p("public static "+className+" parseUnframed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {");
         indent();
         p("return new "+className+"().mergeUnframed(data)"+postMergeProcessing+";");
         unindent();
         p("}");
         p();
 
-        p("public static "+className+" parseUnframed(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException {");
+        p("public static "+className+" parseUnframed(org.apache.activemq.protobuf.ByteString data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {");
         indent();
         p("return new "+className+"().mergeUnframed(data)"+postMergeProcessing+";");
         unindent();
         p("}");
         p();
 
-        p("public static "+className+" parseUnframed(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException {");
+        p("public static "+className+" parseUnframed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {");
         indent();
         p("return new "+className+"().mergeUnframed(data)"+postMergeProcessing+";");
         unindent();
         p("}");
         p();
         
-        p("public static "+className+" parseUnframed(java.io.InputStream data) throws com.google.protobuf.InvalidProtocolBufferException, java.io.IOException {");
+        p("public static "+className+" parseUnframed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {");
         indent();
         p("return new "+className+"().mergeUnframed(data)"+postMergeProcessing+";");
         unindent();
         p("}");
         p();
         
-        p("public static "+className+" parseFramed(com.google.protobuf.CodedInputStream data) throws com.google.protobuf.InvalidProtocolBufferException, java.io.IOException {");
+        p("public static "+className+" parseFramed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {");
         indent();
         p("return new "+className+"().mergeFramed(data)"+postMergeProcessing+";");
         unindent();
         p("}");
         p();
         
-        p("public static "+className+" parseFramed(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException {");
+        p("public static "+className+" parseFramed(org.apache.activemq.protobuf.ByteString data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {");
         indent();
         p("return new "+className+"().mergeFramed(data)"+postMergeProcessing+";");
         unindent();
         p("}");
         p();
 
-        p("public static "+className+" parseFramed(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException {");
+        p("public static "+className+" parseFramed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {");
         indent();
         p("return new "+className+"().mergeFramed(data)"+postMergeProcessing+";");
         unindent();
         p("}");
         p();
         
-        p("public static "+className+" parseFramed(java.io.InputStream data) throws com.google.protobuf.InvalidProtocolBufferException, java.io.IOException {");
+        p("public static "+className+" parseFramed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {");
         indent();
         p("return new "+className+"().mergeFramed(data)"+postMergeProcessing+";");
         unindent();
@@ -637,37 +637,37 @@
             }
 
             if( field.getType()==FieldDescriptor.STRING_TYPE ) {
-                p("size += com.google.protobuf.CodedOutputStream.computeStringSize("+field.getTag()+", "+getter+");");
+                p("size += org.apache.activemq.protobuf.CodedOutputStream.computeStringSize("+field.getTag()+", "+getter+");");
             } else if( field.getType()==FieldDescriptor.BYTES_TYPE ) {
-                p("size += com.google.protobuf.CodedOutputStream.computeBytesSize("+field.getTag()+", "+getter+");");
+                p("size += org.apache.activemq.protobuf.CodedOutputStream.computeBytesSize("+field.getTag()+", "+getter+");");
             } else if( field.getType()==FieldDescriptor.BOOL_TYPE ) {
-                p("size += com.google.protobuf.CodedOutputStream.computeBoolSize("+field.getTag()+", "+getter+");");
+                p("size += org.apache.activemq.protobuf.CodedOutputStream.computeBoolSize("+field.getTag()+", "+getter+");");
             } else if( field.getType()==FieldDescriptor.DOUBLE_TYPE ) {
-                p("size += com.google.protobuf.CodedOutputStream.computeDoubleSize("+field.getTag()+", "+getter+");");
+                p("size += org.apache.activemq.protobuf.CodedOutputStream.computeDoubleSize("+field.getTag()+", "+getter+");");
             } else if( field.getType()==FieldDescriptor.FLOAT_TYPE ) {
-                p("size += com.google.protobuf.CodedOutputStream.computeFloatSize("+field.getTag()+", "+getter+");");
+                p("size += org.apache.activemq.protobuf.CodedOutputStream.computeFloatSize("+field.getTag()+", "+getter+");");
             } else if( field.getType()==FieldDescriptor.INT32_TYPE ) {
-                p("size += com.google.protobuf.CodedOutputStream.computeInt32Size("+field.getTag()+", "+getter+");");
+                p("size += org.apache.activemq.protobuf.CodedOutputStream.computeInt32Size("+field.getTag()+", "+getter+");");
             } else if( field.getType()==FieldDescriptor.INT64_TYPE ) {
-                p("size += com.google.protobuf.CodedOutputStream.computeInt64Size("+field.getTag()+", "+getter+");");
+                p("size += org.apache.activemq.protobuf.CodedOutputStream.computeInt64Size("+field.getTag()+", "+getter+");");
             } else if( field.getType()==FieldDescriptor.SINT32_TYPE ) {
-                p("size += com.google.protobuf.CodedOutputStream.computeSInt32Size("+field.getTag()+", "+getter+");");
+                p("size += org.apache.activemq.protobuf.CodedOutputStream.computeSInt32Size("+field.getTag()+", "+getter+");");
             } else if( field.getType()==FieldDescriptor.SINT64_TYPE ) {
-                p("size += com.google.protobuf.CodedOutputStream.computeSInt64Size("+field.getTag()+", "+getter+");");
+                p("size += org.apache.activemq.protobuf.CodedOutputStream.computeSInt64Size("+field.getTag()+", "+getter+");");
             } else if( field.getType()==FieldDescriptor.UINT32_TYPE ) {
-                p("size += com.google.protobuf.CodedOutputStream.computeUInt32Size("+field.getTag()+", "+getter+");");
+                p("size += org.apache.activemq.protobuf.CodedOutputStream.computeUInt32Size("+field.getTag()+", "+getter+");");
             } else if( field.getType()==FieldDescriptor.UINT64_TYPE ) {
-                p("size += com.google.protobuf.CodedOutputStream.computeUInt64Size("+field.getTag()+", "+getter+");");
+                p("size += org.apache.activemq.protobuf.CodedOutputStream.computeUInt64Size("+field.getTag()+", "+getter+");");
             } else if( field.getType()==FieldDescriptor.FIXED32_TYPE ) {
-                p("size += com.google.protobuf.CodedOutputStream.computeFixed32Size("+field.getTag()+", "+getter+");");
+                p("size += org.apache.activemq.protobuf.CodedOutputStream.computeFixed32Size("+field.getTag()+", "+getter+");");
             } else if( field.getType()==FieldDescriptor.FIXED64_TYPE ) {
-                p("size += com.google.protobuf.CodedOutputStream.computeFixed64Size("+field.getTag()+", "+getter+");");
+                p("size += org.apache.activemq.protobuf.CodedOutputStream.computeFixed64Size("+field.getTag()+", "+getter+");");
             } else if( field.getType()==FieldDescriptor.SFIXED32_TYPE ) {
-                p("size += com.google.protobuf.CodedOutputStream.computeSFixed32Size("+field.getTag()+", "+getter+");");
+                p("size += org.apache.activemq.protobuf.CodedOutputStream.computeSFixed32Size("+field.getTag()+", "+getter+");");
             } else if( field.getType()==FieldDescriptor.SFIXED64_TYPE ) {
-                p("size += com.google.protobuf.CodedOutputStream.computeSFixed64Size("+field.getTag()+", "+getter+");");
+                p("size += org.apache.activemq.protobuf.CodedOutputStream.computeSFixed64Size("+field.getTag()+", "+getter+");");
             } else if( field.getTypeDescriptor().isEnum() ) {
-                p("size += com.google.protobuf.CodedOutputStream.computeEnumSize("+field.getTag()+", "+getter+".getNumber());");
+                p("size += org.apache.activemq.protobuf.CodedOutputStream.computeEnumSize("+field.getTag()+", "+getter+".getNumber());");
             } else if ( field.getGroup()!=null ) {
                 p("size += computeGroupSize("+field.getTag()+", "+getter+");");
             } else {
@@ -695,15 +695,15 @@
      * @param m
      */
     private void generateMethodWriteTo(MessageDescriptor m) {
-        p("public void writeUnframed(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {");
+        p("public void writeUnframed(org.apache.activemq.protobuf.CodedOutputStream output) throws java.io.IOException {");
         indent();
         
         if( deferredDecode ) {
 			p("if (encodedForm == null) {");
 			indent();
 			p("encodedForm = new byte[serializedSizeUnframed()];");
-			p("com.google.protobuf.CodedOutputStream original = output;");
-			p("output = com.google.protobuf.CodedOutputStream.newInstance(encodedForm);");
+			p("org.apache.activemq.protobuf.CodedOutputStream original = output;");
+			p("output = org.apache.activemq.protobuf.CodedOutputStream.newInstance(encodedForm);");
         }
         
 
@@ -786,7 +786,7 @@
      * @param className
      */
     private void generateMethodMergeFromStream(MessageDescriptor m, String className) {
-        p("public "+className+" mergeUnframed(com.google.protobuf.CodedInputStream input) throws java.io.IOException {");
+        p("public "+className+" mergeUnframed(org.apache.activemq.protobuf.CodedInputStream input) throws java.io.IOException {");
         indent();
 		{        
 			p("while (true) {");
@@ -1349,7 +1349,7 @@
             if( field.isStringType() ) {
                 return asJavaString(defaultOption.getValue());
             } else if( field.getType() == FieldDescriptor.BYTES_TYPE ) {
-                return "com.google.protobuf.ByteString.copyFromUtf8("+asJavaString(defaultOption.getValue())+")";
+                return "org.apache.activemq.protobuf.ByteString.copyFromUtf8("+asJavaString(defaultOption.getValue())+")";
             } else if( field.isInteger32Type() ) {
                 int v;
                 if( field.getType() == FieldDescriptor.UINT32_TYPE ) {
@@ -1529,7 +1529,7 @@
             return "java.lang.String";
         }
         if( field.getType() == FieldDescriptor.BYTES_TYPE ) {
-            return "com.google.protobuf.ByteString";
+            return "org.apache.activemq.protobuf.ByteString";
         }
         if( field.getType() == FieldDescriptor.BOOL_TYPE ) {
             return "java.lang.Boolean";
@@ -1556,7 +1556,7 @@
             return "java.lang.String";
         }
         if( field.getType() == FieldDescriptor.BYTES_TYPE ) {
-            return "com.google.protobuf.ByteString";
+            return "org.apache.activemq.protobuf.ByteString";
         }
         if( field.getType() == FieldDescriptor.BOOL_TYPE ) {
             return "boolean";

Modified: activemq/sandbox/activemq-protobuf/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/ParserSupport.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-protobuf/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/ParserSupport.java?rev=713432&r1=713431&r2=713432&view=diff
==============================================================================
--- activemq/sandbox/activemq-protobuf/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/ParserSupport.java (original)
+++ activemq/sandbox/activemq-protobuf/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/ParserSupport.java Wed Nov 12 09:42:27 2008
@@ -19,7 +19,6 @@
 import org.apache.activemq.protobuf.compiler.TextFormat.InvalidEscapeSequence;
 import org.apache.activemq.protobuf.compiler.parser.ParseException;
 import org.apache.activemq.protobuf.compiler.parser.Token;
-import com.google.protobuf.ByteString;
 
 public class ParserSupport {
 

Modified: activemq/sandbox/activemq-protobuf/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/TextFormat.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-protobuf/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/TextFormat.java?rev=713432&r1=713431&r2=713432&view=diff
==============================================================================
--- activemq/sandbox/activemq-protobuf/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/TextFormat.java (original)
+++ activemq/sandbox/activemq-protobuf/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/TextFormat.java Wed Nov 12 09:42:27 2008
@@ -16,21 +16,14 @@
 
 package org.apache.activemq.protobuf.compiler;
 
-import com.google.protobuf.ByteString;
-import com.google.protobuf.Descriptors.Descriptor;
-import com.google.protobuf.Descriptors.FieldDescriptor;
-import com.google.protobuf.Descriptors.EnumDescriptor;
-import com.google.protobuf.Descriptors.EnumValueDescriptor;
-
 import java.io.IOException;
-import java.nio.CharBuffer;
 import java.math.BigInteger;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
+import java.nio.CharBuffer;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.apache.activemq.protobuf.ByteString;
+
 /** 
  * Provide ascii text parsing and formatting support for proto2 instances.
  * The implementation largely follows google/protobuf/text_format.cc.