activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmacn...@apache.org
Subject svn commit: r909704 [4/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/AmqpRelinkMarshaller.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/AmqpRelinkMarshaller.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/AmqpRelinkMarshaller.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpRelinkMarshaller.java Sat Feb 13 03:20:16 2010
@@ -36,7 +36,7 @@
 public class AmqpRelinkMarshaller implements DescribedTypeMarshaller<AmqpRelink>{
 
     static final AmqpRelinkMarshaller SINGLETON = new AmqpRelinkMarshaller();
-    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:relink:list";
     //Format code: 0x00000001:0x00000305:
@@ -50,49 +50,72 @@
         (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x05   // 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 > 4) {
+                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<?, ?>[4]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(in)));
+                dataCount--;
             }
-            case 2: {
-                return AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(in));
-            }
-            case 3: {
-                return AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(in));
+
+            //handle:
+            if(dataCount > 0) {
+                rc.set(1, AmqpHandle.AmqpHandleBuffer.create(AmqpUintMarshaller.createEncoded(in)));
+                dataCount--;
             }
-            default: {
-                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+
+            //source:
+            if(dataCount > 0) {
+                rc.set(2, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(in)));
+                dataCount--;
             }
+
+            //target:
+            if(dataCount > 0) {
+                rc.set(3, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.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 > 4) {
+                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<?, ?>[4]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(constituents[0])));
+                dataCount--;
             }
-            case 2: {
-                return AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
-            }
-            case 3: {
-                return AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
+
+            //handle:
+            if(dataCount > 0) {
+                rc.set(1, AmqpHandle.AmqpHandleBuffer.create(AmqpUintMarshaller.createEncoded(constituents[1])));
+                dataCount--;
             }
-            default: {
-                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+
+            //source:
+            if(dataCount > 0) {
+                rc.set(2, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(constituents[2])));
+                dataCount--;
             }
+
+            //target:
+            if(dataCount > 0) {
+                rc.set(3, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(constituents[3])));
+                dataCount--;
             }
+            return rc;
         }
     };
 
-    public static class AmqpRelinkEncoded extends DescribedEncoded<IAmqpList> {
+    public static class AmqpRelinkEncoded extends DescribedEncoded<IAmqpList<AmqpType<?, ?>>> {
 
         public AmqpRelinkEncoded(DescribedBuffer buffer) {
             super(buffer);
@@ -110,11 +133,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);
         }
 
@@ -123,19 +146,19 @@
         }
     }
 
-    public static final Encoded<IAmqpList> encode(AmqpRelink value) throws AmqpEncodingError {
+    public static final Encoded<IAmqpList<AmqpType<?, ?>>> encode(AmqpRelink value) throws AmqpEncodingError {
         return new AmqpRelinkEncoded(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/AmqpSaslChallengeMarshaller.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/AmqpSaslChallengeMarshaller.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/AmqpSaslChallengeMarshaller.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpSaslChallengeMarshaller.java Sat Feb 13 03:20:16 2010
@@ -35,7 +35,7 @@
 public class AmqpSaslChallengeMarshaller implements DescribedTypeMarshaller<AmqpSaslChallenge>{
 
     static final AmqpSaslChallengeMarshaller SINGLETON = new AmqpSaslChallengeMarshaller();
-    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:sasl-challenge:list";
     //Format code: 0x00000001:0x00000703:
@@ -49,37 +49,54 @@
         (byte) 0x00, (byte) 0x00, (byte) 0x07, (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 AmqpMap.AmqpMapBuffer.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 > 2) {
+                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<?, ?>[2]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(in)));
+                dataCount--;
             }
-            default: {
-                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+
+            //challenge:
+            if(dataCount > 0) {
+                rc.set(1, AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(in)));
+                dataCount--;
             }
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": challenge");
             }
+            return rc;
         }
 
-        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
-            switch(pos) {
-            case 0: {
-                return AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
+        public IAmqpList<AmqpType<?, ?>> decode(EncodedBuffer[] constituents) {
+            if (constituents.length > 2) {
+                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<?, ?>[2]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(constituents[0])));
+                dataCount--;
             }
-            default: {
-                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+
+            //challenge:
+            if(dataCount > 0) {
+                rc.set(1, AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(constituents[1])));
+                dataCount--;
             }
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": challenge");
             }
+            return rc;
         }
     };
 
-    public static class AmqpSaslChallengeEncoded extends DescribedEncoded<IAmqpList> {
+    public static class AmqpSaslChallengeEncoded extends DescribedEncoded<IAmqpList<AmqpType<?, ?>>> {
 
         public AmqpSaslChallengeEncoded(DescribedBuffer buffer) {
             super(buffer);
@@ -97,11 +114,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);
         }
 
@@ -110,19 +127,19 @@
         }
     }
 
-    public static final Encoded<IAmqpList> encode(AmqpSaslChallenge value) throws AmqpEncodingError {
+    public static final Encoded<IAmqpList<AmqpType<?, ?>>> encode(AmqpSaslChallenge value) throws AmqpEncodingError {
         return new AmqpSaslChallengeEncoded(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/AmqpSaslInitMarshaller.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/AmqpSaslInitMarshaller.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/AmqpSaslInitMarshaller.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpSaslInitMarshaller.java Sat Feb 13 03:20:16 2010
@@ -36,7 +36,7 @@
 public class AmqpSaslInitMarshaller implements DescribedTypeMarshaller<AmqpSaslInit>{
 
     static final AmqpSaslInitMarshaller SINGLETON = new AmqpSaslInitMarshaller();
-    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:sasl-init:list";
     //Format code: 0x00000001:0x00000702:
@@ -50,43 +50,66 @@
         (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x02   // 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 AmqpMap.AmqpMapBuffer.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 AmqpString.AmqpStringBuffer.create(AmqpStringMarshaller.createEncoded(in));
+            IAmqpList<AmqpType<?, ?>> rc = new IAmqpList.ArrayBackedList<AmqpType<?, ?>>(new AmqpType<?, ?>[3]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(in)));
+                dataCount--;
             }
-            case 2: {
-                return AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(in));
+
+            //mechanism:
+            if(dataCount > 0) {
+                rc.set(1, AmqpString.AmqpStringBuffer.create(AmqpStringMarshaller.createEncoded(in)));
+                dataCount--;
             }
-            default: {
-                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": mechanism");
             }
+
+            //initial-response:
+            if(dataCount > 0) {
+                rc.set(2, AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(in)));
+                dataCount--;
             }
+            return rc;
         }
 
