You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2012/12/12 14:33:07 UTC

svn commit: r1420665 [4/7] - in /qpid/proton/trunk/proton-j: contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/api/ contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/ proton/src/main/java/org/apache/qpid/proton/amq...

Copied: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/AMQPDefinedTypes.java (from r1418272, qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/AMQPDefinedTypes.java)
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/AMQPDefinedTypes.java?p2=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/AMQPDefinedTypes.java&p1=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/AMQPDefinedTypes.java&r1=1418272&r2=1420665&rev=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/AMQPDefinedTypes.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/AMQPDefinedTypes.java Wed Dec 12 13:32:32 2012
@@ -21,75 +21,89 @@
 */
 
 
-package org.apache.qpid.proton.type;
+package org.apache.qpid.proton.codec;
 
+import org.apache.qpid.proton.amqp.transport.Attach;
+import org.apache.qpid.proton.amqp.transport.Begin;
+import org.apache.qpid.proton.amqp.transport.Close;
+import org.apache.qpid.proton.amqp.transport.Detach;
+import org.apache.qpid.proton.amqp.transport.Disposition;
+import org.apache.qpid.proton.amqp.transport.End;
+import org.apache.qpid.proton.amqp.transport.Flow;
+import org.apache.qpid.proton.amqp.transport.Open;
+import org.apache.qpid.proton.amqp.transport.Transfer;
 import org.apache.qpid.proton.codec.Decoder;
+import org.apache.qpid.proton.codec.EncoderImpl;
+import org.apache.qpid.proton.codec.messaging.*;
+import org.apache.qpid.proton.codec.security.*;
+import org.apache.qpid.proton.codec.transaction.*;
+import org.apache.qpid.proton.codec.transport.*;
 
 public class AMQPDefinedTypes
 {
-    public static void registerAllTypes(Decoder decoder)
+    public static void registerAllTypes(Decoder decoder, EncoderImpl encoder)
     {
-        registerTransportTypes(decoder);
-        registerMessagingTypes(decoder);
-        registerTransactionTypes(decoder);
-        registerSecurityTypes(decoder);
+        registerTransportTypes(decoder, encoder);
+        registerMessagingTypes(decoder, encoder);
+        registerTransactionTypes(decoder, encoder);
+        registerSecurityTypes(decoder, encoder);
     }
 
 
-    public static void registerTransportTypes(Decoder decoder)
+    public static void registerTransportTypes(Decoder decoder, EncoderImpl encoder)
     {
-        org.apache.qpid.proton.type.transport.Open.register( decoder );
-        org.apache.qpid.proton.type.transport.Begin.register( decoder );
-        org.apache.qpid.proton.type.transport.Attach.register( decoder );
-        org.apache.qpid.proton.type.transport.Flow.register( decoder );
-        org.apache.qpid.proton.type.transport.Transfer.register( decoder );
-        org.apache.qpid.proton.type.transport.Disposition.register( decoder );
-        org.apache.qpid.proton.type.transport.Detach.register( decoder );
-        org.apache.qpid.proton.type.transport.End.register( decoder );
-        org.apache.qpid.proton.type.transport.Close.register( decoder );
-        org.apache.qpid.proton.type.transport.Error.register( decoder );
+        OpenType.register(decoder, encoder);
+        BeginType.register(decoder, encoder);
+        AttachType.register(decoder, encoder);
+        FlowType.register(decoder, encoder);
+        TransferType.register(decoder, encoder);
+        DispositionType.register(decoder, encoder);
+        DetachType.register(decoder, encoder);
+        EndType.register(decoder, encoder);
+        CloseType.register(decoder, encoder);
+        ErrorConditionType.register(decoder, encoder);
     }
 
-    public static void registerMessagingTypes(Decoder decoder)
+    public static void registerMessagingTypes(Decoder decoder, EncoderImpl encoder)
     {
-        org.apache.qpid.proton.type.messaging.Header.register( decoder );
-        org.apache.qpid.proton.type.messaging.DeliveryAnnotations.register( decoder );
-        org.apache.qpid.proton.type.messaging.MessageAnnotations.register( decoder );
-        org.apache.qpid.proton.type.messaging.Properties.register( decoder );
-        org.apache.qpid.proton.type.messaging.ApplicationProperties.register( decoder );
-        org.apache.qpid.proton.type.messaging.Data.register( decoder );
-        org.apache.qpid.proton.type.messaging.AmqpSequence.register( decoder );
-        org.apache.qpid.proton.type.messaging.AmqpValue.register( decoder );
-        org.apache.qpid.proton.type.messaging.Footer.register( decoder );
-        org.apache.qpid.proton.type.messaging.Received.register( decoder );
-        org.apache.qpid.proton.type.messaging.Accepted.register( decoder );
-        org.apache.qpid.proton.type.messaging.Rejected.register( decoder );
-        org.apache.qpid.proton.type.messaging.Released.register( decoder );
-        org.apache.qpid.proton.type.messaging.Modified.register( decoder );
-        org.apache.qpid.proton.type.messaging.Source.register( decoder );
-        org.apache.qpid.proton.type.messaging.Target.register( decoder );
-        org.apache.qpid.proton.type.messaging.DeleteOnClose.register( decoder );
-        org.apache.qpid.proton.type.messaging.DeleteOnNoLinks.register( decoder );
-        org.apache.qpid.proton.type.messaging.DeleteOnNoMessages.register( decoder );
-        org.apache.qpid.proton.type.messaging.DeleteOnNoLinksOrMessages.register( decoder );
+        HeaderType.register(decoder, encoder);
+        DeliveryAnnotationsType.register(decoder, encoder);
+        MessageAnnotationsType.register(decoder, encoder);
+        PropertiesType.register( decoder, encoder );
+        ApplicationPropertiesType.register(decoder, encoder);
+        DataType.register(decoder, encoder);
+        AmqpSequenceType.register(decoder, encoder);
+        AmqpValueType.register(decoder, encoder);
+        FooterType.register(decoder, encoder);
+        ReceivedType.register(decoder, encoder);
+        AcceptedType.register(decoder , encoder);
+        RejectedType.register(decoder, encoder);
+        ReleasedType.register(decoder, encoder);
+        ModifiedType.register(decoder, encoder);
+        SourceType.register(decoder, encoder);
+        TargetType.register(decoder, encoder);
+        DeleteOnCloseType.register(decoder, encoder);
+        DeleteOnNoLinksType.register(decoder, encoder);
+        DeleteOnNoMessagesType.register(decoder, encoder);
+        DeleteOnNoLinksOrMessagesType.register(decoder, encoder);
     }
 
-    public static void registerTransactionTypes(Decoder decoder)
+    public static void registerTransactionTypes(Decoder decoder, EncoderImpl encoder)
     {
-        org.apache.qpid.proton.type.transaction.Coordinator.register( decoder );
-        org.apache.qpid.proton.type.transaction.Declare.register( decoder );
-        org.apache.qpid.proton.type.transaction.Discharge.register( decoder );
-        org.apache.qpid.proton.type.transaction.Declared.register( decoder );
-        org.apache.qpid.proton.type.transaction.TransactionalState.register( decoder );
+        CoordinatorType.register(decoder, encoder);
+        DeclareType.register(decoder, encoder);
+        DischargeType.register(decoder, encoder);
+        DeclaredType.register(decoder, encoder);
+        TransactionalStateType.register(decoder, encoder);
     }
 
-    public static void registerSecurityTypes(Decoder decoder)
+    public static void registerSecurityTypes(Decoder decoder, EncoderImpl encoder)
     {
-        org.apache.qpid.proton.type.security.SaslMechanisms.register( decoder );
-        org.apache.qpid.proton.type.security.SaslInit.register( decoder );
-        org.apache.qpid.proton.type.security.SaslChallenge.register( decoder );
-        org.apache.qpid.proton.type.security.SaslResponse.register( decoder );
-        org.apache.qpid.proton.type.security.SaslOutcome.register( decoder );
+        SaslMechanismsType.register(decoder, encoder);
+        SaslInitType.register(decoder, encoder);
+        SaslChallengeType.register(decoder, encoder);
+        SaslResponseType.register(decoder, encoder);
+        SaslOutcomeType.register(decoder, encoder);
     }
 
 }

