activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmacn...@apache.org
Subject svn commit: r909704 [5/10] - in /activemq/sandbox/activemq-apollo-actor/activemq-amqp/src: main/java/org/apache/activemq/amqp/protocol/marshaller/ main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/ main/java/org/apache/activemq/amqp/protoco...
Date Sat, 13 Feb 2010 03:20:18 GMT
Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpTxnMarshaller.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpTxnMarshaller.java?rev=909704&r1=909703&r2=909704&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpTxnMarshaller.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpTxnMarshaller.java Sat Feb 13 03:20:16 2010
@@ -35,7 +35,7 @@
 public class AmqpTxnMarshaller implements DescribedTypeMarshaller<AmqpTxn>{
 
     static final AmqpTxnMarshaller SINGLETON = new AmqpTxnMarshaller();
-    private static final Encoded<IAmqpList> NULL_ENCODED = new Encoder.NullEncoded<IAmqpList>();
+    private static final Encoded<IAmqpList<AmqpType<?, ?>>> NULL_ENCODED = new Encoder.NullEncoded<IAmqpList<AmqpType<?, ?>>>();
 
     public static final String SYMBOLIC_ID = "amqp:txn:list";
     //Format code: 0x00000001:0x00000303:
@@ -49,43 +49,60 @@
         (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x03   // DESCRIPTOR ID CODE
     }), 0);
 
-    private static final ListDecoder DECODER = new ListDecoder() {
-        public final AmqpType<?, ?> unmarshalType(int pos, DataInput in) throws IOException {
-            switch(pos) {
-            case 0: {
-                return AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(in));
+    private static final ListDecoder<AmqpType<?, ?>> DECODER = new ListDecoder<AmqpType<?, ?>>() {
+        public final IAmqpList<AmqpType<?, ?>> unmarshalType(int dataCount, int dataSize, DataInput in) throws AmqpEncodingError, IOException {
+            if (dataCount > 3) {
+                throw new AmqpEncodingError("Too many fields for " + SYMBOLIC_ID + ": " + dataCount);
             }
-            case 1: {
-                return AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(in));
+            IAmqpList<AmqpType<?, ?>> rc = new IAmqpList.ArrayBackedList<AmqpType<?, ?>>(new AmqpType<?, ?>[3]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(in)));
+                dataCount--;
             }
-            case 2: {
-                return AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(in));
-            }
-            default: {
-                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+
+            //fail:
+            if(dataCount > 0) {
+                rc.set(1, AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(in)));
+                dataCount--;
             }
+
+            //suspend:
+            if(dataCount > 0) {
+                rc.set(2, AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(in)));
+                dataCount--;
             }
+            return rc;
         }
 
-        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
-            switch(pos) {
-            case 0: {
-                return AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
+        public IAmqpList<AmqpType<?, ?>> decode(EncodedBuffer[] constituents) {
+            if (constituents.length > 3) {
+                throw new AmqpEncodingError("Too many fields for " + SYMBOLIC_ID + ":" + constituents.length);
             }
-            case 1: {
-                return AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(buffer));
+            int dataCount = constituents.length;
+            IAmqpList<AmqpType<?, ?>> rc = new IAmqpList.ArrayBackedList<AmqpType<?, ?>>(new AmqpType<?, ?>[3]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(constituents[0])));
+                dataCount--;
             }
-            case 2: {
-                return AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(buffer));
-            }
-            default: {
-                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+
+            //fail:
+            if(dataCount > 0) {
+                rc.set(1, AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(constituents[1])));
+                dataCount--;
             }
+
+            //suspend:
+            if(dataCount > 0) {
+                rc.set(2, AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(constituents[2])));
+                dataCount--;
             }
+            return rc;
         }
     };
 