-        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
-            switch(pos) {
-            case 0: {
-                return AmqpMap.AmqpMapBuffer.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 AmqpString.AmqpStringBuffer.create(AmqpStringMarshaller.createEncoded(buffer));
+            int dataCount = constituents.length;
+            IAmqpList<AmqpType<?, ?>> rc = new IAmqpList.ArrayBackedList<AmqpType<?, ?>>(new AmqpType<?, ?>[3]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(constituents[0])));
+                dataCount--;
             }
-            case 2: {
-                return AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(buffer));
+
+            //mechanism:
+            if(dataCount > 0) {
+                rc.set(1, AmqpString.AmqpStringBuffer.create(AmqpStringMarshaller.createEncoded(constituents[1])));
+                dataCount--;
             }
-            default: {
-                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": mechanism");
             }
+
+            //initial-response:
+            if(dataCount > 0) {
+                rc.set(2, AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(constituents[2])));
+                dataCount--;
             }
+            return rc;
         }
     };
 
-    public static class AmqpSaslInitEncoded extends DescribedEncoded<IAmqpList> {
+    public static class AmqpSaslInitEncoded extends DescribedEncoded<IAmqpList<AmqpType<?, ?>>> {
 
         public AmqpSaslInitEncoded(DescribedBuffer buffer) {
             super(buffer);
@@ -104,11 +127,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 +140,19 @@
         }
     }
 
-    public static final Encoded<IAmqpList> encode(AmqpSaslInit value) throws AmqpEncodingError {
+    public static final Encoded<IAmqpList<AmqpType<?, ?>>> encode(AmqpSaslInit value) throws AmqpEncodingError {
         return new AmqpSaslInitEncoded(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/AmqpSaslMechanismsMarshaller.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/AmqpSaslMechanismsMarshaller.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/AmqpSaslMechanismsMarshaller.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpSaslMechanismsMarshaller.java Sat Feb 13 03:20:16 2010
@@ -35,7 +35,7 @@
 public class AmqpSaslMechanismsMarshaller implements DescribedTypeMarshaller<AmqpSaslMechanisms>{
 
     static final AmqpSaslMechanismsMarshaller SINGLETON = new AmqpSaslMechanismsMarshaller();
-    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:sasl-mechanisms:list";
     //Format code: 0x00000001:0x00000701:
@@ -49,37 +49,48 @@
         (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x01   // 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 AmqpMap.AmqpMapBuffer.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 > 2) {
+                throw new AmqpEncodingError("Too many fields for " + SYMBOLIC_ID + ": " + dataCount);
             }
-            case 1: {
-                return AmqpList.AmqpListBuffer.create(AmqpListMarshaller.createEncoded(in));
-            }
-            default: {
-                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+            IAmqpList<AmqpType<?, ?>> rc = new IAmqpList.ArrayBackedList<AmqpType<?, ?>>(new AmqpType<?, ?>[2]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(in)));
+                dataCount--;
             }
+
+            //sasl-server-mechanisms:
+            if(dataCount > 0) {
+                rc.set(1, AmqpList.AmqpListBuffer.create(AmqpListMarshaller.createEncoded(in)));
+                dataCount--;
             }
+            return rc;
         }
 
-        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
-            switch(pos) {
-            case 0: {
-                return AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
+        public IAmqpList<AmqpType<?, ?>> decode(EncodedBuffer[] constituents) {
+            if (constituents.length > 2) {
+                throw new AmqpEncodingError("Too many fields for " + SYMBOLIC_ID + ":" + constituents.length);
             }
-            case 1: {
-                return AmqpList.AmqpListBuffer.create(AmqpListMarshaller.createEncoded(buffer));
-            }
-            default: {
-                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+            int dataCount = constituents.length;
+            IAmqpList<AmqpType<?, ?>> rc = new IAmqpList.ArrayBackedList<AmqpType<?, ?>>(new AmqpType<?, ?>[2]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(constituents[0])));
+                dataCount--;
             }
+
+            //sasl-server-mechanisms:
+            if(dataCount > 0) {
+                rc.set(1, AmqpList.AmqpListBuffer.create(AmqpListMarshaller.createEncoded(constituents[1])));
+                dataCount--;
             }
+            return rc;
         }
     };
 
-    public static class AmqpSaslMechanismsEncoded extends DescribedEncoded<IAmqpList> {
+    public static class AmqpSaslMechanismsEncoded extends DescribedEncoded<IAmqpList<AmqpType<?, ?>>> {
 
         public AmqpSaslMechanismsEncoded(DescribedBuffer buffer) {
             super(buffer);
@@ -97,11 +108,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);
         }
 
@@ -110,19 +121,19 @@
         }
     }
 
-    public static final Encoded<IAmqpList> encode(AmqpSaslMechanisms value) throws AmqpEncodingError {
+    public static final Encoded<IAmqpList<AmqpType<?, ?>>> encode(AmqpSaslMechanisms value) throws AmqpEncodingError {
         return new AmqpSaslMechanismsEncoded(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/AmqpSaslOutcomeMarshaller.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/AmqpSaslOutcomeMarshaller.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/AmqpSaslOutcomeMarshaller.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpSaslOutcomeMarshaller.java Sat Feb 13 03:20:16 2010
@@ -36,7 +36,7 @@
 public class AmqpSaslOutcomeMarshaller implements DescribedTypeMarshaller<AmqpSaslOutcome>{
 
     static final AmqpSaslOutcomeMarshaller SINGLETON = new AmqpSaslOutcomeMarshaller();
-    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:sasl-outcome:list";
     //Format code: 0x00000001:0x00000705:
@@ -50,43 +50,60 @@
         (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x05   // 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 AmqpMap.AmqpMapBuffer.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 AmqpUbyte.AmqpUbyteBuffer.create(AmqpUbyteMarshaller.createEncoded(in));
+            IAmqpList<AmqpType<?, ?>> rc = new IAmqpList.ArrayBackedList<AmqpType<?, ?>>(new AmqpType<?, ?>[3]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(in)));
+                dataCount--;
             }
-            case 2: {
-                return AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(in));
-            }
-            default: {
-                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+
+            //code:
+            if(dataCount > 0) {
+                rc.set(1, AmqpUbyte.AmqpUbyteBuffer.create(AmqpUbyteMarshaller.createEncoded(in)));
+                dataCount--;
             }
+
+            //additional-data:
+            if(dataCount > 0) {
+                rc.set(2, AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(in)));
+                dataCount--;
             }
+            return rc;
         }
 
-        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
-            switch(pos) {
-            case 0: {
-                return AmqpMap.AmqpMapBuffer.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 AmqpUbyte.AmqpUbyteBuffer.create(AmqpUbyteMarshaller.createEncoded(buffer));
+            int dataCount = constituents.length;
+            IAmqpList<AmqpType<?, ?>> rc = new IAmqpList.ArrayBackedList<AmqpType<?, ?>>(new AmqpType<?, ?>[3]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(constituents[0])));
+                dataCount--;
             }
-            case 2: {
-                return AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(buffer));
-            }
-            default: {
-                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+
+            //code:
+            if(dataCount > 0) {
+                rc.set(1, AmqpUbyte.AmqpUbyteBuffer.create(AmqpUbyteMarshaller.createEncoded(constituents[1])));
+                dataCount--;
             }
+
+            //additional-data:
+            if(dataCount > 0) {
+                rc.set(2, AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(constituents[2])));
+                dataCount--;
             }
+            return rc;
         }
     };
 
