activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmacn...@apache.org
Subject svn commit: r909224 [4/9] - in /activemq/sandbox/activemq-apollo-actor/activemq-amqp/src: main/java/org/apache/activemq/amqp/protocol/marshaller/ main/java/org/apache/activemq/amqp/protocol/marshaller/v1_0_0/ main/java/org/apache/activemq/amqp/protocol...
Date Fri, 12 Feb 2010 04:25:28 GMT
Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFilterSet.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFilterSet.java?rev=909224&r1=909223&r2=909224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFilterSet.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFilterSet.java Fri Feb 12 04:25:25 2010
@@ -20,11 +20,14 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
 import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
 import org.apache.activemq.amqp.protocol.marshaller.AmqpMarshaller;
 import org.apache.activemq.amqp.protocol.marshaller.Encoded;
 import org.apache.activemq.amqp.protocol.types.AmqpFilterSet;
 import org.apache.activemq.amqp.protocol.types.AmqpMap;
+import org.apache.activemq.amqp.protocol.types.IAmqpMap;
 import org.apache.activemq.util.buffer.Buffer;
 
 /**
@@ -40,16 +43,17 @@
 
         private AmqpFilterSetBuffer buffer;
         private AmqpFilterSetBean bean = this;
-        private HashMap<AmqpType<?,?>, AmqpType<?,?>> value;
+        private IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> value;
 
-        protected AmqpFilterSetBean() {
+        AmqpFilterSetBean() {
+            this.value = new IAmqpMap.AmqpWrapperMap<AmqpType<?,?>, AmqpType<?,?>>(new HashMap<AmqpType<?,?>, AmqpType<?,?>>());
         }
 
-        public AmqpFilterSetBean(HashMap<AmqpType<?,?>, AmqpType<?,?>> value) {
+        AmqpFilterSetBean(IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> value) {
             this.value = value;
         }
 
-        public AmqpFilterSetBean(AmqpFilterSet.AmqpFilterSetBean other) {
+        AmqpFilterSetBean(AmqpFilterSet.AmqpFilterSetBean other) {
             this.bean = other;
         }
 
@@ -69,14 +73,23 @@
         }
 
         public void put(AmqpType<?, ?> key, AmqpType<?, ?> value) {
+            copyCheck();
             bean.value.put(key, value);
         }
 
-        public AmqpType<?, ?> get(AmqpType<?, ?> key) {
+        public AmqpType<?, ?> get(Object key) {
             return bean.value.get(key);
         }
 
-        public HashMap<AmqpType<?,?>, AmqpType<?,?>> getValue() {
+        public int getEntryCount() {
+            return bean.value.getEntryCount();
+        }
+
+        public Iterator<Map.Entry<AmqpType<?, ?>, AmqpType<?, ?>>> iterator() {
+            return bean.value.iterator();
+        }
+
+        public IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> getValue() {
             return bean.value;
         }
 
@@ -95,28 +108,24 @@
             bean = this;
         }
 
-        public boolean equivalent(AmqpType<?,?> t){
-            if(this == t) {
+        public boolean equals(Object o){
+            if(this == o) {
                 return true;
             }
 
-            if(t == null || !(t instanceof AmqpFilterSet)) {
+            if(o == null || !(o instanceof AmqpFilterSet)) {
                 return false;
             }
 
-            return equivalent((AmqpFilterSet) t);
+            return equals((AmqpFilterSet) o);
         }
 
-        public boolean equivalent(AmqpFilterSet b) {
-            if(b == null) {
-                return false;
-            }
-
-            if(b.getValue() == null ^ getValue() == null) {
-                return false;
-            }
+        public boolean equals(AmqpFilterSet b) {
+            return AbstractAmqpMap.checkEqual(this, b);
+        }
 
-            return b.getValue() == null || b.getValue().equals(getValue());
+        public int hashCode() {
+            return AbstractAmqpMap.hashCodeFor(this);
         }
     }
 
@@ -128,18 +137,26 @@
             super();
         }
 
-        protected AmqpFilterSetBuffer(Encoded<HashMap<AmqpType<?,?>, AmqpType<?,?>>> encoded) {
+        protected AmqpFilterSetBuffer(Encoded<IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>>> encoded) {
             super(encoded);
         }
         public void put(AmqpType<?, ?> key, AmqpType<?, ?> value) {
             bean().put(key, value);
         }
 
-        public AmqpType<?, ?> get(AmqpType<?, ?> key) {
+        public AmqpType<?, ?> get(Object key) {
             return bean().get(key);
         }
 
-        public HashMap<AmqpType<?,?>, AmqpType<?,?>> getValue() {
+        public int getEntryCount() {
+            return bean().getEntryCount();
+        }
+
+        public Iterator<Map.Entry<AmqpType<?, ?>, AmqpType<?, ?>>> iterator() {
+            return bean().iterator();
+        }
+
+        public IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> getValue() {
             return bean().getValue();
         }
 
@@ -155,11 +172,19 @@
             return bean;
         }
 
-        public boolean equivalent(AmqpType<?, ?> t) {
-            return bean().equivalent(t);
+        public boolean equals(Object o){
+            return bean().equals(o);
+        }
+
+        public boolean equals(AmqpFilterSet o){
+            return bean().equals(o);
+        }
+
+        public int hashCode() {
+            return bean().hashCode();
         }
 
-        public static AmqpFilterSet.AmqpFilterSetBuffer create(Encoded<HashMap<AmqpType<?,?>, AmqpType<?,?>>> encoded) {
+        public static AmqpFilterSet.AmqpFilterSetBuffer create(Encoded<IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>>> encoded) {
             if(encoded.isNull()) {
                 return null;
             }

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFloat.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFloat.java?rev=909224&r1=909223&r2=909224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFloat.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFloat.java Fri Feb 12 04:25:25 2010
@@ -39,14 +39,11 @@
         private AmqpFloatBean bean = this;
         private Float value;
 
-        protected AmqpFloatBean() {
-        }
-
-        public AmqpFloatBean(Float value) {
+        AmqpFloatBean(Float value) {
             this.value = value;
         }
 
-        public AmqpFloatBean(AmqpFloat.AmqpFloatBean other) {
+        AmqpFloatBean(AmqpFloat.AmqpFloatBean other) {
             this.bean = other;
         }
 
@@ -80,29 +77,10 @@
                 return false;
             }
 
-            return equivalent((AmqpFloat) o);
+            return equals((AmqpFloat) o);
         }
 
-        public int hashCode() {
-            if(getValue() == null) {
-                return AmqpFloat.AmqpFloatBean.class.hashCode();
-            }
-            return getValue().hashCode();
-        }
-
-        public boolean equivalent(AmqpType<?,?> t){
-            if(this == t) {
-                return true;
-            }
-
-            if(t == null || !(t instanceof AmqpFloat)) {
-                return false;
-            }
-
-            return equivalent((AmqpFloat) t);
-        }
-
-        public boolean equivalent(AmqpFloat b) {
+        public boolean equals(AmqpFloat b) {
             if(b == null) {
                 return false;
             }
@@ -113,6 +91,13 @@
 
             return b.getValue() == null || b.getValue().equals(getValue());
         }
+
+        public int hashCode() {
+            if(getValue() == null) {
+                return AmqpFloat.AmqpFloatBean.class.hashCode();
+            }
+            return getValue().hashCode();
+        }
     }
 
     public static class AmqpFloatBuffer implements AmqpFloat, AmqpBuffer< Float> {
@@ -155,12 +140,12 @@
             return bean().equals(o);
         }
 
-        public int hashCode() {
-            return bean().hashCode();
+        public boolean equals(AmqpFloat o){
+            return bean().equals(o);
         }
 
-        public boolean equivalent(AmqpType<?, ?> t) {
-            return bean().equivalent(t);
+        public int hashCode() {
+            return bean().hashCode();
         }
 
         public static AmqpFloat.AmqpFloatBuffer create(Encoded<Float> encoded) {

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFlow.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFlow.java?rev=909224&r1=909223&r2=909224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFlow.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFlow.java Fri Feb 12 04:25:25 2010
@@ -53,6 +53,40 @@
      * <p>
      * Identifies the Link whose transfer-limit is to be updated.
      * </p>
+     * <p>
+     * command and subsequently used
+     * by endpoints as a shorthand to refer to the Link in all outgoing commands. The two
+     * endpoints may potentially use different handles to refer to the same Link. Link handles
+     * may be reused once a Link is closed for both send and receive.
+     * </p>
+     */
+    public void setHandle(Long handle);
+
+    /**
+     * the Link handle
+     * <p>
+     * Identifies the Link whose transfer-limit is to be updated.
+     * </p>
+     * <p>
+     * command and subsequently used
+     * by endpoints as a shorthand to refer to the Link in all outgoing commands. The two
+     * endpoints may potentially use different handles to refer to the same Link. Link handles
+     * may be reused once a Link is closed for both send and receive.
+     * </p>
+     */
+    public void setHandle(long handle);
+
+    /**
+     * the Link handle
+     * <p>
+     * Identifies the Link whose transfer-limit is to be updated.
+     * </p>
+     * <p>
+     * command and subsequently used
+     * by endpoints as a shorthand to refer to the Link in all outgoing commands. The two
+     * endpoints may potentially use different handles to refer to the same Link. Link handles
+     * may be reused once a Link is closed for both send and receive.
+     * </p>
      */
     public void setHandle(AmqpHandle handle);
 
@@ -61,6 +95,12 @@
      * <p>
      * Identifies the Link whose transfer-limit is to be updated.
      * </p>