Added: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/AbstractDescribedType.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/AbstractDescribedType.java?rev=1420665&view=auto
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/AbstractDescribedType.java (added)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/AbstractDescribedType.java Wed Dec 12 13:32:32 2012
@@ -0,0 +1,141 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this 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.qpid.proton.codec;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+
+abstract public class AbstractDescribedType<T,M> implements AMQPType<T>
+{
+
+    private final EncoderImpl _encoder;
+    private final Map<TypeEncoding<M>, TypeEncoding<T>> _encodings = new HashMap<TypeEncoding<M>, TypeEncoding<T>>();
+
+    public AbstractDescribedType(EncoderImpl encoder)
+    {
+        _encoder = encoder;
+    }
+
+    abstract protected UnsignedLong getDescriptor();
+
+
+    public TypeEncoding<T> getEncoding(final T val)
+    {
+        M asUnderlying = wrap(val);
+        TypeEncoding<M> underlyingEncoding = _encoder.getType(asUnderlying).getEncoding(asUnderlying);
+        TypeEncoding<T> encoding = _encodings.get(underlyingEncoding);
+        if(encoding == null)
+        {
+            encoding = new DynamicDescribedTypeEncoding(underlyingEncoding);
+            _encodings.put(underlyingEncoding, encoding);
+        }
+
+        return encoding;
+    }
+
+    abstract protected M wrap(T val);
+
+    public TypeEncoding<T> getCanonicalEncoding()
+    {
+        return null;
+    }
+
+    public Collection<TypeEncoding<T>> getAllEncodings()
+    {
+        Collection values = _encodings.values();
+        Collection unmodifiable = Collections.unmodifiableCollection(values);
+        return (Collection<TypeEncoding<T>>) unmodifiable;
+    }
+
+    public void write(final T val)
+    {
+        TypeEncoding<T> encoding = getEncoding(val);
+        encoding.writeConstructor();
+        encoding.writeValue(val);
+    }
+
+    private class DynamicDescribedTypeEncoding implements TypeEncoding<T>
+    {
+        private final TypeEncoding<M> _underlyingEncoding;
+        private final TypeEncoding<UnsignedLong> _descriptorType;
+        private final int _constructorSize;
+
+
+        public DynamicDescribedTypeEncoding(final TypeEncoding<M> underlyingEncoding)
+        {
+            _underlyingEncoding = underlyingEncoding;
+            _descriptorType = _encoder.getType(getDescriptor()).getEncoding(getDescriptor());
+            _constructorSize = 1 + _descriptorType.getConstructorSize()
+                               + _descriptorType.getValueSize(getDescriptor())
+                               + _underlyingEncoding.getConstructorSize();
+        }
+
+        public AMQPType<T> getType()
+        {
+            return AbstractDescribedType.this;
+        }
+
+        public void writeConstructor()
+        {
+            _encoder.writeRaw(EncodingCodes.DESCRIBED_TYPE_INDICATOR);
+            _descriptorType.writeConstructor();
+            _descriptorType.writeValue(getDescriptor());
+            _underlyingEncoding.writeConstructor();
+        }
+
+        public int getConstructorSize()
+        {
+            return _constructorSize;
+        }
+
+        public void writeValue(final T val)
+        {
+            _underlyingEncoding.writeValue(wrap(val));
+        }
+
+        public int getValueSize(final T val)
+        {
+            return _underlyingEncoding.getValueSize(wrap(val));
+        }
+
+        public boolean isFixedSizeVal()
+        {
+            return _underlyingEncoding.isFixedSizeVal();
+        }
+
+        public boolean encodesSuperset(final TypeEncoding<T> encoding)
+        {
+            return (getType() == encoding.getType())
+                   && (_underlyingEncoding.encodesSuperset(((DynamicDescribedTypeEncoding)encoding)
+                                                                   ._underlyingEncoding));
+        }
+
+        @Override
+        public boolean encodesJavaPrimitive()
+        {
+            return false;
+        }
+
+    }
+}

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/BinaryType.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/BinaryType.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/BinaryType.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/BinaryType.java Wed Dec 12 13:32:32 2012
@@ -20,7 +20,7 @@
  */
 package org.apache.qpid.proton.codec;
 
-import org.apache.qpid.proton.type.Binary;
+import org.apache.qpid.proton.amqp.Binary;
 
 import java.util.Arrays;
 import java.util.Collection;

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Data.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Data.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Data.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Data.java Wed Dec 12 13:32:32 2012
@@ -20,12 +20,12 @@
  */
 package org.apache.qpid.proton.codec;
 
-import org.apache.qpid.proton.type.Binary;
-import org.apache.qpid.proton.type.Symbol;
-import org.apache.qpid.proton.type.UnsignedByte;
-import org.apache.qpid.proton.type.UnsignedInteger;
-import org.apache.qpid.proton.type.UnsignedLong;
-import org.apache.qpid.proton.type.UnsignedShort;
+import org.apache.qpid.proton.amqp.Binary;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedByte;
+import org.apache.qpid.proton.amqp.UnsignedInteger;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.UnsignedShort;
 
 public interface Data
 {

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Decimal128Type.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Decimal128Type.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Decimal128Type.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Decimal128Type.java Wed Dec 12 13:32:32 2012
@@ -20,7 +20,7 @@
  */
 package org.apache.qpid.proton.codec;
 
-import org.apache.qpid.proton.type.Decimal128;
+import org.apache.qpid.proton.amqp.Decimal128;
 
 import java.util.Collection;
 import java.util.Collections;

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Decimal32Type.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Decimal32Type.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Decimal32Type.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Decimal32Type.java Wed Dec 12 13:32:32 2012
@@ -20,7 +20,7 @@
  */
 package org.apache.qpid.proton.codec;
 
-import org.apache.qpid.proton.type.Decimal32;
+import org.apache.qpid.proton.amqp.Decimal32;
 
 import java.util.Collection;
 import java.util.Collections;

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Decimal64Type.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Decimal64Type.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Decimal64Type.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Decimal64Type.java Wed Dec 12 13:32:32 2012
@@ -20,7 +20,7 @@
  */
 package org.apache.qpid.proton.codec;
 
-import org.apache.qpid.proton.type.Decimal64;
+import org.apache.qpid.proton.amqp.Decimal64;
 
 import java.util.Collection;
 import java.util.Collections;

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Decoder.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Decoder.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Decoder.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Decoder.java Wed Dec 12 13:32:32 2012
@@ -20,7 +20,15 @@
  */
 package org.apache.qpid.proton.codec;
 
-import org.apache.qpid.proton.type.*;
+import org.apache.qpid.proton.amqp.Binary;
+import org.apache.qpid.proton.amqp.Decimal128;
+import org.apache.qpid.proton.amqp.Decimal32;
+import org.apache.qpid.proton.amqp.Decimal64;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedByte;
+import org.apache.qpid.proton.amqp.UnsignedInteger;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.UnsignedShort;
 
 import java.util.Date;
 import java.util.List;

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/DecoderImpl.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/DecoderImpl.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/DecoderImpl.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/DecoderImpl.java Wed Dec 12 13:32:32 2012
@@ -20,7 +20,16 @@
  */
 package org.apache.qpid.proton.codec;
 
-import org.apache.qpid.proton.type.*;
+import org.apache.qpid.proton.amqp.Binary;
+import org.apache.qpid.proton.amqp.Decimal128;
+import org.apache.qpid.proton.amqp.Decimal32;
+import org.apache.qpid.proton.amqp.Decimal64;
+import org.apache.qpid.proton.amqp.DescribedType;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedByte;
+import org.apache.qpid.proton.amqp.UnsignedInteger;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.UnsignedShort;
 
 import java.lang.reflect.Array;
 import java.nio.ByteBuffer;

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/DescribedTypeConstructor.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/DescribedTypeConstructor.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/DescribedTypeConstructor.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/DescribedTypeConstructor.java Wed Dec 12 13:32:32 2012
@@ -20,9 +20,7 @@
  */
 package org.apache.qpid.proton.codec;
 
-import org.apache.qpid.proton.type.DescribedType;
-
-public interface DescribedTypeConstructor<V extends DescribedType>
+public interface DescribedTypeConstructor<V>
 {
     V newInstance(Object described);
 

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/DynamicDescribedType.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/DynamicDescribedType.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/DynamicDescribedType.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/DynamicDescribedType.java Wed Dec 12 13:32:32 2012
@@ -20,7 +20,7 @@
  */
 package org.apache.qpid.proton.codec;
 
-import org.apache.qpid.proton.type.DescribedType;
+import org.apache.qpid.proton.amqp.DescribedType;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -119,7 +119,7 @@ public class DynamicDescribedType implem
 
         public int getValueSize(final Object val)
         {
-            return _underlyingEncoding.getValueSize(((DescribedType)val).getDescribed());
+            return _underlyingEncoding.getValueSize(((DescribedType) val).getDescribed());
         }
 
         public boolean isFixedSizeVal()
@@ -134,19 +134,11 @@ public class DynamicDescribedType implem
                                                                    ._underlyingEncoding));
         }
 
-        public Object readValue()
-        {
-            return _underlyingEncoding.readValue();
-        }
-
+        @Override
         public boolean encodesJavaPrimitive()
         {
             return false;
         }
 