-    public static class AmqpSaslOutcomeEncoded extends DescribedEncoded<IAmqpList> {
+    public static class AmqpSaslOutcomeEncoded extends DescribedEncoded<IAmqpList<AmqpType<?, ?>>> {
 
         public AmqpSaslOutcomeEncoded(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(AmqpSaslOutcome value) throws AmqpEncodingError {
+    public static final Encoded<IAmqpList<AmqpType<?, ?>>> encode(AmqpSaslOutcome value) throws AmqpEncodingError {
         return new AmqpSaslOutcomeEncoded(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/AmqpSaslResponseMarshaller.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/AmqpSaslResponseMarshaller.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/AmqpSaslResponseMarshaller.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpSaslResponseMarshaller.java Sat Feb 13 03:20:16 2010
@@ -35,7 +35,7 @@
 public class AmqpSaslResponseMarshaller implements DescribedTypeMarshaller<AmqpSaslResponse>{
 
     static final AmqpSaslResponseMarshaller SINGLETON = new AmqpSaslResponseMarshaller();
-    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:sasl-response:list";
     //Format code: 0x00000001:0x00000704:
@@ -49,37 +49,54 @@
         (byte) 0x00, (byte) 0x00, (byte) 0x07, (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 AmqpMap.AmqpMapBuffer.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 > 2) {
+                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<?, ?>[2]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(in)));
+                dataCount--;
             }
-            default: {
-                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+
+            //response:
+            if(dataCount > 0) {
+                rc.set(1, AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(in)));
+                dataCount--;
             }
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": response");
             }
+            return rc;
         }
 
-        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
-            switch(pos) {
-            case 0: {
-                return AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
+        public IAmqpList<AmqpType<?, ?>> decode(EncodedBuffer[] constituents) {
+            if (constituents.length > 2) {
+                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<?, ?>[2]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(constituents[0])));
+                dataCount--;
             }
-            default: {
-                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+
+            //response:
+            if(dataCount > 0) {
+                rc.set(1, AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(constituents[1])));
+                dataCount--;
             }
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": response");
             }
+            return rc;
         }
     };
 
-    public static class AmqpSaslResponseEncoded extends DescribedEncoded<IAmqpList> {
+    public static class AmqpSaslResponseEncoded extends DescribedEncoded<IAmqpList<AmqpType<?, ?>>> {
 
         public AmqpSaslResponseEncoded(DescribedBuffer buffer) {
             super(buffer);
@@ -97,11 +114,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);
         }
 
@@ -110,19 +127,19 @@
         }
     }
 