+     * <p>
+     * command and subsequently used
+     * by endpoints as a shorthand to refer to the Link in all outgoing commands. The two
+     * endpoints may potentially use different handles to refer to the same Link. Link handles
+     * may be reused once a Link is closed for both send and receive.
+     * </p>
      */
     public AmqpHandle getHandle();
 
@@ -72,6 +112,40 @@
      * wraparound and compare according to RFC-1982 serial number arithmetic. If this is not
      * set, there is no limit and transfers may be sent until a limit is imposed.
      * </p>
+     * <p>
+     * A sequence-no encodes a serial number as defined in RFC-1982. The arithmetic, and
+     * operators for these numbers are defined by RFC-1982.
+     * </p>
+     */
+    public void setLimit(Long limit);
+
+    /**
+     * the Link transfer-limit
+     * <p>
+     * The updated value for the transfer-limit. This is the limit beyond which the sent
+     * transfer-count for the Link may not exceed. This is an absolute number and must
+     * wraparound and compare according to RFC-1982 serial number arithmetic. If this is not
+     * set, there is no limit and transfers may be sent until a limit is imposed.
+     * </p>
+     * <p>
+     * A sequence-no encodes a serial number as defined in RFC-1982. The arithmetic, and
+     * operators for these numbers are defined by RFC-1982.
+     * </p>
+     */
+    public void setLimit(long limit);
+
+    /**
+     * the Link transfer-limit
+     * <p>
+     * The updated value for the transfer-limit. This is the limit beyond which the sent
+     * transfer-count for the Link may not exceed. This is an absolute number and must
+     * wraparound and compare according to RFC-1982 serial number arithmetic. If this is not
+     * set, there is no limit and transfers may be sent until a limit is imposed.
+     * </p>
+     * <p>
+     * A sequence-no encodes a serial number as defined in RFC-1982. The arithmetic, and
+     * operators for these numbers are defined by RFC-1982.
+     * </p>
      */
     public void setLimit(AmqpSequenceNo limit);
 
@@ -83,6 +157,10 @@
      * wraparound and compare according to RFC-1982 serial number arithmetic. If this is not
      * set, there is no limit and transfers may be sent until a limit is imposed.
      * </p>
+     * <p>
+     * A sequence-no encodes a serial number as defined in RFC-1982. The arithmetic, and
+     * operators for these numbers are defined by RFC-1982.
+     * </p>
      */
     public AmqpSequenceNo getLimit();
 
@@ -94,170 +172,191 @@
         private AmqpHandle handle;
         private AmqpSequenceNo limit;
 
-        public AmqpFlowBean() {
+        AmqpFlowBean() {
         }
 
-        public AmqpFlowBean(IAmqpList value) {
-            //TODO we should defer decoding of the described type:
-            for(int i = 0; i < value.getListCount(); i++) {
-                set(i, value.get(i));
-            }
-        }
+        AmqpFlowBean(IAmqpList value) {
 
-        public AmqpFlowBean(AmqpFlow.AmqpFlowBean other) {
-            this.bean = other;
+        for(int i = 0; i < value.getListCount(); i++) {
+            set(i, value.get(i));
         }
+    }
 
-        public final AmqpFlowBean copy() {
-            return new AmqpFlow.AmqpFlowBean(bean);
-        }
+    AmqpFlowBean(AmqpFlow.AmqpFlowBean other) {
+        this.bean = other;
+    }
 
-        public final void handle(AmqpCommandHandler handler) throws Exception {
-            handler.handleFlow(this);
-        }
+    public final AmqpFlowBean copy() {
+        return new AmqpFlow.AmqpFlowBean(bean);
+    }
 
-        public final AmqpFlow.AmqpFlowBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
-            if(buffer == null) {
-                buffer = new AmqpFlowBuffer(marshaller.encode(this));
-            }
-            return buffer;
-        }
+    public final void handle(AmqpCommandHandler handler) throws Exception {
+        handler.handleFlow(this);
+    }
 
-        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
-            getBuffer(marshaller).marshal(out, marshaller);
+    public final AmqpFlow.AmqpFlowBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+        if(buffer == null) {
+            buffer = new AmqpFlowBuffer(marshaller.encode(this));
         }
+        return buffer;
+    }
 
+    public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+        getBuffer(marshaller).marshal(out, marshaller);
+    }
 
-        public final void setOptions(AmqpOptions options) {
-            copyCheck();
-            bean.options = options;
-        }
 
-        public final AmqpOptions getOptions() {
-            return bean.options;
-        }
+    public final void setOptions(AmqpOptions options) {
+        copyCheck();
+        bean.options = options;
+    }
 
-        public final void setHandle(AmqpHandle handle) {
-            copyCheck();
-            bean.handle = handle;
-        }
+    public final AmqpOptions getOptions() {
+        return bean.options;
+    }
 
-        public final AmqpHandle getHandle() {
-            return bean.handle;
-        }
+    public void setHandle(Long handle) {
+        setHandle(TypeFactory.createAmqpHandle(handle));
+    }
 