-        public Class getTypeClass()
-        {
-            return _underlyingEncoding.getTypeClass();
-        }
     }
 }

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Encoder.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Encoder.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Encoder.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/Encoder.java Wed Dec 12 13:32:32 2012
@@ -20,7 +20,16 @@
  */
 package org.apache.qpid.proton.codec;
 
-import org.apache.qpid.proton.type.*;
+import org.apache.qpid.proton.amqp.Binary;
+import org.apache.qpid.proton.amqp.Decimal128;
+import org.apache.qpid.proton.amqp.Decimal32;
+import org.apache.qpid.proton.amqp.Decimal64;
+import org.apache.qpid.proton.amqp.DescribedType;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedByte;
+import org.apache.qpid.proton.amqp.UnsignedInteger;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.UnsignedShort;
 
 import java.util.Date;
 import java.util.List;
@@ -106,4 +115,7 @@ public interface Encoder
 
     void writeObject(Object o);
 
+    <V> void register(AMQPType<V> type);
+
+    AMQPType getType(Object element);
 }

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/EncoderImpl.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/EncoderImpl.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/EncoderImpl.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/EncoderImpl.java Wed Dec 12 13:32:32 2012
@@ -20,11 +20,19 @@
  */
 package org.apache.qpid.proton.codec;
 
-import java.awt.*;
 import java.nio.ByteBuffer;
 import java.util.*;
 import java.util.List;
-import org.apache.qpid.proton.type.*;
+import org.apache.qpid.proton.amqp.Binary;
+import org.apache.qpid.proton.amqp.Decimal128;
+import org.apache.qpid.proton.amqp.Decimal32;
+import org.apache.qpid.proton.amqp.Decimal64;
+import org.apache.qpid.proton.amqp.DescribedType;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedByte;
+import org.apache.qpid.proton.amqp.UnsignedInteger;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.UnsignedShort;
 
 public final class EncoderImpl implements ByteBufferEncoder
 {
@@ -132,6 +140,7 @@ public final class EncoderImpl implement
     }
 
 
+    @Override
     public AMQPType getType(final Object element)
     {
         if(element instanceof DescribedType)
@@ -184,6 +193,12 @@ public final class EncoderImpl implement
         return amqpType;
     }
 
+    @Override
+    public <V> void register(AMQPType<V> type)
+    {
+        register(type.getTypeClass(), type);
+    }
+
     <T> void register(Class<T> clazz, AMQPType<T> type)
     {
         _typeRegistry.put(clazz, type);
@@ -719,7 +734,7 @@ public final class EncoderImpl implement
         }
     }
 
-    void writeRaw(final byte b)
+    public void writeRaw(final byte b)
     {
         _buffer.put(b);
     }

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/EncodingCodes.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/EncodingCodes.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/EncodingCodes.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/EncodingCodes.java Wed Dec 12 13:32:32 2012
@@ -20,7 +20,7 @@
  */
 package org.apache.qpid.proton.codec;
 
-interface EncodingCodes
+public interface EncodingCodes
 {
     public static final byte DESCRIBED_TYPE_INDICATOR = (byte) 0x00;
 

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/PrimitiveTypeEncoding.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/PrimitiveTypeEncoding.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/PrimitiveTypeEncoding.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/PrimitiveTypeEncoding.java Wed Dec 12 13:32:32 2012
@@ -20,7 +20,7 @@
  */
 package org.apache.qpid.proton.codec;
 
-public interface PrimitiveTypeEncoding<T> extends TypeEncoding<T>
+public interface PrimitiveTypeEncoding<T> extends TypeEncoding<T>, TypeConstructor<T>
 {
     PrimitiveType<T> getType();
 

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/SymbolType.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/SymbolType.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/SymbolType.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/SymbolType.java Wed Dec 12 13:32:32 2012
@@ -20,7 +20,7 @@
  */
 package org.apache.qpid.proton.codec;
 
-import org.apache.qpid.proton.type.Symbol;
+import org.apache.qpid.proton.amqp.Symbol;
 
 import java.nio.ByteBuffer;
 import java.nio.charset.Charset;

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/TypeEncoding.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/TypeEncoding.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/TypeEncoding.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/TypeEncoding.java Wed Dec 12 13:32:32 2012
@@ -20,7 +20,7 @@
  */
 package org.apache.qpid.proton.codec;
 
-public interface TypeEncoding<V> extends TypeConstructor<V>
+public interface TypeEncoding<V>
 {
     AMQPType<V> getType();
 

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/UnsignedByteType.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/UnsignedByteType.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/UnsignedByteType.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/UnsignedByteType.java Wed Dec 12 13:32:32 2012
@@ -20,7 +20,7 @@
  */
 package org.apache.qpid.proton.codec;
 
-import org.apache.qpid.proton.type.UnsignedByte;
+import org.apache.qpid.proton.amqp.UnsignedByte;
 
 import java.util.Collection;
 import java.util.Collections;

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/UnsignedIntegerType.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/UnsignedIntegerType.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/UnsignedIntegerType.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/UnsignedIntegerType.java Wed Dec 12 13:32:32 2012
@@ -20,7 +20,7 @@
  */
 package org.apache.qpid.proton.codec;
 
-import org.apache.qpid.proton.type.UnsignedInteger;
+import org.apache.qpid.proton.amqp.UnsignedInteger;
 
 import java.util.Arrays;
 import java.util.Collection;

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/UnsignedLongType.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/UnsignedLongType.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/UnsignedLongType.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/UnsignedLongType.java Wed Dec 12 13:32:32 2012
@@ -20,7 +20,7 @@
  */
 package org.apache.qpid.proton.codec;
 
-import org.apache.qpid.proton.type.UnsignedLong;
+import org.apache.qpid.proton.amqp.UnsignedLong;
 
 import java.util.Arrays;
 import java.util.Collection;

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/UnsignedShortType.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/UnsignedShortType.java?rev=1420665&r1=1420664&r2=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/UnsignedShortType.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/UnsignedShortType.java Wed Dec 12 13:32:32 2012
@@ -20,7 +20,7 @@
  */
 package org.apache.qpid.proton.codec;
 
-import org.apache.qpid.proton.type.UnsignedShort;
+import org.apache.qpid.proton.amqp.UnsignedShort;
 
 import java.util.Collection;
 import java.util.Collections;

Added: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/AcceptedType.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/AcceptedType.java?rev=1420665&view=auto
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/AcceptedType.java (added)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/AcceptedType.java Wed Dec 12 13:32:32 2012
@@ -0,0 +1,81 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this 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.qpid.proton.codec.messaging;
+
+import java.util.Collections;
+import java.util.List;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.messaging.Accepted;
+import org.apache.qpid.proton.codec.AbstractDescribedType;
+import org.apache.qpid.proton.codec.Decoder;
+import org.apache.qpid.proton.codec.DescribedTypeConstructor;
+import org.apache.qpid.proton.codec.EncoderImpl;
+
+public final class AcceptedType extends AbstractDescribedType<Accepted,List> implements DescribedTypeConstructor<Accepted>
+{
+
+    private static final Object[] DESCRIPTORS =
+    {
+        UnsignedLong.valueOf(0x0000000000000024L), Symbol.valueOf("amqp:accepted:list"),
+    };
+
+    private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000024L);
+
+
+    private AcceptedType(EncoderImpl encoder)
+    {
+        super(encoder);
+    }
+
+    @Override
+    protected UnsignedLong getDescriptor()
+    {
+        return DESCRIPTOR;
+    }
+
+    @Override
+    protected List wrap(Accepted val)
+    {
+        return Collections.EMPTY_LIST;
+    }
+
+    @Override
+    public Class<Accepted> getTypeClass()
+    {
+        return Accepted.class;
+    }
+
+    public Accepted newInstance(Object described)
+    {
+        return Accepted.getInstance();
+    }
+
+    public static void register(Decoder decoder, EncoderImpl encoder)
+    {
+        AcceptedType type = new AcceptedType(encoder);
+        for(Object descriptor : DESCRIPTORS)
+        {
+            decoder.register(descriptor, type);
+        }
+        encoder.register(type);
+    }
+}

Copied: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpSequenceType.java (from r1418272, qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/AmqpSequence.java)
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpSequenceType.java?p2=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpSequenceType.java&p1=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/AmqpSequence.java&r1=1418272&r2=1420665&rev=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/AmqpSequence.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpSequenceType.java Wed Dec 12 13:32:32 2012
@@ -21,67 +21,63 @@
 */
 
 
-package org.apache.qpid.proton.type.messaging;
-import java.util.List;
-
+package org.apache.qpid.proton.codec.messaging;
 
+import java.util.List;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.messaging.AmqpSequence;
+import org.apache.qpid.proton.codec.AbstractDescribedType;
 import org.apache.qpid.proton.codec.Decoder;
 import org.apache.qpid.proton.codec.DescribedTypeConstructor;
-import org.apache.qpid.proton.type.*;
+import org.apache.qpid.proton.codec.EncoderImpl;
 
 
-public class AmqpSequence
-      implements DescribedType , Section
+public class AmqpSequenceType extends AbstractDescribedType<AmqpSequence,List> implements DescribedTypeConstructor<AmqpSequence>
 {
     private static final Object[] DESCRIPTORS =
     {
-        UnsignedLong.valueOf(0x0000000000000076L), Symbol.valueOf("amqp:amqp-sequence:list"), 
+        UnsignedLong.valueOf(0x0000000000000076L), Symbol.valueOf("amqp:amqp-sequence:list"),
     };
 
     private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000076L);
-    private final List _value;
 
-    public AmqpSequence(List value)
+    private AmqpSequenceType(EncoderImpl encoder)
     {
-        _value = value;
+        super(encoder);
     }
 
-    public List getValue()
+    public UnsignedLong getDescriptor()
     {
-        return _value;
+        return DESCRIPTOR;
     }
 
-    public Object getDescriptor()
+    @Override
+    protected List wrap(AmqpSequence val)
     {
-        return DESCRIPTOR;
+        return val.getValue();
     }
 
-    public Object getDescribed()
+    public AmqpSequence newInstance(Object described)
     {
-        return _value;
+        return new AmqpSequence( (List) described );
     }
 
-    private static class AmqpSequenceConstructor implements DescribedTypeConstructor<AmqpSequence>
+    public Class<AmqpSequence> getTypeClass()
     {
-        public AmqpSequence newInstance(Object described)
-        {
-            return new AmqpSequence( (List) described );
-        }
-
-        public Class<AmqpSequence> getTypeClass()
-        {
-            return AmqpSequence.class;
-        }
+        return AmqpSequence.class;
     }
+
       
 
-    public static void register(Decoder decoder)
+    public static void register(Decoder decoder, EncoderImpl encoder)
     {
-        AmqpSequenceConstructor constructor = new AmqpSequenceConstructor();
+        AmqpSequenceType type = new AmqpSequenceType(encoder);
         for(Object descriptor : DESCRIPTORS)
         {
-            decoder.register(descriptor, constructor);
+            decoder.register(descriptor, type);
         }
+        encoder.register(type);
     }
 }
   
\ No newline at end of file

Copied: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpValueType.java (from r1418272, qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/AmqpValue.java)
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpValueType.java?p2=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpValueType.java&p1=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/AmqpValue.java&r1=1418272&r2=1420665&rev=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/AmqpValue.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpValueType.java Wed Dec 12 13:32:32 2012
@@ -21,66 +21,63 @@
 */
 
 
-package org.apache.qpid.proton.type.messaging;
+package org.apache.qpid.proton.codec.messaging;
 
 
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.messaging.AmqpValue;
+import org.apache.qpid.proton.codec.AbstractDescribedType;
 import org.apache.qpid.proton.codec.Decoder;
 import org.apache.qpid.proton.codec.DescribedTypeConstructor;
-import org.apache.qpid.proton.type.*;
+import org.apache.qpid.proton.codec.EncoderImpl;
 
 
-public class AmqpValue
-      implements DescribedType , Section
+public class AmqpValueType extends AbstractDescribedType<AmqpValue,Object> implements DescribedTypeConstructor<AmqpValue>
 {
     private static final Object[] DESCRIPTORS =
     {
-        UnsignedLong.valueOf(0x0000000000000077L), Symbol.valueOf("amqp:amqp-value:*"), 
+        UnsignedLong.valueOf(0x0000000000000077L), Symbol.valueOf("amqp:amqp-value:*"),
     };
 
     private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000077L);
-    private final Object _value;
 
-    public AmqpValue(Object value)
+    private AmqpValueType(EncoderImpl encoder)
     {
-        _value = value;
+        super(encoder);
     }
 
-    public Object getValue()
+    public UnsignedLong getDescriptor()
     {
-        return _value;
+        return DESCRIPTOR;
     }
 
-    public Object getDescriptor()
+    @Override
+    protected Object wrap(AmqpValue val)
     {
-        return DESCRIPTOR;
+        return val.getValue();
     }
 
-    public Object getDescribed()
+    public AmqpValue newInstance(Object described)
     {
-        return _value;
+        return new AmqpValue( described );
     }
 
-    private static class AmqpValueConstructor implements DescribedTypeConstructor<AmqpValue>
+    public Class<AmqpValue> getTypeClass()
     {
-        public AmqpValue newInstance(Object described)
-        {
-            return new AmqpValue( (Object) described );
-        }
-
-        public Class<AmqpValue> getTypeClass()
-        {
-            return AmqpValue.class;
-        }
+        return AmqpValue.class;
     }
+
       
 
-    public static void register(Decoder decoder)
+    public static void register(Decoder decoder, EncoderImpl encoder)
     {
-        AmqpValueConstructor constructor = new AmqpValueConstructor();
+        AmqpValueType type = new AmqpValueType(encoder);
         for(Object descriptor : DESCRIPTORS)
         {
-            decoder.register(descriptor, constructor);
+            decoder.register(descriptor, type);
         }
+        encoder.register(type);
     }
 }
   