-    public static final Encoded<IAmqpList> encode(AmqpSaslResponse value) throws AmqpEncodingError {
+    public static final Encoded<IAmqpList<AmqpType<?, ?>>> encode(AmqpSaslResponse value) throws AmqpEncodingError {
         return new AmqpSaslResponseEncoded(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/AmqpSessionErrorMarshaller.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/AmqpSessionErrorMarshaller.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/AmqpSessionErrorMarshaller.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpSessionErrorMarshaller.java Sat Feb 13 03:20:16 2010
@@ -38,7 +38,7 @@
 public class AmqpSessionErrorMarshaller implements DescribedTypeMarshaller<AmqpSessionError>{
 
     static final AmqpSessionErrorMarshaller SINGLETON = new AmqpSessionErrorMarshaller();
-    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:session-error:list";
     //Format code: 0x00000001:0x00000102:
@@ -52,61 +52,102 @@
         (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x02   // 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 AmqpUshort.AmqpUshortBuffer.create(AmqpUshortMarshaller.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 > 6) {
+                throw new AmqpEncodingError("Too many fields for " + SYMBOLIC_ID + ": " + dataCount);
             }
-            case 1: {
-                return AmqpSequenceNo.AmqpSequenceNoBuffer.create(AmqpUintMarshaller.createEncoded(in));
+            IAmqpList<AmqpType<?, ?>> rc = new IAmqpList.ArrayBackedList<AmqpType<?, ?>>(new AmqpType<?, ?>[6]);
+            //error-code:
+            if(dataCount > 0) {
+                rc.set(0, AmqpUshort.AmqpUshortBuffer.create(AmqpUshortMarshaller.createEncoded(in)));
+                dataCount--;
             }
-            case 2: {
-                return AmqpUbyte.AmqpUbyteBuffer.create(AmqpUbyteMarshaller.createEncoded(in));
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": error-code");
             }
-            case 3: {
-                return AmqpUbyte.AmqpUbyteBuffer.create(AmqpUbyteMarshaller.createEncoded(in));
+
+            //command-id:
+            if(dataCount > 0) {
+                rc.set(1, AmqpSequenceNo.AmqpSequenceNoBuffer.create(AmqpUintMarshaller.createEncoded(in)));
+                dataCount--;
             }
-            case 4: {
-                return AmqpString.AmqpStringBuffer.create(AmqpStringMarshaller.createEncoded(in));
+
+            //command-code:
+            if(dataCount > 0) {
+                rc.set(2, AmqpUbyte.AmqpUbyteBuffer.create(AmqpUbyteMarshaller.createEncoded(in)));
+                dataCount--;
             }
-            case 5: {
-                return AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(in));
+
+            //field-index:
+            if(dataCount > 0) {
+                rc.set(3, AmqpUbyte.AmqpUbyteBuffer.create(AmqpUbyteMarshaller.createEncoded(in)));
+                dataCount--;
             }
-            default: {
-                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+
+            //description:
+            if(dataCount > 0) {
+                rc.set(4, AmqpString.AmqpStringBuffer.create(AmqpStringMarshaller.createEncoded(in)));
+                dataCount--;
             }
+
+            //error-info:
+            if(dataCount > 0) {
+                rc.set(5, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(in)));
+                dataCount--;
             }
+            return rc;
         }
 
-        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
-            switch(pos) {
-            case 0: {
-                return AmqpUshort.AmqpUshortBuffer.create(AmqpUshortMarshaller.createEncoded(buffer));
+        public IAmqpList<AmqpType<?, ?>> decode(EncodedBuffer[] constituents) {
+            if (constituents.length > 6) {
+                throw new AmqpEncodingError("Too many fields for " + SYMBOLIC_ID + ":" + constituents.length);
             }
-            case 1: {
-                return AmqpSequenceNo.AmqpSequenceNoBuffer.create(AmqpUintMarshaller.createEncoded(buffer));
+            int dataCount = constituents.length;
+            IAmqpList<AmqpType<?, ?>> rc = new IAmqpList.ArrayBackedList<AmqpType<?, ?>>(new AmqpType<?, ?>[6]);
+            //error-code:
+            if(dataCount > 0) {
+                rc.set(0, AmqpUshort.AmqpUshortBuffer.create(AmqpUshortMarshaller.createEncoded(constituents[0])));
+                dataCount--;
             }
-            case 2: {
-                return AmqpUbyte.AmqpUbyteBuffer.create(AmqpUbyteMarshaller.createEncoded(buffer));
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": error-code");
             }
-            case 3: {
-                return AmqpUbyte.AmqpUbyteBuffer.create(AmqpUbyteMarshaller.createEncoded(buffer));
+
+            //command-id:
+            if(dataCount > 0) {
+                rc.set(1, AmqpSequenceNo.AmqpSequenceNoBuffer.create(AmqpUintMarshaller.createEncoded(constituents[1])));
+                dataCount--;
             }
-            case 4: {
-                return AmqpString.AmqpStringBuffer.create(AmqpStringMarshaller.createEncoded(buffer));
+
+            //command-code:
+            if(dataCount > 0) {
+                rc.set(2, AmqpUbyte.AmqpUbyteBuffer.create(AmqpUbyteMarshaller.createEncoded(constituents[2])));
+                dataCount--;
             }
-            case 5: {
-                return AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
+
+            //field-index:
+            if(dataCount > 0) {
+                rc.set(3, AmqpUbyte.AmqpUbyteBuffer.create(AmqpUbyteMarshaller.createEncoded(constituents[3])));
+                dataCount--;
             }
-            default: {
-                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+
+            //description:
+            if(dataCount > 0) {
+                rc.set(4, AmqpString.AmqpStringBuffer.create(AmqpStringMarshaller.createEncoded(constituents[4])));
+                dataCount--;
             }
+
+            //error-info:
+            if(dataCount > 0) {
+                rc.set(5, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(constituents[5])));
+                dataCount--;
             }
+            return rc;
         }
     };
 
-    public static class AmqpSessionErrorEncoded extends DescribedEncoded<IAmqpList> {
+    public static class AmqpSessionErrorEncoded extends DescribedEncoded<IAmqpList<AmqpType<?, ?>>> {
 
         public AmqpSessionErrorEncoded(DescribedBuffer buffer) {
             super(buffer);
@@ -124,11 +165,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);
         }
 
@@ -137,19 +178,19 @@
         }
     }
 
-    public static final Encoded<IAmqpList> encode(AmqpSessionError value) throws AmqpEncodingError {
+    public static final Encoded<IAmqpList<AmqpType<?, ?>>> encode(AmqpSessionError value) throws AmqpEncodingError {
         return new AmqpSessionErrorEncoded(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/AmqpSourceMarshaller.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/AmqpSourceMarshaller.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/AmqpSourceMarshaller.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpSourceMarshaller.java Sat Feb 13 03:20:16 2010
@@ -56,73 +56,82 @@
 
     private static final MapDecoder<AmqpSymbol, AmqpType<?, ?>> DECODER = new MapDecoder<AmqpSymbol, AmqpType<?, ?>>() {
 
-        public IAmqpMap<AmqpSymbol, AmqpType<?, ?>> createMap(int entryCount) {
-            return new IAmqpMap.AmqpWrapperMap<AmqpSymbol, AmqpType<?,?>>(new HashMap<AmqpSymbol, AmqpType<?,?>>());
-
-        }
-
-        public void decodeToMap(EncodedBuffer encodedKey, EncodedBuffer encodedValue, IAmqpMap<AmqpSymbol,AmqpType<?, ?>> map) throws AmqpEncodingError {
-            AmqpSymbol key = AmqpSymbol.AmqpSymbolBuffer.create(AmqpSymbolMarshaller.createEncoded(encodedKey));
-            if (key == null) {
-                throw new AmqpEncodingError("Null Key for " + SYMBOLIC_ID);
-            }
-
-            if (key.equals(AmqpSource.ADDRESS_KEY)){
-                map.put(AmqpSource.ADDRESS_KEY, AmqpAddress.AmqpAddressBuffer.create(AmqpBinaryMarshaller.createEncoded(encodedValue)));
-            }
-            if (key.equals(AmqpSource.CREATE_KEY)){
-                map.put(AmqpSource.CREATE_KEY, AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(encodedValue)));
-            }
-            if (key.equals(AmqpSource.TIMEOUT_KEY)){
-                map.put(AmqpSource.TIMEOUT_KEY, AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(encodedValue)));
-            }
-            if (key.equals(AmqpSource.DISTRIBUTION_MODE_KEY)){
-                map.put(AmqpSource.DISTRIBUTION_MODE_KEY, AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(encodedValue)));
-            }
-            if (key.equals(AmqpSource.FILTER_KEY)){
-                map.put(AmqpSource.FILTER_KEY, AmqpFilterSet.AmqpFilterSetBuffer.create(AmqpMapMarshaller.createEncoded(encodedValue)));
-            }
-            if (key.equals(AmqpSource.MESSAGE_STATES_KEY)){
-                map.put(AmqpSource.MESSAGE_STATES_KEY, AmqpList.AmqpListBuffer.create(AmqpListMarshaller.createEncoded(encodedValue)));
-            }
-            if (key.equals(AmqpSource.ORPHAN_DISPOSITION_KEY)){
-                map.put(AmqpSource.ORPHAN_DISPOSITION_KEY, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(encodedValue)));
-            }
-            else {
-                throw new UnexpectedTypeException("Invalid Key for " + SYMBOLIC_ID + " : " + key);
-            }
-        }
-
-        public void unmarshalToMap(DataInput in, IAmqpMap<AmqpSymbol,AmqpType<?, ?>> map) throws IOException, AmqpEncodingError {
-            AmqpSymbol key = AmqpSymbol.AmqpSymbolBuffer.create(AmqpSymbolMarshaller.createEncoded(in));
-            if (key == null) {
-                throw new AmqpEncodingError("Null Key for " + SYMBOLIC_ID);
-            }
-
-            if (key.equals(AmqpSource.ADDRESS_KEY)){
-                map.put(AmqpSource.ADDRESS_KEY, AmqpAddress.AmqpAddressBuffer.create(AmqpBinaryMarshaller.createEncoded(in)));
-            }
-            if (key.equals(AmqpSource.CREATE_KEY)){
-                map.put(AmqpSource.CREATE_KEY, AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(in)));
-            }
-            if (key.equals(AmqpSource.TIMEOUT_KEY)){
-                map.put(AmqpSource.TIMEOUT_KEY, AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(in)));
-            }
-            if (key.equals(AmqpSource.DISTRIBUTION_MODE_KEY)){
-                map.put(AmqpSource.DISTRIBUTION_MODE_KEY, AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(in)));
-            }
-            if (key.equals(AmqpSource.FILTER_KEY)){
-                map.put(AmqpSource.FILTER_KEY, AmqpFilterSet.AmqpFilterSetBuffer.create(AmqpMapMarshaller.createEncoded(in)));
-            }
-            if (key.equals(AmqpSource.MESSAGE_STATES_KEY)){
-                map.put(AmqpSource.MESSAGE_STATES_KEY, AmqpList.AmqpListBuffer.create(AmqpListMarshaller.createEncoded(in)));
-            }
-            if (key.equals(AmqpSource.ORPHAN_DISPOSITION_KEY)){
-                map.put(AmqpSource.ORPHAN_DISPOSITION_KEY, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(in)));
-            }
-            else {
-                throw new UnexpectedTypeException("Invalid Key for " + SYMBOLIC_ID + " : " + key);
+        public IAmqpMap<AmqpSymbol, AmqpType<?, ?>> decode(EncodedBuffer[] constituents) throws AmqpEncodingError {
+            IAmqpMap<AmqpSymbol, AmqpType<?, ?>> rc = new IAmqpMap.AmqpWrapperMap<AmqpSymbol, AmqpType<?,?>>(new HashMap<AmqpSymbol, AmqpType<?,?>>());
+            if (constituents.length % 2 != 0) {
+                throw new AmqpEncodingError("Invalid number of compound constituents for " + SYMBOLIC_ID + ": " + constituents.length);
+            }
+            for (int i = 0; i < constituents.length; i += 2) {
+                AmqpSymbol key = AmqpSymbol.AmqpSymbolBuffer.create(AmqpSymbolMarshaller.createEncoded(constituents[i]));
+                if (key == null) {
+                    throw new AmqpEncodingError("Null Key for " + SYMBOLIC_ID);
+                }
+
+                if (key.equals(AmqpSource.ADDRESS_KEY)){
+                    rc.put(AmqpSource.ADDRESS_KEY, AmqpAddress.AmqpAddressBuffer.create(AmqpBinaryMarshaller.createEncoded(constituents[i + 1])));
+                }
+                if (key.equals(AmqpSource.CREATE_KEY)){
+                    rc.put(AmqpSource.CREATE_KEY, AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(constituents[i + 1])));
+                }
+                if (key.equals(AmqpSource.TIMEOUT_KEY)){
+                    rc.put(AmqpSource.TIMEOUT_KEY, AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(constituents[i + 1])));
+                }
+                if (key.equals(AmqpSource.DISTRIBUTION_MODE_KEY)){
+                    rc.put(AmqpSource.DISTRIBUTION_MODE_KEY, AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(constituents[i + 1])));
+                }
+                if (key.equals(AmqpSource.FILTER_KEY)){
+                    rc.put(AmqpSource.FILTER_KEY, AmqpFilterSet.AmqpFilterSetBuffer.create(AmqpMapMarshaller.createEncoded(constituents[i + 1])));
+                }
+                if (key.equals(AmqpSource.MESSAGE_STATES_KEY)){
+                    rc.put(AmqpSource.MESSAGE_STATES_KEY, AmqpList.AmqpListBuffer.create(AmqpListMarshaller.createEncoded(constituents[i + 1])));
+                }
+                if (key.equals(AmqpSource.ORPHAN_DISPOSITION_KEY)){
+                    rc.put(AmqpSource.ORPHAN_DISPOSITION_KEY, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(constituents[i + 1])));
+                }
+                else {
+                    throw new UnexpectedTypeException("Invalid field key for " + SYMBOLIC_ID + " : " + key);
+                }
+            }
+            return rc;
+        }
+
+        public IAmqpMap<AmqpSymbol, AmqpType<?, ?>> unmarshalType(int dataCount, int dataSize, DataInput in) throws IOException, AmqpEncodingError {
+            IAmqpMap<AmqpSymbol, AmqpType<?, ?>> rc = new IAmqpMap.AmqpWrapperMap<AmqpSymbol, AmqpType<?,?>>(new HashMap<AmqpSymbol, AmqpType<?,?>>());
+            if (dataCount % 2 != 0) {
+                throw new AmqpEncodingError("Invalid number of compound constituents for " + SYMBOLIC_ID + ": " + dataCount);
+            }
+            for (int i = 0; i < dataCount; i += 2) {
+                AmqpSymbol key = AmqpSymbol.AmqpSymbolBuffer.create(AmqpSymbolMarshaller.createEncoded(in));
+                if (key == null) {
+                    throw new AmqpEncodingError("Null Key for " + SYMBOLIC_ID);
+                }
+
+                if (key.equals(AmqpSource.ADDRESS_KEY)){
+                    rc.put(AmqpSource.ADDRESS_KEY, AmqpAddress.AmqpAddressBuffer.create(AmqpBinaryMarshaller.createEncoded(in)));
+                }
+                if (key.equals(AmqpSource.CREATE_KEY)){
+                    rc.put(AmqpSource.CREATE_KEY, AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(in)));
+                }
+                if (key.equals(AmqpSource.TIMEOUT_KEY)){
+                    rc.put(AmqpSource.TIMEOUT_KEY, AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(in)));
+                }
+                if (key.equals(AmqpSource.DISTRIBUTION_MODE_KEY)){
+                    rc.put(AmqpSource.DISTRIBUTION_MODE_KEY, AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(in)));
+                }
+                if (key.equals(AmqpSource.FILTER_KEY)){
+                    rc.put(AmqpSource.FILTER_KEY, AmqpFilterSet.AmqpFilterSetBuffer.create(AmqpMapMarshaller.createEncoded(in)));
+                }
+                if (key.equals(AmqpSource.MESSAGE_STATES_KEY)){
+                    rc.put(AmqpSource.MESSAGE_STATES_KEY, AmqpList.AmqpListBuffer.create(AmqpListMarshaller.createEncoded(in)));
+                }
+                if (key.equals(AmqpSource.ORPHAN_DISPOSITION_KEY)){
+                    rc.put(AmqpSource.ORPHAN_DISPOSITION_KEY, AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(in)));
+                }
+                else {
+                    throw new UnexpectedTypeException("Invalid field key for " + SYMBOLIC_ID + " : " + key);
+                }
             }