-    public static class AmqpTxnEncoded extends DescribedEncoded<IAmqpList> {
+    public static class AmqpTxnEncoded extends DescribedEncoded<IAmqpList<AmqpType<?, ?>>> {
 
         public AmqpTxnEncoded(DescribedBuffer buffer) {
             super(buffer);
@@ -103,11 +120,11 @@
             return NUMERIC_ID;
         }
 
-        protected final Encoded<IAmqpList> decodeDescribed(EncodedBuffer encoded) throws AmqpEncodingError {
+        protected final Encoded<IAmqpList<AmqpType<?, ?>>> decodeDescribed(EncodedBuffer encoded) throws AmqpEncodingError {
             return AmqpListMarshaller.createEncoded(encoded, DECODER);
         }
 
-        protected final Encoded<IAmqpList> unmarshalDescribed(DataInput in) throws IOException {
+        protected final Encoded<IAmqpList<AmqpType<?, ?>>> unmarshalDescribed(DataInput in) throws IOException {
             return AmqpListMarshaller.createEncoded(in, DECODER);
         }
 
@@ -116,19 +133,19 @@
         }
     }
 
-    public static final Encoded<IAmqpList> encode(AmqpTxn value) throws AmqpEncodingError {
+    public static final Encoded<IAmqpList<AmqpType<?, ?>>> encode(AmqpTxn value) throws AmqpEncodingError {
         return new AmqpTxnEncoded(value);
     }
 
-    static final Encoded<IAmqpList> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
+    static final Encoded<IAmqpList<AmqpType<?, ?>>> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
         return createEncoded(FormatCategory.createBuffer(source, offset));
     }
 
-    static final Encoded<IAmqpList> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
+    static final Encoded<IAmqpList<AmqpType<?, ?>>> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
         return createEncoded(FormatCategory.createBuffer(in.readByte(), in));
     }
 
-    static final Encoded<IAmqpList> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
+    static final Encoded<IAmqpList<AmqpType<?, ?>>> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
         byte fc = buffer.getEncodingFormatCode();
         if (fc == Encoder.NULL_FORMAT_CODE) {
             return NULL_ENCODED;

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpUnlinkMarshaller.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpUnlinkMarshaller.java?rev=909704&r1=909703&r2=909704&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpUnlinkMarshaller.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpUnlinkMarshaller.java Sat Feb 13 03:20:16 2010
@@ -36,7 +36,7 @@
 public class AmqpUnlinkMarshaller implements DescribedTypeMarshaller<AmqpUnlink>{
 
     static final AmqpUnlinkMarshaller SINGLETON = new AmqpUnlinkMarshaller();
-    private static final Encoded<IAmqpList> NULL_ENCODED = new Encoder.NullEncoded<IAmqpList>();
+    private static final Encoded<IAmqpList<AmqpType<?, ?>>> NULL_ENCODED = new Encoder.NullEncoded<IAmqpList<AmqpType<?, ?>>>();
 
     public static final String SYMBOLIC_ID = "amqp:unlink:list";
     //Format code: 0x00000001:0x00000306:
@@ -50,43 +50,60 @@
         (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x06   // DESCRIPTOR ID CODE
     }), 0);
 
-    private static final ListDecoder DECODER = new ListDecoder() {
-        public final AmqpType<?, ?> unmarshalType(int pos, DataInput in) throws IOException {
-            switch(pos) {
-            case 0: {
-                return AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(in));
+    private static final ListDecoder<AmqpType<?, ?>> DECODER = new ListDecoder<AmqpType<?, ?>>() {
+        public final IAmqpList<AmqpType<?, ?>> unmarshalType(int dataCount, int dataSize, DataInput in) throws AmqpEncodingError, IOException {
+            if (dataCount > 3) {
+                throw new AmqpEncodingError("Too many fields for " + SYMBOLIC_ID + ": " + dataCount);
             }
-            case 1: {
-                return AmqpHandle.AmqpHandleBuffer.create(AmqpUintMarshaller.createEncoded(in));
+            IAmqpList<AmqpType<?, ?>> rc = new IAmqpList.ArrayBackedList<AmqpType<?, ?>>(new AmqpType<?, ?>[3]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(in)));
+                dataCount--;
             }
-            case 2: {
-                return AmqpLinkError.AmqpLinkErrorBuffer.create(AmqpLinkErrorMarshaller.createEncoded(in));
-            }
-            default: {
-                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+
+            //handle:
+            if(dataCount > 0) {
+                rc.set(1, AmqpHandle.AmqpHandleBuffer.create(AmqpUintMarshaller.createEncoded(in)));
+                dataCount--;
             }
+
+            //exception:
+            if(dataCount > 0) {
+                rc.set(2, AmqpLinkError.AmqpLinkErrorBuffer.create(AmqpLinkErrorMarshaller.createEncoded(in)));
+                dataCount--;
             }
+            return rc;
         }
 
-        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
-            switch(pos) {
-            case 0: {
-                return AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
+        public IAmqpList<AmqpType<?, ?>> decode(EncodedBuffer[] constituents) {
+            if (constituents.length > 3) {
+                throw new AmqpEncodingError("Too many fields for " + SYMBOLIC_ID + ":" + constituents.length);
             }
-            case 1: {
-                return AmqpHandle.AmqpHandleBuffer.create(AmqpUintMarshaller.createEncoded(buffer));
+            int dataCount = constituents.length;
+            IAmqpList<AmqpType<?, ?>> rc = new IAmqpList.ArrayBackedList<AmqpType<?, ?>>(new AmqpType<?, ?>[3]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(constituents[0])));
+                dataCount--;
             }
-            case 2: {
-                return AmqpLinkError.AmqpLinkErrorBuffer.create(AmqpLinkErrorMarshaller.createEncoded(buffer));
-            }
-            default: {
-                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+
+            //handle:
+            if(dataCount > 0) {
+                rc.set(1, AmqpHandle.AmqpHandleBuffer.create(AmqpUintMarshaller.createEncoded(constituents[1])));
+                dataCount--;
             }
+
+            //exception:
+            if(dataCount > 0) {
+                rc.set(2, AmqpLinkError.AmqpLinkErrorBuffer.create(AmqpLinkErrorMarshaller.createEncoded(constituents[2])));
+                dataCount--;
             }
+            return rc;
         }
     };
 
-    public static class AmqpUnlinkEncoded extends DescribedEncoded<IAmqpList> {
+    public static class AmqpUnlinkEncoded extends DescribedEncoded<IAmqpList<AmqpType<?, ?>>> {
 
         public AmqpUnlinkEncoded(DescribedBuffer buffer) {
             super(buffer);
@@ -104,11 +121,11 @@
             return NUMERIC_ID;
         }
 
-        protected final Encoded<IAmqpList> decodeDescribed(EncodedBuffer encoded) throws AmqpEncodingError {
+        protected final Encoded<IAmqpList<AmqpType<?, ?>>> decodeDescribed(EncodedBuffer encoded) throws AmqpEncodingError {
             return AmqpListMarshaller.createEncoded(encoded, DECODER);
         }
 
-        protected final Encoded<IAmqpList> unmarshalDescribed(DataInput in) throws IOException {
+        protected final Encoded<IAmqpList<AmqpType<?, ?>>> unmarshalDescribed(DataInput in) throws IOException {
             return AmqpListMarshaller.createEncoded(in, DECODER);
         }
 
@@ -117,19 +134,19 @@
         }
     }
 
-    public static final Encoded<IAmqpList> encode(AmqpUnlink value) throws AmqpEncodingError {
+    public static final Encoded<IAmqpList<AmqpType<?, ?>>> encode(AmqpUnlink value) throws AmqpEncodingError {
         return new AmqpUnlinkEncoded(value);
     }
 
-    static final Encoded<IAmqpList> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
+    static final Encoded<IAmqpList<AmqpType<?, ?>>> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
         return createEncoded(FormatCategory.createBuffer(source, offset));
     }
 
-    static final Encoded<IAmqpList> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
+    static final Encoded<IAmqpList<AmqpType<?, ?>>> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
         return createEncoded(FormatCategory.createBuffer(in.readByte(), in));
     }
 
-    static final Encoded<IAmqpList> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
+    static final Encoded<IAmqpList<AmqpType<?, ?>>> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
         byte fc = buffer.getEncodingFormatCode();
         if (fc == Encoder.NULL_FORMAT_CODE) {
             return NULL_ENCODED;

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpXidMarshaller.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpXidMarshaller.java?rev=909704&r1=909703&r2=909704&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpXidMarshaller.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpXidMarshaller.java Sat Feb 13 03:20:16 2010
@@ -35,7 +35,7 @@
 public class AmqpXidMarshaller implements DescribedTypeMarshaller<AmqpXid>{
 
     static final AmqpXidMarshaller SINGLETON = new AmqpXidMarshaller();
-    private static final Encoded<IAmqpList> NULL_ENCODED = new Encoder.NullEncoded<IAmqpList>();
+    private static final Encoded<IAmqpList<AmqpType<?, ?>>> NULL_ENCODED = new Encoder.NullEncoded<IAmqpList<AmqpType<?, ?>>>();
 
     public static final String SYMBOLIC_ID = "amqp:xid:list";
     //Format code: 0x00000001:0x00000104:
@@ -49,43 +49,78 @@
         (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x04   // DESCRIPTOR ID CODE
     }), 0);
 
-    private static final ListDecoder DECODER = new ListDecoder() {
-        public final AmqpType<?, ?> unmarshalType(int pos, DataInput in) throws IOException {
-            switch(pos) {
-            case 0: {
-                return AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(in));
+    private static final ListDecoder<AmqpType<?, ?>> DECODER = new ListDecoder<AmqpType<?, ?>>() {
+        public final IAmqpList<AmqpType<?, ?>> unmarshalType(int dataCount, int dataSize, DataInput in) throws AmqpEncodingError, IOException {
+            if (dataCount > 3) {
+                throw new AmqpEncodingError("Too many fields for " + SYMBOLIC_ID + ": " + dataCount);
             }
-            case 1: {
-                return AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(in));
+            IAmqpList<AmqpType<?, ?>> rc = new IAmqpList.ArrayBackedList<AmqpType<?, ?>>(new AmqpType<?, ?>[3]);
+            //format:
+            if(dataCount > 0) {
+                rc.set(0, AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(in)));
+                dataCount--;
             }
-            case 2: {
-                return AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(in));
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": format");
             }
-            default: {
-                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+
+            //global-id:
+            if(dataCount > 0) {
+                rc.set(1, AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(in)));
+                dataCount--;
+            }
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": global-id");
+            }
+
+            //branch-id:
+            if(dataCount > 0) {
+                rc.set(2, AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(in)));
+                dataCount--;
             }
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": branch-id");
             }
+            return rc;
         }
 
-        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
-            switch(pos) {
-            case 0: {
-                return AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(buffer));
+        public IAmqpList<AmqpType<?, ?>> decode(EncodedBuffer[] constituents) {
+            if (constituents.length > 3) {
+                throw new AmqpEncodingError("Too many fields for " + SYMBOLIC_ID + ":" + constituents.length);
             }
-            case 1: {
-                return AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(buffer));
+            int dataCount = constituents.length;
+            IAmqpList<AmqpType<?, ?>> rc = new IAmqpList.ArrayBackedList<AmqpType<?, ?>>(new AmqpType<?, ?>[3]);
+            //format:
+            if(dataCount > 0) {
+                rc.set(0, AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(constituents[0])));
+                dataCount--;
             }
-            case 2: {
-                return AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(buffer));
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": format");
             }
-            default: {
-                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+
+            //global-id:
+            if(dataCount > 0) {
+                rc.set(1, AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(constituents[1])));
+                dataCount--;
+            }
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": global-id");
+            }
+
+            //branch-id:
+            if(dataCount > 0) {
+                rc.set(2, AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(constituents[2])));
+                dataCount--;
             }
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": branch-id");
             }
+            return rc;
         }
     };
 