\ No newline at end of file

Copied: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/ApplicationPropertiesType.java (from r1418272, qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/ApplicationProperties.java)
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/ApplicationPropertiesType.java?p2=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/ApplicationPropertiesType.java&p1=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/ApplicationProperties.java&r1=1418272&r2=1420665&rev=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/ApplicationProperties.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/ApplicationPropertiesType.java Wed Dec 12 13:32:32 2012
@@ -21,67 +21,64 @@
 */
 
 
-package org.apache.qpid.proton.type.messaging;
-import java.util.Map;
-
+package org.apache.qpid.proton.codec.messaging;
 
+import java.util.Map;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.messaging.ApplicationProperties;
+import org.apache.qpid.proton.codec.AbstractDescribedType;
 import org.apache.qpid.proton.codec.Decoder;
 import org.apache.qpid.proton.codec.DescribedTypeConstructor;
-import org.apache.qpid.proton.type.*;
+import org.apache.qpid.proton.codec.EncoderImpl;
 
 
-public class ApplicationProperties
-      implements DescribedType , Section
+public class ApplicationPropertiesType  extends AbstractDescribedType<ApplicationProperties,Map> implements DescribedTypeConstructor<ApplicationProperties>
 {
     private static final Object[] DESCRIPTORS =
     {
-        UnsignedLong.valueOf(0x0000000000000074L), Symbol.valueOf("amqp:application-properties:map"), 
+        UnsignedLong.valueOf(0x0000000000000074L), Symbol.valueOf("amqp:application-properties:map"),
     };
 
     private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000074L);
-    private final Map _value;
 
-    public ApplicationProperties(Map value)
+    public ApplicationPropertiesType(EncoderImpl encoder)
     {
-        _value = value;
+        super(encoder);
     }
 
-    public Map getValue()
+    public UnsignedLong getDescriptor()
     {
-        return _value;
+        return DESCRIPTOR;
     }
 
-    public Object getDescriptor()
+    @Override
+    protected Map wrap(ApplicationProperties val)
     {
-        return DESCRIPTOR;
+        return val.getValue();
     }
 
-    public Object getDescribed()
+
+    public ApplicationProperties newInstance(Object described)
     {
-        return _value;
+        return new ApplicationProperties( (Map) described );
     }
 
-    private static class ApplicationPropertiesConstructor implements DescribedTypeConstructor<ApplicationProperties>
+    public Class<ApplicationProperties> getTypeClass()
     {
-        public ApplicationProperties newInstance(Object described)
-        {
-            return new ApplicationProperties( (Map) described );
-        }
-
-        public Class<ApplicationProperties> getTypeClass()
-        {
-            return ApplicationProperties.class;
-        }
+        return ApplicationProperties.class;
     }
+
       
 
-    public static void register(Decoder decoder)
+    public static void register(Decoder decoder, EncoderImpl encoder)
     {
-        ApplicationPropertiesConstructor constructor = new ApplicationPropertiesConstructor();
+        ApplicationPropertiesType type = new ApplicationPropertiesType(encoder);
         for(Object descriptor : DESCRIPTORS)
         {
-            decoder.register(descriptor, constructor);
+            decoder.register(descriptor, type);
         }
+        encoder.register(type);
     }
 }
   
\ No newline at end of file

Copied: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DataType.java (from r1418272, qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/Data.java)
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DataType.java?p2=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DataType.java&p1=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/Data.java&r1=1418272&r2=1420665&rev=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/Data.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DataType.java Wed Dec 12 13:32:32 2012
@@ -21,66 +21,64 @@
 */
 
 