-        public final void setLimit(AmqpSequenceNo limit) {
-            copyCheck();
-            bean.limit = limit;
+
+    public void setHandle(long handle) {
+        setHandle(TypeFactory.createAmqpHandle(handle));
+    }
+
+
+    public final void setHandle(AmqpHandle handle) {
+        copyCheck();
+        bean.handle = handle;
+    }
+
+    public final AmqpHandle getHandle() {
+        return bean.handle;
+    }
+
+    public void setLimit(Long limit) {
+        setLimit(TypeFactory.createAmqpSequenceNo(limit));
+    }
+
+
+    public void setLimit(long limit) {
+        setLimit(TypeFactory.createAmqpSequenceNo(limit));
+    }
+
+
+    public final void setLimit(AmqpSequenceNo limit) {
+        copyCheck();
+        bean.limit = limit;
+    }
+
+    public final AmqpSequenceNo getLimit() {
+        return bean.limit;
+    }
+
+    public void set(int index, AmqpType<?, ?> value) {
+        switch(index) {
+        case 0: {
+            setOptions((AmqpOptions) value);
+            break;
+        }
+        case 1: {
+            setHandle((AmqpHandle) value);
+            break;
+        }
+        case 2: {
+            setLimit((AmqpSequenceNo) value);
+            break;
+        }
+        default : {
+            throw new IndexOutOfBoundsException(String.valueOf(index));
         }
+        }
+    }
 
-        public final AmqpSequenceNo getLimit() {
+    public AmqpType<?, ?> get(int index) {
+        switch(index) {
+        case 0: {
+            return bean.options;
+        }
+        case 1: {
+            return bean.handle;
+        }
+        case 2: {
             return bean.limit;
         }
-
-        public void set(int index, AmqpType<?, ?> value) {
-            switch(index) {
-            case 0: {
-                setOptions((AmqpOptions) value);
-                break;
-            }
-            case 1: {
-                setHandle((AmqpHandle) value);
-                break;
-            }
-            case 2: {
-                setLimit((AmqpSequenceNo) value);
-                break;
-            }
-            default : {
-                throw new IndexOutOfBoundsException(String.valueOf(index));
-            }
-            }
+        default : {
+            throw new IndexOutOfBoundsException(String.valueOf(index));
         }
-
-        public AmqpType<?, ?> get(int index) {
-            switch(index) {
-            case 0: {
-                return bean.options;
-            }
-            case 1: {
-                return bean.handle;
-            }
-            case 2: {
-                return bean.limit;
-            }
-            default : {
-                throw new IndexOutOfBoundsException(String.valueOf(index));
-            }
-            }
         }
+    }
 
-        public int getListCount() {
-            return 3;
-        }
+    public int getListCount() {
+        return 3;
+    }
 
-        public IAmqpList getValue() {
-            return bean;
-        }
+    public IAmqpList getValue() {
+        return bean;
+    }
 
-        public Iterator<AmqpType<?, ?>> iterator() {
-            return new AmqpListIterator(bean);
-        }
+    public Iterator<AmqpType<?, ?>> iterator() {
+        return new AmqpListIterator(bean);
+    }
 
 
-        private final void copyCheck() {
-            if(buffer != null) {;
-                throw new IllegalStateException("unwriteable");
-            }
-            if(bean != this) {;
-                copy(bean);
-            }
+    private final void copyCheck() {
+        if(buffer != null) {;
+            throw new IllegalStateException("unwriteable");
         }
-
-        private final void copy(AmqpFlow.AmqpFlowBean other) {
-            this.options= other.options;
-            this.handle= other.handle;
-            this.limit= other.limit;
-            bean = this;
+        if(bean != this) {;
+            copy(bean);
         }
+    }
 
-        public boolean equivalent(AmqpType<?,?> t){
-            if(this == t) {
-                return true;
-            }
+    private final void copy(AmqpFlow.AmqpFlowBean other) {
+        bean = this;
+    }
 
-            if(t == null || !(t instanceof AmqpFlow)) {
-                return false;
-            }
+    public boolean equals(Object o){
+        if(this == o) {
+            return true;
+        }
 
-            return equivalent((AmqpFlow) t);
+        if(o == null || !(o instanceof AmqpFlow)) {
+            return false;
         }
 
-        public boolean equivalent(AmqpFlow b) {
+        return equals((AmqpFlow) o);
+    }
 
-            if(b.getOptions() == null ^ getOptions() == null) {
-                return false;
-            }
-            if(b.getOptions() != null && !b.getOptions().equals(getOptions())){ 
-                return false;
-            }
+    public boolean equals(AmqpFlow b) {
 
-            if(b.getHandle() == null ^ getHandle() == null) {
-                return false;
-            }
-            if(b.getHandle() != null && !b.getHandle().equals(getHandle())){ 
-                return false;
-            }
+        if(b.getOptions() == null ^ getOptions() == null) {
+            return false;
+        }
+        if(b.getOptions() != null && !b.getOptions().equals(getOptions())){ 
+            return false;
+        }
 
-            if(b.getLimit() == null ^ getLimit() == null) {
-                return false;
-            }
-            if(b.getLimit() != null && !b.getLimit().equals(getLimit())){ 
-                return false;
-            }
-            return true;
+        if(b.getHandle() == null ^ getHandle() == null) {
+            return false;
+        }
+        if(b.getHandle() != null && !b.getHandle().equals(getHandle())){ 
+            return false;
+        }
+
+        if(b.getLimit() == null ^ getLimit() == null) {
+            return false;
         }
+        if(b.getLimit() != null && !b.getLimit().equals(getLimit())){ 
+            return false;
+        }
+        return true;
+    }
+
+    public int hashCode() {
+        return AbstractAmqpList.hashCodeFor(this);
     }
+}
 
     public static class AmqpFlowBuffer extends AmqpList.AmqpListBuffer implements AmqpFlow{
 
@@ -275,6 +374,15 @@
             return bean().getOptions();
         }
 
+        public void setHandle(Long handle) {
+            bean().setHandle(handle);
+        }
+
+        public void setHandle(long handle) {
+            bean().setHandle(handle);
+        }
+
+
         public final void setHandle(AmqpHandle handle) {
             bean().setHandle(handle);
         }
@@ -283,6 +391,15 @@
             return bean().getHandle();
         }
 
+        public void setLimit(Long limit) {
+            bean().setLimit(limit);
+        }
+
+        public void setLimit(long limit) {
+            bean().setLimit(limit);
+        }
+
+
         public final void setLimit(AmqpSequenceNo limit) {
             bean().setLimit(limit);
         }
@@ -327,8 +444,16 @@
             handler.handleFlow(this);
         }
 
-        public boolean equivalent(AmqpType<?, ?> t) {
-            return bean().equivalent(t);
+        public boolean equals(Object o){
+            return bean().equals(o);
+        }
+
+        public boolean equals(AmqpFlow o){
+            return bean().equals(o);
+        }
+
+        public int hashCode() {
+            return bean().hashCode();
         }
 
         public static AmqpFlow.AmqpFlowBuffer create(Encoded<IAmqpList> encoded) {

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFooter.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFooter.java?rev=909224&r1=909223&r2=909224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFooter.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFooter.java Fri Feb 12 04:25:25 2010
@@ -76,142 +76,144 @@
         private AmqpMessageAttributes messageAttrs;
         private AmqpMessageAttributes deliveryAttrs;
 
-        public AmqpFooterBean() {
+        AmqpFooterBean() {
         }
 
-        public AmqpFooterBean(IAmqpList value) {
-            //TODO we should defer decoding of the described type:
-            for(int i = 0; i < value.getListCount(); i++) {
-                set(i, value.get(i));
-            }
-        }
+        AmqpFooterBean(IAmqpList value) {
 
-        public AmqpFooterBean(AmqpFooter.AmqpFooterBean other) {
-            this.bean = other;
+        for(int i = 0; i < value.getListCount(); i++) {
+            set(i, value.get(i));
         }
+    }
 
-        public final AmqpFooterBean copy() {
-            return new AmqpFooter.AmqpFooterBean(bean);
-        }
+    AmqpFooterBean(AmqpFooter.AmqpFooterBean other) {
+        this.bean = other;
+    }
 
-        public final AmqpFooter.AmqpFooterBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
-            if(buffer == null) {
-                buffer = new AmqpFooterBuffer(marshaller.encode(this));
-            }
-            return buffer;
-        }
+    public final AmqpFooterBean copy() {
+        return new AmqpFooter.AmqpFooterBean(bean);
+    }
 
-        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
-            getBuffer(marshaller).marshal(out, marshaller);
+    public final AmqpFooter.AmqpFooterBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+        if(buffer == null) {
+            buffer = new AmqpFooterBuffer(marshaller.encode(this));
         }
+        return buffer;
+    }
+
+    public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+        getBuffer(marshaller).marshal(out, marshaller);
+    }
 
 
-        public final void setMessageAttrs(AmqpMessageAttributes messageAttrs) {
-            copyCheck();
-            bean.messageAttrs = messageAttrs;
-        }
+    public final void setMessageAttrs(AmqpMessageAttributes messageAttrs) {
+        copyCheck();
+        bean.messageAttrs = messageAttrs;
+    }
 
-        public final AmqpMessageAttributes getMessageAttrs() {
-            return bean.messageAttrs;
-        }
+    public final AmqpMessageAttributes getMessageAttrs() {
+        return bean.messageAttrs;
+    }
 
-        public final void setDeliveryAttrs(AmqpMessageAttributes deliveryAttrs) {
-            copyCheck();
-            bean.deliveryAttrs = deliveryAttrs;
+    public final void setDeliveryAttrs(AmqpMessageAttributes deliveryAttrs) {
+        copyCheck();
+        bean.deliveryAttrs = deliveryAttrs;
+    }
+
+    public final AmqpMessageAttributes getDeliveryAttrs() {
+        return bean.deliveryAttrs;
+    }
+
+    public void set(int index, AmqpType<?, ?> value) {
+        switch(index) {
+        case 0: {
+            setMessageAttrs((AmqpMessageAttributes) value);
+            break;
+        }
+        case 1: {
+            setDeliveryAttrs((AmqpMessageAttributes) value);
+            break;
+        }
+        default : {
+            throw new IndexOutOfBoundsException(String.valueOf(index));
+        }
         }
+    }
 
-        public final AmqpMessageAttributes getDeliveryAttrs() {
+    public AmqpType<?, ?> get(int index) {
+        switch(index) {
+        case 0: {
+            return bean.messageAttrs;
+        }
+        case 1: {
             return bean.deliveryAttrs;
         }
-
-        public void set(int index, AmqpType<?, ?> value) {
-            switch(index) {
-            case 0: {
-                setMessageAttrs((AmqpMessageAttributes) value);
-                break;
-            }
-            case 1: {
-                setDeliveryAttrs((AmqpMessageAttributes) value);
-                break;
-            }
-            default : {
-                throw new IndexOutOfBoundsException(String.valueOf(index));
-            }
-            }
+        default : {
+            throw new IndexOutOfBoundsException(String.valueOf(index));
         }
-
-        public AmqpType<?, ?> get(int index) {
-            switch(index) {
-            case 0: {
-                return bean.messageAttrs;
-            }
-            case 1: {
-                return bean.deliveryAttrs;
-            }
-            default : {
-                throw new IndexOutOfBoundsException(String.valueOf(index));
-            }
-            }
         }
+    }
 
-        public int getListCount() {
-            return 2;
-        }
+    public int getListCount() {
+        return 2;
+    }
 
-        public IAmqpList getValue() {
-            return bean;
-        }
+    public IAmqpList getValue() {
+        return bean;
+    }
 
-        public Iterator<AmqpType<?, ?>> iterator() {
-            return new AmqpListIterator(bean);
-        }
+    public Iterator<AmqpType<?, ?>> iterator() {
+        return new AmqpListIterator(bean);
+    }
 
 
-        private final void copyCheck() {
-            if(buffer != null) {;
-                throw new IllegalStateException("unwriteable");
-            }
-            if(bean != this) {;
-                copy(bean);
-            }
+    private final void copyCheck() {
+        if(buffer != null) {;
+            throw new IllegalStateException("unwriteable");
         }
-
-        private final void copy(AmqpFooter.AmqpFooterBean other) {
-            this.messageAttrs= other.messageAttrs;
-            this.deliveryAttrs= other.deliveryAttrs;
-            bean = this;
+        if(bean != this) {;
+            copy(bean);
         }
+    }
 
-        public boolean equivalent(AmqpType<?,?> t){
-            if(this == t) {
-                return true;
-            }
+    private final void copy(AmqpFooter.AmqpFooterBean other) {
+        bean = this;
+    }
 
-            if(t == null || !(t instanceof AmqpFooter)) {
-                return false;
-            }
+    public boolean equals(Object o){
+        if(this == o) {
+            return true;
+        }
 
-            return equivalent((AmqpFooter) t);
+        if(o == null || !(o instanceof AmqpFooter)) {
+            return false;
         }
 
-        public boolean equivalent(AmqpFooter b) {
+        return equals((AmqpFooter) o);
+    }
 
-            if(b.getMessageAttrs() == null ^ getMessageAttrs() == null) {
-                return false;
-            }
-            if(b.getMessageAttrs() != null && !b.getMessageAttrs().equals(getMessageAttrs())){ 
-                return false;
-            }
+    public boolean equals(AmqpFooter b) {
 
-            if(b.getDeliveryAttrs() == null ^ getDeliveryAttrs() == null) {
-                return false;
-            }
-            if(b.getDeliveryAttrs() != null && !b.getDeliveryAttrs().equals(getDeliveryAttrs())){ 
-                return false;
-            }
-            return true;
+        if(b.getMessageAttrs() == null ^ getMessageAttrs() == null) {
+            return false;
+        }
+        if(b.getMessageAttrs() != null && !b.getMessageAttrs().equals(getMessageAttrs())){ 
+            return false;
         }
+
+        if(b.getDeliveryAttrs() == null ^ getDeliveryAttrs() == null) {
+            return false;
+        }
+        if(b.getDeliveryAttrs() != null && !b.getDeliveryAttrs().equals(getDeliveryAttrs())){ 
+            return false;
+        }
+        return true;
+    }
+
+    public int hashCode() {
+        return AbstractAmqpList.hashCodeFor(this);
     }
+}
 
     public static class AmqpFooterBuffer extends AmqpList.AmqpListBuffer implements AmqpFooter{
 
@@ -269,8 +271,16 @@
             return bean;
         }
 
-        public boolean equivalent(AmqpType<?, ?> t) {
-            return bean().equivalent(t);
+        public boolean equals(Object o){
+            return bean().equals(o);
+        }
+
+        public boolean equals(AmqpFooter o){
+            return bean().equals(o);
+        }
+
+        public int hashCode() {
+            return bean().hashCode();
         }
 
         public static AmqpFooter.AmqpFooterBuffer create(Encoded<IAmqpList> encoded) {

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFragment.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFragment.java?rev=909224&r1=909223&r2=909224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFragment.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFragment.java Fri Feb 12 04:25:25 2010
@@ -57,6 +57,15 @@
      * boundary within the Message.
      * </p>
      */
+    public void setFirst(boolean first);
+
+    /**
+     * indicates the fragment is the first in the Section
+     * <p>
+     * If this flag is true, then the beginning of the payload corresponds with a section
+     * boundary within the Message.
+     * </p>
+     */
     public void setFirst(AmqpBoolean first);
 
     /**
@@ -84,6 +93,15 @@
      * within the Message.
      * </p>
      */
+    public void setLast(boolean last);
+
+    /**
+     * indicates the fragment is the last in the Section
+     * <p>
+     * If this flag is true, then the end of the payload corresponds with a section boundary
+     * within the Message.
+     * </p>
+     */
     public void setLast(AmqpBoolean last);
 
     /**
@@ -113,6 +131,16 @@
      * is only permitted to change at section boundaries.
      * </p>
      */
+    public void setFormatCode(long formatCode);
+
+    /**
+     * indicates the format of the Message section
+     * <p>
+     * The format code indicates the format of the current section of the Message. A Message
+     * may have multiple sections, and therefore multiple format codes, however the format code
+     * is only permitted to change at section boundaries.
+     * </p>
+     */
     public void setFormatCode(AmqpUint formatCode);
 
     /**
@@ -165,239 +193,253 @@
         private AmqpUlong fragmentOffset;
         private AmqpBinary payload;
 
-        public AmqpFragmentBean() {
+        AmqpFragmentBean() {
         }
 
-        public AmqpFragmentBean(IAmqpList value) {
-            //TODO we should defer decoding of the described type:
-            for(int i = 0; i < value.getListCount(); i++) {
-                set(i, value.get(i));
-            }
-        }
+        AmqpFragmentBean(IAmqpList value) {
 
-        public AmqpFragmentBean(AmqpFragment.AmqpFragmentBean other) {
-            this.bean = other;
+        for(int i = 0; i < value.getListCount(); i++) {
+            set(i, value.get(i));
         }
+    }
 
-        public final AmqpFragmentBean copy() {
-            return new AmqpFragment.AmqpFragmentBean(bean);
-        }
+    AmqpFragmentBean(AmqpFragment.AmqpFragmentBean other) {
+        this.bean = other;
+    }
 
-        public final AmqpFragment.AmqpFragmentBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
-            if(buffer == null) {
-                buffer = new AmqpFragmentBuffer(marshaller.encode(this));
-            }
-            return buffer;
-        }
+    public final AmqpFragmentBean copy() {
+        return new AmqpFragment.AmqpFragmentBean(bean);
+    }
 
-        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
-            getBuffer(marshaller).marshal(out, marshaller);
+    public final AmqpFragment.AmqpFragmentBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+        if(buffer == null) {
+            buffer = new AmqpFragmentBuffer(marshaller.encode(this));
         }
+        return buffer;
+    }
 
+    public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+        getBuffer(marshaller).marshal(out, marshaller);
+    }
 
-        public void setFirst(Boolean first) {
-            setFirst(new AmqpBoolean.AmqpBooleanBean(first));
-        }
 
+    public void setFirst(Boolean first) {
+        setFirst(TypeFactory.createAmqpBoolean(first));
+    }
 
-        public final void setFirst(AmqpBoolean first) {
-            copyCheck();
-            bean.first = first;
-        }
 
-        public final Boolean getFirst() {
-            return bean.first.getValue();
-        }
+    public void setFirst(boolean first) {
+        setFirst(TypeFactory.createAmqpBoolean(first));
+    }
 
-        public void setLast(Boolean last) {
-            setLast(new AmqpBoolean.AmqpBooleanBean(last));
-        }
 
+    public final void setFirst(AmqpBoolean first) {
+        copyCheck();
+        bean.first = first;
+    }
 
-        public final void setLast(AmqpBoolean last) {
-            copyCheck();
-            bean.last = last;
-        }
+    public final Boolean getFirst() {
+        return bean.first.getValue();
+    }
 
-        public final Boolean getLast() {
-            return bean.last.getValue();
-        }
+    public void setLast(Boolean last) {
+        setLast(TypeFactory.createAmqpBoolean(last));
+    }
 
-        public void setFormatCode(Long formatCode) {
-            setFormatCode(new AmqpUint.AmqpUintBean(formatCode));
-        }
 
+    public void setLast(boolean last) {
+        setLast(TypeFactory.createAmqpBoolean(last));
+    }
 
-        public final void setFormatCode(AmqpUint formatCode) {
-            copyCheck();
-            bean.formatCode = formatCode;
-        }
 
-        public final Long getFormatCode() {
-            return bean.formatCode.getValue();
-        }
+    public final void setLast(AmqpBoolean last) {
+        copyCheck();
+        bean.last = last;
+    }
 
-        public void setFragmentOffset(BigInteger fragmentOffset) {
-            setFragmentOffset(new AmqpUlong.AmqpUlongBean(fragmentOffset));
-        }
+    public final Boolean getLast() {
+        return bean.last.getValue();
+    }
 
+    public void setFormatCode(Long formatCode) {
+        setFormatCode(TypeFactory.createAmqpUint(formatCode));
+    }
 
-        public final void setFragmentOffset(AmqpUlong fragmentOffset) {
-            copyCheck();
-            bean.fragmentOffset = fragmentOffset;
-        }
 
-        public final BigInteger getFragmentOffset() {
-            return bean.fragmentOffset.getValue();
-        }
+    public void setFormatCode(long formatCode) {
+        setFormatCode(TypeFactory.createAmqpUint(formatCode));
+    }
 
-        public void setPayload(Buffer payload) {
-            setPayload(new AmqpBinary.AmqpBinaryBean(payload));
-        }
 
+    public final void setFormatCode(AmqpUint formatCode) {
+        copyCheck();
+        bean.formatCode = formatCode;
+    }
 
-        public final void setPayload(AmqpBinary payload) {
-            copyCheck();
-            bean.payload = payload;
-        }
+    public final Long getFormatCode() {
+        return bean.formatCode.getValue();
+    }
 
-        public final Buffer getPayload() {
-            return bean.payload.getValue();
-        }
+    public void setFragmentOffset(BigInteger fragmentOffset) {
+        setFragmentOffset(TypeFactory.createAmqpUlong(fragmentOffset));
+    }
 
-        public void set(int index, AmqpType<?, ?> value) {
-            switch(index) {
-            case 0: {
-                setFirst((AmqpBoolean) value);
-                break;
-            }
-            case 1: {
-                setLast((AmqpBoolean) value);
-                break;
-            }
-            case 2: {
-                setFormatCode((AmqpUint) value);
-                break;
-            }
-            case 3: {
-                setFragmentOffset((AmqpUlong) value);
-                break;
-            }
-            case 4: {
-                setPayload((AmqpBinary) value);
-                break;
-            }
-            default : {
-                throw new IndexOutOfBoundsException(String.valueOf(index));
-            }
-            }
-        }
 
-        public AmqpType<?, ?> get(int index) {
-            switch(index) {
-            case 0: {
-                return bean.first;
-            }
-            case 1: {
-                return bean.last;
-            }
-            case 2: {
-                return bean.formatCode;
-            }
-            case 3: {
-                return bean.fragmentOffset;
-            }
-            case 4: {
-                return bean.payload;
-            }
-            default : {
-                throw new IndexOutOfBoundsException(String.valueOf(index));
-            }
-            }
-        }
+    public final void setFragmentOffset(AmqpUlong fragmentOffset) {
+        copyCheck();
+        bean.fragmentOffset = fragmentOffset;
+    }
 
-        public int getListCount() {
-            return 5;
-        }
+    public final BigInteger getFragmentOffset() {
+        return bean.fragmentOffset.getValue();
+    }
 
-        public IAmqpList getValue() {
-            return bean;
+    public void setPayload(Buffer payload) {
+        setPayload(TypeFactory.createAmqpBinary(payload));
+    }
+
+
+    public final void setPayload(AmqpBinary payload) {
+        copyCheck();
+        bean.payload = payload;
+    }
+
+    public final Buffer getPayload() {
+        return bean.payload.getValue();
+    }
+
+    public void set(int index, AmqpType<?, ?> value) {
+        switch(index) {
+        case 0: {
+            setFirst((AmqpBoolean) value);
+            break;
+        }
+        case 1: {
+            setLast((AmqpBoolean) value);
+            break;
+        }
+        case 2: {
+            setFormatCode((AmqpUint) value);
+            break;
+        }
+        case 3: {
+            setFragmentOffset((AmqpUlong) value);
+            break;
+        }
+        case 4: {
+            setPayload((AmqpBinary) value);
+            break;
+        }
+        default : {
+            throw new IndexOutOfBoundsException(String.valueOf(index));
+        }
         }
+    }
 
-        public Iterator<AmqpType<?, ?>> iterator() {
-            return new AmqpListIterator(bean);
+    public AmqpType<?, ?> get(int index) {
+        switch(index) {
+        case 0: {
+            return bean.first;
+        }
+        case 1: {
+            return bean.last;
         }
+        case 2: {
+            return bean.formatCode;
+        }
+        case 3: {
+            return bean.fragmentOffset;
+        }
+        case 4: {
+            return bean.payload;
+        }
+        default : {
+            throw new IndexOutOfBoundsException(String.valueOf(index));
+        }
+        }
+    }
 
+    public int getListCount() {
+        return 5;
+    }
+
+    public IAmqpList getValue() {
+        return bean;
+    }
+
+    public Iterator<AmqpType<?, ?>> iterator() {
+        return new AmqpListIterator(bean);
+    }
 
-        private final void copyCheck() {
-            if(buffer != null) {;
-                throw new IllegalStateException("unwriteable");
-            }
-            if(bean != this) {;
-                copy(bean);
-            }
-        }
 
-        private final void copy(AmqpFragment.AmqpFragmentBean other) {
-            this.first= other.first;
-            this.last= other.last;
-            this.formatCode= other.formatCode;
-            this.fragmentOffset= other.fragmentOffset;
-            this.payload= other.payload;
-            bean = this;
+    private final void copyCheck() {
+        if(buffer != null) {;
+            throw new IllegalStateException("unwriteable");
+        }
+        if(bean != this) {;
+            copy(bean);
         }
+    }
 
-        public boolean equivalent(AmqpType<?,?> t){
-            if(this == t) {
-                return true;
-            }
+    private final void copy(AmqpFragment.AmqpFragmentBean other) {
+        bean = this;
+    }
 
-            if(t == null || !(t instanceof AmqpFragment)) {
-                return false;
-            }
+    public boolean equals(Object o){
+        if(this == o) {
+            return true;
+        }
 
-            return equivalent((AmqpFragment) t);
+        if(o == null || !(o instanceof AmqpFragment)) {
+            return false;
         }
 
-        public boolean equivalent(AmqpFragment b) {
+        return equals((AmqpFragment) o);
+    }
 
-            if(b.getFirst() == null ^ getFirst() == null) {
-                return false;
-            }
-            if(b.getFirst() != null && !b.getFirst().equals(getFirst())){ 
-                return false;
-            }
+    public boolean equals(AmqpFragment b) {
 
-            if(b.getLast() == null ^ getLast() == null) {
-                return false;
-            }
-            if(b.getLast() != null && !b.getLast().equals(getLast())){ 
-                return false;
-            }
+        if(b.getFirst() == null ^ getFirst() == null) {
+            return false;
+        }
+        if(b.getFirst() != null && !b.getFirst().equals(getFirst())){ 
+            return false;
+        }
 
-            if(b.getFormatCode() == null ^ getFormatCode() == null) {
-                return false;
-            }
-            if(b.getFormatCode() != null && !b.getFormatCode().equals(getFormatCode())){ 
-                return false;
-            }
+        if(b.getLast() == null ^ getLast() == null) {
+            return false;
+        }
+        if(b.getLast() != null && !b.getLast().equals(getLast())){ 
+            return false;
+        }
 
-            if(b.getFragmentOffset() == null ^ getFragmentOffset() == null) {
-                return false;
-            }
-            if(b.getFragmentOffset() != null && !b.getFragmentOffset().equals(getFragmentOffset())){ 
-                return false;
-            }
+        if(b.getFormatCode() == null ^ getFormatCode() == null) {
+            return false;
+        }
+        if(b.getFormatCode() != null && !b.getFormatCode().equals(getFormatCode())){ 
+            return false;
+        }
 
-            if(b.getPayload() == null ^ getPayload() == null) {
-                return false;
-            }
-            if(b.getPayload() != null && !b.getPayload().equals(getPayload())){ 
-                return false;
-            }
-            return true;
+        if(b.getFragmentOffset() == null ^ getFragmentOffset() == null) {
+            return false;
+        }
+        if(b.getFragmentOffset() != null && !b.getFragmentOffset().equals(getFragmentOffset())){ 
+            return false;
+        }
+
+        if(b.getPayload() == null ^ getPayload() == null) {
+            return false;
         }
+        if(b.getPayload() != null && !b.getPayload().equals(getPayload())){ 
+            return false;
+        }
+        return true;
+    }
+
+    public int hashCode() {
+        return AbstractAmqpList.hashCodeFor(this);
     }
+}
 
     public static class AmqpFragmentBuffer extends AmqpList.AmqpListBuffer implements AmqpFragment{
 
@@ -407,10 +449,15 @@
             super(encoded);
         }
 
-    public void setFirst(Boolean first) {
+        public void setFirst(Boolean first) {
             bean().setFirst(first);
         }
 
+        public void setFirst(boolean first) {
+            bean().setFirst(first);
+        }
+
+
         public final void setFirst(AmqpBoolean first) {
             bean().setFirst(first);
         }
@@ -419,10 +466,15 @@
             return bean().getFirst();
         }
 
-    public void setLast(Boolean last) {
+        public void setLast(Boolean last) {
+            bean().setLast(last);
+        }
+
+        public void setLast(boolean last) {
             bean().setLast(last);
         }
 
+
         public final void setLast(AmqpBoolean last) {
             bean().setLast(last);
         }
@@ -431,10 +483,15 @@
             return bean().getLast();
         }
 
-    public void setFormatCode(Long formatCode) {
+        public void setFormatCode(Long formatCode) {
             bean().setFormatCode(formatCode);
         }
 
+        public void setFormatCode(long formatCode) {
+            bean().setFormatCode(formatCode);
+        }
+
+
         public final void setFormatCode(AmqpUint formatCode) {
             bean().setFormatCode(formatCode);
         }
@@ -443,7 +500,7 @@
             return bean().getFormatCode();
         }
 
-    public void setFragmentOffset(BigInteger fragmentOffset) {
+        public void setFragmentOffset(BigInteger fragmentOffset) {
             bean().setFragmentOffset(fragmentOffset);
         }
 
@@ -455,7 +512,7 @@
             return bean().getFragmentOffset();
         }
 
-    public void setPayload(Buffer payload) {
+        public void setPayload(Buffer payload) {
             bean().setPayload(payload);
         }
 
@@ -499,8 +556,16 @@
             return bean;
         }
 
-        public boolean equivalent(AmqpType<?, ?> t) {
-            return bean().equivalent(t);
+        public boolean equals(Object o){
+            return bean().equals(o);
+        }
+
+        public boolean equals(AmqpFragment o){
+            return bean().equals(o);
+        }
+
+        public int hashCode() {
+            return bean().hashCode();
         }
 
         public static AmqpFragment.AmqpFragmentBuffer create(Encoded<IAmqpList> encoded) {

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpHandle.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpHandle.java?rev=909224&r1=909223&r2=909224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpHandle.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpHandle.java Fri Feb 12 04:25:25 2010
@@ -45,14 +45,11 @@
         private AmqpHandleBean bean = this;
         private Long value;
 
-        protected AmqpHandleBean() {
-        }
-
-        public AmqpHandleBean(Long value) {
+        AmqpHandleBean(Long value) {
             this.value = value;
         }
 
-        public AmqpHandleBean(AmqpHandle.AmqpHandleBean other) {
+        AmqpHandleBean(AmqpHandle.AmqpHandleBean other) {
             this.bean = other;
         }
 
@@ -86,29 +83,10 @@
                 return false;
             }
 
-            return equivalent((AmqpHandle) o);
-        }
-
-        public int hashCode() {
-            if(getValue() == null) {
-                return AmqpHandle.AmqpHandleBean.class.hashCode();
-            }
-            return getValue().hashCode();
-        }
-
-        public boolean equivalent(AmqpType<?,?> t){
-            if(this == t) {
-                return true;
-            }
-
-            if(t == null || !(t instanceof AmqpHandle)) {
-                return false;
-            }
-
-            return equivalent((AmqpHandle) t);
+            return equals((AmqpHandle) o);
         }
 
-        public boolean equivalent(AmqpHandle b) {
+        public boolean equals(AmqpHandle b) {
             if(b == null) {
                 return false;
             }
@@ -119,6 +97,13 @@
 
             return b.getValue() == null || b.getValue().equals(getValue());
         }
+
+        public int hashCode() {
+            if(getValue() == null) {
+                return AmqpHandle.AmqpHandleBean.class.hashCode();
+            }
+            return getValue().hashCode();
+        }
     }
 
     public static class AmqpHandleBuffer extends AmqpUint.AmqpUintBuffer implements AmqpHandle{
@@ -149,8 +134,16 @@
             return bean;
         }
 
-        public boolean equivalent(AmqpType<?, ?> t) {
-            return bean().equivalent(t);
+        public boolean equals(Object o){
+            return bean().equals(o);
+        }
+
+        public boolean equals(AmqpHandle o){
+            return bean().equals(o);
+        }
+
+        public int hashCode() {
+            return bean().hashCode();
         }
 
         public static AmqpHandle.AmqpHandleBuffer create(Encoded<Long> encoded) {

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpHeader.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpHeader.java?rev=909224&r1=909223&r2=909224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpHeader.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpHeader.java Fri Feb 12 04:25:25 2010
@@ -58,6 +58,15 @@
      * restarted.
      * </p>
      */
+    public void setDurable(boolean durable);
+
+    /**
+     * specify durability requirements
+     * <p>
+     * Durable Messages MUST NOT be lost even if an intermediary is unexpectedly terminated and
+     * restarted.
+     * </p>
+     */
     public void setDurable(AmqpBoolean durable);
 
     /**
@@ -159,6 +168,52 @@
      * different priority levels where n > m.
      * </p>
      */
+    public void setPriority(short priority);
+
+    /**
+     * relative Message priority
+     * <p>
+     * This field contains the relative Message priority. Higher numbers indicate higher
+     * priority Messages. Messages with higher priorities MAY be delivered before those with
+     * lower priorities.
+     * </p>
+     * <p>
+     * An AMQP intermediary implementing distinct priority levels MUST do so in the following
+     * manner:
+     * </p>
+     * <ul>
+     * <li>
+     * <p>
+     * If n distinct priorities are implemented and n is less than 10 -- priorities 0 to
+     * (5 - ceiling(n/2)) MUST be treated equivalently and MUST be the lowest effective
+     * priority. The priorities (4 + floor(n/2)) and above MUST be treated equivalently
+     * and MUST be the highest effective priority. The priorities (5 - ceiling(n/2)) to (4
+     * + floor(n/2)) inclusive MUST be treated as distinct priorities.
+     * </p>
+     * <
+     * ></li>
+     * <li>
+     * <p>
+     * If n distinct priorities are implemented and n is 10 or greater -- priorities 0 to
+     * (n - 1) MUST be distinct, and priorities n and above MUST be equivalent to priority
+     * (n - 1).
+     * </p>
+     * <
+     * ></li>
+     * <
+     * ></ul>
+     * <p>
+     * Thus, for example, if 2 distinct priorities are implemented, then levels 0 to 4 are
+     * equivalent, and levels 5 to 9 are equivalent and levels 4 and 5 are distinct. If 3
+     * distinct priorities are implements the 0 to 3 are equivalent, 5 to 9 are equivalent and
+     * 3, 4 and 5 are distinct.
+     * </p>
+     * <p>
+     * This scheme ensures that if two priorities are distinct for a server which implements m
+     * separate priority levels they are also distinct for a server which implements n
+     * different priority levels where n > m.
+     * </p>
+     */
     public void setPriority(AmqpUbyte priority);
 
     /**
@@ -286,6 +341,15 @@
      * current Link has been previously attempted.
      * </p>
      */
+    public void setFormerAcquirers(long formerAcquirers);
+
+    /**
+     * <p>
+     * The number of other DESTRUCTIVE Links to which delivery of this Message was previously
+     * attempted unsuccessfully. This does not include the current Link even if delivery to the
+     * current Link has been previously attempted.
+     * </p>
+     */
     public void setFormerAcquirers(AmqpUint formerAcquirers);
 
     /**
@@ -343,6 +407,30 @@
      * </li>
      * </ol>
      */
+    public void setDeliveryFailures(long deliveryFailures);
+
+    /**
+     * the number of prior unsuccessful delivery attempts
+     * <p>
+     * The number of unsuccessful previous attempts to deliver this message. If this value is
+     * non-zero it may be taken as an indication that the Message may be a duplicate. The
+     * delivery-failures value is initially set to the same value as the Message has when it
+     * arrived at the source. It is incremented When:
+     * </p>
+     * <ol>
+     * <li>
+     * <p>
+     * the Message has previously been sent from this Node using a Source with a
+     * distribution-mode of DESTRUCTIVE which closed without the Message being acknowledged
+     * </p>
+     * </li>
+     * <li>
+     * <p>
+     * and the delivery-failed field set to true.
+     * </p>
+     * </li>
+     * </ol>
+     */
     public void setDeliveryFailures(AmqpUint deliveryFailures);
 
     /**
@@ -377,6 +465,11 @@
     /**
      * indicates the format of the Message
      */
+    public void setFormatCode(long formatCode);
+
+    /**
+     * indicates the format of the Message
+     */
     public void setFormatCode(AmqpUint formatCode);
 
     /**
@@ -434,345 +527,365 @@
         private AmqpMessageAttributes messageAttrs;
         private AmqpMessageAttributes deliveryAttrs;
 
-        public AmqpHeaderBean() {
+        AmqpHeaderBean() {
         }
 
-        public AmqpHeaderBean(IAmqpList value) {
-            //TODO we should defer decoding of the described type:
-            for(int i = 0; i < value.getListCount(); i++) {
-                set(i, value.get(i));
-            }
-        }
+        AmqpHeaderBean(IAmqpList value) {
 
-        public AmqpHeaderBean(AmqpHeader.AmqpHeaderBean other) {
-            this.bean = other;
+        for(int i = 0; i < value.getListCount(); i++) {
+            set(i, value.get(i));
         }
+    }
 
-        public final AmqpHeaderBean copy() {
-            return new AmqpHeader.AmqpHeaderBean(bean);
-        }
+    AmqpHeaderBean(AmqpHeader.AmqpHeaderBean other) {
+        this.bean = other;
+    }
 
-        public final AmqpHeader.AmqpHeaderBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
-            if(buffer == null) {
-                buffer = new AmqpHeaderBuffer(marshaller.encode(this));
-            }
-            return buffer;
-        }
+    public final AmqpHeaderBean copy() {
+        return new AmqpHeader.AmqpHeaderBean(bean);
+    }
 
-        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
-            getBuffer(marshaller).marshal(out, marshaller);
+    public final AmqpHeader.AmqpHeaderBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+        if(buffer == null) {
+            buffer = new AmqpHeaderBuffer(marshaller.encode(this));
         }
+        return buffer;
+    }
 
+    public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+        getBuffer(marshaller).marshal(out, marshaller);
+    }
 
-        public void setDurable(Boolean durable) {
-            setDurable(new AmqpBoolean.AmqpBooleanBean(durable));
-        }
 
+    public void setDurable(Boolean durable) {
+        setDurable(TypeFactory.createAmqpBoolean(durable));
+    }
 
-        public final void setDurable(AmqpBoolean durable) {
-            copyCheck();
-            bean.durable = durable;
-        }
 
-        public final Boolean getDurable() {
-            return bean.durable.getValue();
-        }
+    public void setDurable(boolean durable) {
+        setDurable(TypeFactory.createAmqpBoolean(durable));
+    }
 
-        public void setPriority(Short priority) {
-            setPriority(new AmqpUbyte.AmqpUbyteBean(priority));
-        }
 
+    public final void setDurable(AmqpBoolean durable) {
+        copyCheck();
+        bean.durable = durable;
+    }
 
-        public final void setPriority(AmqpUbyte priority) {
-            copyCheck();
-            bean.priority = priority;
-        }
+    public final Boolean getDurable() {
+        return bean.durable.getValue();
+    }
 
-        public final Short getPriority() {
-            return bean.priority.getValue();
-        }
+    public void setPriority(Short priority) {
+        setPriority(TypeFactory.createAmqpUbyte(priority));
+    }
 
-        public void setTransmitTime(Date transmitTime) {
-            setTransmitTime(new AmqpTimestamp.AmqpTimestampBean(transmitTime));
-        }
 
+    public void setPriority(short priority) {
+        setPriority(TypeFactory.createAmqpUbyte(priority));
+    }
 
-        public final void setTransmitTime(AmqpTimestamp transmitTime) {
-            copyCheck();
-            bean.transmitTime = transmitTime;
-        }
 
-        public final Date getTransmitTime() {
-            return bean.transmitTime.getValue();
-        }
+    public final void setPriority(AmqpUbyte priority) {
+        copyCheck();
+        bean.priority = priority;
+    }
 
-        public void setTtl(BigInteger ttl) {
-            setTtl(new AmqpUlong.AmqpUlongBean(ttl));
-        }
+    public final Short getPriority() {
+        return bean.priority.getValue();
+    }
 
+    public void setTransmitTime(Date transmitTime) {
+        setTransmitTime(TypeFactory.createAmqpTimestamp(transmitTime));
+    }
 
-        public final void setTtl(AmqpUlong ttl) {
-            copyCheck();
-            bean.ttl = ttl;
-        }
 
-        public final BigInteger getTtl() {
-            return bean.ttl.getValue();
-        }
+    public final void setTransmitTime(AmqpTimestamp transmitTime) {
+        copyCheck();
+        bean.transmitTime = transmitTime;
+    }
 
-        public void setFormerAcquirers(Long formerAcquirers) {
-            setFormerAcquirers(new AmqpUint.AmqpUintBean(formerAcquirers));
-        }
+    public final Date getTransmitTime() {
+        return bean.transmitTime.getValue();
+    }
 
+    public void setTtl(BigInteger ttl) {
+        setTtl(TypeFactory.createAmqpUlong(ttl));
+    }
 
-        public final void setFormerAcquirers(AmqpUint formerAcquirers) {
-            copyCheck();
-            bean.formerAcquirers = formerAcquirers;
-        }
 
-        public final Long getFormerAcquirers() {
-            return bean.formerAcquirers.getValue();
-        }
+    public final void setTtl(AmqpUlong ttl) {
+        copyCheck();
+        bean.ttl = ttl;
+    }
 
-        public void setDeliveryFailures(Long deliveryFailures) {
-            setDeliveryFailures(new AmqpUint.AmqpUintBean(deliveryFailures));
-        }
+    public final BigInteger getTtl() {
+        return bean.ttl.getValue();
+    }
 
+    public void setFormerAcquirers(Long formerAcquirers) {
+        setFormerAcquirers(TypeFactory.createAmqpUint(formerAcquirers));
+    }
 
-        public final void setDeliveryFailures(AmqpUint deliveryFailures) {
-            copyCheck();
-            bean.deliveryFailures = deliveryFailures;
-        }
 
-        public final Long getDeliveryFailures() {
-            return bean.deliveryFailures.getValue();
-        }
+    public void setFormerAcquirers(long formerAcquirers) {
+        setFormerAcquirers(TypeFactory.createAmqpUint(formerAcquirers));
+    }
 
-        public void setFormatCode(Long formatCode) {
-            setFormatCode(new AmqpUint.AmqpUintBean(formatCode));
-        }
 
+    public final void setFormerAcquirers(AmqpUint formerAcquirers) {
+        copyCheck();
+        bean.formerAcquirers = formerAcquirers;
+    }
 
-        public final void setFormatCode(AmqpUint formatCode) {
-            copyCheck();
-            bean.formatCode = formatCode;
-        }
+    public final Long getFormerAcquirers() {
+        return bean.formerAcquirers.getValue();
+    }
 
-        public final Long getFormatCode() {
-            return bean.formatCode.getValue();
-        }
+    public void setDeliveryFailures(Long deliveryFailures) {
+        setDeliveryFailures(TypeFactory.createAmqpUint(deliveryFailures));
+    }
 
-        public final void setMessageAttrs(AmqpMessageAttributes messageAttrs) {
-            copyCheck();
-            bean.messageAttrs = messageAttrs;
-        }
 
-        public final AmqpMessageAttributes getMessageAttrs() {
-            return bean.messageAttrs;
-        }
+    public void setDeliveryFailures(long deliveryFailures) {
+        setDeliveryFailures(TypeFactory.createAmqpUint(deliveryFailures));
+    }
 
-        public final void setDeliveryAttrs(AmqpMessageAttributes deliveryAttrs) {
-            copyCheck();
-            bean.deliveryAttrs = deliveryAttrs;
+
+    public final void setDeliveryFailures(AmqpUint deliveryFailures) {
+        copyCheck();
+        bean.deliveryFailures = deliveryFailures;
+    }
+
+    public final Long getDeliveryFailures() {
+        return bean.deliveryFailures.getValue();
+    }
+
+    public void setFormatCode(Long formatCode) {
+        setFormatCode(TypeFactory.createAmqpUint(formatCode));
+    }
+
+
+    public void setFormatCode(long formatCode) {
+        setFormatCode(TypeFactory.createAmqpUint(formatCode));
+    }
+
+
+    public final void setFormatCode(AmqpUint formatCode) {
+        copyCheck();
+        bean.formatCode = formatCode;
+    }
+
+    public final Long getFormatCode() {
+        return bean.formatCode.getValue();
+    }
+
+    public final void setMessageAttrs(AmqpMessageAttributes messageAttrs) {
+        copyCheck();
+        bean.messageAttrs = messageAttrs;
+    }
+
+    public final AmqpMessageAttributes getMessageAttrs() {
+        return bean.messageAttrs;
+    }
+
+    public final void setDeliveryAttrs(AmqpMessageAttributes deliveryAttrs) {
+        copyCheck();
+        bean.deliveryAttrs = deliveryAttrs;
+    }
+
+    public final AmqpMessageAttributes getDeliveryAttrs() {
+        return bean.deliveryAttrs;
+    }
+
+    public void set(int index, AmqpType<?, ?> value) {
+        switch(index) {
+        case 0: {
+            setDurable((AmqpBoolean) value);
+            break;
+        }
+        case 1: {
+            setPriority((AmqpUbyte) value);
+            break;
+        }
+        case 2: {
+            setTransmitTime((AmqpTimestamp) value);
+            break;
+        }
+        case 3: {
+            setTtl((AmqpUlong) value);
+            break;
+        }
+        case 4: {
+            setFormerAcquirers((AmqpUint) value);
+            break;
+        }
+        case 5: {
+            setDeliveryFailures((AmqpUint) value);
+            break;
+        }
+        case 6: {
+            setFormatCode((AmqpUint) value);
+            break;
+        }
+        case 7: {
+            setMessageAttrs((AmqpMessageAttributes) value);
+            break;
+        }
+        case 8: {
+            setDeliveryAttrs((AmqpMessageAttributes) value);
+            break;
+        }
+        default : {
+            throw new IndexOutOfBoundsException(String.valueOf(index));
         }
+        }
+    }
 
-        public final AmqpMessageAttributes getDeliveryAttrs() {
+    public AmqpType<?, ?> get(int index) {
+        switch(index) {
+        case 0: {
+            return bean.durable;
+        }
+        case 1: {
+            return bean.priority;
+        }
+        case 2: {
+            return bean.transmitTime;
+        }
+        case 3: {
+            return bean.ttl;
+        }
+        case 4: {
+            return bean.formerAcquirers;
+        }
+        case 5: {
+            return bean.deliveryFailures;
+        }
+        case 6: {
+            return bean.formatCode;
+        }
+        case 7: {
+            return bean.messageAttrs;
+        }
+        case 8: {
             return bean.deliveryAttrs;
         }
-
-        public void set(int index, AmqpType<?, ?> value) {
-            switch(index) {
-            case 0: {
-                setDurable((AmqpBoolean) value);
-                break;
-            }
-            case 1: {
-                setPriority((AmqpUbyte) value);
-                break;
-            }
-            case 2: {
-                setTransmitTime((AmqpTimestamp) value);
-                break;
-            }
-            case 3: {
-                setTtl((AmqpUlong) value);
-                break;
-            }
-            case 4: {
-                setFormerAcquirers((AmqpUint) value);
-                break;
-            }
-            case 5: {
-                setDeliveryFailures((AmqpUint) value);
-                break;
-            }
-            case 6: {
-                setFormatCode((AmqpUint) value);
-                break;
-            }
-            case 7: {
-                setMessageAttrs((AmqpMessageAttributes) value);
-                break;
-            }
-            case 8: {
-                setDeliveryAttrs((AmqpMessageAttributes) value);
-                break;
-            }
-            default : {
-                throw new IndexOutOfBoundsException(String.valueOf(index));
-            }
-            }
+        default : {
+            throw new IndexOutOfBoundsException(String.valueOf(index));
         }
-
-        public AmqpType<?, ?> get(int index) {
-            switch(index) {
-            case 0: {
-                return bean.durable;
-            }
-            case 1: {
-                return bean.priority;
-            }
-            case 2: {
-                return bean.transmitTime;
-            }
-            case 3: {
-                return bean.ttl;
-            }
-            case 4: {
-                return bean.formerAcquirers;
-            }
-            case 5: {
-                return bean.deliveryFailures;
-            }
-            case 6: {
-                return bean.formatCode;
-            }
-            case 7: {
-                return bean.messageAttrs;
-            }
-            case 8: {
-                return bean.deliveryAttrs;
-            }
-            default : {
-                throw new IndexOutOfBoundsException(String.valueOf(index));
-            }
-            }
         }
+    }
 
-        public int getListCount() {
-            return 9;
-        }
+    public int getListCount() {
+        return 9;
+    }
 
-        public IAmqpList getValue() {
-            return bean;
-        }
+    public IAmqpList getValue() {
+        return bean;
+    }
 
-        public Iterator<AmqpType<?, ?>> iterator() {
-            return new AmqpListIterator(bean);
-        }
+    public Iterator<AmqpType<?, ?>> iterator() {
+        return new AmqpListIterator(bean);
+    }
 
 
-        private final void copyCheck() {
-            if(buffer != null) {;
-                throw new IllegalStateException("unwriteable");
-            }
-            if(bean != this) {;
-                copy(bean);
-            }
+    private final void copyCheck() {
+        if(buffer != null) {;
+            throw new IllegalStateException("unwriteable");
         }
+        if(bean != this) {;
+            copy(bean);
+        }
+    }
 
-        private final void copy(AmqpHeader.AmqpHeaderBean other) {
-            this.durable= other.durable;
-            this.priority= other.priority;
-            this.transmitTime= other.transmitTime;
-            this.ttl= other.ttl;
-            this.formerAcquirers= other.formerAcquirers;
-            this.deliveryFailures= other.deliveryFailures;
-            this.formatCode= other.formatCode;
-            this.messageAttrs= other.messageAttrs;
-            this.deliveryAttrs= other.deliveryAttrs;
-            bean = this;
-        }
-
-        public boolean equivalent(AmqpType<?,?> t){
-            if(this == t) {
-                return true;
-            }
+    private final void copy(AmqpHeader.AmqpHeaderBean other) {
+        bean = this;
+    }
 
-            if(t == null || !(t instanceof AmqpHeader)) {
-                return false;
-            }
+    public boolean equals(Object o){
+        if(this == o) {
+            return true;
+        }
 
-            return equivalent((AmqpHeader) t);
+        if(o == null || !(o instanceof AmqpHeader)) {
+            return false;
         }
 
-        public boolean equivalent(AmqpHeader b) {
+        return equals((AmqpHeader) o);
+    }
 
-            if(b.getDurable() == null ^ getDurable() == null) {
-                return false;
-            }
-            if(b.getDurable() != null && !b.getDurable().equals(getDurable())){ 
-                return false;
-            }
+    public boolean equals(AmqpHeader b) {
 
-            if(b.getPriority() == null ^ getPriority() == null) {
-                return false;
-            }
-            if(b.getPriority() != null && !b.getPriority().equals(getPriority())){ 
-                return false;
-            }
+        if(b.getDurable() == null ^ getDurable() == null) {
+            return false;
+        }
+        if(b.getDurable() != null && !b.getDurable().equals(getDurable())){ 
+            return false;
+        }
 
-            if(b.getTransmitTime() == null ^ getTransmitTime() == null) {
-                return false;
-            }
-            if(b.getTransmitTime() != null && !b.getTransmitTime().equals(getTransmitTime())){ 
-                return false;
-            }
+        if(b.getPriority() == null ^ getPriority() == null) {
+            return false;
+        }
+        if(b.getPriority() != null && !b.getPriority().equals(getPriority())){ 
+            return false;
+        }
 
-            if(b.getTtl() == null ^ getTtl() == null) {
-                return false;
-            }
-            if(b.getTtl() != null && !b.getTtl().equals(getTtl())){ 
-                return false;
-            }
+        if(b.getTransmitTime() == null ^ getTransmitTime() == null) {
+            return false;
+        }
+        if(b.getTransmitTime() != null && !b.getTransmitTime().equals(getTransmitTime())){ 
+            return false;
+        }
 
-            if(b.getFormerAcquirers() == null ^ getFormerAcquirers() == null) {
-                return false;
-            }
-            if(b.getFormerAcquirers() != null && !b.getFormerAcquirers().equals(getFormerAcquirers())){ 
-                return false;
-            }
+        if(b.getTtl() == null ^ getTtl() == null) {
+            return false;
+        }
+        if(b.getTtl() != null && !b.getTtl().equals(getTtl())){ 
+            return false;
+        }
 
-            if(b.getDeliveryFailures() == null ^ getDeliveryFailures() == null) {
-                return false;
-            }
-            if(b.getDeliveryFailures() != null && !b.getDeliveryFailures().equals(getDeliveryFailures())){ 
-                return false;
-            }
+        if(b.getFormerAcquirers() == null ^ getFormerAcquirers() == null) {
+            return false;
+        }
+        if(b.getFormerAcquirers() != null && !b.getFormerAcquirers().equals(getFormerAcquirers())){ 
+            return false;
+        }
 
-            if(b.getFormatCode() == null ^ getFormatCode() == null) {
-                return false;
-            }
-            if(b.getFormatCode() != null && !b.getFormatCode().equals(getFormatCode())){ 
-                return false;
-            }
+        if(b.getDeliveryFailures() == null ^ getDeliveryFailures() == null) {
+            return false;
+        }
+        if(b.getDeliveryFailures() != null && !b.getDeliveryFailures().equals(getDeliveryFailures())){ 
+            return false;
+        }
 
-            if(b.getMessageAttrs() == null ^ getMessageAttrs() == null) {
-                return false;
-            }
-            if(b.getMessageAttrs() != null && !b.getMessageAttrs().equals(getMessageAttrs())){ 
-                return false;
-            }
+        if(b.getFormatCode() == null ^ getFormatCode() == null) {
+            return false;
+        }
+        if(b.getFormatCode() != null && !b.getFormatCode().equals(getFormatCode())){ 
+            return false;
+        }
 
-            if(b.getDeliveryAttrs() == null ^ getDeliveryAttrs() == null) {
-                return false;
-            }
-            if(b.getDeliveryAttrs() != null && !b.getDeliveryAttrs().equals(getDeliveryAttrs())){ 
-                return false;
-            }
-            return true;
+        if(b.getMessageAttrs() == null ^ getMessageAttrs() == null) {
+            return false;
+        }
+        if(b.getMessageAttrs() != null && !b.getMessageAttrs().equals(getMessageAttrs())){ 
+            return false;
+        }
+
+        if(b.getDeliveryAttrs() == null ^ getDeliveryAttrs() == null) {
+            return false;
         }
+        if(b.getDeliveryAttrs() != null && !b.getDeliveryAttrs().equals(getDeliveryAttrs())){ 
+            return false;
+        }
+        return true;
+    }
+
+    public int hashCode() {
+        return AbstractAmqpList.hashCodeFor(this);
     }
+}
 
     public static class AmqpHeaderBuffer extends AmqpList.AmqpListBuffer implements AmqpHeader{
 
@@ -782,10 +895,15 @@
             super(encoded);
         }
 
-    public void setDurable(Boolean durable) {
+        public void setDurable(Boolean durable) {
             bean().setDurable(durable);
         }
 
+        public void setDurable(boolean durable) {
+            bean().setDurable(durable);
+        }
+
+
         public final void setDurable(AmqpBoolean durable) {
             bean().setDurable(durable);
         }
@@ -794,10 +912,15 @@
             return bean().getDurable();
         }
 
-    public void setPriority(Short priority) {
+        public void setPriority(Short priority) {
             bean().setPriority(priority);
         }
 
+        public void setPriority(short priority) {
+            bean().setPriority(priority);
+        }
+
+
         public final void setPriority(AmqpUbyte priority) {
             bean().setPriority(priority);
         }
@@ -806,7 +929,7 @@
             return bean().getPriority();
         }
 
-    public void setTransmitTime(Date transmitTime) {
+        public void setTransmitTime(Date transmitTime) {
             bean().setTransmitTime(transmitTime);
         }
 
@@ -818,7 +941,7 @@
             return bean().getTransmitTime();
         }
 
-    public void setTtl(BigInteger ttl) {
+        public void setTtl(BigInteger ttl) {
             bean().setTtl(ttl);
         }
 
@@ -830,10 +953,15 @@
             return bean().getTtl();
         }
 
-    public void setFormerAcquirers(Long formerAcquirers) {
+        public void setFormerAcquirers(Long formerAcquirers) {
             bean().setFormerAcquirers(formerAcquirers);
         }
 
+        public void setFormerAcquirers(long formerAcquirers) {
+            bean().setFormerAcquirers(formerAcquirers);
+        }
+
+
         public final void setFormerAcquirers(AmqpUint formerAcquirers) {
             bean().setFormerAcquirers(formerAcquirers);
         }
@@ -842,10 +970,15 @@
             return bean().getFormerAcquirers();
         }
 
-    public void setDeliveryFailures(Long deliveryFailures) {
+        public void setDeliveryFailures(Long deliveryFailures) {
             bean().setDeliveryFailures(deliveryFailures);
         }
 
+        public void setDeliveryFailures(long deliveryFailures) {
+            bean().setDeliveryFailures(deliveryFailures);
+        }
+
+
         public final void setDeliveryFailures(AmqpUint deliveryFailures) {
             bean().setDeliveryFailures(deliveryFailures);
         }
@@ -854,10 +987,15 @@
             return bean().getDeliveryFailures();
         }
 
-    public void setFormatCode(Long formatCode) {
+        public void setFormatCode(Long formatCode) {
+            bean().setFormatCode(formatCode);
+        }
+
+        public void setFormatCode(long formatCode) {
             bean().setFormatCode(formatCode);
         }
 
+
         public final void setFormatCode(AmqpUint formatCode) {
             bean().setFormatCode(formatCode);
         }
@@ -914,8 +1052,16 @@
             return bean;
         }
 
-        public boolean equivalent(AmqpType<?, ?> t) {
-            return bean().equivalent(t);
+        public boolean equals(Object o){
+            return bean().equals(o);
+        }
+
+        public boolean equals(AmqpHeader o){
+            return bean().equals(o);
+        }
+
+        public int hashCode() {
+            return bean().hashCode();
         }
 
         public static AmqpHeader.AmqpHeaderBuffer create(Encoded<IAmqpList> encoded) {

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpInt.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpInt.java?rev=909224&r1=909223&r2=909224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpInt.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpInt.java Fri Feb 12 04:25:25 2010
@@ -39,14 +39,11 @@
         private AmqpIntBean bean = this;
         private Integer value;
 
-        protected AmqpIntBean() {
-        }
-
-        public AmqpIntBean(Integer value) {
+        AmqpIntBean(Integer value) {
             this.value = value;
         }
 
-        public AmqpIntBean(AmqpInt.AmqpIntBean other) {
+        AmqpIntBean(AmqpInt.AmqpIntBean other) {
             this.bean = other;
         }
 
@@ -80,29 +77,10 @@
                 return false;
             }
 
-            return equivalent((AmqpInt) o);
+            return equals((AmqpInt) o);
         }
 
-        public int hashCode() {
-            if(getValue() == null) {
-                return AmqpInt.AmqpIntBean.class.hashCode();
-            }
-            return getValue().hashCode();
-        }
-
-        public boolean equivalent(AmqpType<?,?> t){
-            if(this == t) {
-                return true;
-            }
-
-            if(t == null || !(t instanceof AmqpInt)) {
-                return false;
-            }
-
-            return equivalent((AmqpInt) t);
-        }
-
-        public boolean equivalent(AmqpInt b) {
+        public boolean equals(AmqpInt b) {
             if(b == null) {
                 return false;
             }
@@ -113,6 +91,13 @@
 
             return b.getValue() == null || b.getValue().equals(getValue());
         }
+
+        public int hashCode() {
+            if(getValue() == null) {
+                return AmqpInt.AmqpIntBean.class.hashCode();
+            }
+            return getValue().hashCode();
+        }
     }
 
     public static class AmqpIntBuffer implements AmqpInt, AmqpBuffer< Integer> {
@@ -155,12 +140,12 @@
             return bean().equals(o);
         }
 
-        public int hashCode() {
-            return bean().hashCode();
+        public boolean equals(AmqpInt o){
+            return bean().equals(o);
         }
 
-        public boolean equivalent(AmqpType<?, ?> t) {
-            return bean().equivalent(t);
+        public int hashCode() {
+            return bean().hashCode();
         }
 
         public static AmqpInt.AmqpIntBuffer create(Encoded<Integer> encoded) {



Mime
View raw message