+            return rc;
         }
     };
 

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpStringMarshaller.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/AmqpStringMarshaller.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/AmqpStringMarshaller.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpStringMarshaller.java Sat Feb 13 03:20:16 2010
@@ -153,14 +153,14 @@
             ENCODER.encodeStringStr8Utf8(value, encoded, offset);
         }
 
-        public final String decode(EncodedBuffer encoded) throws AmqpEncodingError {
-            return ENCODER.decodeStringStr8Utf8(encoded.getBuffer(), encoded.getDataOffset(), encoded.getDataSize());
-        }
-
         public final void marshalData(DataOutput out) throws IOException {
             ENCODER.writeStringStr8Utf8(value, out);
         }
 
+        public final String decode(EncodedBuffer encoded) throws AmqpEncodingError {
+            return ENCODER.decodeStringStr8Utf8(encoded.getBuffer(), encoded.getDataOffset(), encoded.getDataSize());
+        }
+
         public final String unmarshalData(DataInput in) throws IOException {
             return ENCODER.readStringStr8Utf8(getDataSize(), in);
         }
@@ -188,14 +188,14 @@
             ENCODER.encodeStringStr8Utf16(value, encoded, offset);
         }
 
-        public final String decode(EncodedBuffer encoded) throws AmqpEncodingError {
-            return ENCODER.decodeStringStr8Utf16(encoded.getBuffer(), encoded.getDataOffset(), encoded.getDataSize());
-        }
-
         public final void marshalData(DataOutput out) throws IOException {
             ENCODER.writeStringStr8Utf16(value, out);
         }
 