-package org.apache.qpid.proton.type.messaging;
+package org.apache.qpid.proton.codec.messaging;
 
 
+import org.apache.qpid.proton.amqp.Binary;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.messaging.Data;
+import org.apache.qpid.proton.codec.AbstractDescribedType;
 import org.apache.qpid.proton.codec.Decoder;
 import org.apache.qpid.proton.codec.DescribedTypeConstructor;
-import org.apache.qpid.proton.type.*;
+import org.apache.qpid.proton.codec.EncoderImpl;
 
 
-public class Data
-      implements DescribedType , Section
+public class DataType extends AbstractDescribedType<Data,Binary> implements DescribedTypeConstructor<Data>
 {
     private static final Object[] DESCRIPTORS =
     {
-        UnsignedLong.valueOf(0x0000000000000075L), Symbol.valueOf("amqp:data:binary"), 
+        UnsignedLong.valueOf(0x0000000000000075L), Symbol.valueOf("amqp:data:binary"),
     };
 
     private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000075L);
-    private final Binary _value;
 
-    public Data(Binary value)
+    private DataType(EncoderImpl encoder)
     {
-        _value = value;
+        super(encoder);
     }
 
-    public Binary getValue()
+    public UnsignedLong getDescriptor()
     {
-        return _value;
+        return DESCRIPTOR;
     }
 
-    public Object getDescriptor()
+    @Override
+    protected Binary wrap(Data val)
     {
-        return DESCRIPTOR;
+        return val.getValue();
     }
 
-    public Object getDescribed()
+    public Data newInstance(Object described)
     {
-        return _value;
+        return new Data( (Binary) described );
     }
 
-    private static class DataConstructor implements DescribedTypeConstructor<Data>
+    public Class<Data> getTypeClass()
     {
-        public Data newInstance(Object described)
-        {
-            return new Data( (Binary) described );
-        }
-
-        public Class<Data> getTypeClass()
-        {
-            return Data.class;
-        }
+        return Data.class;
     }
+
       
 
-    public static void register(Decoder decoder)
+    public static void register(Decoder decoder, EncoderImpl encoder)
     {
-        DataConstructor constructor = new DataConstructor();
+        DataType type = new DataType(encoder);
         for(Object descriptor : DESCRIPTORS)
         {
-            decoder.register(descriptor, constructor);
+            decoder.register(descriptor, type);
         }
+        encoder.register(type);
     }
 }
   
\ No newline at end of file

Copied: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnCloseType.java (from r1418272, qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/DeleteOnClose.java)
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnCloseType.java?p2=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnCloseType.java&p1=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/DeleteOnClose.java&r1=1418272&r2=1420665&rev=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/DeleteOnClose.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnCloseType.java Wed Dec 12 13:32:32 2012
@@ -21,94 +21,64 @@
 */
 
 
-package org.apache.qpid.proton.type.messaging;
-import java.util.List;
-import java.util.AbstractList;
-
+package org.apache.qpid.proton.codec.messaging;
 
+import java.util.Collections;
+import java.util.List;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.messaging.DeleteOnClose;
+import org.apache.qpid.proton.codec.AbstractDescribedType;
 import org.apache.qpid.proton.codec.Decoder;
 import org.apache.qpid.proton.codec.DescribedTypeConstructor;
-import org.apache.qpid.proton.type.*;
+import org.apache.qpid.proton.codec.EncoderImpl;
 
 
-public class DeleteOnClose
-      implements DescribedType , LifetimePolicy
+public class DeleteOnCloseType extends AbstractDescribedType<DeleteOnClose,List> implements DescribedTypeConstructor<DeleteOnClose>
 {
     private static final Object[] DESCRIPTORS =
     {
-        UnsignedLong.valueOf(0x000000000000002bL), Symbol.valueOf("amqp:delete-on-close:list"), 
+        UnsignedLong.valueOf(0x000000000000002bL), Symbol.valueOf("amqp:delete-on-close:list"),
     };
 
     private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x000000000000002bL);
-    private final DeleteOnCloseWrapper _wrapper = new DeleteOnCloseWrapper();
-    
-    
-    public Object getDescriptor()
-    {
-        return DESCRIPTOR;
-    }
 
-    public Object getDescribed()
+    private DeleteOnCloseType(EncoderImpl encoder)
     {
-        return _wrapper;
+        super(encoder);
     }
-    
-    public Object get(final int index)
-    {
 
-        throw new IllegalStateException("Unknown index " + index);
 
+    public UnsignedLong getDescriptor()
+    {
+        return DESCRIPTOR;
     }
 
-    public int size()
+    @Override
+    protected List wrap(DeleteOnClose val)
     {
-        return 0;        
-
+        return Collections.EMPTY_LIST;
     }
 
-
-    public final class DeleteOnCloseWrapper extends AbstractList
+    public DeleteOnClose newInstance(Object described)
     {
-
-        @Override
-        public Object get(final int index)
-        {
-            return DeleteOnClose.this.get(index);
-        }
-
-        @Override
-        public int size()
-        {
-            return DeleteOnClose.this.size();
-        }
+        return DeleteOnClose.getInstance();
     }
 
-    private static class DeleteOnCloseConstructor implements DescribedTypeConstructor<DeleteOnClose>
+    public Class<DeleteOnClose> getTypeClass()
     {
-        public DeleteOnClose newInstance(Object described)
-        {
-            List l = (List) described;
-
-            DeleteOnClose o = new DeleteOnClose();
-
-
-            return o;
-        }
-
-        public Class<DeleteOnClose> getTypeClass()
-        {
-            return DeleteOnClose.class;
-        }
+        return DeleteOnClose.class;
     }
 
 
-    public static void register(Decoder decoder)
+    public static void register(Decoder decoder, EncoderImpl encoder)
     {
-        DeleteOnCloseConstructor constructor = new DeleteOnCloseConstructor();
+        DeleteOnCloseType type = new DeleteOnCloseType(encoder);
         for(Object descriptor : DESCRIPTORS)
         {
-            decoder.register(descriptor, constructor);
+            decoder.register(descriptor, type);
         }
+        encoder.register(type);
     }
 }
   
\ No newline at end of file

Copied: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksOrMessagesType.java (from r1418272, qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/DeleteOnNoLinksOrMessages.java)
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksOrMessagesType.java?p2=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksOrMessagesType.java&p1=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/DeleteOnNoLinksOrMessages.java&r1=1418272&r2=1420665&rev=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/DeleteOnNoLinksOrMessages.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksOrMessagesType.java Wed Dec 12 13:32:32 2012
@@ -21,94 +21,63 @@
 */
 
 
-package org.apache.qpid.proton.type.messaging;
-import java.util.List;
-import java.util.AbstractList;
-
+package org.apache.qpid.proton.codec.messaging;
 
+import java.util.Collections;
+import java.util.List;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.messaging.DeleteOnNoLinksOrMessages;
+import org.apache.qpid.proton.codec.AbstractDescribedType;
 import org.apache.qpid.proton.codec.Decoder;
 import org.apache.qpid.proton.codec.DescribedTypeConstructor;
-import org.apache.qpid.proton.type.*;
+import org.apache.qpid.proton.codec.EncoderImpl;
 
 
-public class DeleteOnNoLinksOrMessages
-      implements DescribedType , LifetimePolicy
+public class DeleteOnNoLinksOrMessagesType extends AbstractDescribedType<DeleteOnNoLinksOrMessages,List> implements DescribedTypeConstructor<DeleteOnNoLinksOrMessages>
 {
     private static final Object[] DESCRIPTORS =
     {
-        UnsignedLong.valueOf(0x000000000000002eL), Symbol.valueOf("amqp:delete-on-no-links-or-messages:list"), 
+        UnsignedLong.valueOf(0x000000000000002eL), Symbol.valueOf("amqp:delete-on-no-links-or-messages:list"),
     };
 
     private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x000000000000002eL);
-    private final DeleteOnNoLinksOrMessagesWrapper _wrapper = new DeleteOnNoLinksOrMessagesWrapper();
-    
-    
-    public Object getDescriptor()
-    {
-        return DESCRIPTOR;
-    }
 
-    public Object getDescribed()
+    private DeleteOnNoLinksOrMessagesType(EncoderImpl encoder)
     {
-        return _wrapper;
+        super(encoder);
     }