-    public static class AmqpXidEncoded extends DescribedEncoded<IAmqpList> {
+    public static class AmqpXidEncoded extends DescribedEncoded<IAmqpList<AmqpType<?, ?>>> {
 
         public AmqpXidEncoded(DescribedBuffer buffer) {
             super(buffer);
@@ -103,11 +138,11 @@
             return NUMERIC_ID;
         }
 
-        protected final Encoded<IAmqpList> decodeDescribed(EncodedBuffer encoded) throws AmqpEncodingError {
+        protected final Encoded<IAmqpList<AmqpType<?, ?>>> decodeDescribed(EncodedBuffer encoded) throws AmqpEncodingError {
             return AmqpListMarshaller.createEncoded(encoded, DECODER);
         }
 
-        protected final Encoded<IAmqpList> unmarshalDescribed(DataInput in) throws IOException {
+        protected final Encoded<IAmqpList<AmqpType<?, ?>>> unmarshalDescribed(DataInput in) throws IOException {
             return AmqpListMarshaller.createEncoded(in, DECODER);
         }
 
@@ -116,19 +151,19 @@
         }
     }
 
-    public static final Encoded<IAmqpList> encode(AmqpXid value) throws AmqpEncodingError {
+    public static final Encoded<IAmqpList<AmqpType<?, ?>>> encode(AmqpXid value) throws AmqpEncodingError {
         return new AmqpXidEncoded(value);
     }
 
-    static final Encoded<IAmqpList> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
+    static final Encoded<IAmqpList<AmqpType<?, ?>>> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
         return createEncoded(FormatCategory.createBuffer(source, offset));
     }
 
-    static final Encoded<IAmqpList> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
+    static final Encoded<IAmqpList<AmqpType<?, ?>>> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
         return createEncoded(FormatCategory.createBuffer(in.readByte(), in));
     }
 
-    static final Encoded<IAmqpList> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
+    static final Encoded<IAmqpList<AmqpType<?, ?>>> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
         byte fc = buffer.getEncodingFormatCode();
         if (fc == Encoder.NULL_FORMAT_CODE) {
             return NULL_ENCODED;

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/Encoder.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/Encoder.java?rev=909704&r1=909703&r2=909704&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/Encoder.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/Encoder.java Sat Feb 13 03:20:16 2010
@@ -21,7 +21,6 @@
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.activemq.amqp.protocol.marshaller.AmqpVersion;
@@ -46,30 +45,61 @@
     static final byte NULL_FORMAT_CODE = AmqpNullMarshaller.FORMAT_CODE;
     static final byte DESCRIBED_FORMAT_CODE = (byte) 0x00;
 
-    static final ListDecoder DEFAULT_LIST_DECODER = new ListDecoder() {
+    public static interface ListDecoder<E extends AmqpType<?, ?>> {
+        public IAmqpList<E> decode(EncodedBuffer[] constituents) throws AmqpEncodingError;
 
-        public final AmqpType<?, ?> unmarshalType(int pos, DataInput in) throws IOException, AmqpEncodingError {
-            return MARSHALLER.unmarshalType(in);
+        public IAmqpList<E> unmarshalType(int dataCount, int dataSize, DataInput in) throws IOException, AmqpEncodingError;
+    }
+
+    public static interface MapDecoder<K extends AmqpType<?, ?>, V extends AmqpType<?, ?>> {
+        public IAmqpMap<K, V> decode(EncodedBuffer[] constituents) throws AmqpEncodingError;
+
+        public IAmqpMap<K, V> unmarshalType(int dataCount, int dataSize, DataInput in) throws IOException, AmqpEncodingError;
+    }
+
+    static final ListDecoder<AmqpType<?, ?>> DEFAULT_LIST_DECODER = new ListDecoder<AmqpType<?, ?>>() {
+
+        public IAmqpList<AmqpType<?, ?>> decode(EncodedBuffer[] constituents) {
+            IAmqpList<AmqpType<?, ?>> rc = new IAmqpList.ArrayBackedList<AmqpType<?, ?>>(new AmqpType<?, ?>[constituents.length]);
+            for (int i = 0; i < constituents.length; i++) {
+                rc.set(i, MARSHALLER.decodeType(constituents[i]));
+            }
+            return rc;
         }
 
-        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
-            return MARSHALLER.decodeType(buffer);
+        public final IAmqpList<AmqpType<?, ?>> unmarshalType(int dataCount, int dataSize, DataInput in) throws IOException, AmqpEncodingError {
+            IAmqpList<AmqpType<?, ?>> rc = new IAmqpList.ArrayBackedList<AmqpType<?, ?>>(new AmqpType<?, ?>[dataCount]);
+            for (int i = 0; i < dataCount; i++) {
+                rc.set(i, MARSHALLER.unmarshalType(in));
+            }
+            return rc;
         }
     };
 
-    static final MapDecoder<AmqpType<?,?>, AmqpType<?, ?>> DEFAULT_MAP_DECODER = new MapDecoder<AmqpType<?,?>, AmqpType<?, ?>>() {
+    static final MapDecoder<AmqpType<?, ?>, AmqpType<?, ?>> DEFAULT_MAP_DECODER = new MapDecoder<AmqpType<?, ?>, AmqpType<?, ?>>() {
 
-        public IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> createMap(int entryCount) {
-            return new IAmqpMap.AmqpWrapperMap<AmqpType<?,?>, AmqpType<?,?>>(new HashMap<AmqpType<?,?>, AmqpType<?,?>>());
-        }
+        public IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> decode(EncodedBuffer[] constituents) {
+            IAmqpMap.AmqpWrapperMap<AmqpType<?, ?>, AmqpType<?, ?>> rc = new IAmqpMap.AmqpWrapperMap<AmqpType<?, ?>, AmqpType<?, ?>>(new HashMap<AmqpType<?, ?>, AmqpType<?, ?>>());
+            if (constituents.length % 2 != 0) {
+                throw new AmqpEncodingError("Invalid number of compound constituents: " + constituents.length);
+            }
 
-        public void decodeToMap(EncodedBuffer key, EncodedBuffer val, IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> map) throws AmqpEncodingError {
-            map.put(MARSHALLER.decodeType(key), MARSHALLER.decodeType(key));
-            
+            for (int i = 0; i < constituents.length; i += 2) {
+                rc.put(MARSHALLER.decodeType(constituents[i]), MARSHALLER.decodeType(constituents[i + 1]));
+            }
+            return rc;
         }
 
-        public void unmarshalToMap(DataInput in, IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> map) throws IOException, AmqpEncodingError {
-            map.put(MARSHALLER.unmarshalType(in), MARSHALLER.unmarshalType(in));
+        public IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> unmarshalType(int dataCount, int dataSize, DataInput in) throws IOException, AmqpEncodingError {
+            IAmqpMap.AmqpWrapperMap<AmqpType<?, ?>, AmqpType<?, ?>> rc = new IAmqpMap.AmqpWrapperMap<AmqpType<?, ?>, AmqpType<?, ?>>(new HashMap<AmqpType<?, ?>, AmqpType<?, ?>>());
+            if (dataCount % 2 != 0) {
+                throw new AmqpEncodingError("Invalid number of compound constituents: " + dataCount);
+            }
+
+            for (int i = 0; i < dataCount; i += 2) {
+                rc.put(MARSHALLER.unmarshalType(in), MARSHALLER.unmarshalType(in));
+            }
+            return rc;
         }
     };
 
@@ -578,7 +608,7 @@
             }
 
             Buffer rc = new Buffer(1 + category.WIDTH + dataSize);
-            System.arraycopy(source, offset, rc, 0, rc.length);
+            System.arraycopy(source.data, offset, rc.data, 0, rc.length);
             return rc;
         }
 
@@ -707,8 +737,9 @@
                 EncodedBuffer[] cb = new EncodedBuffer[getDataCount()];
                 Buffer b = getBuffer();
                 int offset = getDataOffset();
-                for (int i = 0; i < constituents.length; i++) {
-                    constituents[i] = FormatCategory.createBuffer(b, offset);
+                for (int i = 0; i < cb.length; i++) {
+                    cb[i] = FormatCategory.createBuffer(b, offset);
+                    offset += cb[i].getEncodedSize();
                 }
                 this.constituents = cb;
             }
@@ -881,7 +912,7 @@
         protected V value;
 
         // TODO make configurable.
-        //private boolean cacheEncoded = true;
+        // private boolean cacheEncoded = true;
 
         AbstractEncoded(EncodedBuffer encoded) {
             this.encoded = encoded;
@@ -1016,7 +1047,7 @@
 
     static class NullEncoded<V> extends AbstractEncoded<V> {
 
-        private static FixedBuffer nb = new FixedBuffer(new Buffer(new byte [] {NULL_FORMAT_CODE}), 0);
+        private static FixedBuffer nb = new FixedBuffer(new Buffer(new byte[] { NULL_FORMAT_CODE }), 0);
 
         NullEncoded() {
             super(nb);
@@ -1104,20 +1135,6 @@
         protected abstract Encoded<V> unmarshalDescribed(DataInput in) throws IOException, AmqpEncodingError;
     }
 
-    public static interface ListDecoder {
-        AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError;
-
-        AmqpType<?, ?> unmarshalType(int pos, DataInput in) throws IOException, AmqpEncodingError;
-    }
-
-    public static interface MapDecoder<K extends AmqpType<?, ?>, V extends AmqpType<?, ?>> {
-        void decodeToMap(EncodedBuffer key, EncodedBuffer val, IAmqpMap<K, V> map) throws AmqpEncodingError;
-
-        public void unmarshalToMap(DataInput in, IAmqpMap<K, V> map) throws IOException, AmqpEncodingError;
-
-        IAmqpMap<K, V> createMap(int entryCount);
-    }
-
     // ///////////////////////////////////////////////////////////////////////////////////////////////////
     // Encoding Helpers:
     // ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1187,37 +1204,12 @@
     // ///////////////////////////////////////////////////////////////////////////////////////////////////
     // LIST ENCODINGS
     // ///////////////////////////////////////////////////////////////////////////////////////////////////
-
-    private static class ArrayBackedList implements IAmqpList {
-        AmqpType<?, ?>[] list;
-
-        ArrayBackedList(int size) {
-            list = new AmqpType<?, ?>[size];
-        }
-
-        public AmqpType<?, ?> get(int index) {
-            return list[index];
-        }
-
-        public int getListCount() {
-            return list.length;
-        }
-
-        public void set(int index, AmqpType<?, ?> value) {
-            list[index] = value;
-        }
-
-        public Iterator<AmqpType<?, ?>> iterator() {
-            return new AmqpListIterator(this);
-        }
-    }
-    
-    public static final AmqpListMarshaller.LIST_ENCODING chooseListEncoding(IAmqpList val) throws AmqpEncodingError {
+    public static final <E extends AmqpType<?, ?>> AmqpListMarshaller.LIST_ENCODING chooseListEncoding(IAmqpList<E> val) throws AmqpEncodingError {
         if (val.getListCount() > 255) {
             return AmqpListMarshaller.LIST_ENCODING.LIST32;
         }
         int size = 1;
-        for (AmqpType<?, ?> le : val) {
+        for (E le : val) {
             if (le == null) {
                 size += 1;
             } else {
@@ -1230,7 +1222,7 @@
         return AmqpListMarshaller.LIST_ENCODING.LIST8;
     }
 
-    public final int getEncodedSizeOfList(IAmqpList val, LIST_ENCODING encoding) throws AmqpEncodingError {
+    public final <E extends AmqpType<?, ?>> int getEncodedSizeOfList(IAmqpList<E> val, LIST_ENCODING encoding) throws AmqpEncodingError {
         int size = 0;
         switch (encoding) {
         // TODO for arrays we need to choose an encoding that is compatible for
@@ -1242,7 +1234,7 @@
         }
         case LIST32:
         case LIST8: {
-            for (AmqpType<?, ?> le : val) {
+            for (E le : val) {
                 if (le == null) {
                     size += 1;
                 } else {
@@ -1257,107 +1249,57 @@
         }
     }
 
-    public final int getEncodedCountOfList(IAmqpList val, LIST_ENCODING listENCODING) throws AmqpEncodingError {
+    public final <E extends AmqpType<?, ?>> int getEncodedCountOfList(IAmqpList<E> val, LIST_ENCODING listENCODING) throws AmqpEncodingError {
         return val.getListCount();
     }
 
     // List 8 encoding
-    public void encodeListList8(IAmqpList value, Buffer encoded, int offset) throws AmqpEncodingError {
+    public <E extends AmqpType<?, ?>> void encodeListList8(IAmqpList<E> value, Buffer encoded, int offset) throws AmqpEncodingError {
         encodeList(value, encoded, offset);
     }
 
-    public IAmqpList decodeListList8(Buffer encoded, int offset, int count, int size, ListDecoder decoder) throws AmqpEncodingError {
-        return decodeList(encoded, offset, count, size, decoder);
-    }
-
-    public void writeListList8(IAmqpList val, DataOutput out) throws IOException, AmqpEncodingError {
+    public <E extends AmqpType<?, ?>> void writeListList8(IAmqpList<E> val, DataOutput out) throws IOException, AmqpEncodingError {
         writeList(val, out);
     }
 
-    public IAmqpList readListList8(int count, int size, DataInput in, ListDecoder decoder) throws IOException, AmqpEncodingError {
-        return readList(count, size, in, decoder);
-    }
-
     // List 32 encoding:
-    public void encodeListList32(IAmqpList value, Buffer encoded, int offset) throws AmqpEncodingError {
+    public <E extends AmqpType<?, ?>> void encodeListList32(IAmqpList<E> value, Buffer encoded, int offset) throws AmqpEncodingError {
         encodeList(value, encoded, offset);
     }
 
-    public IAmqpList decodeListList32(Buffer encoded, int offset, int count, int size, ListDecoder decoder) throws AmqpEncodingError {
-        return decodeList(encoded, offset, count, size, decoder);
-    }
-
-    public void writeListList32(IAmqpList val, DataOutput out) throws IOException, AmqpEncodingError {
+    public <E extends AmqpType<?, ?>> void writeListList32(IAmqpList<E> val, DataOutput out) throws IOException, AmqpEncodingError {
         writeList(val, out);
     }
 
-    public IAmqpList readListList32(int count, int size, DataInput in, ListDecoder decoder) throws IOException, AmqpEncodingError {
-        return readList(count, size, in, decoder);
-    }
-
     // Array 8 encoding
-    public void encodeListArray8(IAmqpList value, Buffer encoded, int offset) throws AmqpEncodingError {
+    public <E extends AmqpType<?, ?>> void encodeListArray8(IAmqpList<E> value, Buffer encoded, int offset) throws AmqpEncodingError {
         encodeArray(value, encoded, offset);
     }
 
-    public IAmqpList decodeListArray8(Buffer encoded, int offset, int count, int size, ListDecoder decoder) throws AmqpEncodingError {
-        return decodeArray(encoded, offset, count, size, decoder);
-    }
-
-    public void writeListArray8(IAmqpList val, DataOutput out) throws IOException, AmqpEncodingError {
+    public <E extends AmqpType<?, ?>> void writeListArray8(IAmqpList<E> val, DataOutput out) throws IOException, AmqpEncodingError {
         writeArray(val, out);
     }
 
-    public IAmqpList readListArray8(int count, int size, DataInput in, ListDecoder decoder) throws IOException, AmqpEncodingError {
-        return readArray(count, size, in, decoder);
-    }
-
     // List 32 encoding:
-    public void encodeListArray32(IAmqpList value, Buffer encoded, int offset) throws AmqpEncodingError {
+    public <E extends AmqpType<?, ?>> void encodeListArray32(IAmqpList<E> value, Buffer encoded, int offset) throws AmqpEncodingError {
         encodeArray(value, encoded, offset);
     }
 
-    public IAmqpList decodeListArray32(Buffer encoded, int offset, int count, int size, ListDecoder decoder) throws AmqpEncodingError {
-        return decodeArray(encoded, offset, count, size, decoder);
-    }
-
-    public void writeListArray32(IAmqpList val, DataOutput out) throws IOException, AmqpEncodingError {
+    public <E extends AmqpType<?, ?>> void writeListArray32(IAmqpList<E> val, DataOutput out) throws IOException, AmqpEncodingError {
         writeArray(val, out);
     }
 
-    public IAmqpList readListArray32(int count, int size, DataInput in, ListDecoder decoder) throws IOException, AmqpEncodingError {
-        return readArray(count, size, in, decoder);
-    }
-
     // Generic versions:
-    public static final void encodeList(IAmqpList value, Buffer target, int offset) throws AmqpEncodingError {
-        for (AmqpType<?, ?> le : value) {
+    public static final <E extends AmqpType<?, ?>> void encodeList(IAmqpList<E> value, Buffer target, int offset) throws AmqpEncodingError {
+        for (E le : value) {
             Encoded<?> encoded = le.getBuffer(MARSHALLER).getEncoded();
             encoded.encode(target, offset);
             offset = encoded.getDataSize();
         }
     }
 
-    public static final IAmqpList decodeList(Buffer source, int offset, int count, int size, ListDecoder decoder) throws AmqpEncodingError {
-        IAmqpList rc = new ArrayBackedList(count);
-        for (int i = 0; i < count; i++) {
-            EncodedBuffer encoded = FormatCategory.createBuffer(source, offset);
-            offset += encoded.getEncodedSize();
-            rc.set(i, decoder.decodeType(i, encoded));
-        }
-        return rc;
-    }
-
-    public static final IAmqpList readList(int count, int size, DataInput in, ListDecoder decoder) throws IOException, AmqpEncodingError {
-        IAmqpList rc = new ArrayBackedList(count);
-        for (int i = 0; i < count; i++) {
-            rc.set(i, decoder.unmarshalType(i, in));
-        }
-        return rc;
-    }
-
-    public static final void writeList(IAmqpList val, DataOutput out) throws IOException, AmqpEncodingError {
-        for (AmqpType<?, ?> le : val) {
+    public static final <E extends AmqpType<?, ?>> void writeList(IAmqpList<E> val, DataOutput out) throws IOException, AmqpEncodingError {
+        for (E le : val) {
             if (le == null) {
                 out.writeByte(NULL_FORMAT_CODE);
             } else {
@@ -1366,7 +1308,7 @@
         }
     }
 
-    public static final void encodeArray(IAmqpList value, Buffer target, int offset) throws AmqpEncodingError {
+    public static final <E extends AmqpType<?, ?>> void encodeArray(IAmqpList<E> value, Buffer target, int offset) throws AmqpEncodingError {
         Encoded<?> first = value.get(0).getBuffer(MARSHALLER).getEncoded();
         first.encode(target, offset);
         offset += first.getEncodedSize();
@@ -1379,17 +1321,17 @@
         // }
     }
 
-    public static final IAmqpList decodeArray(Buffer encoded, int offset, int count, int size, ListDecoder decoder) {
+    public static final <E extends AmqpType<?, ?>> IAmqpList<E> decodeArray(Buffer encoded, int offset, int count, int size, ListDecoder<E> decoder) {
         // TODO
         throw new UnsupportedOperationException();
     }
 
-    public static final IAmqpList readArray(int count, int size, DataInput dis, ListDecoder decoder) throws IOException, AmqpEncodingError {
+    public static final <E extends AmqpType<?, ?>> IAmqpList<E> readArray(int count, int size, DataInput dis, ListDecoder<E> decoder) throws IOException, AmqpEncodingError {
         // TODO
         throw new UnsupportedOperationException();
     }
 
-    public static final void writeArray(IAmqpList val, DataOutput out) throws IOException, AmqpEncodingError {
+    public static final <E extends AmqpType<?, ?>> void writeArray(IAmqpList<E> val, DataOutput out) throws IOException, AmqpEncodingError {
         Encoded<?> first = val.get(0).getBuffer(MARSHALLER).getEncoded();
         first.marshal(out);
         for (int i = 1; i < val.getListCount(); i++) {
@@ -1401,8 +1343,8 @@
     // Map ENCODINGS
     // ///////////////////////////////////////////////////////////////////////////////////////////////////
     public static final AmqpMapMarshaller.MAP_ENCODING chooseMapEncoding(IAmqpMap<?, ?> map) throws AmqpEncodingError {
-        for (Map.Entry<? extends AmqpType<?,?>, ? extends AmqpType<?,?>> me : map) {
-            
+        for (Map.Entry<? extends AmqpType<?, ?>, ? extends AmqpType<?, ?>> me : map) {
+
             int size = me.getKey().getBuffer(MARSHALLER).getEncoded().getEncodedSize() + me.getValue().getBuffer(MARSHALLER).getEncoded().getEncodedSize();
             if (size > 255) {
                 return AmqpMapMarshaller.MAP_ENCODING.MAP32;
@@ -1413,7 +1355,7 @@
 
     public final int getEncodedSizeOfMap(IAmqpMap<?, ?> map, MAP_ENCODING encoding) throws AmqpEncodingError {
         int size = 0;
-        for (Map.Entry<? extends AmqpType<?,?>, ? extends AmqpType<?,?>> me : map) {
+        for (Map.Entry<? extends AmqpType<?, ?>, ? extends AmqpType<?, ?>> me : map) {
             size += me.getKey().getBuffer(MARSHALLER).getEncoded().getEncodedSize() + me.getValue().getBuffer(MARSHALLER).getEncoded().getEncodedSize();
         }
         return size;
@@ -1427,59 +1369,21 @@
         encodeMap(value, target, offset);
     }
 
-    public final <K extends AmqpType<?,?>, V extends AmqpType<?,?>> IAmqpMap<K, V> decodeMapMap32(Buffer source, int offset, int count, int size, MapDecoder<K, V> decoder) throws AmqpEncodingError {
-        return decodeMap(source, offset, count, size, decoder);
-    }
-
     public final void writeMapMap32(IAmqpMap<?, ?> val, DataOutput out) throws AmqpEncodingError, IOException {
         writeMap(val, out);
-
-    }
-
-    public final <K extends AmqpType<?,?>, V extends AmqpType<?,?>> IAmqpMap<K, V> readMapMap32(int count, int size, DataInput in, MapDecoder<K, V> decoder) throws AmqpEncodingError, IOException {
-        return readMap(count, size, in, decoder);
     }
 
     public final void encodeMapMap8(IAmqpMap<?, ?> value, Buffer target, int offset) throws AmqpEncodingError {
         encodeMap(value, target, offset);
     }
 
-    public final <K extends AmqpType<?,?>, V extends AmqpType<?,?>> IAmqpMap<K, V> decodeMapMap8(Buffer source, int offset, int count, int size, MapDecoder<K, V> decoder) throws AmqpEncodingError {
-        return decodeMap(source, offset, count, size, decoder);
-    }
-
     public final void writeMapMap8(IAmqpMap<?, ?> val, DataOutput out) throws AmqpEncodingError, IOException {
         writeMap(val, out);
 
     }
 
-    public final <K extends AmqpType<?,?>, V extends AmqpType<?,?>> IAmqpMap<K, V> readMapMap8(int count, int size, DataInput in, MapDecoder<K, V> decoder) throws AmqpEncodingError, IOException {
-        return readMap(count, size, in, decoder);
-    }
-
-    public static final <K extends AmqpType<?,?>, V extends AmqpType<?,?>> IAmqpMap<K, V> decodeMap(Buffer source, int offset, int count, int size, MapDecoder<K, V> decoder) throws AmqpEncodingError {
-        IAmqpMap<K, V> rc = decoder.createMap(count / 2);
-        for (int i = 0; i < count; i += 2) {
-            EncodedBuffer encodedKey = FormatCategory.createBuffer(source, offset);
-            offset += encodedKey.getEncodedSize();
-            EncodedBuffer encodedVal = FormatCategory.createBuffer(source, offset);
-            offset += encodedVal.getEncodedSize();
-            decoder.decodeToMap(encodedKey, encodedVal, rc);
-        }
-        return rc;
-    }
-    
-
-    public static final <K extends AmqpType<?,?>, V extends AmqpType<?,?>> IAmqpMap<K, V> readMap(int count, int size, DataInput in, MapDecoder<K, V> decoder) throws IOException, AmqpEncodingError {
-        IAmqpMap<K, V> rc = decoder.createMap(count / 2);
-        for (int i = 0; i < count; i += 2) {
-            decoder.unmarshalToMap(in, rc);
-        }
-        return rc;
-    }
-
     public static final void encodeMap(IAmqpMap<?, ?> value, Buffer target, int offset) throws AmqpEncodingError {
-        for (Map.Entry<? extends AmqpType<?,?>, ? extends AmqpType<?,?>> me : value) {
+        for (Map.Entry<? extends AmqpType<?, ?>, ? extends AmqpType<?, ?>> me : value) {
             Encoded<?> eKey = me.getKey().getBuffer(MARSHALLER).getEncoded();
             eKey.encode(target, offset);
             offset += eKey.getEncodedSize();
@@ -1491,7 +1395,7 @@
     }
 
     public static final void writeMap(IAmqpMap<?, ?> val, DataOutput out) throws IOException, AmqpEncodingError {
-        for (Map.Entry<? extends AmqpType<?,?>, ? extends AmqpType<?,?>> me : val) {
+        for (Map.Entry<? extends AmqpType<?, ?>, ? extends AmqpType<?, ?>> me : val) {
             me.getKey().marshal(out, MARSHALLER);
             me.getValue().marshal(out, MARSHALLER);
         }

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpAttach.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpAttach.java?rev=909704&r1=909703&r2=909704&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpAttach.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpAttach.java Sat Feb 13 03:20:16 2010
@@ -250,307 +250,307 @@
         AmqpAttachBean() {
         }
 
-        AmqpAttachBean(IAmqpList value) {
+        AmqpAttachBean(IAmqpList<AmqpType<?, ?>> value) {
 
-        for(int i = 0; i < value.getListCount(); i++) {
-            set(i, value.get(i));
+            for(int i = 0; i < value.getListCount(); i++) {
+                set(i, value.get(i));
+            }
         }
-    }
-
-    AmqpAttachBean(AmqpAttach.AmqpAttachBean other) {
-        this.bean = other;
-    }
-
-    public final AmqpAttachBean copy() {
-        return new AmqpAttach.AmqpAttachBean(bean);
-    }
 
-    public final void handle(AmqpCommandHandler handler) throws Exception {
-        handler.handleAttach(this);
-    }
-
-    public final AmqpAttach.AmqpAttachBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
-        if(buffer == null) {
-            buffer = new AmqpAttachBuffer(marshaller.encode(this));
+        AmqpAttachBean(AmqpAttach.AmqpAttachBean other) {
+            this.bean = other;
         }
-        return buffer;
-    }
-
-    public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
-        getBuffer(marshaller).marshal(out, marshaller);
-    }
 
+        public final AmqpAttachBean copy() {
+            return new AmqpAttach.AmqpAttachBean(bean);
+        }
 
-    public final void setOptions(AmqpOptions options) {
-        copyCheck();
-        bean.options = options;
-    }
-
-    public final AmqpOptions getOptions() {
-        return bean.options;
-    }
-
-    public void setName(Buffer name) {
-        setName(TypeFactory.createAmqpSessionName(name));
-    }
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleAttach(this);
+        }
 
+        public final AmqpAttach.AmqpAttachBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpAttachBuffer(marshaller.encode(this));
+            }
+            return buffer;
+        }
 
-    public final void setName(AmqpSessionName name) {
-        copyCheck();
-        bean.name = name;
-    }
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            getBuffer(marshaller).marshal(out, marshaller);
+        }
 
-    public final AmqpSessionName getName() {
-        return bean.name;
-    }
 
-    public void setOpening(Boolean opening) {
-        setOpening(TypeFactory.createAmqpBoolean(opening));
-    }
+        public final void setOptions(AmqpOptions options) {
+            copyCheck();
+            bean.options = options;
+        }
 
+        public final AmqpOptions getOptions() {
+            return bean.options;
+        }
 
-    public void setOpening(boolean opening) {
-        setOpening(TypeFactory.createAmqpBoolean(opening));
-    }
+        public void setName(Buffer name) {
+            setName(TypeFactory.createAmqpSessionName(name));
+        }
 
 
-    public final void setOpening(AmqpBoolean opening) {
-        copyCheck();
-        bean.opening = opening;
-    }
+        public final void setName(AmqpSessionName name) {
+            copyCheck();
+            bean.name = name;
+        }
 
-    public final Boolean getOpening() {
-        return bean.opening.getValue();
-    }
+        public final AmqpSessionName getName() {
+            return bean.name;
+        }
 
-    public void setReceived(Long received) {
-        setReceived(TypeFactory.createAmqpSequenceNo(received));
-    }
+        public void setOpening(Boolean opening) {
+            setOpening(TypeFactory.createAmqpBoolean(opening));
+        }
 
 
-    public void setReceived(long received) {
-        setReceived(TypeFactory.createAmqpSequenceNo(received));
-    }
+        public void setOpening(boolean opening) {
+            setOpening(TypeFactory.createAmqpBoolean(opening));
+        }
 
 
-    public final void setReceived(AmqpSequenceNo received) {
-        copyCheck();
-        bean.received = received;
-    }
+        public final void setOpening(AmqpBoolean opening) {
+            copyCheck();
+            bean.opening = opening;
+        }
 
-    public final AmqpSequenceNo getReceived() {
-        return bean.received;
-    }
+        public final Boolean getOpening() {
+            return bean.opening.getValue();
+        }
 
-    public void setTimeout(Long timeout) {
-        setTimeout(TypeFactory.createAmqpUint(timeout));
-    }
+        public void setReceived(Long received) {
+            setReceived(TypeFactory.createAmqpSequenceNo(received));
+        }
 
 
-    public void setTimeout(long timeout) {
-        setTimeout(TypeFactory.createAmqpUint(timeout));
-    }
+        public void setReceived(long received) {
+            setReceived(TypeFactory.createAmqpSequenceNo(received));
+        }
 
 
-    public final void setTimeout(AmqpUint timeout) {
-        copyCheck();
-        bean.timeout = timeout;
-    }
+        public final void setReceived(AmqpSequenceNo received) {
+            copyCheck();
+            bean.received = received;
+        }
 
-    public final Long getTimeout() {
-        return bean.timeout.getValue();
-    }
+        public final AmqpSequenceNo getReceived() {
+            return bean.received;
+        }
 
-    public final void setTxnMode(AmqpTxnLevel txnMode) {
-        copyCheck();
-        bean.txnMode = txnMode;
-    }
+        public void setTimeout(Long timeout) {
+            setTimeout(TypeFactory.createAmqpUint(timeout));
+        }
 
-    public final AmqpTxnLevel getTxnMode() {
-        return bean.txnMode;
-    }
 
-    public final void setTxnSupport(AmqpTxnLevel txnSupport) {
-        copyCheck();
-        bean.txnSupport = txnSupport;
-    }
+        public void setTimeout(long timeout) {
+            setTimeout(TypeFactory.createAmqpUint(timeout));
+        }
 
-    public final AmqpTxnLevel getTxnSupport() {
-        return bean.txnSupport;
-    }
 
-    public void set(int index, AmqpType<?, ?> value) {
-        switch(index) {
-        case 0: {
-            setOptions((AmqpOptions) value);
-            break;
-        }
-        case 1: {
-            setName((AmqpSessionName) value);
-            break;
-        }
-        case 2: {
-            setOpening((AmqpBoolean) value);
-            break;
-        }
-        case 3: {
-            setReceived((AmqpSequenceNo) value);
-            break;
-        }
-        case 4: {
-            setTimeout((AmqpUint) value);
-            break;
-        }
-        case 5: {
-            setTxnMode(AmqpTxnLevel.get((AmqpUbyte)value));
-            break;
-        }
-        case 6: {
-            setTxnSupport(AmqpTxnLevel.get((AmqpUbyte)value));
-            break;
-        }
-        default : {
-            throw new IndexOutOfBoundsException(String.valueOf(index));
-        }
+        public final void setTimeout(AmqpUint timeout) {
+            copyCheck();
+            bean.timeout = timeout;
         }
-    }
 
-    public AmqpType<?, ?> get(int index) {
-        switch(index) {
-        case 0: {
-            return bean.options;
+        public final Long getTimeout() {
+            return bean.timeout.getValue();
         }
-        case 1: {
-            return bean.name;
+
+        public final void setTxnMode(AmqpTxnLevel txnMode) {
+            copyCheck();
+            bean.txnMode = txnMode;
         }
-        case 2: {
-            return bean.opening;
+
+        public final AmqpTxnLevel getTxnMode() {
+            return bean.txnMode;
         }
-        case 3: {
-            return bean.received;
+
+        public final void setTxnSupport(AmqpTxnLevel txnSupport) {
+            copyCheck();
+            bean.txnSupport = txnSupport;
         }
-        case 4: {
-            return bean.timeout;
+
+        public final AmqpTxnLevel getTxnSupport() {
+            return bean.txnSupport;
         }
-        case 5: {
-            if(txnMode == null) {
-                return null;
+
+        public void set(int index, AmqpType<?, ?> value) {
+            switch(index) {
+            case 0: {
+                setOptions((AmqpOptions) value);
+                break;
+            }
+            case 1: {
+                setName((AmqpSessionName) value);
+                break;
+            }
+            case 2: {
+                setOpening((AmqpBoolean) value);
+                break;
+            }
+            case 3: {
+                setReceived((AmqpSequenceNo) value);
+                break;
+            }
+            case 4: {
+                setTimeout((AmqpUint) value);
+                break;
+            }
+            case 5: {
+                setTxnMode(AmqpTxnLevel.get((AmqpUbyte)value));
+                break;
+            }
+            case 6: {
+                setTxnSupport(AmqpTxnLevel.get((AmqpUbyte)value));
+                break;
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
             }
-            return txnMode.getValue();
-        }
-        case 6: {
-            if(txnSupport == null) {
-                return null;
             }
-            return txnSupport.getValue();
-        }
-        default : {
-            throw new IndexOutOfBoundsException(String.valueOf(index));
         }
+
+        public AmqpType<?, ?> get(int index) {
+            switch(index) {
+            case 0: {
+                return bean.options;
+            }
+            case 1: {
+                return bean.name;
+            }
+            case 2: {
+                return bean.opening;
+            }
+            case 3: {
+                return bean.received;
+            }
+            case 4: {
+                return bean.timeout;
+            }
+            case 5: {
+                if(txnMode == null) {
+                    return null;
+                }
+                return txnMode.getValue();
+            }
+            case 6: {
+                if(txnSupport == null) {
+                    return null;
+                }
+                return txnSupport.getValue();
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
         }
-    }
 
-    public int getListCount() {
-        return 7;
-    }
+        public int getListCount() {
+            return 7;
+        }
 
-    public IAmqpList getValue() {
-        return bean;
-    }
+        public IAmqpList<AmqpType<?, ?>> getValue() {
+            return bean;
+        }
 
-    public Iterator<AmqpType<?, ?>> iterator() {
-        return new AmqpListIterator(bean);
-    }
+        public Iterator<AmqpType<?, ?>> iterator() {
+            return new AmqpListIterator<AmqpType<?, ?>>(bean);
+        }
 
 
-    private final void copyCheck() {
-        if(buffer != null) {;
-            throw new IllegalStateException("unwriteable");
+        private final void copyCheck() {
+            if(buffer != null) {;
+                throw new IllegalStateException("unwriteable");
+            }
+            if(bean != this) {;
+                copy(bean);
+            }
         }
-        if(bean != this) {;
-            copy(bean);
+
+        private final void copy(AmqpAttach.AmqpAttachBean other) {
+            bean = this;
         }
-    }
 
-    private final void copy(AmqpAttach.AmqpAttachBean other) {
-        bean = this;
-    }
+        public boolean equals(Object o){
+            if(this == o) {
+                return true;
+            }
 
-    public boolean equals(Object o){
-        if(this == o) {
-            return true;
-        }
+            if(o == null || !(o instanceof AmqpAttach)) {
+                return false;
+            }
 
-        if(o == null || !(o instanceof AmqpAttach)) {
-            return false;
+            return equals((AmqpAttach) o);
         }
 
-        return equals((AmqpAttach) o);
-    }
+        public boolean equals(AmqpAttach b) {
 
-    public boolean equals(AmqpAttach b) {
+            if(b.getOptions() == null ^ getOptions() == null) {
+                return false;
+            }
+            if(b.getOptions() != null && !b.getOptions().equals(getOptions())){ 
+                return false;
+            }
 
-        if(b.getOptions() == null ^ getOptions() == null) {
-            return false;
-        }
-        if(b.getOptions() != null && !b.getOptions().equals(getOptions())){ 
-            return false;
-        }
+            if(b.getName() == null ^ getName() == null) {
+                return false;
+            }
+            if(b.getName() != null && !b.getName().equals(getName())){ 
+                return false;
+            }
 
-        if(b.getName() == null ^ getName() == null) {
-            return false;
-        }
-        if(b.getName() != null && !b.getName().equals(getName())){ 
-            return false;
-        }
+            if(b.getOpening() == null ^ getOpening() == null) {
+                return false;
+            }
+            if(b.getOpening() != null && !b.getOpening().equals(getOpening())){ 
+                return false;
+            }
 
-        if(b.getOpening() == null ^ getOpening() == null) {
-            return false;
-        }
-        if(b.getOpening() != null && !b.getOpening().equals(getOpening())){ 
-            return false;
-        }
+            if(b.getReceived() == null ^ getReceived() == null) {
+                return false;
+            }
+            if(b.getReceived() != null && !b.getReceived().equals(getReceived())){ 
+                return false;
+            }
 
-        if(b.getReceived() == null ^ getReceived() == null) {
-            return false;
-        }
-        if(b.getReceived() != null && !b.getReceived().equals(getReceived())){ 
-            return false;
-        }
+            if(b.getTimeout() == null ^ getTimeout() == null) {
+                return false;
+            }
+            if(b.getTimeout() != null && !b.getTimeout().equals(getTimeout())){ 
+                return false;
+            }
 
-        if(b.getTimeout() == null ^ getTimeout() == null) {
-            return false;
-        }
-        if(b.getTimeout() != null && !b.getTimeout().equals(getTimeout())){ 
-            return false;
-        }
+            if(b.getTxnMode() == null ^ getTxnMode() == null) {
+                return false;
+            }
+            if(b.getTxnMode() != null && !b.getTxnMode().equals(getTxnMode())){ 
+                return false;
+            }
 
-        if(b.getTxnMode() == null ^ getTxnMode() == null) {
-            return false;
-        }
-        if(b.getTxnMode() != null && !b.getTxnMode().equals(getTxnMode())){ 
-            return false;
+            if(b.getTxnSupport() == null ^ getTxnSupport() == null) {
+                return false;
+            }
+            if(b.getTxnSupport() != null && !b.getTxnSupport().equals(getTxnSupport())){ 
+                return false;
+            }
+            return true;
         }
 
-        if(b.getTxnSupport() == null ^ getTxnSupport() == null) {
-            return false;
-        }
-        if(b.getTxnSupport() != null && !b.getTxnSupport().equals(getTxnSupport())){ 
-            return false;
+        public int hashCode() {
+            return AbstractAmqpList.hashCodeFor(this);
         }
-        return true;
-    }
-
-    public int hashCode() {
-        return AbstractAmqpList.hashCodeFor(this);
     }
-}
 
     public static class AmqpAttachBuffer extends AmqpList.AmqpListBuffer implements AmqpAttach{
 
         private AmqpAttachBean bean;
 
-        protected AmqpAttachBuffer(Encoded<IAmqpList> encoded) {
+        protected AmqpAttachBuffer(Encoded<IAmqpList<AmqpType<?, ?>>> encoded) {
             super(encoded);
         }
 
@@ -657,10 +657,6 @@
             return bean().iterator();
         }
 
-        public IAmqpList getValue() {
-            return bean().getValue();
-        }
-
         public AmqpAttach.AmqpAttachBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
             return this;
         }
@@ -689,7 +685,7 @@
             return bean().hashCode();
         }
 
-        public static AmqpAttach.AmqpAttachBuffer create(Encoded<IAmqpList> encoded) {
+        public static AmqpAttach.AmqpAttachBuffer create(Encoded<IAmqpList<AmqpType<?, ?>>> encoded) {
             if(encoded.isNull()) {
                 return null;
             }

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpBar.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpBar.java?rev=909704&r1=909703&r2=909704&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpBar.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpBar.java Sat Feb 13 03:20:16 2010
@@ -134,189 +134,189 @@
         AmqpBarBean() {
         }
 
-        AmqpBarBean(IAmqpList value) {
+        AmqpBarBean(IAmqpList<AmqpType<?, ?>> value) {
 
-        for(int i = 0; i < value.getListCount(); i++) {
-            set(i, value.get(i));
+            for(int i = 0; i < value.getListCount(); i++) {
+                set(i, value.get(i));
+            }
         }
-    }
-
-    AmqpBarBean(AmqpBar.AmqpBarBean other) {
-        this.bean = other;
-    }
 
-    public final AmqpBarBean copy() {
-        return new AmqpBar.AmqpBarBean(bean);
-    }
-
-    public final void handle(AmqpCommandHandler handler) throws Exception {
-        handler.handleBar(this);
-    }
+        AmqpBarBean(AmqpBar.AmqpBarBean other) {
+            this.bean = other;
+        }
 
-    public final AmqpBar.AmqpBarBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
-        if(buffer == null) {
-            buffer = new AmqpBarBuffer(marshaller.encode(this));
+        public final AmqpBarBean copy() {
+            return new AmqpBar.AmqpBarBean(bean);
         }
-        return buffer;
-    }
 
-    public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
-        getBuffer(marshaller).marshal(out, marshaller);
-    }
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleBar(this);
+        }
 
+        public final AmqpBar.AmqpBarBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpBarBuffer(marshaller.encode(this));
+            }
+            return buffer;
+        }
 
-    public final void setOptions(AmqpOptions options) {
-        copyCheck();
-        bean.options = options;
-    }
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            getBuffer(marshaller).marshal(out, marshaller);
+        }
 
-    public final AmqpOptions getOptions() {
-        return bean.options;
-    }
 
-    public void setHandle(Long handle) {
-        setHandle(TypeFactory.createAmqpHandle(handle));
-    }
+        public final void setOptions(AmqpOptions options) {
+            copyCheck();
+            bean.options = options;
+        }
 
+        public final AmqpOptions getOptions() {
+            return bean.options;
+        }
 
-    public void setHandle(long handle) {
-        setHandle(TypeFactory.createAmqpHandle(handle));
-    }
+        public void setHandle(Long handle) {
+            setHandle(TypeFactory.createAmqpHandle(handle));
+        }
 
 
-    public final void setHandle(AmqpHandle handle) {
-        copyCheck();
-        bean.handle = handle;
-    }
+        public void setHandle(long handle) {
+            setHandle(TypeFactory.createAmqpHandle(handle));
+        }
 
-    public final AmqpHandle getHandle() {
-        return bean.handle;
-    }
 
-    public void setBarrier(Buffer barrier) {
-        setBarrier(TypeFactory.createAmqpDeliveryTag(barrier));
-    }
+        public final void setHandle(AmqpHandle handle) {
+            copyCheck();
+            bean.handle = handle;
+        }
 
+        public final AmqpHandle getHandle() {
+            return bean.handle;
+        }
 
-    public final void setBarrier(AmqpDeliveryTag barrier) {
-        copyCheck();
-        bean.barrier = barrier;
-    }
+        public void setBarrier(Buffer barrier) {
+            setBarrier(TypeFactory.createAmqpDeliveryTag(barrier));
+        }
 
-    public final AmqpDeliveryTag getBarrier() {
-        return bean.barrier;
-    }
 
-    public void set(int index, AmqpType<?, ?> value) {
-        switch(index) {
-        case 0: {
-            setOptions((AmqpOptions) value);
-            break;
-        }
-        case 1: {
-            setHandle((AmqpHandle) value);
-            break;
-        }
-        case 2: {
-            setBarrier((AmqpDeliveryTag) value);
-            break;
-        }
-        default : {
-            throw new IndexOutOfBoundsException(String.valueOf(index));
-        }
+        public final void setBarrier(AmqpDeliveryTag barrier) {
+            copyCheck();
+            bean.barrier = barrier;
         }
-    }
 
-    public AmqpType<?, ?> get(int index) {
-        switch(index) {
-        case 0: {
-            return bean.options;
-        }
-        case 1: {
-            return bean.handle;
-        }
-        case 2: {
+        public final AmqpDeliveryTag getBarrier() {
             return bean.barrier;
         }
-        default : {
-            throw new IndexOutOfBoundsException(String.valueOf(index));
+
+        public void set(int index, AmqpType<?, ?> value) {
+            switch(index) {
+            case 0: {
+                setOptions((AmqpOptions) value);
+                break;
+            }
+            case 1: {
+                setHandle((AmqpHandle) value);
+                break;
+            }
+            case 2: {
+                setBarrier((AmqpDeliveryTag) value);
+                break;
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
         }
+
+        public AmqpType<?, ?> get(int index) {
+            switch(index) {
+            case 0: {
+                return bean.options;
+            }
+            case 1: {
+                return bean.handle;
+            }
+            case 2: {
+                return bean.barrier;
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
         }
-    }
 
-    public int getListCount() {
-        return 3;
-    }
+        public int getListCount() {
+            return 3;
+        }
 
-    public IAmqpList getValue() {
-        return bean;
-    }
+        public IAmqpList<AmqpType<?, ?>> getValue() {
+            return bean;
+        }
 
-    public Iterator<AmqpType<?, ?>> iterator() {
-        return new AmqpListIterator(bean);
-    }
+        public Iterator<AmqpType<?, ?>> iterator() {
+            return new AmqpListIterator<AmqpType<?, ?>>(bean);
+        }
 
 
-    private final void copyCheck() {
-        if(buffer != null) {;
-            throw new IllegalStateException("unwriteable");
+        private final void copyCheck() {
+            if(buffer != null) {;
+                throw new IllegalStateException("unwriteable");
+            }
+            if(bean != this) {;
+                copy(bean);
+            }
         }
-        if(bean != this) {;
-            copy(bean);
+
+        private final void copy(AmqpBar.AmqpBarBean other) {
+            bean = this;
         }
-    }
 
-    private final void copy(AmqpBar.AmqpBarBean other) {
-        bean = this;
-    }
+        public boolean equals(Object o){
+            if(this == o) {
+                return true;
+            }
 
-    public boolean equals(Object o){
-        if(this == o) {
-            return true;
-        }
+            if(o == null || !(o instanceof AmqpBar)) {
+                return false;
+            }
 
-        if(o == null || !(o instanceof AmqpBar)) {
-            return false;
+            return equals((AmqpBar) o);
         }
 
-        return equals((AmqpBar) o);
-    }
+        public boolean equals(AmqpBar b) {
 
-    public boolean equals(AmqpBar b) {
+            if(b.getOptions() == null ^ getOptions() == null) {
+                return false;
+            }
+            if(b.getOptions() != null && !b.getOptions().equals(getOptions())){ 
+                return false;
+            }
 
-        if(b.getOptions() == null ^ getOptions() == null) {
-            return false;
-        }
-        if(b.getOptions() != null && !b.getOptions().equals(getOptions())){ 
-            return false;
-        }
+            if(b.getHandle() == null ^ getHandle() == null) {
+                return false;
+            }
+            if(b.getHandle() != null && !b.getHandle().equals(getHandle())){ 
+                return false;
+            }
 
-        if(b.getHandle() == null ^ getHandle() == null) {
-            return false;
-        }
-        if(b.getHandle() != null && !b.getHandle().equals(getHandle())){ 
-            return false;
+            if(b.getBarrier() == null ^ getBarrier() == null) {
+                return false;
+            }
+            if(b.getBarrier() != null && !b.getBarrier().equals(getBarrier())){ 
+                return false;
+            }
+            return true;
         }
 
-        if(b.getBarrier() == null ^ getBarrier() == null) {
-            return false;
-        }
-        if(b.getBarrier() != null && !b.getBarrier().equals(getBarrier())){ 
-            return false;
+        public int hashCode() {
+            return AbstractAmqpList.hashCodeFor(this);
         }
-        return true;
-    }
-
-    public int hashCode() {
-        return AbstractAmqpList.hashCodeFor(this);
     }
-}
 
     public static class AmqpBarBuffer extends AmqpList.AmqpListBuffer implements AmqpBar{
 
         private AmqpBarBean bean;
 
-        protected AmqpBarBuffer(Encoded<IAmqpList> encoded) {
+        protected AmqpBarBuffer(Encoded<IAmqpList<AmqpType<?, ?>>> encoded) {
             super(encoded);
         }
 
@@ -373,10 +373,6 @@
             return bean().iterator();
         }
 
-        public IAmqpList getValue() {
-            return bean().getValue();
-        }
-
         public AmqpBar.AmqpBarBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
             return this;
         }
@@ -405,7 +401,7 @@
             return bean().hashCode();
         }
 
-        public static AmqpBar.AmqpBarBuffer create(Encoded<IAmqpList> encoded) {
+        public static AmqpBar.AmqpBarBuffer create(Encoded<IAmqpList<AmqpType<?, ?>>> encoded) {
             if(encoded.isNull()) {
                 return null;
             }

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpClose.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpClose.java?rev=909704&r1=909703&r2=909704&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpClose.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpClose.java Sat Feb 13 03:20:16 2010
@@ -78,151 +78,151 @@
         AmqpCloseBean() {
         }
 
-        AmqpCloseBean(IAmqpList value) {
+        AmqpCloseBean(IAmqpList<AmqpType<?, ?>> value) {
 
-        for(int i = 0; i < value.getListCount(); i++) {
-            set(i, value.get(i));
+            for(int i = 0; i < value.getListCount(); i++) {
+                set(i, value.get(i));
+            }
         }
-    }
-
-    AmqpCloseBean(AmqpClose.AmqpCloseBean other) {
-        this.bean = other;
-    }
-
-    public final AmqpCloseBean copy() {
-        return new AmqpClose.AmqpCloseBean(bean);
-    }
-
-    public final void handle(AmqpCommandHandler handler) throws Exception {
-        handler.handleClose(this);
-    }
 
-    public final AmqpClose.AmqpCloseBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
-        if(buffer == null) {
-            buffer = new AmqpCloseBuffer(marshaller.encode(this));
+        AmqpCloseBean(AmqpClose.AmqpCloseBean other) {
+            this.bean = other;
         }
-        return buffer;
-    }
-
-    public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
-        getBuffer(marshaller).marshal(out, marshaller);
-    }
 
+        public final AmqpCloseBean copy() {
+            return new AmqpClose.AmqpCloseBean(bean);
+        }
 
-    public final void setOptions(AmqpOptions options) {
-        copyCheck();
-        bean.options = options;
-    }
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleClose(this);
+        }
 
-    public final AmqpOptions getOptions() {
-        return bean.options;
-    }
+        public final AmqpClose.AmqpCloseBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpCloseBuffer(marshaller.encode(this));
+            }
+            return buffer;
+        }
 
-    public final void setException(AmqpConnectionError exception) {
-        copyCheck();
-        bean.exception = exception;
-    }
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            getBuffer(marshaller).marshal(out, marshaller);
+        }
 
-    public final AmqpConnectionError getException() {
-        return bean.exception;
-    }
 
-    public void set(int index, AmqpType<?, ?> value) {
-        switch(index) {
-        case 0: {
-            setOptions((AmqpOptions) value);
-            break;
-        }
-        case 1: {
-            setException((AmqpConnectionError) value);
-            break;
-        }
-        default : {
-            throw new IndexOutOfBoundsException(String.valueOf(index));
-        }
+        public final void setOptions(AmqpOptions options) {
+            copyCheck();
+            bean.options = options;
         }
-    }
 
-    public AmqpType<?, ?> get(int index) {
-        switch(index) {
-        case 0: {
+        public final AmqpOptions getOptions() {
             return bean.options;
         }
-        case 1: {
+
+        public final void setException(AmqpConnectionError exception) {
+            copyCheck();
+            bean.exception = exception;
+        }
+
+        public final AmqpConnectionError getException() {
             return bean.exception;
         }
-        default : {
-            throw new IndexOutOfBoundsException(String.valueOf(index));
+
+        public void set(int index, AmqpType<?, ?> value) {
+            switch(index) {
+            case 0: {
+                setOptions((AmqpOptions) value);
+                break;
+            }
+            case 1: {
+                setException((AmqpConnectionError) value);
+                break;
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
         }
+
+        public AmqpType<?, ?> get(int index) {
+            switch(index) {
+            case 0: {
+                return bean.options;
+            }
+            case 1: {
+                return bean.exception;
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
         }
-    }
 
-    public int getListCount() {
-        return 2;
-    }
+        public int getListCount() {
+            return 2;
+        }
 
-    public IAmqpList getValue() {
-        return bean;
-    }
+        public IAmqpList<AmqpType<?, ?>> getValue() {
+            return bean;
+        }
 
-    public Iterator<AmqpType<?, ?>> iterator() {
-        return new AmqpListIterator(bean);
-    }
+        public Iterator<AmqpType<?, ?>> iterator() {
+            return new AmqpListIterator<AmqpType<?, ?>>(bean);
+        }
 
 
-    private final void copyCheck() {
-        if(buffer != null) {;
-            throw new IllegalStateException("unwriteable");
+        private final void copyCheck() {
+            if(buffer != null) {;
+                throw new IllegalStateException("unwriteable");
+            }
+            if(bean != this) {;
+                copy(bean);
+            }
         }
-        if(bean != this) {;
-            copy(bean);
+
+        private final void copy(AmqpClose.AmqpCloseBean other) {
+            bean = this;
         }
-    }
 
-    private final void copy(AmqpClose.AmqpCloseBean other) {
-        bean = this;
-    }
+        public boolean equals(Object o){
+            if(this == o) {
+                return true;
+            }
 
-    public boolean equals(Object o){
-        if(this == o) {
-            return true;
-        }
+            if(o == null || !(o instanceof AmqpClose)) {
+                return false;
+            }
 
-        if(o == null || !(o instanceof AmqpClose)) {
-            return false;
+            return equals((AmqpClose) o);
         }
 
-        return equals((AmqpClose) o);
-    }
+        public boolean equals(AmqpClose b) {
 
-    public boolean equals(AmqpClose b) {
+            if(b.getOptions() == null ^ getOptions() == null) {
+                return false;
+            }
+            if(b.getOptions() != null && !b.getOptions().equals(getOptions())){ 
+                return false;
+            }
 
-        if(b.getOptions() == null ^ getOptions() == null) {
-            return false;
-        }
-        if(b.getOptions() != null && !b.getOptions().equals(getOptions())){ 
-            return false;
+            if(b.getException() == null ^ getException() == null) {
+                return false;
+            }
+            if(b.getException() != null && !b.getException().equals(getException())){ 
+                return false;
+            }
+            return true;
         }
 
-        if(b.getException() == null ^ getException() == null) {
-            return false;
-        }
-        if(b.getException() != null && !b.getException().equals(getException())){ 
-            return false;
+        public int hashCode() {
+            return AbstractAmqpList.hashCodeFor(this);
         }
-        return true;
     }
 
-    public int hashCode() {
-        return AbstractAmqpList.hashCodeFor(this);
-    }
-}
-
     public static class AmqpCloseBuffer extends AmqpList.AmqpListBuffer implements AmqpClose{
 
         private AmqpCloseBean bean;
 
-        protected AmqpCloseBuffer(Encoded<IAmqpList> encoded) {
+        protected AmqpCloseBuffer(Encoded<IAmqpList<AmqpType<?, ?>>> encoded) {
             super(encoded);
         }
 
@@ -258,10 +258,6 @@
             return bean().iterator();
         }
 
-        public IAmqpList getValue() {
-            return bean().getValue();
-        }
-
         public AmqpClose.AmqpCloseBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
             return this;
         }
@@ -290,7 +286,7 @@
             return bean().hashCode();
         }
 
-        public static AmqpClose.AmqpCloseBuffer create(Encoded<IAmqpList> encoded) {
+        public static AmqpClose.AmqpCloseBuffer create(Encoded<IAmqpList<AmqpType<?, ?>>> encoded) {
             if(encoded.isNull()) {
                 return null;
             }

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpCompleted.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpCompleted.java?rev=909704&r1=909703&r2=909704&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpCompleted.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpCompleted.java Sat Feb 13 03:20:16 2010
@@ -91,7 +91,7 @@
         private IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> value;
 
         AmqpCompletedBean() {
-            this.value = new IAmqpMap.AmqpWrapperMap<AmqpType<?,?>, AmqpType<?,?>>(new HashMap<AmqpType<?,?>, AmqpType<?,?>>());
+            this.value = new IAmqpMap.AmqpWrapperMap<AmqpType<?,?>,AmqpType<?,?>>(new HashMap<AmqpType<?,?>,AmqpType<?,?>>());
         }
 
         AmqpCompletedBean(IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> value) {
@@ -136,12 +136,12 @@
         public final Boolean getTruncate() {
             return bean.truncate.getValue();
         }
-        public void put(AmqpType<?, ?> key, AmqpType<?, ?> value) {
+        public void put(AmqpType<?,?> key, AmqpType<?,?> value) {
             copyCheck();
             bean.value.put(key, value);
         }
 
-        public AmqpType<?, ?> get(Object key) {
+        public AmqpType<?,?> get(Object key) {
             return bean.value.get(key);
         }
 
@@ -149,14 +149,10 @@
             return bean.value.getEntryCount();
         }
 
-        public Iterator<Map.Entry<AmqpType<?, ?>, AmqpType<?, ?>>> iterator() {
+        public Iterator<Map.Entry<AmqpType<?,?>, AmqpType<?,?>>> iterator() {
             return bean.value.iterator();
         }
 
-        public IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> getValue() {
-            return bean.value;
-        }
-
 
         private final void copyCheck() {
             if(buffer != null) {;
@@ -223,11 +219,11 @@
         public final Boolean getTruncate() {
             return bean().getTruncate();
         }
-        public void put(AmqpType<?, ?> key, AmqpType<?, ?> value) {
+        public void put(AmqpType<?,?> key, AmqpType<?,?> value) {
             bean().put(key, value);
         }
 
-        public AmqpType<?, ?> get(Object key) {
+        public AmqpType<?,?> get(Object key) {
             return bean().get(key);
         }
 
@@ -235,14 +231,10 @@
             return bean().getEntryCount();
         }
 
-        public Iterator<Map.Entry<AmqpType<?, ?>, AmqpType<?, ?>>> iterator() {
+        public Iterator<Map.Entry<AmqpType<?,?>, AmqpType<?,?>>> iterator() {
             return bean().iterator();
         }
 
-        public IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> getValue() {
-            return bean().getValue();
-        }
-
         public AmqpCompleted.AmqpCompletedBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
             return this;
         }



Mime
View raw message