+        public final String decode(EncodedBuffer encoded) throws AmqpEncodingError {
+            return ENCODER.decodeStringStr8Utf16(encoded.getBuffer(), encoded.getDataOffset(), encoded.getDataSize());
+        }
+
         public final String unmarshalData(DataInput in) throws IOException {
             return ENCODER.readStringStr8Utf16(getDataSize(), in);
         }
@@ -223,14 +223,14 @@
             ENCODER.encodeStringStr32Utf8(value, encoded, offset);
         }
 
-        public final String decode(EncodedBuffer encoded) throws AmqpEncodingError {
-            return ENCODER.decodeStringStr32Utf8(encoded.getBuffer(), encoded.getDataOffset(), encoded.getDataSize());
-        }
-
         public final void marshalData(DataOutput out) throws IOException {
             ENCODER.writeStringStr32Utf8(value, out);
         }
 
+        public final String decode(EncodedBuffer encoded) throws AmqpEncodingError {
+            return ENCODER.decodeStringStr32Utf8(encoded.getBuffer(), encoded.getDataOffset(), encoded.getDataSize());
+        }
+
         public final String unmarshalData(DataInput in) throws IOException {
             return ENCODER.readStringStr32Utf8(getDataSize(), in);
         }
@@ -258,14 +258,14 @@
             ENCODER.encodeStringStr32Utf16(value, encoded, offset);
         }
 
-        public final String decode(EncodedBuffer encoded) throws AmqpEncodingError {
-            return ENCODER.decodeStringStr32Utf16(encoded.getBuffer(), encoded.getDataOffset(), encoded.getDataSize());
-        }
-
         public final void marshalData(DataOutput out) throws IOException {
             ENCODER.writeStringStr32Utf16(value, out);
         }
 
+        public final String decode(EncodedBuffer encoded) throws AmqpEncodingError {
+            return ENCODER.decodeStringStr32Utf16(encoded.getBuffer(), encoded.getDataOffset(), encoded.getDataSize());
+        }
+
         public final String unmarshalData(DataInput in) throws IOException {
             return ENCODER.readStringStr32Utf16(getDataSize(), in);
         }

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpSymbolMarshaller.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/AmqpSymbolMarshaller.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/AmqpSymbolMarshaller.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpSymbolMarshaller.java Sat Feb 13 03:20:16 2010
@@ -131,14 +131,14 @@
             ENCODER.encodeSymbolSym8(value, encoded, offset);
         }
 