-    
-    public Object get(final int index)
-    {
-
-        throw new IllegalStateException("Unknown index " + index);
 
+    public UnsignedLong getDescriptor()
+    {
+        return DESCRIPTOR;
     }
 
-    public int size()
+    @Override
+    protected List wrap(DeleteOnNoLinksOrMessages val)
     {
-        return 0;        
-
+        return Collections.EMPTY_LIST;
     }
 
-
-    public final class DeleteOnNoLinksOrMessagesWrapper extends AbstractList
+    public DeleteOnNoLinksOrMessages newInstance(Object described)
     {
-
-        @Override
-        public Object get(final int index)
-        {
-            return DeleteOnNoLinksOrMessages.this.get(index);
-        }
-
-        @Override
-        public int size()
-        {
-            return DeleteOnNoLinksOrMessages.this.size();
-        }
+        return DeleteOnNoLinksOrMessages.getInstance();
     }
 
-    private static class DeleteOnNoLinksOrMessagesConstructor implements DescribedTypeConstructor<DeleteOnNoLinksOrMessages>
+    public Class<DeleteOnNoLinksOrMessages> getTypeClass()
     {
-        public DeleteOnNoLinksOrMessages newInstance(Object described)
-        {
-            List l = (List) described;
-
-            DeleteOnNoLinksOrMessages o = new DeleteOnNoLinksOrMessages();
-
-
-            return o;
-        }
-
-        public Class<DeleteOnNoLinksOrMessages> getTypeClass()
-        {
-            return DeleteOnNoLinksOrMessages.class;
-        }
+        return DeleteOnNoLinksOrMessages.class;
     }
 
 
-    public static void register(Decoder decoder)
+    public static void register(Decoder decoder, EncoderImpl encoder)
     {
-        DeleteOnNoLinksOrMessagesConstructor constructor = new DeleteOnNoLinksOrMessagesConstructor();
+        DeleteOnNoLinksOrMessagesType type = new DeleteOnNoLinksOrMessagesType(encoder);
         for(Object descriptor : DESCRIPTORS)
         {
-            decoder.register(descriptor, constructor);
+            decoder.register(descriptor, type);
         }
+        encoder.register(type);
     }
 }
   
\ No newline at end of file

Copied: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksType.java (from r1418272, qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/DeleteOnNoLinks.java)
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksType.java?p2=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksType.java&p1=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/DeleteOnNoLinks.java&r1=1418272&r2=1420665&rev=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/DeleteOnNoLinks.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksType.java Wed Dec 12 13:32:32 2012
@@ -21,94 +21,65 @@
 */
 
 
-package org.apache.qpid.proton.type.messaging;
-import java.util.List;
-import java.util.AbstractList;
-
+package org.apache.qpid.proton.codec.messaging;
 
+import java.util.Collections;
+import java.util.List;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.messaging.DeleteOnNoLinks;
+import org.apache.qpid.proton.codec.AbstractDescribedType;
 import org.apache.qpid.proton.codec.Decoder;
 import org.apache.qpid.proton.codec.DescribedTypeConstructor;
-import org.apache.qpid.proton.type.*;
-
+import org.apache.qpid.proton.codec.EncoderImpl;
 
-public class DeleteOnNoLinks
-      implements DescribedType , LifetimePolicy
+public class DeleteOnNoLinksType extends AbstractDescribedType<DeleteOnNoLinks,List> implements DescribedTypeConstructor<DeleteOnNoLinks>
 {
     private static final Object[] DESCRIPTORS =
     {
-        UnsignedLong.valueOf(0x000000000000002cL), Symbol.valueOf("amqp:delete-on-no-links:list"), 
+        UnsignedLong.valueOf(0x000000000000002cL), Symbol.valueOf("amqp:delete-on-no-links:list"),
     };
 
     private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x000000000000002cL);
-    private final DeleteOnNoLinksWrapper _wrapper = new DeleteOnNoLinksWrapper();
-    
-    
-    public Object getDescriptor()
-    {
-        return DESCRIPTOR;
-    }
 
-    public Object getDescribed()
+    private DeleteOnNoLinksType(EncoderImpl encoder)
     {
-        return _wrapper;
+        super(encoder);
     }
-    
-    public Object get(final int index)
-    {
-
-        throw new IllegalStateException("Unknown index " + index);
 
+    public UnsignedLong getDescriptor()
+    {
+        return DESCRIPTOR;
     }
 
-    public int size()
+    @Override
+    protected List wrap(DeleteOnNoLinks val)
     {
-        return 0;        
-
+        return Collections.EMPTY_LIST;
     }
 
-
-    public final class DeleteOnNoLinksWrapper extends AbstractList
+    @Override
+    public DeleteOnNoLinks newInstance(Object described)
     {
-
-        @Override
-        public Object get(final int index)
-        {
-            return DeleteOnNoLinks.this.get(index);
-        }
-
-        @Override
-        public int size()
-        {
-            return DeleteOnNoLinks.this.size();
-        }
+        return DeleteOnNoLinks.getInstance();
     }
 
-    private static class DeleteOnNoLinksConstructor implements DescribedTypeConstructor<DeleteOnNoLinks>
+    @Override
+    public Class<DeleteOnNoLinks> getTypeClass()
     {
-        public DeleteOnNoLinks newInstance(Object described)
-        {
-            List l = (List) described;
-
-            DeleteOnNoLinks o = new DeleteOnNoLinks();
-
-
-            return o;
-        }
-
-        public Class<DeleteOnNoLinks> getTypeClass()
-        {
-            return DeleteOnNoLinks.class;
-        }
+        return DeleteOnNoLinks.class;
     }
 
 
-    public static void register(Decoder decoder)
+
+    public static void register(Decoder decoder, EncoderImpl encoder)
     {
-        DeleteOnNoLinksConstructor constructor = new DeleteOnNoLinksConstructor();
+        DeleteOnNoLinksType type = new DeleteOnNoLinksType(encoder);
         for(Object descriptor : DESCRIPTORS)
         {
-            decoder.register(descriptor, constructor);
+            decoder.register(descriptor, type);
         }
+        encoder.register(type);
     }
 }
   
\ No newline at end of file

Copied: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoMessagesType.java (from r1418272, qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/DeleteOnNoMessages.java)
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoMessagesType.java?p2=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoMessagesType.java&p1=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/DeleteOnNoMessages.java&r1=1418272&r2=1420665&rev=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/DeleteOnNoMessages.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoMessagesType.java Wed Dec 12 13:32:32 2012
@@ -21,94 +21,64 @@
 */
 
 
-package org.apache.qpid.proton.type.messaging;
-import java.util.List;
-import java.util.AbstractList;
-
+package org.apache.qpid.proton.codec.messaging;
 
+import java.util.Collections;
+import java.util.List;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.messaging.DeleteOnNoMessages;
+import org.apache.qpid.proton.codec.AbstractDescribedType;
 import org.apache.qpid.proton.codec.Decoder;
 import org.apache.qpid.proton.codec.DescribedTypeConstructor;
-import org.apache.qpid.proton.type.*;
+import org.apache.qpid.proton.codec.EncoderImpl;
 
 
-public class DeleteOnNoMessages
-      implements DescribedType , LifetimePolicy
+public class DeleteOnNoMessagesType extends AbstractDescribedType<DeleteOnNoMessages,List> implements DescribedTypeConstructor<DeleteOnNoMessages>
 {
     private static final Object[] DESCRIPTORS =
     {
-        UnsignedLong.valueOf(0x000000000000002dL), Symbol.valueOf("amqp:delete-on-no-messages:list"), 
+        UnsignedLong.valueOf(0x000000000000002dL), Symbol.valueOf("amqp:delete-on-no-messages:list"),
     };
 
     private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x000000000000002dL);
-    private final DeleteOnNoMessagesWrapper _wrapper = new DeleteOnNoMessagesWrapper();
-    
-    
-    public Object getDescriptor()
-    {
-        return DESCRIPTOR;
-    }
 
-    public Object getDescribed()
+    private DeleteOnNoMessagesType(EncoderImpl encoder)
     {
-        return _wrapper;
+        super(encoder);
     }
