activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmacn...@apache.org
Subject svn commit: r908857 [3/17] - in /activemq/sandbox/activemq-apollo-actor/activemq-amqp: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/activemq/ src/main/java/org/apache/activemq/amqp/ src/main/jav...
Date Thu, 11 Feb 2010 07:04:46 GMT
Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpDispositionMarshaller.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/AmqpDispositionMarshaller.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpDispositionMarshaller.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpDispositionMarshaller.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,163 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.marshaller.v1_0_0;
+
+import java.io.DataInput;
+import java.io.IOException;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.marshaller.Encoded;
+import org.apache.activemq.amqp.protocol.marshaller.UnexpectedTypeException;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder.*;
+import org.apache.activemq.amqp.protocol.types.AmqpDeliveryTag;
+import org.apache.activemq.amqp.protocol.types.AmqpDisposition;
+import org.apache.activemq.amqp.protocol.types.AmqpHandle;
+import org.apache.activemq.amqp.protocol.types.AmqpMap;
+import org.apache.activemq.amqp.protocol.types.AmqpOptions;
+import org.apache.activemq.amqp.protocol.types.AmqpSymbol;
+import org.apache.activemq.amqp.protocol.types.AmqpType;
+import org.apache.activemq.amqp.protocol.types.AmqpUlong;
+import org.apache.activemq.amqp.protocol.types.IAmqpList;
+import org.apache.activemq.util.buffer.Buffer;
+
+public class AmqpDispositionMarshaller implements DescribedTypeMarshaller<AmqpDisposition>{
+
+    static final AmqpDispositionMarshaller SINGLETON = new AmqpDispositionMarshaller();
+    private static final Encoded<IAmqpList> NULL_ENCODED = new Encoder.NullEncoded<IAmqpList>();
+
+    public static final String SYMBOLIC_ID = "amqp:disposition:list";
+    //Format code: 0x00000001:0x00009902:
+    public static final long CATEGORY = 1;
+    public static final long DESCRIPTOR_ID = 39170;
+    public static final long NUMERIC_ID = CATEGORY << 32 | DESCRIPTOR_ID; //(4295006466L)
+    //Hard coded descriptor:
+    public static final EncodedBuffer DESCRIPTOR = FormatCategory.createBuffer(new Buffer(new byte [] {
+        (byte) 0x80,                                         // ulong descriptor encoding)
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,  // CATEGORY CODE
+        (byte) 0x00, (byte) 0x00, (byte) 0x99, (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 AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(in));
+            }
+            case 1: {
+                return AmqpHandle.AmqpHandleBuffer.create(AmqpUintMarshaller.createEncoded(in));
+            }
+            case 2: {
+                return AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(in));
+            }
+            case 3: {
+                return AmqpDeliveryTag.AmqpDeliveryTagBuffer.create(AmqpBinaryMarshaller.createEncoded(in));
+            }
+            case 4: {
+                return AmqpDeliveryTag.AmqpDeliveryTagBuffer.create(AmqpBinaryMarshaller.createEncoded(in));
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+            }
+            }
+        }
+
+        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
+            switch(pos) {
+            case 0: {
+                return AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
+            }
+            case 1: {
+                return AmqpHandle.AmqpHandleBuffer.create(AmqpUintMarshaller.createEncoded(buffer));
+            }
+            case 2: {
+                return AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
+            }
+            case 3: {
+                return AmqpDeliveryTag.AmqpDeliveryTagBuffer.create(AmqpBinaryMarshaller.createEncoded(buffer));
+            }
+            case 4: {
+                return AmqpDeliveryTag.AmqpDeliveryTagBuffer.create(AmqpBinaryMarshaller.createEncoded(buffer));
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+            }
+            }
+        }
+    };
+
+    public static class AmqpDispositionEncoded extends DescribedEncoded<IAmqpList> {
+
+        public AmqpDispositionEncoded(DescribedBuffer buffer) {
+            super(buffer);
+        }
+
+        public AmqpDispositionEncoded(AmqpDisposition value) {
+            super(AmqpListMarshaller.encode(value));
+        }
+
+        protected final String getSymbolicId() {
+            return SYMBOLIC_ID;
+        }
+
+        protected final long getNumericId() {
+            return NUMERIC_ID;
+        }
+
+        protected final Encoded<IAmqpList> decodeDescribed(EncodedBuffer encoded) throws AmqpEncodingError {
+            return AmqpListMarshaller.createEncoded(encoded, DECODER);
+        }
+
+        protected final Encoded<IAmqpList> unmarshalDescribed(DataInput in) throws IOException {
+            return AmqpListMarshaller.createEncoded(in, DECODER);
+        }
+
+        protected final EncodedBuffer getDescriptor() {
+            return DESCRIPTOR;
+        }
+    }
+
+    public static final Encoded<IAmqpList> encode(AmqpDisposition value) throws AmqpEncodingError {
+        return new AmqpDispositionEncoded(value);
+    }
+
+    static final Encoded<IAmqpList> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(source, offset));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(in.readByte(), in));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
+        byte fc = buffer.getEncodingFormatCode();
+        if (fc == Encoder.NULL_FORMAT_CODE) {
+            return NULL_ENCODED;
+        }
+
+        DescribedBuffer db = buffer.asDescribed();
+        AmqpType<?, ?> descriptor = AmqpMarshaller.SINGLETON.decodeType(db.getDescriptorBuffer());
+        if(!(descriptor instanceof AmqpUlong && ((AmqpUlong)descriptor).getValue().longValue() == NUMERIC_ID ||
+               descriptor instanceof AmqpSymbol && ((AmqpSymbol)descriptor).getValue().equals(SYMBOLIC_ID))) {
+            throw new UnexpectedTypeException("descriptor mismatch: " + descriptor);
+        }
+        return new AmqpDispositionEncoded(db);
+    }
+
+    public final AmqpDisposition.AmqpDispositionBuffer decodeDescribedType(AmqpType<?, ?> descriptor, DescribedBuffer encoded) throws AmqpEncodingError {
+        return AmqpDisposition.AmqpDispositionBuffer.create(new AmqpDispositionEncoded(encoded));
+    }
+}

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpDoubleMarshaller.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/AmqpDoubleMarshaller.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpDoubleMarshaller.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpDoubleMarshaller.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.marshaller.v1_0_0;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.lang.Double;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.marshaller.Encoded;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder.*;
+import org.apache.activemq.amqp.protocol.types.AmqpDouble;
+import org.apache.activemq.util.buffer.Buffer;
+
+public class AmqpDoubleMarshaller {
+
+    private static final Encoder ENCODER = Encoder.SINGLETON;
+    private static final Encoded<Double> NULL_ENCODED = new Encoder.NullEncoded<Double>();
+
+    public static final byte FORMAT_CODE = (byte) 0x82;
+    public static final FormatSubCategory FORMAT_CATEGORY  = FormatSubCategory.getCategory(FORMAT_CODE);
+
+    public static class AmqpDoubleEncoded  extends AbstractEncoded<Double> {
+
+        public AmqpDoubleEncoded (EncodedBuffer encoded) {
+            super(encoded);
+        }
+
+        public AmqpDoubleEncoded (Double value) throws AmqpEncodingError {
+            super(FORMAT_CODE, value);
+        }
+
+        public final void encode(Double value, Buffer encoded, int offset) throws AmqpEncodingError{
+            ENCODER.encodeDouble(value, encoded, offset);
+        }
+
+        public final Double decode(EncodedBuffer encoded) throws AmqpEncodingError{
+            return ENCODER.decodeDouble(encoded.getBuffer(), encoded.getDataOffset());
+        }
+
+        public final void marshalData(DataOutput out) throws IOException {
+            ENCODER.writeDouble(value, out);
+        }
+
+        public final Double unmarshalData(DataInput in) throws IOException {
+            return ENCODER.readDouble(in);
+        }
+    }
+
+    public static final Encoded<Double> encode(AmqpDouble data) throws AmqpEncodingError {
+        if(data == null) {
+            return NULL_ENCODED;
+        }
+        return new AmqpDoubleEncoded(data.getValue());
+    }
+
+    static final Encoded<Double> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(source, offset));
+    }
+
+    static final Encoded<Double> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(in.readByte(), in));
+    }
+
+    static final Encoded<Double> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
+        if(buffer.getEncodingFormatCode() == AmqpNullMarshaller.FORMAT_CODE) {
+            return new Encoder.NullEncoded<Double>();
+        }
+        if(buffer.getEncodingFormatCode() != FORMAT_CODE) {
+            throw new AmqpEncodingError("Unexpected format for AmqpDouble expected: " + FORMAT_CODE);
+        }
+        return new AmqpDoubleEncoded(buffer);
+    }
+}

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpDrainMarshaller.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/AmqpDrainMarshaller.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpDrainMarshaller.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpDrainMarshaller.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,143 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.marshaller.v1_0_0;
+
+import java.io.DataInput;
+import java.io.IOException;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.marshaller.Encoded;
+import org.apache.activemq.amqp.protocol.marshaller.UnexpectedTypeException;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder.*;
+import org.apache.activemq.amqp.protocol.types.AmqpDrain;
+import org.apache.activemq.amqp.protocol.types.AmqpHandle;
+import org.apache.activemq.amqp.protocol.types.AmqpOptions;
+import org.apache.activemq.amqp.protocol.types.AmqpSymbol;
+import org.apache.activemq.amqp.protocol.types.AmqpType;
+import org.apache.activemq.amqp.protocol.types.AmqpUlong;
+import org.apache.activemq.amqp.protocol.types.IAmqpList;
+import org.apache.activemq.util.buffer.Buffer;
+
+public class AmqpDrainMarshaller implements DescribedTypeMarshaller<AmqpDrain>{
+
+    static final AmqpDrainMarshaller SINGLETON = new AmqpDrainMarshaller();
+    private static final Encoded<IAmqpList> NULL_ENCODED = new Encoder.NullEncoded<IAmqpList>();
+
+    public static final String SYMBOLIC_ID = "amqp:drain:list";
+    //Format code: 0x00000001:0x00000308:
+    public static final long CATEGORY = 1;
+    public static final long DESCRIPTOR_ID = 776;
+    public static final long NUMERIC_ID = CATEGORY << 32 | DESCRIPTOR_ID; //(4294968072L)
+    //Hard coded descriptor:
+    public static final EncodedBuffer DESCRIPTOR = FormatCategory.createBuffer(new Buffer(new byte [] {
+        (byte) 0x80,                                         // ulong descriptor encoding)
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,  // CATEGORY CODE
+        (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x08   // 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));
+            }
+            case 1: {
+                return AmqpHandle.AmqpHandleBuffer.create(AmqpUintMarshaller.createEncoded(in));
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+            }
+            }
+        }
+
+        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
+            switch(pos) {
+            case 0: {
+                return AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
+            }
+            case 1: {
+                return AmqpHandle.AmqpHandleBuffer.create(AmqpUintMarshaller.createEncoded(buffer));
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+            }
+            }
+        }
+    };
+
+    public static class AmqpDrainEncoded extends DescribedEncoded<IAmqpList> {
+
+        public AmqpDrainEncoded(DescribedBuffer buffer) {
+            super(buffer);
+        }
+
+        public AmqpDrainEncoded(AmqpDrain value) {
+            super(AmqpListMarshaller.encode(value));
+        }
+
+        protected final String getSymbolicId() {
+            return SYMBOLIC_ID;
+        }
+
+        protected final long getNumericId() {
+            return NUMERIC_ID;
+        }
+
+        protected final Encoded<IAmqpList> decodeDescribed(EncodedBuffer encoded) throws AmqpEncodingError {
+            return AmqpListMarshaller.createEncoded(encoded, DECODER);
+        }
+
+        protected final Encoded<IAmqpList> unmarshalDescribed(DataInput in) throws IOException {
+            return AmqpListMarshaller.createEncoded(in, DECODER);
+        }
+
+        protected final EncodedBuffer getDescriptor() {
+            return DESCRIPTOR;
+        }
+    }
+
+    public static final Encoded<IAmqpList> encode(AmqpDrain value) throws AmqpEncodingError {
+        return new AmqpDrainEncoded(value);
+    }
+
+    static final Encoded<IAmqpList> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(source, offset));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(in.readByte(), in));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
+        byte fc = buffer.getEncodingFormatCode();
+        if (fc == Encoder.NULL_FORMAT_CODE) {
+            return NULL_ENCODED;
+        }
+
+        DescribedBuffer db = buffer.asDescribed();
+        AmqpType<?, ?> descriptor = AmqpMarshaller.SINGLETON.decodeType(db.getDescriptorBuffer());
+        if(!(descriptor instanceof AmqpUlong && ((AmqpUlong)descriptor).getValue().longValue() == NUMERIC_ID ||
+               descriptor instanceof AmqpSymbol && ((AmqpSymbol)descriptor).getValue().equals(SYMBOLIC_ID))) {
+            throw new UnexpectedTypeException("descriptor mismatch: " + descriptor);
+        }
+        return new AmqpDrainEncoded(db);
+    }
+
+    public final AmqpDrain.AmqpDrainBuffer decodeDescribedType(AmqpType<?, ?> descriptor, DescribedBuffer encoded) throws AmqpEncodingError {
+        return AmqpDrain.AmqpDrainBuffer.create(new AmqpDrainEncoded(encoded));
+    }
+}

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpEnlistMarshaller.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/AmqpEnlistMarshaller.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpEnlistMarshaller.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpEnlistMarshaller.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,156 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.marshaller.v1_0_0;
+
+import java.io.DataInput;
+import java.io.IOException;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.marshaller.Encoded;
+import org.apache.activemq.amqp.protocol.marshaller.UnexpectedTypeException;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder.*;
+import org.apache.activemq.amqp.protocol.types.AmqpBoolean;
+import org.apache.activemq.amqp.protocol.types.AmqpEnlist;
+import org.apache.activemq.amqp.protocol.types.AmqpOptions;
+import org.apache.activemq.amqp.protocol.types.AmqpSymbol;
+import org.apache.activemq.amqp.protocol.types.AmqpType;
+import org.apache.activemq.amqp.protocol.types.AmqpUlong;
+import org.apache.activemq.amqp.protocol.types.AmqpXid;
+import org.apache.activemq.amqp.protocol.types.IAmqpList;
+import org.apache.activemq.util.buffer.Buffer;
+
+public class AmqpEnlistMarshaller implements DescribedTypeMarshaller<AmqpEnlist>{
+
+    static final AmqpEnlistMarshaller SINGLETON = new AmqpEnlistMarshaller();
+    private static final Encoded<IAmqpList> NULL_ENCODED = new Encoder.NullEncoded<IAmqpList>();
+
+    public static final String SYMBOLIC_ID = "amqp:enlist:list";
+    //Format code: 0x00000001:0x00000302:
+    public static final long CATEGORY = 1;
+    public static final long DESCRIPTOR_ID = 770;
+    public static final long NUMERIC_ID = CATEGORY << 32 | DESCRIPTOR_ID; //(4294968066L)
+    //Hard coded descriptor:
+    public static final EncodedBuffer DESCRIPTOR = FormatCategory.createBuffer(new Buffer(new byte [] {
+        (byte) 0x80,                                         // ulong descriptor encoding)
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,  // CATEGORY CODE
+        (byte) 0x00, (byte) 0x00, (byte) 0x03, (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 AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(in));
+            }
+            case 1: {
+                return AmqpXid.AmqpXidBuffer.create(AmqpXidMarshaller.createEncoded(in));
+            }
+            case 2: {
+                return AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(in));
+            }
+            case 3: {
+                return AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(in));
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+            }
+            }
+        }
+
+        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
+            switch(pos) {
+            case 0: {
+                return AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
+            }
+            case 1: {
+                return AmqpXid.AmqpXidBuffer.create(AmqpXidMarshaller.createEncoded(buffer));
+            }
+            case 2: {
+                return AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(buffer));
+            }
+            case 3: {
+                return AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(buffer));
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+            }
+            }
+        }
+    };
+
+    public static class AmqpEnlistEncoded extends DescribedEncoded<IAmqpList> {
+
+        public AmqpEnlistEncoded(DescribedBuffer buffer) {
+            super(buffer);
+        }
+
+        public AmqpEnlistEncoded(AmqpEnlist value) {
+            super(AmqpListMarshaller.encode(value));
+        }
+
+        protected final String getSymbolicId() {
+            return SYMBOLIC_ID;
+        }
+
+        protected final long getNumericId() {
+            return NUMERIC_ID;
+        }
+
+        protected final Encoded<IAmqpList> decodeDescribed(EncodedBuffer encoded) throws AmqpEncodingError {
+            return AmqpListMarshaller.createEncoded(encoded, DECODER);
+        }
+
+        protected final Encoded<IAmqpList> unmarshalDescribed(DataInput in) throws IOException {
+            return AmqpListMarshaller.createEncoded(in, DECODER);
+        }
+
+        protected final EncodedBuffer getDescriptor() {
+            return DESCRIPTOR;
+        }
+    }
+
+    public static final Encoded<IAmqpList> encode(AmqpEnlist value) throws AmqpEncodingError {
+        return new AmqpEnlistEncoded(value);
+    }
+
+    static final Encoded<IAmqpList> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(source, offset));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(in.readByte(), in));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
+        byte fc = buffer.getEncodingFormatCode();
+        if (fc == Encoder.NULL_FORMAT_CODE) {
+            return NULL_ENCODED;
+        }
+
+        DescribedBuffer db = buffer.asDescribed();
+        AmqpType<?, ?> descriptor = AmqpMarshaller.SINGLETON.decodeType(db.getDescriptorBuffer());
+        if(!(descriptor instanceof AmqpUlong && ((AmqpUlong)descriptor).getValue().longValue() == NUMERIC_ID ||
+               descriptor instanceof AmqpSymbol && ((AmqpSymbol)descriptor).getValue().equals(SYMBOLIC_ID))) {
+            throw new UnexpectedTypeException("descriptor mismatch: " + descriptor);
+        }
+        return new AmqpEnlistEncoded(db);
+    }
+
+    public final AmqpEnlist.AmqpEnlistBuffer decodeDescribedType(AmqpType<?, ?> descriptor, DescribedBuffer encoded) throws AmqpEncodingError {
+        return AmqpEnlist.AmqpEnlistBuffer.create(new AmqpEnlistEncoded(encoded));
+    }
+}

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpFilterMarshaller.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/AmqpFilterMarshaller.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpFilterMarshaller.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpFilterMarshaller.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,141 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.marshaller.v1_0_0;
+
+import java.io.DataInput;
+import java.io.IOException;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.marshaller.Encoded;
+import org.apache.activemq.amqp.protocol.marshaller.UnexpectedTypeException;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder.*;
+import org.apache.activemq.amqp.protocol.types.AmqpFilter;
+import org.apache.activemq.amqp.protocol.types.AmqpSymbol;
+import org.apache.activemq.amqp.protocol.types.AmqpType;
+import org.apache.activemq.amqp.protocol.types.AmqpUlong;
+import org.apache.activemq.amqp.protocol.types.IAmqpList;
+import org.apache.activemq.util.buffer.Buffer;
+
+public class AmqpFilterMarshaller implements DescribedTypeMarshaller<AmqpFilter>{
+
+    static final AmqpFilterMarshaller SINGLETON = new AmqpFilterMarshaller();
+    private static final Encoded<IAmqpList> NULL_ENCODED = new Encoder.NullEncoded<IAmqpList>();
+
+    public static final String SYMBOLIC_ID = "amqp:filter:list";
+    //Format code: 0x00000001:0x00009703:
+    public static final long CATEGORY = 1;
+    public static final long DESCRIPTOR_ID = 38659;
+    public static final long NUMERIC_ID = CATEGORY << 32 | DESCRIPTOR_ID; //(4295005955L)
+    //Hard coded descriptor:
+    public static final EncodedBuffer DESCRIPTOR = FormatCategory.createBuffer(new Buffer(new byte [] {
+        (byte) 0x80,                                         // ulong descriptor encoding)
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,  // CATEGORY CODE
+        (byte) 0x00, (byte) 0x00, (byte) 0x97, (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 AmqpSymbol.AmqpSymbolBuffer.create(AmqpSymbolMarshaller.createEncoded(in));
+            }
+            case 1: {
+                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+            }
+            }
+        }
+
+        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
+            switch(pos) {
+            case 0: {
+                return AmqpSymbol.AmqpSymbolBuffer.create(AmqpSymbolMarshaller.createEncoded(buffer));
+            }
+            case 1: {
+                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+            }
+            }
+        }
+    };
+
+    public static class AmqpFilterEncoded extends DescribedEncoded<IAmqpList> {
+
+        public AmqpFilterEncoded(DescribedBuffer buffer) {
+            super(buffer);
+        }
+
+        public AmqpFilterEncoded(AmqpFilter value) {
+            super(AmqpListMarshaller.encode(value));
+        }
+
+        protected final String getSymbolicId() {
+            return SYMBOLIC_ID;
+        }
+
+        protected final long getNumericId() {
+            return NUMERIC_ID;
+        }
+
+        protected final Encoded<IAmqpList> decodeDescribed(EncodedBuffer encoded) throws AmqpEncodingError {
+            return AmqpListMarshaller.createEncoded(encoded, DECODER);
+        }
+
+        protected final Encoded<IAmqpList> unmarshalDescribed(DataInput in) throws IOException {
+            return AmqpListMarshaller.createEncoded(in, DECODER);
+        }
+
+        protected final EncodedBuffer getDescriptor() {
+            return DESCRIPTOR;
+        }
+    }
+
+    public static final Encoded<IAmqpList> encode(AmqpFilter value) throws AmqpEncodingError {
+        return new AmqpFilterEncoded(value);
+    }
+
+    static final Encoded<IAmqpList> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(source, offset));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(in.readByte(), in));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
+        byte fc = buffer.getEncodingFormatCode();
+        if (fc == Encoder.NULL_FORMAT_CODE) {
+            return NULL_ENCODED;
+        }
+
+        DescribedBuffer db = buffer.asDescribed();
+        AmqpType<?, ?> descriptor = AmqpMarshaller.SINGLETON.decodeType(db.getDescriptorBuffer());
+        if(!(descriptor instanceof AmqpUlong && ((AmqpUlong)descriptor).getValue().longValue() == NUMERIC_ID ||
+               descriptor instanceof AmqpSymbol && ((AmqpSymbol)descriptor).getValue().equals(SYMBOLIC_ID))) {
+            throw new UnexpectedTypeException("descriptor mismatch: " + descriptor);
+        }
+        return new AmqpFilterEncoded(db);
+    }
+
+    public final AmqpFilter.AmqpFilterBuffer decodeDescribedType(AmqpType<?, ?> descriptor, DescribedBuffer encoded) throws AmqpEncodingError {
+        return AmqpFilter.AmqpFilterBuffer.create(new AmqpFilterEncoded(encoded));
+    }
+}

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpFloatMarshaller.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/AmqpFloatMarshaller.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpFloatMarshaller.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpFloatMarshaller.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.marshaller.v1_0_0;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.lang.Float;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.marshaller.Encoded;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder.*;
+import org.apache.activemq.amqp.protocol.types.AmqpFloat;
+import org.apache.activemq.util.buffer.Buffer;
+
+public class AmqpFloatMarshaller {
+
+    private static final Encoder ENCODER = Encoder.SINGLETON;
+    private static final Encoded<Float> NULL_ENCODED = new Encoder.NullEncoded<Float>();
+
+    public static final byte FORMAT_CODE = (byte) 0x72;
+    public static final FormatSubCategory FORMAT_CATEGORY  = FormatSubCategory.getCategory(FORMAT_CODE);
+
+    public static class AmqpFloatEncoded  extends AbstractEncoded<Float> {
+
+        public AmqpFloatEncoded (EncodedBuffer encoded) {
+            super(encoded);
+        }
+
+        public AmqpFloatEncoded (Float value) throws AmqpEncodingError {
+            super(FORMAT_CODE, value);
+        }
+
+        public final void encode(Float value, Buffer encoded, int offset) throws AmqpEncodingError{
+            ENCODER.encodeFloat(value, encoded, offset);
+        }
+
+        public final Float decode(EncodedBuffer encoded) throws AmqpEncodingError{
+            return ENCODER.decodeFloat(encoded.getBuffer(), encoded.getDataOffset());
+        }
+
+        public final void marshalData(DataOutput out) throws IOException {
+            ENCODER.writeFloat(value, out);
+        }
+
+        public final Float unmarshalData(DataInput in) throws IOException {
+            return ENCODER.readFloat(in);
+        }
+    }
+
+    public static final Encoded<Float> encode(AmqpFloat data) throws AmqpEncodingError {
+        if(data == null) {
+            return NULL_ENCODED;
+        }
+        return new AmqpFloatEncoded(data.getValue());
+    }
+
+    static final Encoded<Float> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(source, offset));
+    }
+
+    static final Encoded<Float> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(in.readByte(), in));
+    }
+
+    static final Encoded<Float> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
+        if(buffer.getEncodingFormatCode() == AmqpNullMarshaller.FORMAT_CODE) {
+            return new Encoder.NullEncoded<Float>();
+        }
+        if(buffer.getEncodingFormatCode() != FORMAT_CODE) {
+            throw new AmqpEncodingError("Unexpected format for AmqpFloat expected: " + FORMAT_CODE);
+        }
+        return new AmqpFloatEncoded(buffer);
+    }
+}

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpFlowMarshaller.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/AmqpFlowMarshaller.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpFlowMarshaller.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpFlowMarshaller.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,150 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.marshaller.v1_0_0;
+
+import java.io.DataInput;
+import java.io.IOException;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.marshaller.Encoded;
+import org.apache.activemq.amqp.protocol.marshaller.UnexpectedTypeException;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder.*;
+import org.apache.activemq.amqp.protocol.types.AmqpFlow;
+import org.apache.activemq.amqp.protocol.types.AmqpHandle;
+import org.apache.activemq.amqp.protocol.types.AmqpOptions;
+import org.apache.activemq.amqp.protocol.types.AmqpSequenceNo;
+import org.apache.activemq.amqp.protocol.types.AmqpSymbol;
+import org.apache.activemq.amqp.protocol.types.AmqpType;
+import org.apache.activemq.amqp.protocol.types.AmqpUlong;
+import org.apache.activemq.amqp.protocol.types.IAmqpList;
+import org.apache.activemq.util.buffer.Buffer;
+
+public class AmqpFlowMarshaller implements DescribedTypeMarshaller<AmqpFlow>{
+
+    static final AmqpFlowMarshaller SINGLETON = new AmqpFlowMarshaller();
+    private static final Encoded<IAmqpList> NULL_ENCODED = new Encoder.NullEncoded<IAmqpList>();
+
+    public static final String SYMBOLIC_ID = "amqp:flow:list";
+    //Format code: 0x00000001:0x00000307:
+    public static final long CATEGORY = 1;
+    public static final long DESCRIPTOR_ID = 775;
+    public static final long NUMERIC_ID = CATEGORY << 32 | DESCRIPTOR_ID; //(4294968071L)
+    //Hard coded descriptor:
+    public static final EncodedBuffer DESCRIPTOR = FormatCategory.createBuffer(new Buffer(new byte [] {
+        (byte) 0x80,                                         // ulong descriptor encoding)
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,  // CATEGORY CODE
+        (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x07   // 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));
+            }
+            case 1: {
+                return AmqpHandle.AmqpHandleBuffer.create(AmqpUintMarshaller.createEncoded(in));
+            }
+            case 2: {
+                return AmqpSequenceNo.AmqpSequenceNoBuffer.create(AmqpUintMarshaller.createEncoded(in));
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+            }
+            }
+        }
+
+        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
+            switch(pos) {
+            case 0: {
+                return AmqpOptions.AmqpOptionsBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
+            }
+            case 1: {
+                return AmqpHandle.AmqpHandleBuffer.create(AmqpUintMarshaller.createEncoded(buffer));
+            }
+            case 2: {
+                return AmqpSequenceNo.AmqpSequenceNoBuffer.create(AmqpUintMarshaller.createEncoded(buffer));
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+            }
+            }
+        }
+    };
+
+    public static class AmqpFlowEncoded extends DescribedEncoded<IAmqpList> {
+
+        public AmqpFlowEncoded(DescribedBuffer buffer) {
+            super(buffer);
+        }
+
+        public AmqpFlowEncoded(AmqpFlow value) {
+            super(AmqpListMarshaller.encode(value));
+        }
+
+        protected final String getSymbolicId() {
+            return SYMBOLIC_ID;
+        }
+
+        protected final long getNumericId() {
+            return NUMERIC_ID;
+        }
+
+        protected final Encoded<IAmqpList> decodeDescribed(EncodedBuffer encoded) throws AmqpEncodingError {
+            return AmqpListMarshaller.createEncoded(encoded, DECODER);
+        }
+
+        protected final Encoded<IAmqpList> unmarshalDescribed(DataInput in) throws IOException {
+            return AmqpListMarshaller.createEncoded(in, DECODER);
+        }
+
+        protected final EncodedBuffer getDescriptor() {
+            return DESCRIPTOR;
+        }
+    }
+
+    public static final Encoded<IAmqpList> encode(AmqpFlow value) throws AmqpEncodingError {
+        return new AmqpFlowEncoded(value);
+    }
+
+    static final Encoded<IAmqpList> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(source, offset));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(in.readByte(), in));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
+        byte fc = buffer.getEncodingFormatCode();
+        if (fc == Encoder.NULL_FORMAT_CODE) {
+            return NULL_ENCODED;
+        }
+
+        DescribedBuffer db = buffer.asDescribed();
+        AmqpType<?, ?> descriptor = AmqpMarshaller.SINGLETON.decodeType(db.getDescriptorBuffer());
+        if(!(descriptor instanceof AmqpUlong && ((AmqpUlong)descriptor).getValue().longValue() == NUMERIC_ID ||
+               descriptor instanceof AmqpSymbol && ((AmqpSymbol)descriptor).getValue().equals(SYMBOLIC_ID))) {
+            throw new UnexpectedTypeException("descriptor mismatch: " + descriptor);
+        }
+        return new AmqpFlowEncoded(db);
+    }
+
+    public final AmqpFlow.AmqpFlowBuffer decodeDescribedType(AmqpType<?, ?> descriptor, DescribedBuffer encoded) throws AmqpEncodingError {
+        return AmqpFlow.AmqpFlowBuffer.create(new AmqpFlowEncoded(encoded));
+    }
+}

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpFooterMarshaller.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/AmqpFooterMarshaller.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpFooterMarshaller.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpFooterMarshaller.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,142 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.marshaller.v1_0_0;
+
+import java.io.DataInput;
+import java.io.IOException;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.marshaller.Encoded;
+import org.apache.activemq.amqp.protocol.marshaller.UnexpectedTypeException;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder.*;
+import org.apache.activemq.amqp.protocol.types.AmqpFooter;
+import org.apache.activemq.amqp.protocol.types.AmqpMessageAttributes;
+import org.apache.activemq.amqp.protocol.types.AmqpSymbol;
+import org.apache.activemq.amqp.protocol.types.AmqpType;
+import org.apache.activemq.amqp.protocol.types.AmqpUlong;
+import org.apache.activemq.amqp.protocol.types.IAmqpList;
+import org.apache.activemq.util.buffer.Buffer;
+
+public class AmqpFooterMarshaller implements DescribedTypeMarshaller<AmqpFooter>{
+
+    static final AmqpFooterMarshaller SINGLETON = new AmqpFooterMarshaller();
+    private static final Encoded<IAmqpList> NULL_ENCODED = new Encoder.NullEncoded<IAmqpList>();
+
+    public static final String SYMBOLIC_ID = "amqp:footer:list";
+    //Format code: 0x00000001:0x00009803:
+    public static final long CATEGORY = 1;
+    public static final long DESCRIPTOR_ID = 38915;
+    public static final long NUMERIC_ID = CATEGORY << 32 | DESCRIPTOR_ID; //(4295006211L)
+    //Hard coded descriptor:
+    public static final EncodedBuffer DESCRIPTOR = FormatCategory.createBuffer(new Buffer(new byte [] {
+        (byte) 0x80,                                         // ulong descriptor encoding)
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,  // CATEGORY CODE
+        (byte) 0x00, (byte) 0x00, (byte) 0x98, (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 AmqpMessageAttributes.AmqpMessageAttributesBuffer.create(AmqpMapMarshaller.createEncoded(in));
+            }
+            case 1: {
+                return AmqpMessageAttributes.AmqpMessageAttributesBuffer.create(AmqpMapMarshaller.createEncoded(in));
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+            }
+            }
+        }
+
+        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
+            switch(pos) {
+            case 0: {
+                return AmqpMessageAttributes.AmqpMessageAttributesBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
+            }
+            case 1: {
+                return AmqpMessageAttributes.AmqpMessageAttributesBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+            }
+            }
+        }
+    };
+
+    public static class AmqpFooterEncoded extends DescribedEncoded<IAmqpList> {
+
+        public AmqpFooterEncoded(DescribedBuffer buffer) {
+            super(buffer);
+        }
+
+        public AmqpFooterEncoded(AmqpFooter value) {
+            super(AmqpListMarshaller.encode(value));
+        }
+
+        protected final String getSymbolicId() {
+            return SYMBOLIC_ID;
+        }
+
+        protected final long getNumericId() {
+            return NUMERIC_ID;
+        }
+
+        protected final Encoded<IAmqpList> decodeDescribed(EncodedBuffer encoded) throws AmqpEncodingError {
+            return AmqpListMarshaller.createEncoded(encoded, DECODER);
+        }
+
+        protected final Encoded<IAmqpList> unmarshalDescribed(DataInput in) throws IOException {
+            return AmqpListMarshaller.createEncoded(in, DECODER);
+        }
+
+        protected final EncodedBuffer getDescriptor() {
+            return DESCRIPTOR;
+        }
+    }
+
+    public static final Encoded<IAmqpList> encode(AmqpFooter value) throws AmqpEncodingError {
+        return new AmqpFooterEncoded(value);
+    }
+
+    static final Encoded<IAmqpList> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(source, offset));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(in.readByte(), in));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
+        byte fc = buffer.getEncodingFormatCode();
+        if (fc == Encoder.NULL_FORMAT_CODE) {
+            return NULL_ENCODED;
+        }
+
+        DescribedBuffer db = buffer.asDescribed();
+        AmqpType<?, ?> descriptor = AmqpMarshaller.SINGLETON.decodeType(db.getDescriptorBuffer());
+        if(!(descriptor instanceof AmqpUlong && ((AmqpUlong)descriptor).getValue().longValue() == NUMERIC_ID ||
+               descriptor instanceof AmqpSymbol && ((AmqpSymbol)descriptor).getValue().equals(SYMBOLIC_ID))) {
+            throw new UnexpectedTypeException("descriptor mismatch: " + descriptor);
+        }
+        return new AmqpFooterEncoded(db);
+    }
+
+    public final AmqpFooter.AmqpFooterBuffer decodeDescribedType(AmqpType<?, ?> descriptor, DescribedBuffer encoded) throws AmqpEncodingError {
+        return AmqpFooter.AmqpFooterBuffer.create(new AmqpFooterEncoded(encoded));
+    }
+}

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpFragmentMarshaller.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/AmqpFragmentMarshaller.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpFragmentMarshaller.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpFragmentMarshaller.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,162 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.marshaller.v1_0_0;
+
+import java.io.DataInput;
+import java.io.IOException;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.marshaller.Encoded;
+import org.apache.activemq.amqp.protocol.marshaller.UnexpectedTypeException;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder.*;
+import org.apache.activemq.amqp.protocol.types.AmqpBinary;
+import org.apache.activemq.amqp.protocol.types.AmqpBoolean;
+import org.apache.activemq.amqp.protocol.types.AmqpFragment;
+import org.apache.activemq.amqp.protocol.types.AmqpSymbol;
+import org.apache.activemq.amqp.protocol.types.AmqpType;
+import org.apache.activemq.amqp.protocol.types.AmqpUint;
+import org.apache.activemq.amqp.protocol.types.AmqpUlong;
+import org.apache.activemq.amqp.protocol.types.IAmqpList;
+import org.apache.activemq.util.buffer.Buffer;
+
+public class AmqpFragmentMarshaller implements DescribedTypeMarshaller<AmqpFragment>{
+
+    static final AmqpFragmentMarshaller SINGLETON = new AmqpFragmentMarshaller();
+    private static final Encoded<IAmqpList> NULL_ENCODED = new Encoder.NullEncoded<IAmqpList>();
+
+    public static final String SYMBOLIC_ID = "amqp:fragment:list";
+    //Format code: 0x00000001:0x00009903:
+    public static final long CATEGORY = 1;
+    public static final long DESCRIPTOR_ID = 39171;
+    public static final long NUMERIC_ID = CATEGORY << 32 | DESCRIPTOR_ID; //(4295006467L)
+    //Hard coded descriptor:
+    public static final EncodedBuffer DESCRIPTOR = FormatCategory.createBuffer(new Buffer(new byte [] {
+        (byte) 0x80,                                         // ulong descriptor encoding)
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,  // CATEGORY CODE
+        (byte) 0x00, (byte) 0x00, (byte) 0x99, (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 AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(in));
+            }
+            case 1: {
+                return AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(in));
+            }
+            case 2: {
+                return AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(in));
+            }
+            case 3: {
+                return AmqpUlong.AmqpUlongBuffer.create(AmqpUlongMarshaller.createEncoded(in));
+            }
+            case 4: {
+                return AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(in));
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+            }
+            }
+        }
+
+        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
+            switch(pos) {
+            case 0: {
+                return AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(buffer));
+            }
+            case 1: {
+                return AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(buffer));
+            }
+            case 2: {
+                return AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(buffer));
+            }
+            case 3: {
+                return AmqpUlong.AmqpUlongBuffer.create(AmqpUlongMarshaller.createEncoded(buffer));
+            }
+            case 4: {
+                return AmqpBinary.AmqpBinaryBuffer.create(AmqpBinaryMarshaller.createEncoded(buffer));
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+            }
+            }
+        }
+    };
+
+    public static class AmqpFragmentEncoded extends DescribedEncoded<IAmqpList> {
+
+        public AmqpFragmentEncoded(DescribedBuffer buffer) {
+            super(buffer);
+        }
+
+        public AmqpFragmentEncoded(AmqpFragment value) {
+            super(AmqpListMarshaller.encode(value));
+        }
+
+        protected final String getSymbolicId() {
+            return SYMBOLIC_ID;
+        }
+
+        protected final long getNumericId() {
+            return NUMERIC_ID;
+        }
+
+        protected final Encoded<IAmqpList> decodeDescribed(EncodedBuffer encoded) throws AmqpEncodingError {
+            return AmqpListMarshaller.createEncoded(encoded, DECODER);
+        }
+
+        protected final Encoded<IAmqpList> unmarshalDescribed(DataInput in) throws IOException {
+            return AmqpListMarshaller.createEncoded(in, DECODER);
+        }
+
+        protected final EncodedBuffer getDescriptor() {
+            return DESCRIPTOR;
+        }
+    }
+
+    public static final Encoded<IAmqpList> encode(AmqpFragment value) throws AmqpEncodingError {
+        return new AmqpFragmentEncoded(value);
+    }
+
+    static final Encoded<IAmqpList> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(source, offset));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(in.readByte(), in));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
+        byte fc = buffer.getEncodingFormatCode();
+        if (fc == Encoder.NULL_FORMAT_CODE) {
+            return NULL_ENCODED;
+        }
+
+        DescribedBuffer db = buffer.asDescribed();
+        AmqpType<?, ?> descriptor = AmqpMarshaller.SINGLETON.decodeType(db.getDescriptorBuffer());
+        if(!(descriptor instanceof AmqpUlong && ((AmqpUlong)descriptor).getValue().longValue() == NUMERIC_ID ||
+               descriptor instanceof AmqpSymbol && ((AmqpSymbol)descriptor).getValue().equals(SYMBOLIC_ID))) {
+            throw new UnexpectedTypeException("descriptor mismatch: " + descriptor);
+        }
+        return new AmqpFragmentEncoded(db);
+    }
+
+    public final AmqpFragment.AmqpFragmentBuffer decodeDescribedType(AmqpType<?, ?> descriptor, DescribedBuffer encoded) throws AmqpEncodingError {
+        return AmqpFragment.AmqpFragmentBuffer.create(new AmqpFragmentEncoded(encoded));
+    }
+}

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpHeaderMarshaller.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/AmqpHeaderMarshaller.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpHeaderMarshaller.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpHeaderMarshaller.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,188 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.marshaller.v1_0_0;
+
+import java.io.DataInput;
+import java.io.IOException;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.marshaller.Encoded;
+import org.apache.activemq.amqp.protocol.marshaller.UnexpectedTypeException;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder.*;
+import org.apache.activemq.amqp.protocol.types.AmqpBoolean;
+import org.apache.activemq.amqp.protocol.types.AmqpHeader;
+import org.apache.activemq.amqp.protocol.types.AmqpMessageAttributes;
+import org.apache.activemq.amqp.protocol.types.AmqpSymbol;
+import org.apache.activemq.amqp.protocol.types.AmqpTimestamp;
+import org.apache.activemq.amqp.protocol.types.AmqpType;
+import org.apache.activemq.amqp.protocol.types.AmqpUbyte;
+import org.apache.activemq.amqp.protocol.types.AmqpUint;
+import org.apache.activemq.amqp.protocol.types.AmqpUlong;
+import org.apache.activemq.amqp.protocol.types.IAmqpList;
+import org.apache.activemq.util.buffer.Buffer;
+
+public class AmqpHeaderMarshaller implements DescribedTypeMarshaller<AmqpHeader>{
+
+    static final AmqpHeaderMarshaller SINGLETON = new AmqpHeaderMarshaller();
+    private static final Encoded<IAmqpList> NULL_ENCODED = new Encoder.NullEncoded<IAmqpList>();
+
+    public static final String SYMBOLIC_ID = "amqp:header:list";
+    //Format code: 0x00000001:0x0009801:
+    public static final long CATEGORY = 1;
+    public static final long DESCRIPTOR_ID = 38913;
+    public static final long NUMERIC_ID = CATEGORY << 32 | DESCRIPTOR_ID; //(4295006209L)
+    //Hard coded descriptor:
+    public static final EncodedBuffer DESCRIPTOR = FormatCategory.createBuffer(new Buffer(new byte [] {
+        (byte) 0x80,                                         // ulong descriptor encoding)
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,  // CATEGORY CODE
+        (byte) 0x00, (byte) 0x00, (byte) 0x98, (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 AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(in));
+            }
+            case 1: {
+                return AmqpUbyte.AmqpUbyteBuffer.create(AmqpUbyteMarshaller.createEncoded(in));
+            }
+            case 2: {
+                return AmqpTimestamp.AmqpTimestampBuffer.create(AmqpTimestampMarshaller.createEncoded(in));
+            }
+            case 3: {
+                return AmqpUlong.AmqpUlongBuffer.create(AmqpUlongMarshaller.createEncoded(in));
+            }
+            case 4: {
+                return AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(in));
+            }
+            case 5: {
+                return AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(in));
+            }
+            case 6: {
+                return AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(in));
+            }
+            case 7: {
+                return AmqpMessageAttributes.AmqpMessageAttributesBuffer.create(AmqpMapMarshaller.createEncoded(in));
+            }
+            case 8: {
+                return AmqpMessageAttributes.AmqpMessageAttributesBuffer.create(AmqpMapMarshaller.createEncoded(in));
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+            }
+            }
+        }
+
+        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
+            switch(pos) {
+            case 0: {
+                return AmqpBoolean.AmqpBooleanBuffer.create(AmqpBooleanMarshaller.createEncoded(buffer));
+            }
+            case 1: {
+                return AmqpUbyte.AmqpUbyteBuffer.create(AmqpUbyteMarshaller.createEncoded(buffer));
+            }
+            case 2: {
+                return AmqpTimestamp.AmqpTimestampBuffer.create(AmqpTimestampMarshaller.createEncoded(buffer));
+            }
+            case 3: {
+                return AmqpUlong.AmqpUlongBuffer.create(AmqpUlongMarshaller.createEncoded(buffer));
+            }
+            case 4: {
+                return AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(buffer));
+            }
+            case 5: {
+                return AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(buffer));
+            }
+            case 6: {
+                return AmqpUint.AmqpUintBuffer.create(AmqpUintMarshaller.createEncoded(buffer));
+            }
+            case 7: {
+                return AmqpMessageAttributes.AmqpMessageAttributesBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
+            }
+            case 8: {
+                return AmqpMessageAttributes.AmqpMessageAttributesBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+            }
+            }
+        }
+    };
+
+    public static class AmqpHeaderEncoded extends DescribedEncoded<IAmqpList> {
+
+        public AmqpHeaderEncoded(DescribedBuffer buffer) {
+            super(buffer);
+        }
+
+        public AmqpHeaderEncoded(AmqpHeader value) {
+            super(AmqpListMarshaller.encode(value));
+        }
+
+        protected final String getSymbolicId() {
+            return SYMBOLIC_ID;
+        }
+
+        protected final long getNumericId() {
+            return NUMERIC_ID;
+        }
+
+        protected final Encoded<IAmqpList> decodeDescribed(EncodedBuffer encoded) throws AmqpEncodingError {
+            return AmqpListMarshaller.createEncoded(encoded, DECODER);
+        }
+
+        protected final Encoded<IAmqpList> unmarshalDescribed(DataInput in) throws IOException {
+            return AmqpListMarshaller.createEncoded(in, DECODER);
+        }
+
+        protected final EncodedBuffer getDescriptor() {
+            return DESCRIPTOR;
+        }
+    }
+
+    public static final Encoded<IAmqpList> encode(AmqpHeader value) throws AmqpEncodingError {
+        return new AmqpHeaderEncoded(value);
+    }
+
+    static final Encoded<IAmqpList> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(source, offset));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(in.readByte(), in));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
+        byte fc = buffer.getEncodingFormatCode();
+        if (fc == Encoder.NULL_FORMAT_CODE) {
+            return NULL_ENCODED;
+        }
+
+        DescribedBuffer db = buffer.asDescribed();
+        AmqpType<?, ?> descriptor = AmqpMarshaller.SINGLETON.decodeType(db.getDescriptorBuffer());
+        if(!(descriptor instanceof AmqpUlong && ((AmqpUlong)descriptor).getValue().longValue() == NUMERIC_ID ||
+               descriptor instanceof AmqpSymbol && ((AmqpSymbol)descriptor).getValue().equals(SYMBOLIC_ID))) {
+            throw new UnexpectedTypeException("descriptor mismatch: " + descriptor);
+        }
+        return new AmqpHeaderEncoded(db);
+    }
+
+    public final AmqpHeader.AmqpHeaderBuffer decodeDescribedType(AmqpType<?, ?> descriptor, DescribedBuffer encoded) throws AmqpEncodingError {
+        return AmqpHeader.AmqpHeaderBuffer.create(new AmqpHeaderEncoded(encoded));
+    }
+}

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpIntMarshaller.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/AmqpIntMarshaller.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpIntMarshaller.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpIntMarshaller.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.marshaller.v1_0_0;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.lang.Integer;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.marshaller.Encoded;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder.*;
+import org.apache.activemq.amqp.protocol.types.AmqpInt;
+import org.apache.activemq.util.buffer.Buffer;
+
+public class AmqpIntMarshaller {
+
+    private static final Encoder ENCODER = Encoder.SINGLETON;
+    private static final Encoded<Integer> NULL_ENCODED = new Encoder.NullEncoded<Integer>();
+
+    public static final byte FORMAT_CODE = (byte) 0x71;
+    public static final FormatSubCategory FORMAT_CATEGORY  = FormatSubCategory.getCategory(FORMAT_CODE);
+
+    public static class AmqpIntEncoded  extends AbstractEncoded<Integer> {
+
+        public AmqpIntEncoded (EncodedBuffer encoded) {
+            super(encoded);
+        }
+
+        public AmqpIntEncoded (Integer value) throws AmqpEncodingError {
+            super(FORMAT_CODE, value);
+        }
+
+        public final void encode(Integer value, Buffer encoded, int offset) throws AmqpEncodingError{
+            ENCODER.encodeInt(value, encoded, offset);
+        }
+
+        public final Integer decode(EncodedBuffer encoded) throws AmqpEncodingError{
+            return ENCODER.decodeInt(encoded.getBuffer(), encoded.getDataOffset());
+        }
+
+        public final void marshalData(DataOutput out) throws IOException {
+            ENCODER.writeInt(value, out);
+        }
+
+        public final Integer unmarshalData(DataInput in) throws IOException {
+            return ENCODER.readInt(in);
+        }
+    }
+
+    public static final Encoded<Integer> encode(AmqpInt data) throws AmqpEncodingError {
+        if(data == null) {
+            return NULL_ENCODED;
+        }
+        return new AmqpIntEncoded(data.getValue());
+    }
+
+    static final Encoded<Integer> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(source, offset));
+    }
+
+    static final Encoded<Integer> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(in.readByte(), in));
+    }
+
+    static final Encoded<Integer> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
+        if(buffer.getEncodingFormatCode() == AmqpNullMarshaller.FORMAT_CODE) {
+            return new Encoder.NullEncoded<Integer>();
+        }
+        if(buffer.getEncodingFormatCode() != FORMAT_CODE) {
+            throw new AmqpEncodingError("Unexpected format for AmqpInt expected: " + FORMAT_CODE);
+        }
+        return new AmqpIntEncoded(buffer);
+    }
+}

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpLinkErrorMarshaller.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/AmqpLinkErrorMarshaller.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpLinkErrorMarshaller.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/AmqpLinkErrorMarshaller.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,150 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.marshaller.v1_0_0;
+
+import java.io.DataInput;
+import java.io.IOException;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.marshaller.Encoded;
+import org.apache.activemq.amqp.protocol.marshaller.UnexpectedTypeException;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder;
+import org.apache.activemq.amqp.protocol.marshaller.v1_0_0.Encoder.*;
+import org.apache.activemq.amqp.protocol.types.AmqpLinkError;
+import org.apache.activemq.amqp.protocol.types.AmqpMap;
+import org.apache.activemq.amqp.protocol.types.AmqpString;
+import org.apache.activemq.amqp.protocol.types.AmqpSymbol;
+import org.apache.activemq.amqp.protocol.types.AmqpType;
+import org.apache.activemq.amqp.protocol.types.AmqpUlong;
+import org.apache.activemq.amqp.protocol.types.AmqpUshort;
+import org.apache.activemq.amqp.protocol.types.IAmqpList;
+import org.apache.activemq.util.buffer.Buffer;
+
+public class AmqpLinkErrorMarshaller implements DescribedTypeMarshaller<AmqpLinkError>{
+
+    static final AmqpLinkErrorMarshaller SINGLETON = new AmqpLinkErrorMarshaller();
+    private static final Encoded<IAmqpList> NULL_ENCODED = new Encoder.NullEncoded<IAmqpList>();
+
+    public static final String SYMBOLIC_ID = "amqp:link-error:list";
+    //Format code: 0x00000001:0x00000103:
+    public static final long CATEGORY = 1;
+    public static final long DESCRIPTOR_ID = 259;
+    public static final long NUMERIC_ID = CATEGORY << 32 | DESCRIPTOR_ID; //(4294967555L)
+    //Hard coded descriptor:
+    public static final EncodedBuffer DESCRIPTOR = FormatCategory.createBuffer(new Buffer(new byte [] {
+        (byte) 0x80,                                         // ulong descriptor encoding)
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,  // CATEGORY CODE
+        (byte) 0x00, (byte) 0x00, (byte) 0x01, (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 AmqpUshort.AmqpUshortBuffer.create(AmqpUshortMarshaller.createEncoded(in));
+            }
+            case 1: {
+                return AmqpString.AmqpStringBuffer.create(AmqpStringMarshaller.createEncoded(in));
+            }
+            case 2: {
+                return AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(in));
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.unmarshalType(in);
+            }
+            }
+        }
+
+        public final AmqpType<?, ?> decodeType(int pos, EncodedBuffer buffer) throws AmqpEncodingError {
+            switch(pos) {
+            case 0: {
+                return AmqpUshort.AmqpUshortBuffer.create(AmqpUshortMarshaller.createEncoded(buffer));
+            }
+            case 1: {
+                return AmqpString.AmqpStringBuffer.create(AmqpStringMarshaller.createEncoded(buffer));
+            }
+            case 2: {
+                return AmqpMap.AmqpMapBuffer.create(AmqpMapMarshaller.createEncoded(buffer));
+            }
+            default: {
+                return AmqpMarshaller.SINGLETON.decodeType(buffer);
+            }
+            }
+        }
+    };
+
+    public static class AmqpLinkErrorEncoded extends DescribedEncoded<IAmqpList> {
+
+        public AmqpLinkErrorEncoded(DescribedBuffer buffer) {
+            super(buffer);
+        }
+
+        public AmqpLinkErrorEncoded(AmqpLinkError value) {
+            super(AmqpListMarshaller.encode(value));
+        }
+
+        protected final String getSymbolicId() {
+            return SYMBOLIC_ID;
+        }
+
+        protected final long getNumericId() {
+            return NUMERIC_ID;
+        }
+
+        protected final Encoded<IAmqpList> decodeDescribed(EncodedBuffer encoded) throws AmqpEncodingError {
+            return AmqpListMarshaller.createEncoded(encoded, DECODER);
+        }
+
+        protected final Encoded<IAmqpList> unmarshalDescribed(DataInput in) throws IOException {
+            return AmqpListMarshaller.createEncoded(in, DECODER);
+        }
+
+        protected final EncodedBuffer getDescriptor() {
+            return DESCRIPTOR;
+        }
+    }
+
+    public static final Encoded<IAmqpList> encode(AmqpLinkError value) throws AmqpEncodingError {
+        return new AmqpLinkErrorEncoded(value);
+    }
+
+    static final Encoded<IAmqpList> createEncoded(Buffer source, int offset) throws AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(source, offset));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(DataInput in) throws IOException, AmqpEncodingError {
+        return createEncoded(FormatCategory.createBuffer(in.readByte(), in));
+    }
+
+    static final Encoded<IAmqpList> createEncoded(EncodedBuffer buffer) throws AmqpEncodingError {
+        byte fc = buffer.getEncodingFormatCode();
+        if (fc == Encoder.NULL_FORMAT_CODE) {
+            return NULL_ENCODED;
+        }
+
+        DescribedBuffer db = buffer.asDescribed();
+        AmqpType<?, ?> descriptor = AmqpMarshaller.SINGLETON.decodeType(db.getDescriptorBuffer());
+        if(!(descriptor instanceof AmqpUlong && ((AmqpUlong)descriptor).getValue().longValue() == NUMERIC_ID ||
+               descriptor instanceof AmqpSymbol && ((AmqpSymbol)descriptor).getValue().equals(SYMBOLIC_ID))) {
+            throw new UnexpectedTypeException("descriptor mismatch: " + descriptor);
+        }
+        return new AmqpLinkErrorEncoded(db);
+    }
+
+    public final AmqpLinkError.AmqpLinkErrorBuffer decodeDescribedType(AmqpType<?, ?> descriptor, DescribedBuffer encoded) throws AmqpEncodingError {
+        return AmqpLinkError.AmqpLinkErrorBuffer.create(new AmqpLinkErrorEncoded(encoded));
+    }
+}



Mime
View raw message