-        public final String decode(EncodedBuffer encoded) throws AmqpEncodingError {
-            return ENCODER.decodeSymbolSym8(encoded.getBuffer(), encoded.getDataOffset(), encoded.getDataSize());
-        }
-
         public final void marshalData(DataOutput out) throws IOException {
             ENCODER.writeSymbolSym8(value, out);
         }
 
+        public final String decode(EncodedBuffer encoded) throws AmqpEncodingError {
+            return ENCODER.decodeSymbolSym8(encoded.getBuffer(), encoded.getDataOffset(), encoded.getDataSize());
+        }
+
         public final String unmarshalData(DataInput in) throws IOException {
             return ENCODER.readSymbolSym8(getDataSize(), in);
         }
@@ -166,14 +166,14 @@
             ENCODER.encodeSymbolSym32(value, encoded, offset);
         }
 
-        public final String decode(EncodedBuffer encoded) throws AmqpEncodingError {
-            return ENCODER.decodeSymbolSym32(encoded.getBuffer(), encoded.getDataOffset(), encoded.getDataSize());
-        }
-
         public final void marshalData(DataOutput out) throws IOException {
             ENCODER.writeSymbolSym32(value, out);
         }
 
+        public final String decode(EncodedBuffer encoded) throws AmqpEncodingError {
+            return ENCODER.decodeSymbolSym32(encoded.getBuffer(), encoded.getDataOffset(), encoded.getDataSize());
+        }
+
         public final String unmarshalData(DataInput in) throws IOException {
             return ENCODER.readSymbolSym32(getDataSize(), in);
         }

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpTargetMarshaller.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/AmqpTargetMarshaller.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/AmqpTargetMarshaller.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpTargetMarshaller.java Sat Feb 13 03:20:16 2010
@@ -53,49 +53,58 @@
 
     private static final MapDecoder<AmqpSymbol, AmqpType<?, ?>> DECODER = new MapDecoder<AmqpSymbol, AmqpType<?, ?>>() {
 
-        public IAmqpMap<AmqpSymbol, AmqpType<?, ?>> createMap(int entryCount) {
-            return new IAmqpMap.AmqpWrapperMap<AmqpSymbol, AmqpType<?,?>>(new HashMap<AmqpSymbol, AmqpType<?,?>>());
-
-        }
-
-        public void decodeToMap(EncodedBuffer encodedKey, EncodedBuffer encodedValue, IAmqpMap<AmqpSymbol,AmqpType<?, ?>> map) throws AmqpEncodingError {
-            AmqpSymbol key = AmqpSymbol.AmqpSymbolBuffer.create(AmqpSymbolMarshaller.createEncoded(encodedKey));
-            if (key == null) {
-                throw new AmqpEncodingError("Null Key for " + SYMBOLIC_ID);
-            }
-
-            if (key.equals(AmqpTarget.ADDRESS_KEY)){
-                map.put(AmqpTarget.ADDRESS_KEY, AmqpAddress.AmqpAddressBuffer.create(AmqpBinaryMarshaller.createEncoded(encodedValue)));
-            }
-            if (key.equals(AmqpTarget.CREATE_KEY)){
-                map.put(AmqpTarget.CREATE_KEY, AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(encodedValue)));
-            }
-            if (key.equals(AmqpTarget.TIMEOUT_KEY)){
-                map.put(AmqpTarget.TIMEOUT_KEY, AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(encodedValue)));
-            }
-            else {
-                throw new UnexpectedTypeException("Invalid Key for " + SYMBOLIC_ID + " : " + key);
-            }
-        }
-
-        public void unmarshalToMap(DataInput in, IAmqpMap<AmqpSymbol,AmqpType<?, ?>> map) throws IOException, AmqpEncodingError {
-            AmqpSymbol key = AmqpSymbol.AmqpSymbolBuffer.create(AmqpSymbolMarshaller.createEncoded(in));
-            if (key == null) {
-                throw new AmqpEncodingError("Null Key for " + SYMBOLIC_ID);
-            }
-
-            if (key.equals(AmqpTarget.ADDRESS_KEY)){
-                map.put(AmqpTarget.ADDRESS_KEY, AmqpAddress.AmqpAddressBuffer.create(AmqpBinaryMarshaller.createEncoded(in)));
-            }
-            if (key.equals(AmqpTarget.CREATE_KEY)){
-                map.put(AmqpTarget.CREATE_KEY, AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(in)));
-            }
-            if (key.equals(AmqpTarget.TIMEOUT_KEY)){
-                map.put(AmqpTarget.TIMEOUT_KEY, AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(in)));
-            }
-            else {
-                throw new UnexpectedTypeException("Invalid Key for " + SYMBOLIC_ID + " : " + key);
+        public IAmqpMap<AmqpSymbol, AmqpType<?, ?>> decode(EncodedBuffer[] constituents) throws AmqpEncodingError {
+            IAmqpMap<AmqpSymbol, AmqpType<?, ?>> rc = new IAmqpMap.AmqpWrapperMap<AmqpSymbol, AmqpType<?,?>>(new HashMap<AmqpSymbol, AmqpType<?,?>>());
+            if (constituents.length % 2 != 0) {
+                throw new AmqpEncodingError("Invalid number of compound constituents for " + SYMBOLIC_ID + ": " + constituents.length);
+            }
+            for (int i = 0; i < constituents.length; i += 2) {
+                AmqpSymbol key = AmqpSymbol.AmqpSymbolBuffer.create(AmqpSymbolMarshaller.createEncoded(constituents[i]));
+                if (key == null) {
+                    throw new AmqpEncodingError("Null Key for " + SYMBOLIC_ID);
+                }
+
+                if (key.equals(AmqpTarget.ADDRESS_KEY)){
+                    rc.put(AmqpTarget.ADDRESS_KEY, AmqpAddress.AmqpAddressBuffer.create(AmqpBinaryMarshaller.createEncoded(constituents[i + 1])));
+                }
+                if (key.equals(AmqpTarget.CREATE_KEY)){
+                    rc.put(AmqpTarget.CREATE_KEY, AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(constituents[i + 1])));
+                }
+                if (key.equals(AmqpTarget.TIMEOUT_KEY)){
+                    rc.put(AmqpTarget.TIMEOUT_KEY, AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(constituents[i + 1])));
+                }
+                else {
+                    throw new UnexpectedTypeException("Invalid field key for " + SYMBOLIC_ID + " : " + key);
+                }
+            }
+            return rc;
+        }
+
+        public IAmqpMap<AmqpSymbol, AmqpType<?, ?>> unmarshalType(int dataCount, int dataSize, DataInput in) throws IOException, AmqpEncodingError {
+            IAmqpMap<AmqpSymbol, AmqpType<?, ?>> rc = new IAmqpMap.AmqpWrapperMap<AmqpSymbol, AmqpType<?,?>>(new HashMap<AmqpSymbol, AmqpType<?,?>>());
+            if (dataCount % 2 != 0) {
+                throw new AmqpEncodingError("Invalid number of compound constituents for " + SYMBOLIC_ID + ": " + dataCount);
+            }
+            for (int i = 0; i < dataCount; i += 2) {
+                AmqpSymbol key = AmqpSymbol.AmqpSymbolBuffer.create(AmqpSymbolMarshaller.createEncoded(in));
+                if (key == null) {
+                    throw new AmqpEncodingError("Null Key for " + SYMBOLIC_ID);
+                }
+
+                if (key.equals(AmqpTarget.ADDRESS_KEY)){
+                    rc.put(AmqpTarget.ADDRESS_KEY, AmqpAddress.AmqpAddressBuffer.create(AmqpBinaryMarshaller.createEncoded(in)));
+                }
+                if (key.equals(AmqpTarget.CREATE_KEY)){
+                    rc.put(AmqpTarget.CREATE_KEY, AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(in)));
+                }
+                if (key.equals(AmqpTarget.TIMEOUT_KEY)){
+                    rc.put(AmqpTarget.TIMEOUT_KEY, AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(in)));
+                }
+                else {
+                    throw new UnexpectedTypeException("Invalid field key for " + SYMBOLIC_ID + " : " + key);
+                }
             }