-    
-    public Object get(final int index)
-    {
-
-        throw new IllegalStateException("Unknown index " + index);
 
+    public UnsignedLong getDescriptor()
+    {
+        return DESCRIPTOR;
     }
 
-    public int size()
+    @Override
+    protected List wrap(DeleteOnNoMessages val)
     {
-        return 0;        
-
+        return Collections.EMPTY_LIST;
     }
 
-
-    public final class DeleteOnNoMessagesWrapper extends AbstractList
+    @Override
+    public DeleteOnNoMessages newInstance(Object described)
     {
-
-        @Override
-        public Object get(final int index)
-        {
-            return DeleteOnNoMessages.this.get(index);
-        }
-
-        @Override
-        public int size()
-        {
-            return DeleteOnNoMessages.this.size();
-        }
+        return DeleteOnNoMessages.getInstance();
     }
 
-    private static class DeleteOnNoMessagesConstructor implements DescribedTypeConstructor<DeleteOnNoMessages>
+    @Override
+    public Class<DeleteOnNoMessages> getTypeClass()
     {
-        public DeleteOnNoMessages newInstance(Object described)
-        {
-            List l = (List) described;
-
-            DeleteOnNoMessages o = new DeleteOnNoMessages();
-
-
-            return o;
-        }
-
-        public Class<DeleteOnNoMessages> getTypeClass()
-        {
-            return DeleteOnNoMessages.class;
-        }
+        return DeleteOnNoMessages.class;
     }
 
-
-    public static void register(Decoder decoder)
+    public static void register(Decoder decoder, EncoderImpl encoder)
     {
-        DeleteOnNoMessagesConstructor constructor = new DeleteOnNoMessagesConstructor();
+        DeleteOnNoMessagesType type = new DeleteOnNoMessagesType(encoder);
         for(Object descriptor : DESCRIPTORS)
         {
-            decoder.register(descriptor, constructor);
+            decoder.register(descriptor, type);
         }
+        encoder.register(type);
     }
 }
   
\ No newline at end of file

Copied: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeliveryAnnotationsType.java (from r1418272, qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/DeliveryAnnotations.java)
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeliveryAnnotationsType.java?p2=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeliveryAnnotationsType.java&p1=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/DeliveryAnnotations.java&r1=1418272&r2=1420665&rev=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/DeliveryAnnotations.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/DeliveryAnnotationsType.java Wed Dec 12 13:32:32 2012
@@ -21,67 +21,64 @@
 */
 
 
-package org.apache.qpid.proton.type.messaging;
-import java.util.Map;
-
+package org.apache.qpid.proton.codec.messaging;
 
+import java.util.Map;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.messaging.DeliveryAnnotations;
+import org.apache.qpid.proton.codec.AbstractDescribedType;
 import org.apache.qpid.proton.codec.Decoder;
 import org.apache.qpid.proton.codec.DescribedTypeConstructor;
-import org.apache.qpid.proton.type.*;
+import org.apache.qpid.proton.codec.EncoderImpl;
 
 
-public class DeliveryAnnotations
-      implements DescribedType , Section
+public class DeliveryAnnotationsType extends AbstractDescribedType<DeliveryAnnotations,Map> implements DescribedTypeConstructor<DeliveryAnnotations>
 {
     private static final Object[] DESCRIPTORS =
     {
-        UnsignedLong.valueOf(0x0000000000000071L), Symbol.valueOf("amqp:delivery-annotations:map"), 
+        UnsignedLong.valueOf(0x0000000000000071L), Symbol.valueOf("amqp:delivery-annotations:map"),
     };
 
     private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000071L);
-    private final Map _value;
 
-    public DeliveryAnnotations(Map value)
+    public DeliveryAnnotationsType(EncoderImpl encoder)
     {
-        _value = value;
+        super(encoder);
     }
 
-    public Map getValue()
+    public UnsignedLong getDescriptor()
     {
-        return _value;
+        return DESCRIPTOR;
     }
 
-    public Object getDescriptor()
+    @Override
+    protected Map wrap(DeliveryAnnotations val)
     {
-        return DESCRIPTOR;
+        return val.getValue();
     }
 
-    public Object getDescribed()
+
+    public DeliveryAnnotations newInstance(Object described)
     {
-        return _value;
+        return new DeliveryAnnotations( (Map) described );
     }
 
-    private static class DeliveryAnnotationsConstructor implements DescribedTypeConstructor<DeliveryAnnotations>
+    public Class<DeliveryAnnotations> getTypeClass()
     {
-        public DeliveryAnnotations newInstance(Object described)
-        {
-            return new DeliveryAnnotations( (Map) described );
-        }
-
-        public Class<DeliveryAnnotations> getTypeClass()
-        {
-            return DeliveryAnnotations.class;
-        }
+        return DeliveryAnnotations.class;
     }
+
       
 
-    public static void register(Decoder decoder)
+    public static void register(Decoder decoder, EncoderImpl encoder)
     {
-        DeliveryAnnotationsConstructor constructor = new DeliveryAnnotationsConstructor();
+        DeliveryAnnotationsType type = new DeliveryAnnotationsType(encoder);
         for(Object descriptor : DESCRIPTORS)
         {
-            decoder.register(descriptor, constructor);
+            decoder.register(descriptor, type);
         }
+        encoder.register(type);
     }
 }
   
\ No newline at end of file

Copied: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/FooterType.java (from r1418272, qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/Footer.java)
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/FooterType.java?p2=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/FooterType.java&p1=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/Footer.java&r1=1418272&r2=1420665&rev=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/Footer.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/FooterType.java Wed Dec 12 13:32:32 2012
@@ -21,67 +21,62 @@
 */
 
 
-package org.apache.qpid.proton.type.messaging;
-import java.util.Map;
-
+package org.apache.qpid.proton.codec.messaging;
 
+import java.util.Map;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.messaging.Footer;
+import org.apache.qpid.proton.codec.AbstractDescribedType;
 import org.apache.qpid.proton.codec.Decoder;
 import org.apache.qpid.proton.codec.DescribedTypeConstructor;
-import org.apache.qpid.proton.type.*;
+import org.apache.qpid.proton.codec.EncoderImpl;
 
 
-public class Footer
-      implements DescribedType , Section
+public class FooterType extends AbstractDescribedType<Footer,Map> implements DescribedTypeConstructor<Footer>
 {
     private static final Object[] DESCRIPTORS =
     {
-        UnsignedLong.valueOf(0x0000000000000078L), Symbol.valueOf("amqp:footer:map"), 
+        UnsignedLong.valueOf(0x0000000000000078L), Symbol.valueOf("amqp:footer:map"),
     };
 
     private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000078L);
-    private final Map _value;
 
-    public Footer(Map value)
+    public FooterType(EncoderImpl encoder)
     {
-        _value = value;
+        super(encoder);
     }
 
-    public Map getValue()
+    public UnsignedLong getDescriptor()
     {
-        return _value;
+        return DESCRIPTOR;
     }
 
-    public Object getDescriptor()
+    @Override
+    protected Map wrap(Footer val)
     {
-        return DESCRIPTOR;
+        return val.getValue();
     }
 
-    public Object getDescribed()
+    public Footer newInstance(Object described)
     {
-        return _value;
+        return new Footer( (Map) described );
     }
 
-    private static class FooterConstructor implements DescribedTypeConstructor<Footer>
+    public Class<Footer> getTypeClass()
     {
-        public Footer newInstance(Object described)
-        {
-            return new Footer( (Map) described );
-        }
-
-        public Class<Footer> getTypeClass()
-        {
-            return Footer.class;
-        }
+        return Footer.class;
     }
       
 
-    public static void register(Decoder decoder)
+    public static void register(Decoder decoder, EncoderImpl encoder)
     {
-        FooterConstructor constructor = new FooterConstructor();
+        FooterType type = new FooterType(encoder);
         for(Object descriptor : DESCRIPTORS)
         {
-            decoder.register(descriptor, constructor);
+            decoder.register(descriptor, type);
         }
+        encoder.register(type);
     }
 }
   
\ No newline at end of file

Copied: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/HeaderType.java (from r1418272, qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/Header.java)
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/HeaderType.java?p2=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/HeaderType.java&p1=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/Header.java&r1=1418272&r2=1420665&rev=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/Header.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/HeaderType.java Wed Dec 12 13:32:32 2012
@@ -21,18 +21,22 @@
 */
 
 
-package org.apache.qpid.proton.type.messaging;
-import java.util.List;
-import java.util.AbstractList;
-
+package org.apache.qpid.proton.codec.messaging;
 
+import java.util.AbstractList;
+import java.util.List;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedByte;
+import org.apache.qpid.proton.amqp.UnsignedInteger;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.messaging.Header;
+import org.apache.qpid.proton.codec.AbstractDescribedType;
 import org.apache.qpid.proton.codec.Decoder;
 import org.apache.qpid.proton.codec.DescribedTypeConstructor;
-import org.apache.qpid.proton.type.*;
+import org.apache.qpid.proton.codec.EncoderImpl;
 
 
-public class Header
-      implements DescribedType , Section
+public class HeaderType extends AbstractDescribedType<Header,List> implements DescribedTypeConstructor<Header>
 {
     private static final Object[] DESCRIPTORS =
     {
@@ -40,181 +44,115 @@ public class Header
     };
 
     private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000070L);
-    private final HeaderWrapper _wrapper = new HeaderWrapper();
 
-    private Boolean _durable;
-    private UnsignedByte _priority;
-    private UnsignedInteger _ttl;
-    private Boolean _firstAcquirer;
-    private UnsignedInteger _deliveryCount;
-
-    public Boolean getDurable()
+    public HeaderType(EncoderImpl encoder)
     {
-        return _durable;
+        super(encoder);
     }
 
-    public void setDurable(Boolean durable)
+    @Override
+    protected UnsignedLong getDescriptor()
     {
-        _durable = durable;
+        return DESCRIPTOR;
     }
 
-    public UnsignedByte getPriority()
+    @Override
+    protected List wrap(Header val)
     {
-        return _priority;
+        return new HeaderWrapper(val);
     }
 
-    public void setPriority(UnsignedByte priority)
-    {
-        _priority = priority;
-    }
 
-    public UnsignedInteger getTtl()
+    public final class HeaderWrapper extends AbstractList
     {
-        return _ttl;
-    }
+        private final Header _impl;
 
-    public void setTtl(UnsignedInteger ttl)
-    {
-        _ttl = ttl;
-    }
+        public HeaderWrapper(Header impl)
+        {
+            _impl = impl;
+        }
 
-    public Boolean getFirstAcquirer()
-    {
-        return _firstAcquirer;
-    }
 
-    public void setFirstAcquirer(Boolean firstAcquirer)
-    {
-        _firstAcquirer = firstAcquirer;
-    }
+        @Override
+        public Object get(final int index)
+            {
 
-    public UnsignedInteger getDeliveryCount()
-    {
-        return _deliveryCount;
-    }
+                switch(index)
+                {
+                    case 0:
+                        return _impl.getDurable();
+                    case 1:
+                        return _impl.getPriority();
+                    case 2:
+                        return _impl.getTtl();
+                    case 3:
+                        return _impl.getFirstAcquirer();
+                    case 4:
+                        return _impl.getDeliveryCount();
+                }
 
-    public void setDeliveryCount(UnsignedInteger deliveryCount)
-    {
-        _deliveryCount = deliveryCount;
-    }
+                throw new IllegalStateException("Unknown index " + index);
+
+            }
+
+            public int size()
+            {
+                return _impl.getDeliveryCount() != null
+                          ? 5
+                          : _impl.getFirstAcquirer() != null
+                          ? 4
+                          : _impl.getTtl() != null
+                          ? 3
+                          : _impl.getPriority() != null
+                          ? 2
+                          : _impl.getDurable() != null
+                          ? 1
+                          : 0;
+
+            }
 
-    public Object getDescriptor()
-    {
-        return DESCRIPTOR;
-    }
 
-    public Object getDescribed()
-    {
-        return _wrapper;
     }
 
-    public Object get(final int index)
+    public Header newInstance(Object described)
     {
+        List l = (List) described;
 
-        switch(index)
+        Header o = new Header();
+
+
+        switch(5 - l.size())
         {
+
             case 0:
-                return _durable;
+                o.setDeliveryCount( (UnsignedInteger) l.get( 4 ) );
             case 1:
-                return _priority;
+                o.setFirstAcquirer( (Boolean) l.get( 3 ) );
             case 2:
-                return _ttl;
+                o.setTtl( (UnsignedInteger) l.get( 2 ) );
             case 3:
-                return _firstAcquirer;
+                o.setPriority( (UnsignedByte) l.get( 1 ) );
             case 4:
-                return _deliveryCount;
+                o.setDurable( (Boolean) l.get( 0 ) );
         }
 
-        throw new IllegalStateException("Unknown index " + index);
-
-    }
-
-    public int size()
-    {
-        return _deliveryCount != null
-                  ? 5
-                  : _firstAcquirer != null
-                  ? 4
-                  : _ttl != null
-                  ? 3
-                  : _priority != null
-                  ? 2
-                  : _durable != null
-                  ? 1
-                  : 0;
-
-    }
-
 
-    public final class HeaderWrapper extends AbstractList
-    {
-
-        @Override
-        public Object get(final int index)
-        {
-            return Header.this.get(index);
-        }
-
-        @Override
-        public int size()
-        {
-            return Header.this.size();
-        }
+        return o;
     }
 
-    private static class HeaderConstructor implements DescribedTypeConstructor<Header>
+    public Class<Header> getTypeClass()
     {
-        public Header newInstance(Object described)
-        {
-            List l = (List) described;
-
-            Header o = new Header();
-
-
-            switch(5 - l.size())
-            {
-
-                case 0:
-                    o.setDeliveryCount( (UnsignedInteger) l.get( 4 ) );
-                case 1:
-                    o.setFirstAcquirer( (Boolean) l.get( 3 ) );
-                case 2:
-                    o.setTtl( (UnsignedInteger) l.get( 2 ) );
-                case 3:
-                    o.setPriority( (UnsignedByte) l.get( 1 ) );
-                case 4:
-                    o.setDurable( (Boolean) l.get( 0 ) );
-            }
-
-
-            return o;
-        }
-
-        public Class<Header> getTypeClass()
-        {
-            return Header.class;
-        }
+        return Header.class;
     }
 
-
-    public static void register(Decoder decoder)
+    public static void register(Decoder decoder, EncoderImpl encoder)
     {
-        HeaderConstructor constructor = new HeaderConstructor();
+        HeaderType type = new HeaderType(encoder);
         for(Object descriptor : DESCRIPTORS)
         {
-            decoder.register(descriptor, constructor);
+            decoder.register(descriptor, type);
         }
+        encoder.register(type);
     }
 
-    @Override
-    public String toString()
-    {
-        return "Header{" +
-               "durable=" + _durable +
-               ", priority=" + _priority +
-               ", ttl=" + _ttl +
-               ", firstAcquirer=" + _firstAcquirer +
-               ", deliveryCount=" + _deliveryCount +
-               '}';
-    }
 }

Copied: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/MessageAnnotationsType.java (from r1418272, qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/MessageAnnotations.java)
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/MessageAnnotationsType.java?p2=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/MessageAnnotationsType.java&p1=qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/MessageAnnotations.java&r1=1418272&r2=1420665&rev=1420665&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/type/messaging/MessageAnnotations.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/codec/messaging/MessageAnnotationsType.java Wed Dec 12 13:32:32 2012
@@ -21,67 +21,66 @@
 */
 
 
-package org.apache.qpid.proton.type.messaging;
+package org.apache.qpid.proton.codec.messaging;
 import java.util.Map;
 
 
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.messaging.MessageAnnotations;
+import org.apache.qpid.proton.codec.AbstractDescribedType;
 import org.apache.qpid.proton.codec.Decoder;
 import org.apache.qpid.proton.codec.DescribedTypeConstructor;
-import org.apache.qpid.proton.type.*;
+import org.apache.qpid.proton.codec.EncoderImpl;
 
 
-public class MessageAnnotations
-      implements DescribedType , Section
+public class MessageAnnotationsType extends AbstractDescribedType<MessageAnnotations,Map> implements DescribedTypeConstructor<MessageAnnotations>
+
 {
     private static final Object[] DESCRIPTORS =
     {
-        UnsignedLong.valueOf(0x0000000000000072L), Symbol.valueOf("amqp:message-annotations:map"), 
+        UnsignedLong.valueOf(0x0000000000000072L), Symbol.valueOf("amqp:message-annotations:map"),
     };
 
     private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000072L);
-    private final Map _value;
 
-    public MessageAnnotations(Map value)
+    public MessageAnnotationsType(EncoderImpl encoder)
     {
-        _value = value;
+        super(encoder);
     }
 
-    public Map getValue()
+    public UnsignedLong getDescriptor()
     {
-        return _value;
+        return DESCRIPTOR;
     }
 
-    public Object getDescriptor()
+    @Override
+    protected Map wrap(MessageAnnotations val)
     {
-        return DESCRIPTOR;
+        return val.getValue();
     }
 
-    public Object getDescribed()
+
+    public MessageAnnotations newInstance(Object described)
     {
-        return _value;
+        return new MessageAnnotations( (Map) described );
     }
 
-    private static class MessageAnnotationsConstructor implements DescribedTypeConstructor<MessageAnnotations>
+    public Class<MessageAnnotations> getTypeClass()
     {
-        public MessageAnnotations newInstance(Object described)
-        {
-            return new MessageAnnotations( (Map) described );
-        }
-
-        public Class<MessageAnnotations> getTypeClass()
-        {
-            return MessageAnnotations.class;
-        }
+        return MessageAnnotations.class;
     }
-      
 
-    public static void register(Decoder decoder)
+
+
+    public static void register(Decoder decoder, EncoderImpl encoder)
     {
-        MessageAnnotationsConstructor constructor = new MessageAnnotationsConstructor();
+        MessageAnnotationsType constructor = new MessageAnnotationsType(encoder);
         for(Object descriptor : DESCRIPTORS)
         {
             decoder.register(descriptor, constructor);
         }
+        encoder.register(constructor);
     }
 }
   
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org