+            return rc;
         }
     };
 

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpTransferMarshaller.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/AmqpTransferMarshaller.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/AmqpTransferMarshaller.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpTransferMarshaller.java Sat Feb 13 03:20:16 2010
@@ -38,7 +38,7 @@
 public class AmqpTransferMarshaller implements DescribedTypeMarshaller<AmqpTransfer>{
 
     static final AmqpTransferMarshaller SINGLETON = new AmqpTransferMarshaller();
-    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:transfer:list";
     //Format code: 0x00000001:0x00000309:
@@ -52,61 +52,108 @@
         (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x09   // 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 > 6) {
+                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<?, ?>[6]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(in)));
+                dataCount--;
             }
-            case 2: {
-                return AmqpDeliveryTag.AmqpDeliveryTagBuffer.create(AmqpBinaryMarshaller.createEncoded(in));
+
+            //handle:
+            if(dataCount > 0) {
+                rc.set(1, AmqpHandle.AmqpHandleBuffer.create(AmqpUintMarshaller.createEncoded(in)));
+                dataCount--;
+            }
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": handle");
             }
-            case 3: {
-                return AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(in));
+
+            //delivery-tag:
+            if(dataCount > 0) {
+                rc.set(2, AmqpDeliveryTag.AmqpDeliveryTagBuffer.create(AmqpBinaryMarshaller.createEncoded(in)));
+                dataCount--;
             }
-            case 4: {
-                return AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(in));
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": delivery-tag");
             }
-            case 5: {
-                return AmqpList.AmqpListBuffer.create(AmqpListMarshaller.createEncoded(in));
+
+            //more:
+            if(dataCount > 0) {
+                rc.set(3, AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(in)));
+                dataCount--;
             }
-            default: {
-                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+
+            //aborted:
+            if(dataCount > 0) {
+                rc.set(4, AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(in)));
+                dataCount--;
             }
+
+            //fragments:
+            if(dataCount > 0) {
+                rc.set(5, AmqpList.AmqpListBuffer.create(AmqpListMarshaller.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 > 6) {
+                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<?, ?>[6]);
+            //options:
+            if(dataCount > 0) {
+                rc.set(0, AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(constituents[0])));
+                dataCount--;
             }
-            case 2: {
-                return AmqpDeliveryTag.AmqpDeliveryTagBuffer.create(AmqpBinaryMarshaller.createEncoded(buffer));
+
+            //handle:
+            if(dataCount > 0) {
+                rc.set(1, AmqpHandle.AmqpHandleBuffer.create(AmqpUintMarshaller.createEncoded(constituents[1])));
+                dataCount--;
+            }
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": handle");
             }
-            case 3: {
-                return AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(buffer));
+
+            //delivery-tag:
+            if(dataCount > 0) {
+                rc.set(2, AmqpDeliveryTag.AmqpDeliveryTagBuffer.create(AmqpBinaryMarshaller.createEncoded(constituents[2])));
+                dataCount--;
             }
-            case 4: {
-                return AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(buffer));
+            else {
+                throw new AmqpEncodingError("Missing required field for " + SYMBOLIC_ID + ": delivery-tag");
             }
-            case 5: {
-                return AmqpList.AmqpListBuffer.create(AmqpListMarshaller.createEncoded(buffer));
+
+            //more:
+            if(dataCount > 0) {
+                rc.set(3, AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(constituents[3])));
+                dataCount--;
             }
-            default: {
-                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+
+            //aborted:
+            if(dataCount > 0) {
+                rc.set(4, AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(constituents[4])));
+                dataCount--;
             }
+
+            //fragments:
+            if(dataCount > 0) {
+                rc.set(5, AmqpList.AmqpListBuffer.create(AmqpListMarshaller.createEncoded(constituents[5])));
+                dataCount--;
             }
+            return rc;
         }
     };
 
-    public static class AmqpTransferEncoded extends DescribedEncoded<IAmqpList> {
+    public static class AmqpTransferEncoded extends DescribedEncoded<IAmqpList<AmqpType<?, ?>>> {
 
         public AmqpTransferEncoded(DescribedBuffer buffer) {
             super(buffer);
@@ -124,11 +171,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);
         }
 
@@ -137,19 +184,19 @@
         }
     }
 
-    public static final Encoded<IAmqpList> encode(AmqpTransfer value) throws AmqpEncodingError {
+    public static final Encoded<IAmqpList<AmqpType<?, ?>>> encode(AmqpTransfer value) throws AmqpEncodingError {
         return new AmqpTransferEncoded(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;



Mime
View raw message