activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmacn...@apache.org
Subject svn commit: r909224 [5/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/AmqpLink.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpLink.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/AmqpLink.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpLink.java Fri Feb 12 04:25:25 2010
@@ -21,7 +21,6 @@
 import java.io.IOException;
 import java.lang.String;
 import java.math.BigInteger;
-import java.util.HashMap;
 import java.util.Iterator;
 import org.apache.activemq.amqp.protocol.AmqpCommand;
 import org.apache.activemq.amqp.protocol.AmqpCommandHandler;
@@ -108,6 +107,42 @@
      * This field establishes the handle this endpoint will use to refer to the Link in all
      * subsequent outgoing commands.
      * </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>
+     * This field establishes the handle this endpoint will use to refer to the Link in all
+     * subsequent outgoing commands.
+     * </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>
+     * This field establishes the handle this endpoint will use to refer to the Link in all
+     * subsequent outgoing commands.
+     * </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);
 
@@ -117,6 +152,12 @@
      * This field establishes the handle this endpoint will use to refer to the Link in all
      * subsequent outgoing commands.
      * </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();
 
@@ -137,15 +178,6 @@
      * attached to the Link. A Link with no source will never produce outgoing Messages.
      * </p>
      */
-    public void setSource(HashMap<AmqpType<?,?>, AmqpType<?,?>> source);
-
-    /**
-     * the source for Messages
-     * <p>
-     * If no source is specified on an outgoing Link, then there is no source currently
-     * attached to the Link. A Link with no source will never produce outgoing Messages.
-     * </p>
-     */
     public void setSource(AmqpMap source);
 
     /**
@@ -155,16 +187,7 @@
      * attached to the Link. A Link with no source will never produce outgoing Messages.
      * </p>
      */
-    public HashMap<AmqpType<?,?>, AmqpType<?,?>> getSource();
-
-    /**
-     * the target for Messages
-     * <p>
-     * If no target is specified on an incoming Link, then there is no target currently
-     * attached to the Link. A Link with no target will never permit incoming Messages.
-     * </p>
-     */
-    public void setTarget(HashMap<AmqpType<?,?>, AmqpType<?,?>> target);
+    public IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> getSource();
 
     /**
      * the target for Messages
@@ -182,7 +205,7 @@
      * attached to the Link. A Link with no target will never permit incoming Messages.
      * </p>
      */
-    public HashMap<AmqpType<?,?>, AmqpType<?,?>> getTarget();
+    public IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> getTarget();
 
     /**
      * the transfer unit
@@ -306,6 +329,34 @@
      * non-default presumptive disposition.
      * </p>
      */
+    public void setResumeTag(Buffer resumeTag);
+
+    /**
+     * the suggested point to resume delivery
+     * <p>
+     * On resuming a link, both the outgoing and incoming endpoints may have retained state.
+     * The outgoing link endpoint may retain the state of deliveries that have not been
+     * finalized, and the incoming link endpoint may retain the state of deliveries that have
+     * not been settled. In this case the outgoing endpoint sets the resume-tag to the oldest
+     * non-finalized delivery, and the incoming endpoint sets the resume-tag to the newest
+     * unsettled delivery.
+     * </p>
+     * <p>
+     * If the outgoing endpoint sets the resume-tag then it MUST also set its barrier to the
+     * same value.
+     * </p>
+     * <p>
+     * If the resume-tag supplied by the incoming endpoint is among the non-finalized
+     * deliveries which the outgoing endpoint retains, then the outgoing endpoint MUST resume
+     * sending at the point after the delivery specified by the incoming resume-tag. Otherwise
+     * the outgoing endpoint MUST resume from the delivery indicated by the outgoing
+     * resume-tag.
+     * </p>
+     * <p>
+     * The default presumptive disposition MUST be restored before resending deliveries with a
+     * non-default presumptive disposition.
+     * </p>
+     */
     public void setResumeTag(AmqpDeliveryTag resumeTag);
 
     /**
@@ -350,341 +401,341 @@
         private AmqpUlong transferUnit;
         private AmqpDeliveryTag resumeTag;
 
-        public AmqpLinkBean() {
+        AmqpLinkBean() {
         }
 
-        public AmqpLinkBean(IAmqpList value) {
-            //TODO we should defer decoding of the described type:
-            for(int i = 0; i < value.getListCount(); i++) {
-                set(i, value.get(i));
-            }
-        }
+        AmqpLinkBean(IAmqpList value) {
 
-        public AmqpLinkBean(AmqpLink.AmqpLinkBean other) {
-            this.bean = other;
+        for(int i = 0; i < value.getListCount(); i++) {
+            set(i, value.get(i));
         }
+    }
 
-        public final AmqpLinkBean copy() {
-            return new AmqpLink.AmqpLinkBean(bean);
-        }
+    AmqpLinkBean(AmqpLink.AmqpLinkBean other) {
+        this.bean = other;
+    }
 
-        public final void handle(AmqpCommandHandler handler) throws Exception {
-            handler.handleLink(this);
-        }
+    public final AmqpLinkBean copy() {
+        return new AmqpLink.AmqpLinkBean(bean);
+    }
 
-        public final AmqpLink.AmqpLinkBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
-            if(buffer == null) {
-                buffer = new AmqpLinkBuffer(marshaller.encode(this));
-            }
-            return buffer;
-        }
+    public final void handle(AmqpCommandHandler handler) throws Exception {
+        handler.handleLink(this);
+    }
 
-        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
-            getBuffer(marshaller).marshal(out, marshaller);
+    public final AmqpLink.AmqpLinkBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+        if(buffer == null) {
+            buffer = new AmqpLinkBuffer(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 void setName(String name) {
-            setName(new AmqpString.AmqpStringBean(name));
-        }
+    public final AmqpOptions getOptions() {
+        return bean.options;
+    }
 
+    public void setName(String name) {
+        setName(TypeFactory.createAmqpString(name));
+    }
 
-        public final void setName(AmqpString name) {
-            copyCheck();
-            bean.name = name;
-        }
 
-        public final String getName() {
-            return bean.name.getValue();
-        }
+    public final void setName(AmqpString name) {
+        copyCheck();
+        bean.name = name;
+    }
 
-        public final void setScope(AmqpScope scope) {
-            copyCheck();
-            bean.scope = scope;
-        }
+    public final String getName() {
+        return bean.name.getValue();
+    }
 
-        public final AmqpScope getScope() {
-            return bean.scope;
-        }
+    public final void setScope(AmqpScope scope) {
+        copyCheck();
+        bean.scope = scope;
+    }
 
-        public final void setHandle(AmqpHandle handle) {
-            copyCheck();
-            bean.handle = handle;
-        }
+    public final AmqpScope getScope() {
+        return bean.scope;
+    }
 
-        public final AmqpHandle getHandle() {
-            return bean.handle;
-        }
+    public void setHandle(Long handle) {
+        setHandle(TypeFactory.createAmqpHandle(handle));
+    }
 
-        public final void setDirection(AmqpDirection direction) {
-            copyCheck();
-            bean.direction = direction;
-        }
 
-        public final AmqpDirection getDirection() {
-            return bean.direction;
-        }
+    public void setHandle(long handle) {
+        setHandle(TypeFactory.createAmqpHandle(handle));
+    }
 
-        public void setSource(HashMap<AmqpType<?,?>, AmqpType<?,?>> source) {
-            setSource(new AmqpMap.AmqpMapBean(source));
-        }
 
+    public final void setHandle(AmqpHandle handle) {
+        copyCheck();
+        bean.handle = handle;
+    }
 
-        public final void setSource(AmqpMap source) {
-            copyCheck();
-            bean.source = source;
-        }
+    public final AmqpHandle getHandle() {
+        return bean.handle;
+    }
 
-        public final HashMap<AmqpType<?,?>, AmqpType<?,?>> getSource() {
-            return bean.source.getValue();
-        }
+    public final void setDirection(AmqpDirection direction) {
+        copyCheck();
+        bean.direction = direction;
+    }
 
-        public void setTarget(HashMap<AmqpType<?,?>, AmqpType<?,?>> target) {
-            setTarget(new AmqpMap.AmqpMapBean(target));
-        }
+    public final AmqpDirection getDirection() {
+        return bean.direction;
+    }
 
+    public final void setSource(AmqpMap source) {
+        copyCheck();
+        bean.source = source;
+    }
 
-        public final void setTarget(AmqpMap target) {
-            copyCheck();
-            bean.target = target;
-        }
+    public final IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> getSource() {
+        return bean.source.getValue();
+    }
 
-        public final HashMap<AmqpType<?,?>, AmqpType<?,?>> getTarget() {
-            return bean.target.getValue();
-        }
+    public final void setTarget(AmqpMap target) {
+        copyCheck();
+        bean.target = target;
+    }
 
-        public void setTransferUnit(BigInteger transferUnit) {
-            setTransferUnit(new AmqpUlong.AmqpUlongBean(transferUnit));
-        }
+    public final IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> getTarget() {
+        return bean.target.getValue();
+    }
 
+    public void setTransferUnit(BigInteger transferUnit) {
+        setTransferUnit(TypeFactory.createAmqpUlong(transferUnit));
+    }
 
-        public final void setTransferUnit(AmqpUlong transferUnit) {
-            copyCheck();
-            bean.transferUnit = transferUnit;
-        }
 
-        public final BigInteger getTransferUnit() {
-            return bean.transferUnit.getValue();
-        }
+    public final void setTransferUnit(AmqpUlong transferUnit) {
+        copyCheck();
+        bean.transferUnit = transferUnit;
+    }
 
-        public final void setResumeTag(AmqpDeliveryTag resumeTag) {
-            copyCheck();
-            bean.resumeTag = resumeTag;
-        }
+    public final BigInteger getTransferUnit() {
+        return bean.transferUnit.getValue();
+    }
 
-        public final AmqpDeliveryTag getResumeTag() {
-            return bean.resumeTag;
-        }
+    public void setResumeTag(Buffer resumeTag) {
+        setResumeTag(TypeFactory.createAmqpDeliveryTag(resumeTag));
+    }
 
-        public void set(int index, AmqpType<?, ?> value) {
-            switch(index) {
-            case 0: {
-                setOptions((AmqpOptions) value);
-                break;
-            }
-            case 1: {
-                setName((AmqpString) value);
-                break;
-            }
-            case 2: {
-                setScope(AmqpScope.get((AmqpUbyte)value));
-                break;
-            }
-            case 3: {
-                setHandle((AmqpHandle) value);
-                break;
-            }
-            case 4: {
-                setDirection(AmqpDirection.get((AmqpUbyte)value));
-                break;
-            }
-            case 5: {
-                setSource((AmqpMap) value);
-                break;
-            }
-            case 6: {
-                setTarget((AmqpMap) value);
-                break;
-            }
-            case 7: {
-                setTransferUnit((AmqpUlong) value);
-                break;
-            }
-            case 8: {
-                setResumeTag((AmqpDeliveryTag) value);
-                break;
-            }
-            default : {
-                throw new IndexOutOfBoundsException(String.valueOf(index));
-            }
-            }
+
+    public final void setResumeTag(AmqpDeliveryTag resumeTag) {
+        copyCheck();
+        bean.resumeTag = resumeTag;
+    }
+
+    public final AmqpDeliveryTag getResumeTag() {
+        return bean.resumeTag;
+    }
+
+    public void set(int index, AmqpType<?, ?> value) {
+        switch(index) {
+        case 0: {
+            setOptions((AmqpOptions) value);
+            break;
+        }
+        case 1: {
+            setName((AmqpString) value);
+            break;
+        }
+        case 2: {
+            setScope(AmqpScope.get((AmqpUbyte)value));
+            break;
+        }
+        case 3: {
+            setHandle((AmqpHandle) value);
+            break;
+        }
+        case 4: {
+            setDirection(AmqpDirection.get((AmqpUbyte)value));
+            break;
+        }
+        case 5: {
+            setSource((AmqpMap) value);
+            break;
+        }
+        case 6: {
+            setTarget((AmqpMap) value);
+            break;
+        }
+        case 7: {
+            setTransferUnit((AmqpUlong) value);
+            break;
+        }
+        case 8: {
+            setResumeTag((AmqpDeliveryTag) value);
+            break;
+        }
+        default : {
+            throw new IndexOutOfBoundsException(String.valueOf(index));
         }
+        }
+    }
 
-        public AmqpType<?, ?> get(int index) {
-            switch(index) {
-            case 0: {
-                return bean.options;
-            }
-            case 1: {
-                return bean.name;
-            }
-            case 2: {
-                if(scope == null) {
-                    return null;
-                }
-                return scope.getValue();
-            }
-            case 3: {
-                return bean.handle;
-            }
-            case 4: {
-                if(direction == null) {
-                    return null;
-                }
-                return direction.getValue();
-            }
-            case 5: {
-                return bean.source;
-            }
-            case 6: {
-                return bean.target;
-            }
-            case 7: {
-                return bean.transferUnit;
-            }
-            case 8: {
-                return bean.resumeTag;
-            }
-            default : {
-                throw new IndexOutOfBoundsException(String.valueOf(index));
+    public AmqpType<?, ?> get(int index) {
+        switch(index) {
+        case 0: {
+            return bean.options;
+        }
+        case 1: {
+            return bean.name;
+        }
+        case 2: {
+            if(scope == null) {
+                return null;
             }
+            return scope.getValue();
+        }
+        case 3: {
+            return bean.handle;
+        }
+        case 4: {
+            if(direction == null) {
+                return null;
             }
+            return direction.getValue();
         }
-
-        public int getListCount() {
-            return 9;
+        case 5: {
+            return bean.source;
         }
-
-        public IAmqpList getValue() {
-            return bean;
+        case 6: {
+            return bean.target;
         }
-
-        public Iterator<AmqpType<?, ?>> iterator() {
-            return new AmqpListIterator(bean);
+        case 7: {
+            return bean.transferUnit;
+        }
+        case 8: {
+            return bean.resumeTag;
+        }
+        default : {
+            throw new IndexOutOfBoundsException(String.valueOf(index));
         }
+        }
+    }
 
+    public int getListCount() {
+        return 9;
+    }
 
-        private final void copyCheck() {
-            if(buffer != null) {;
-                throw new IllegalStateException("unwriteable");
-            }
-            if(bean != this) {;
-                copy(bean);
-            }
+    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(AmqpLink.AmqpLinkBean other) {
-            this.options= other.options;
-            this.name= other.name;
-            this.scope= other.scope;
-            this.handle= other.handle;
-            this.direction= other.direction;
-            this.source= other.source;
-            this.target= other.target;
-            this.transferUnit= other.transferUnit;
-            this.resumeTag= other.resumeTag;
-            bean = this;
-        }
-
-        public boolean equivalent(AmqpType<?,?> t){
-            if(this == t) {
-                return true;
-            }
+    private final void copy(AmqpLink.AmqpLinkBean other) {
+        bean = this;
+    }
 
-            if(t == null || !(t instanceof AmqpLink)) {
-                return false;
-            }
+    public boolean equals(Object o){
+        if(this == o) {
+            return true;
+        }
 
-            return equivalent((AmqpLink) t);
+        if(o == null || !(o instanceof AmqpLink)) {
+            return false;
         }
 
-        public boolean equivalent(AmqpLink b) {
+        return equals((AmqpLink) o);
+    }
 
-            if(b.getOptions() == null ^ getOptions() == null) {
-                return false;
-            }
-            if(b.getOptions() != null && !b.getOptions().equals(getOptions())){ 
-                return false;
-            }
+    public boolean equals(AmqpLink b) {
 
-            if(b.getName() == null ^ getName() == null) {
-                return false;
-            }
-            if(b.getName() != null && !b.getName().equals(getName())){ 
-                return false;
-            }
+        if(b.getOptions() == null ^ getOptions() == null) {
+            return false;
+        }
+        if(b.getOptions() != null && !b.getOptions().equals(getOptions())){ 
+            return false;
+        }
 
-            if(b.getScope() == null ^ getScope() == null) {
-                return false;
-            }
-            if(b.getScope() != null && !b.getScope().equals(getScope())){ 
-                return false;
-            }
+        if(b.getName() == null ^ getName() == null) {
+            return false;
+        }
+        if(b.getName() != null && !b.getName().equals(getName())){ 
+            return false;
+        }
 
-            if(b.getHandle() == null ^ getHandle() == null) {
-                return false;
-            }
-            if(b.getHandle() != null && !b.getHandle().equals(getHandle())){ 
-                return false;
-            }
+        if(b.getScope() == null ^ getScope() == null) {
+            return false;
+        }
+        if(b.getScope() != null && !b.getScope().equals(getScope())){ 
+            return false;
+        }
 
-            if(b.getDirection() == null ^ getDirection() == null) {
-                return false;
-            }
-            if(b.getDirection() != null && !b.getDirection().equals(getDirection())){ 
-                return false;
-            }
+        if(b.getHandle() == null ^ getHandle() == null) {
+            return false;
+        }
+        if(b.getHandle() != null && !b.getHandle().equals(getHandle())){ 
+            return false;
+        }
 
-            if(b.getSource() == null ^ getSource() == null) {
-                return false;
-            }
-            if(b.getSource() != null && !b.getSource().equals(getSource())){ 
-                return false;
-            }
+        if(b.getDirection() == null ^ getDirection() == null) {
+            return false;
+        }
+        if(b.getDirection() != null && !b.getDirection().equals(getDirection())){ 
+            return false;
+        }
 
-            if(b.getTarget() == null ^ getTarget() == null) {
-                return false;
-            }
-            if(b.getTarget() != null && !b.getTarget().equals(getTarget())){ 
-                return false;
-            }
+        if(b.getSource() == null ^ getSource() == null) {
+            return false;
+        }
+        if(b.getSource() != null && !b.getSource().equals(getSource())){ 
+            return false;
+        }
 
-            if(b.getTransferUnit() == null ^ getTransferUnit() == null) {
-                return false;
-            }
-            if(b.getTransferUnit() != null && !b.getTransferUnit().equals(getTransferUnit())){ 
-                return false;
-            }
+        if(b.getTarget() == null ^ getTarget() == null) {
+            return false;
+        }
+        if(b.getTarget() != null && !b.getTarget().equals(getTarget())){ 
+            return false;
+        }
 
-            if(b.getResumeTag() == null ^ getResumeTag() == null) {
-                return false;
-            }
-            if(b.getResumeTag() != null && !b.getResumeTag().equals(getResumeTag())){ 
-                return false;
-            }
-            return true;
+        if(b.getTransferUnit() == null ^ getTransferUnit() == null) {
+            return false;
+        }
+        if(b.getTransferUnit() != null && !b.getTransferUnit().equals(getTransferUnit())){ 
+            return false;
         }
+
+        if(b.getResumeTag() == null ^ getResumeTag() == null) {
+            return false;
+        }
+        if(b.getResumeTag() != null && !b.getResumeTag().equals(getResumeTag())){ 
+            return false;
+        }
+        return true;
     }
 
+    public int hashCode() {
+        return AbstractAmqpList.hashCodeFor(this);
+    }
+}
+
     public static class AmqpLinkBuffer extends AmqpList.AmqpListBuffer implements AmqpLink{
 
         private AmqpLinkBean bean;
@@ -701,7 +752,7 @@
             return bean().getOptions();
         }
 
-    public void setName(String name) {
+        public void setName(String name) {
             bean().setName(name);
         }
 
@@ -721,6 +772,15 @@
             return bean().getScope();
         }
 
+        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);
         }
@@ -737,31 +797,23 @@
             return bean().getDirection();
         }
 
-    public void setSource(HashMap<AmqpType<?,?>, AmqpType<?,?>> source) {
-            bean().setSource(source);
-        }
-
         public final void setSource(AmqpMap source) {
             bean().setSource(source);
         }
 
-        public final HashMap<AmqpType<?,?>, AmqpType<?,?>> getSource() {
+        public final IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> getSource() {
             return bean().getSource();
         }
 
-    public void setTarget(HashMap<AmqpType<?,?>, AmqpType<?,?>> target) {
-            bean().setTarget(target);
-        }
-
         public final void setTarget(AmqpMap target) {
             bean().setTarget(target);
         }
 
-        public final HashMap<AmqpType<?,?>, AmqpType<?,?>> getTarget() {
+        public final IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> getTarget() {
             return bean().getTarget();
         }
 
-    public void setTransferUnit(BigInteger transferUnit) {
+        public void setTransferUnit(BigInteger transferUnit) {
             bean().setTransferUnit(transferUnit);
         }
 
@@ -773,6 +825,10 @@
             return bean().getTransferUnit();
         }
 
+        public void setResumeTag(Buffer resumeTag) {
+            bean().setResumeTag(resumeTag);
+        }
+
         public final void setResumeTag(AmqpDeliveryTag resumeTag) {
             bean().setResumeTag(resumeTag);
         }
@@ -817,8 +873,16 @@
             handler.handleLink(this);
         }
 
-        public boolean equivalent(AmqpType<?, ?> t) {
-            return bean().equivalent(t);
+        public boolean equals(Object o){
+            return bean().equals(o);
+        }
+
+        public boolean equals(AmqpLink o){
+            return bean().equals(o);
+        }
+
+        public int hashCode() {
+            return bean().hashCode();
         }
 
         public static AmqpLink.AmqpLinkBuffer create(Encoded<IAmqpList> encoded) {

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpLinkError.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpLinkError.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/AmqpLinkError.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpLinkError.java Fri Feb 12 04:25:25 2010
@@ -20,7 +20,6 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.lang.String;
-import java.util.HashMap;
 import java.util.Iterator;
 import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
 import org.apache.activemq.amqp.protocol.marshaller.AmqpMarshaller;
@@ -84,17 +83,12 @@
     /**
      * map to carry additional information about the error
      */
-    public void setErrorInfo(HashMap<AmqpType<?,?>, AmqpType<?,?>> errorInfo);
-
-    /**
-     * map to carry additional information about the error
-     */
     public void setErrorInfo(AmqpMap errorInfo);
 
     /**
      * map to carry additional information about the error
      */
-    public HashMap<AmqpType<?,?>, AmqpType<?,?>> getErrorInfo();
+    public IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> getErrorInfo();
 
     public static class AmqpLinkErrorBean implements AmqpLinkError{
 
@@ -104,179 +98,175 @@
         private AmqpString description;
         private AmqpMap errorInfo;
 
-        public AmqpLinkErrorBean() {
+        AmqpLinkErrorBean() {
         }
 
-        public AmqpLinkErrorBean(IAmqpList value) {
-            //TODO we should defer decoding of the described type:
-            for(int i = 0; i < value.getListCount(); i++) {
-                set(i, value.get(i));
-            }
-        }
+        AmqpLinkErrorBean(IAmqpList value) {
 
-        public AmqpLinkErrorBean(AmqpLinkError.AmqpLinkErrorBean other) {
-            this.bean = other;
+        for(int i = 0; i < value.getListCount(); i++) {
+            set(i, value.get(i));
         }
+    }
 
-        public final AmqpLinkErrorBean copy() {
-            return new AmqpLinkError.AmqpLinkErrorBean(bean);
-        }
+    AmqpLinkErrorBean(AmqpLinkError.AmqpLinkErrorBean other) {
+        this.bean = other;
+    }
 
-        public final AmqpLinkError.AmqpLinkErrorBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
-            if(buffer == null) {
-                buffer = new AmqpLinkErrorBuffer(marshaller.encode(this));
-            }
-            return buffer;
-        }
+    public final AmqpLinkErrorBean copy() {
+        return new AmqpLinkError.AmqpLinkErrorBean(bean);
+    }
 
-        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
-            getBuffer(marshaller).marshal(out, marshaller);
+    public final AmqpLinkError.AmqpLinkErrorBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+        if(buffer == null) {
+            buffer = new AmqpLinkErrorBuffer(marshaller.encode(this));
         }
+        return buffer;
+    }
 
+    public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+        getBuffer(marshaller).marshal(out, marshaller);
+    }
 
-        public final void setErrorCode(AmqpLinkErrorCode errorCode) {
-            copyCheck();
-            bean.errorCode = errorCode;
-        }
 
-        public final AmqpLinkErrorCode getErrorCode() {
-            return bean.errorCode;
-        }
+    public final void setErrorCode(AmqpLinkErrorCode errorCode) {
+        copyCheck();
+        bean.errorCode = errorCode;
+    }
 
-        public void setDescription(String description) {
-            setDescription(new AmqpString.AmqpStringBean(description));
-        }
+    public final AmqpLinkErrorCode getErrorCode() {
+        return bean.errorCode;
+    }
 
+    public void setDescription(String description) {
+        setDescription(TypeFactory.createAmqpString(description));
+    }
 
-        public final void setDescription(AmqpString description) {
-            copyCheck();
-            bean.description = description;
-        }
 
-        public final String getDescription() {
-            return bean.description.getValue();
-        }
+    public final void setDescription(AmqpString description) {
+        copyCheck();
+        bean.description = description;
+    }
 
-        public void setErrorInfo(HashMap<AmqpType<?,?>, AmqpType<?,?>> errorInfo) {
-            setErrorInfo(new AmqpMap.AmqpMapBean(errorInfo));
-        }
+    public final String getDescription() {
+        return bean.description.getValue();
+    }
 
+    public final void setErrorInfo(AmqpMap errorInfo) {
+        copyCheck();
+        bean.errorInfo = errorInfo;
+    }
 
-        public final void setErrorInfo(AmqpMap errorInfo) {
-            copyCheck();
-            bean.errorInfo = errorInfo;
-        }
+    public final IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> getErrorInfo() {
+        return bean.errorInfo.getValue();
+    }
 
-        public final HashMap<AmqpType<?,?>, AmqpType<?,?>> getErrorInfo() {
-            return bean.errorInfo.getValue();
+    public void set(int index, AmqpType<?, ?> value) {
+        switch(index) {
+        case 0: {
+            setErrorCode(AmqpLinkErrorCode.get((AmqpUshort)value));
+            break;
+        }
+        case 1: {
+            setDescription((AmqpString) value);
+            break;
+        }
+        case 2: {
+            setErrorInfo((AmqpMap) value);
+            break;
+        }
+        default : {
+            throw new IndexOutOfBoundsException(String.valueOf(index));
         }
-
-        public void set(int index, AmqpType<?, ?> value) {
-            switch(index) {
-            case 0: {
-                setErrorCode(AmqpLinkErrorCode.get((AmqpUshort)value));
-                break;
-            }
-            case 1: {
-                setDescription((AmqpString) value);
-                break;
-            }
-            case 2: {
-                setErrorInfo((AmqpMap) value);
-                break;
-            }
-            default : {
-                throw new IndexOutOfBoundsException(String.valueOf(index));
-            }
-            }
         }
+    }
 
-        public AmqpType<?, ?> get(int index) {
-            switch(index) {
-            case 0: {
-                if(errorCode == null) {
-                    return null;
-                }
-                return errorCode.getValue();
-            }
-            case 1: {
-                return bean.description;
-            }
-            case 2: {
-                return bean.errorInfo;
-            }
-            default : {
-                throw new IndexOutOfBoundsException(String.valueOf(index));
-            }
+    public AmqpType<?, ?> get(int index) {
+        switch(index) {
+        case 0: {
+            if(errorCode == null) {
+                return null;
             }
+            return errorCode.getValue();
         }
-
-        public int getListCount() {
-            return 3;
+        case 1: {
+            return bean.description;
         }
-
-        public IAmqpList getValue() {
-            return bean;
+        case 2: {
+            return bean.errorInfo;
         }
-
-        public Iterator<AmqpType<?, ?>> iterator() {
-            return new AmqpListIterator(bean);
+        default : {
+            throw new IndexOutOfBoundsException(String.valueOf(index));
         }
+        }
+    }
 
+    public int getListCount() {
+        return 3;
+    }
 
-        private final void copyCheck() {
-            if(buffer != null) {;
-                throw new IllegalStateException("unwriteable");
-            }
-            if(bean != this) {;
-                copy(bean);
-            }
-        }
+    public IAmqpList getValue() {
+        return bean;
+    }
+
+    public Iterator<AmqpType<?, ?>> iterator() {
+        return new AmqpListIterator(bean);
+    }
 
-        private final void copy(AmqpLinkError.AmqpLinkErrorBean other) {
-            this.errorCode= other.errorCode;
-            this.description= other.description;
-            this.errorInfo= other.errorInfo;
-            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(AmqpLinkError.AmqpLinkErrorBean other) {
+        bean = this;
+    }
 
-            if(t == null || !(t instanceof AmqpLinkError)) {
-                return false;
-            }
+    public boolean equals(Object o){
+        if(this == o) {
+            return true;
+        }
 
-            return equivalent((AmqpLinkError) t);
+        if(o == null || !(o instanceof AmqpLinkError)) {
+            return false;
         }
 
-        public boolean equivalent(AmqpLinkError b) {
+        return equals((AmqpLinkError) o);
+    }
 
-            if(b.getErrorCode() == null ^ getErrorCode() == null) {
-                return false;
-            }
-            if(b.getErrorCode() != null && !b.getErrorCode().equals(getErrorCode())){ 
-                return false;
-            }
+    public boolean equals(AmqpLinkError b) {
 
-            if(b.getDescription() == null ^ getDescription() == null) {
-                return false;
-            }
-            if(b.getDescription() != null && !b.getDescription().equals(getDescription())){ 
-                return false;
-            }
+        if(b.getErrorCode() == null ^ getErrorCode() == null) {
+            return false;
+        }
+        if(b.getErrorCode() != null && !b.getErrorCode().equals(getErrorCode())){ 
+            return false;
+        }
 
-            if(b.getErrorInfo() == null ^ getErrorInfo() == null) {
-                return false;
-            }
-            if(b.getErrorInfo() != null && !b.getErrorInfo().equals(getErrorInfo())){ 
-                return false;
-            }
-            return true;
+        if(b.getDescription() == null ^ getDescription() == null) {
+            return false;
+        }
+        if(b.getDescription() != null && !b.getDescription().equals(getDescription())){ 
+            return false;
+        }
+
+        if(b.getErrorInfo() == null ^ getErrorInfo() == null) {
+            return false;
         }
+        if(b.getErrorInfo() != null && !b.getErrorInfo().equals(getErrorInfo())){ 
+            return false;
+        }
+        return true;
+    }
+
+    public int hashCode() {
+        return AbstractAmqpList.hashCodeFor(this);
     }
+}
 
     public static class AmqpLinkErrorBuffer extends AmqpList.AmqpListBuffer implements AmqpLinkError{
 
@@ -294,7 +284,7 @@
             return bean().getErrorCode();
         }
 
-    public void setDescription(String description) {
+        public void setDescription(String description) {
             bean().setDescription(description);
         }
 
@@ -306,15 +296,11 @@
             return bean().getDescription();
         }
 
-    public void setErrorInfo(HashMap<AmqpType<?,?>, AmqpType<?,?>> errorInfo) {
-            bean().setErrorInfo(errorInfo);
-        }
-
         public final void setErrorInfo(AmqpMap errorInfo) {
             bean().setErrorInfo(errorInfo);
         }
 
-        public final HashMap<AmqpType<?,?>, AmqpType<?,?>> getErrorInfo() {
+        public final IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> getErrorInfo() {
             return bean().getErrorInfo();
         }
 
@@ -350,8 +336,16 @@
             return bean;
         }
 
-        public boolean equivalent(AmqpType<?, ?> t) {
-            return bean().equivalent(t);
+        public boolean equals(Object o){
+            return bean().equals(o);
+        }
+
+        public boolean equals(AmqpLinkError o){
+            return bean().equals(o);
+        }
+
+        public int hashCode() {
+            return bean().hashCode();
         }
 
         public static AmqpLinkError.AmqpLinkErrorBuffer create(Encoded<IAmqpList> encoded) {

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpList.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpList.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/AmqpList.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpList.java Fri Feb 12 04:25:25 2010
@@ -19,6 +19,7 @@
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Iterator;
 import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
 import org.apache.activemq.amqp.protocol.marshaller.AmqpMarshaller;
@@ -31,6 +32,9 @@
  */
 public interface AmqpList extends AmqpType<AmqpList.AmqpListBean, AmqpList.AmqpListBuffer>, IAmqpList {
 
+    /**
+     * Represents a a sequence of polymorphic values
+     */
     public void set(int index, AmqpType<?, ?> value);
     public AmqpType<?, ?> get(int index);
     public int getListCount();
@@ -43,14 +47,15 @@
         private AmqpListBean bean = this;
         private IAmqpList value;
 
-        protected AmqpListBean() {
+        AmqpListBean() {
+            this.value = new IAmqpList.AmqpWrapperList(new ArrayList<AmqpType<?,?>>());
         }
 
-        public AmqpListBean(IAmqpList value) {
+        AmqpListBean(IAmqpList value) {
             this.value = value;
         }
 
-        public AmqpListBean(AmqpList.AmqpListBean other) {
+        AmqpListBean(AmqpList.AmqpListBean other) {
             this.bean = other;
         }
 
@@ -71,6 +76,7 @@
 
 
         public void set(int index, AmqpType<?, ?> value) {
+            copyCheck();
             bean.value.set(index, value);
         }
 
@@ -105,28 +111,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 AmqpList)) {
+            if(o == null || !(o instanceof AmqpList)) {
                 return false;
             }
 
-            return equivalent((AmqpList) t);
+            return equals((AmqpList) o);
         }
 
-        public boolean equivalent(AmqpList b) {
-            if(b == null) {
-                return false;
-            }
-
-            if(b.getValue() == null ^ getValue() == null) {
-                return false;
-            }
+        public boolean equals(AmqpList b) {
+            return AbstractAmqpList.checkEqual(this, b);
+        }
 
-            return b.getValue() == null || b.getValue().equals(getValue());
+        public int hashCode() {
+            return AbstractAmqpList.hashCodeFor(this);
         }
     }
 
@@ -182,8 +184,16 @@
             return bean;
         }
 
-        public boolean equivalent(AmqpType<?, ?> t) {
-            return bean().equivalent(t);
+        public boolean equals(Object o){
+            return bean().equals(o);
+        }
+
+        public boolean equals(AmqpList o){
+            return bean().equals(o);
+        }
+
+        public int hashCode() {
+            return bean().hashCode();
         }
 
         public static AmqpList.AmqpListBuffer create(Encoded<IAmqpList> encoded) {

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpLong.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpLong.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/AmqpLong.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpLong.java Fri Feb 12 04:25:25 2010
@@ -39,14 +39,11 @@
         private AmqpLongBean bean = this;
         private Long value;
 
-        protected AmqpLongBean() {
-        }
-
-        public AmqpLongBean(Long value) {
+        AmqpLongBean(Long value) {
             this.value = value;
         }
 
-        public AmqpLongBean(AmqpLong.AmqpLongBean other) {
+        AmqpLongBean(AmqpLong.AmqpLongBean other) {
             this.bean = other;
         }
 
@@ -80,29 +77,10 @@
                 return false;
             }
 
-            return equivalent((AmqpLong) o);
+            return equals((AmqpLong) o);
         }
 
-        public int hashCode() {
-            if(getValue() == null) {
-                return AmqpLong.AmqpLongBean.class.hashCode();
-            }
-            return getValue().hashCode();
-        }
-
-        public boolean equivalent(AmqpType<?,?> t){
-            if(this == t) {
-                return true;
-            }
-
-            if(t == null || !(t instanceof AmqpLong)) {
-                return false;
-            }
-
-            return equivalent((AmqpLong) t);
-        }
-
-        public boolean equivalent(AmqpLong b) {
+        public boolean equals(AmqpLong 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 AmqpLong.AmqpLongBean.class.hashCode();
+            }
+            return getValue().hashCode();
+        }
     }
 
     public static class AmqpLongBuffer implements AmqpLong, AmqpBuffer< Long> {
@@ -155,12 +140,12 @@
             return bean().equals(o);
         }
 
-        public int hashCode() {
-            return bean().hashCode();
+        public boolean equals(AmqpLong o){
+            return bean().equals(o);
         }
 
-        public boolean equivalent(AmqpType<?, ?> t) {
-            return bean().equivalent(t);
+        public int hashCode() {
+            return bean().hashCode();
         }
 
         public static AmqpLong.AmqpLongBuffer create(Encoded<Long> encoded) {

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpMap.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpMap.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/AmqpMap.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpMap.java Fri Feb 12 04:25:25 2010
@@ -20,35 +20,42 @@
 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.IAmqpMap;
 import org.apache.activemq.util.buffer.Buffer;
 
 /**
  * Represents a a polymorphic mapping from distinct keys to values
  */
-public interface AmqpMap extends AmqpType<AmqpMap.AmqpMapBean, AmqpMap.AmqpMapBuffer> {
+public interface AmqpMap extends AmqpType<AmqpMap.AmqpMapBean, AmqpMap.AmqpMapBuffer>, IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> {
 
+    /**
+     * Represents a a polymorphic mapping from distinct keys to values
+     */
     public void put(AmqpType<?, ?> key, AmqpType<?, ?> value);
-    public AmqpType<?, ?> get(AmqpType<?, ?> key);
+    public AmqpType<?, ?> get(Object key);
 
-    public HashMap<AmqpType<?,?>, AmqpType<?,?>> getValue();
+    public IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> getValue();
 
     public static class AmqpMapBean implements AmqpMap{
 
         private AmqpMapBuffer buffer;
         private AmqpMapBean bean = this;
-        private HashMap<AmqpType<?,?>, AmqpType<?,?>> value;
+        private IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> value;
 
-        protected AmqpMapBean() {
+        AmqpMapBean() {
+            this.value = new IAmqpMap.AmqpWrapperMap<AmqpType<?,?>, AmqpType<?,?>>(new HashMap<AmqpType<?,?>, AmqpType<?,?>>());
         }
 
-        public AmqpMapBean(HashMap<AmqpType<?,?>, AmqpType<?,?>> value) {
+        AmqpMapBean(IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> value) {
             this.value = value;
         }
 
-        public AmqpMapBean(AmqpMap.AmqpMapBean other) {
+        AmqpMapBean(AmqpMap.AmqpMapBean other) {
             this.bean = other;
         }
 
@@ -68,14 +75,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;
         }
 
@@ -94,44 +110,40 @@
             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 AmqpMap)) {
+            if(o == null || !(o instanceof AmqpMap)) {
                 return false;
             }
 
-            return equivalent((AmqpMap) t);
+            return equals((AmqpMap) o);
         }
 
-        public boolean equivalent(AmqpMap b) {
-            if(b == null) {
-                return false;
-            }
-
-            if(b.getValue() == null ^ getValue() == null) {
-                return false;
-            }
+        public boolean equals(AmqpMap b) {
+            return AbstractAmqpMap.checkEqual(this, b);
+        }
 
-            return b.getValue() == null || b.getValue().equals(getValue());
+        public int hashCode() {
+            return AbstractAmqpMap.hashCodeFor(this);
         }
     }
 
-    public static class AmqpMapBuffer implements AmqpMap, AmqpBuffer< HashMap<AmqpType<?,?>, AmqpType<?,?>>> {
+    public static class AmqpMapBuffer implements AmqpMap, AmqpBuffer< IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>>> {
 
         private AmqpMapBean bean;
-        protected Encoded<HashMap<AmqpType<?,?>, AmqpType<?,?>>> encoded;
+        protected Encoded<IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>>> encoded;
 
         protected AmqpMapBuffer() {
         }
 
-        protected AmqpMapBuffer(Encoded<HashMap<AmqpType<?,?>, AmqpType<?,?>>> encoded) {
+        protected AmqpMapBuffer(Encoded<IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>>> encoded) {
             this.encoded = encoded;
         }
 
-        public final Encoded<HashMap<AmqpType<?,?>, AmqpType<?,?>>> getEncoded() throws AmqpEncodingError{
+        public final Encoded<IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>>> getEncoded() throws AmqpEncodingError{
             return encoded;
         }
 
@@ -142,11 +154,19 @@
             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();
         }
 
@@ -162,11 +182,19 @@
             return bean;
         }
 
-        public boolean equivalent(AmqpType<?, ?> t) {
-            return bean().equivalent(t);
+        public boolean equals(Object o){
+            return bean().equals(o);
+        }
+
+        public boolean equals(AmqpMap o){
+            return bean().equals(o);
+        }
+
+        public int hashCode() {
+            return bean().hashCode();
         }
 
-        public static AmqpMap.AmqpMapBuffer create(Encoded<HashMap<AmqpType<?,?>, AmqpType<?,?>>> encoded) {
+        public static AmqpMap.AmqpMapBuffer 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/AmqpMessageAttributes.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpMessageAttributes.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/AmqpMessageAttributes.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpMessageAttributes.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.AmqpMap;
 import org.apache.activemq.amqp.protocol.types.AmqpMessageAttributes;
+import org.apache.activemq.amqp.protocol.types.IAmqpMap;
 import org.apache.activemq.util.buffer.Buffer;
 
 /**
@@ -42,16 +45,17 @@
 
         private AmqpMessageAttributesBuffer buffer;
         private AmqpMessageAttributesBean bean = this;
-        private HashMap<AmqpType<?,?>, AmqpType<?,?>> value;
+        private IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> value;
 
-        protected AmqpMessageAttributesBean() {
+        AmqpMessageAttributesBean() {
+            this.value = new IAmqpMap.AmqpWrapperMap<AmqpType<?,?>, AmqpType<?,?>>(new HashMap<AmqpType<?,?>, AmqpType<?,?>>());
         }
 
-        public AmqpMessageAttributesBean(HashMap<AmqpType<?,?>, AmqpType<?,?>> value) {
+        AmqpMessageAttributesBean(IAmqpMap<AmqpType<?, ?>, AmqpType<?, ?>> value) {
             this.value = value;
         }
 
-        public AmqpMessageAttributesBean(AmqpMessageAttributes.AmqpMessageAttributesBean other) {
+        AmqpMessageAttributesBean(AmqpMessageAttributes.AmqpMessageAttributesBean other) {
             this.bean = other;
         }
 
@@ -71,14 +75,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;
         }
 
@@ -97,28 +110,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 AmqpMessageAttributes)) {
+            if(o == null || !(o instanceof AmqpMessageAttributes)) {
                 return false;
             }
 
-            return equivalent((AmqpMessageAttributes) t);
+            return equals((AmqpMessageAttributes) o);
         }
 
-        public boolean equivalent(AmqpMessageAttributes b) {
-            if(b == null) {
-                return false;
-            }
-
-            if(b.getValue() == null ^ getValue() == null) {
-                return false;
-            }
+        public boolean equals(AmqpMessageAttributes b) {
+            return AbstractAmqpMap.checkEqual(this, b);
+        }
 
-            return b.getValue() == null || b.getValue().equals(getValue());
+        public int hashCode() {
+            return AbstractAmqpMap.hashCodeFor(this);
         }
     }
 
@@ -130,18 +139,26 @@
             super();
         }
 
-        protected AmqpMessageAttributesBuffer(Encoded<HashMap<AmqpType<?,?>, AmqpType<?,?>>> encoded) {
+        protected AmqpMessageAttributesBuffer(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();
         }
 
@@ -157,11 +174,19 @@
             return bean;
         }
 
-        public boolean equivalent(AmqpType<?, ?> t) {
-            return bean().equivalent(t);
+        public boolean equals(Object o){
+            return bean().equals(o);
+        }
+
+        public boolean equals(AmqpMessageAttributes o){
+            return bean().equals(o);
+        }
+
+        public int hashCode() {
+            return bean().hashCode();
         }
 
-        public static AmqpMessageAttributes.AmqpMessageAttributesBuffer create(Encoded<HashMap<AmqpType<?,?>, AmqpType<?,?>>> encoded) {
+        public static AmqpMessageAttributes.AmqpMessageAttributesBuffer 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/AmqpNoop.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpNoop.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/AmqpNoop.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpNoop.java Fri Feb 12 04:25:25 2010
@@ -54,122 +54,125 @@
         private AmqpNoopBean bean = this;
         private AmqpOptions options;
 
-        public AmqpNoopBean() {
+        AmqpNoopBean() {
         }
 
-        public AmqpNoopBean(IAmqpList value) {
-            //TODO we should defer decoding of the described type:
-            for(int i = 0; i < value.getListCount(); i++) {
-                set(i, value.get(i));
-            }
-        }
+        AmqpNoopBean(IAmqpList value) {
 
-        public AmqpNoopBean(AmqpNoop.AmqpNoopBean other) {
-            this.bean = other;
+        for(int i = 0; i < value.getListCount(); i++) {
+            set(i, value.get(i));
         }
+    }
 
-        public final AmqpNoopBean copy() {
-            return new AmqpNoop.AmqpNoopBean(bean);
-        }
+    AmqpNoopBean(AmqpNoop.AmqpNoopBean other) {
+        this.bean = other;
+    }
 
-        public final void handle(AmqpCommandHandler handler) throws Exception {
-            handler.handleNoop(this);
-        }
+    public final AmqpNoopBean copy() {
+        return new AmqpNoop.AmqpNoopBean(bean);
+    }
 
-        public final AmqpNoop.AmqpNoopBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
-            if(buffer == null) {
-                buffer = new AmqpNoopBuffer(marshaller.encode(this));
-            }
-            return buffer;
-        }
+    public final void handle(AmqpCommandHandler handler) throws Exception {
+        handler.handleNoop(this);
+    }
 
-        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
-            getBuffer(marshaller).marshal(out, marshaller);
+    public final AmqpNoop.AmqpNoopBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+        if(buffer == null) {
+            buffer = new AmqpNoopBuffer(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 void setOptions(AmqpOptions options) {
+        copyCheck();
+        bean.options = options;
+    }
+
+    public final AmqpOptions getOptions() {
+        return bean.options;
+    }
+
+    public void set(int index, AmqpType<?, ?> value) {
+        switch(index) {
+        case 0: {
+            setOptions((AmqpOptions) value);
+            break;
+        }
+        default : {
+            throw new IndexOutOfBoundsException(String.valueOf(index));
         }
+        }
+    }
 
-        public final AmqpOptions getOptions() {
+    public AmqpType<?, ?> get(int index) {
+        switch(index) {
+        case 0: {
             return bean.options;
         }
-
-        public void set(int index, AmqpType<?, ?> value) {
-            switch(index) {
-            case 0: {
-                setOptions((AmqpOptions) 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;
-            }
-            default : {
-                throw new IndexOutOfBoundsException(String.valueOf(index));
-            }
-            }
         }
+    }
 
-        public int getListCount() {
-            return 1;
-        }
+    public int getListCount() {
+        return 1;
+    }
 
-        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(AmqpNoop.AmqpNoopBean other) {
-            this.options= other.options;
-            bean = this;
+        if(bean != this) {;
+            copy(bean);
         }
+    }
 
-        public boolean equivalent(AmqpType<?,?> t){
-            if(this == t) {
-                return true;
-            }
+    private final void copy(AmqpNoop.AmqpNoopBean other) {
+        bean = this;
+    }
 
-            if(t == null || !(t instanceof AmqpNoop)) {
-                return false;
-            }
+    public boolean equals(Object o){
+        if(this == o) {
+            return true;
+        }
 
-            return equivalent((AmqpNoop) t);
+        if(o == null || !(o instanceof AmqpNoop)) {
+            return false;
         }
 
-        public boolean equivalent(AmqpNoop b) {
+        return equals((AmqpNoop) o);
+    }
 
-            if(b.getOptions() == null ^ getOptions() == null) {
-                return false;
-            }
-            if(b.getOptions() != null && !b.getOptions().equals(getOptions())){ 
-                return false;
-            }
-            return true;
+    public boolean equals(AmqpNoop b) {
+
+        if(b.getOptions() == null ^ getOptions() == null) {
+            return false;
+        }
+        if(b.getOptions() != null && !b.getOptions().equals(getOptions())){ 
+            return false;
         }
+        return true;
+    }
+
+    public int hashCode() {
+        return AbstractAmqpList.hashCodeFor(this);
     }
+}
 
     public static class AmqpNoopBuffer extends AmqpList.AmqpListBuffer implements AmqpNoop{
 
@@ -223,8 +226,16 @@
             handler.handleNoop(this);
         }
 
-        public boolean equivalent(AmqpType<?, ?> t) {
-            return bean().equivalent(t);
+        public boolean equals(Object o){
+            return bean().equals(o);
+        }
+
+        public boolean equals(AmqpNoop o){
+            return bean().equals(o);
+        }
+
+        public int hashCode() {
+            return bean().hashCode();
         }
 
         public static AmqpNoop.AmqpNoopBuffer create(Encoded<IAmqpList> encoded) {

Modified: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpNull.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpNull.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/AmqpNull.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpNull.java Fri Feb 12 04:25:25 2010
@@ -39,14 +39,11 @@
         private AmqpNullBean bean = this;
         private Object value;
 
-        protected AmqpNullBean() {
-        }
-
-        public AmqpNullBean(Object value) {
+        AmqpNullBean(Object value) {
             this.value = value;
         }
 
-        public AmqpNullBean(AmqpNull.AmqpNullBean other) {
+        AmqpNullBean(AmqpNull.AmqpNullBean other) {
             this.bean = other;
         }
 
@@ -80,29 +77,10 @@
                 return false;
             }
 
-            return equivalent((AmqpNull) o);
+            return equals((AmqpNull) o);
         }
 
-        public int hashCode() {
-            if(getValue() == null) {
-                return AmqpNull.AmqpNullBean.class.hashCode();
-            }
-            return getValue().hashCode();
-        }
-
-        public boolean equivalent(AmqpType<?,?> t){
-            if(this == t) {
-                return true;
-            }
-
-            if(t == null || !(t instanceof AmqpNull)) {
-                return false;
-            }
-
-            return equivalent((AmqpNull) t);
-        }
-
-        public boolean equivalent(AmqpNull b) {
+        public boolean equals(AmqpNull 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 AmqpNull.AmqpNullBean.class.hashCode();
+            }
+            return getValue().hashCode();
+        }
     }
 
     public static class AmqpNullBuffer implements AmqpNull, AmqpBuffer< Object> {
@@ -155,12 +140,12 @@
             return bean().equals(o);
         }
 
-        public int hashCode() {
-            return bean().hashCode();
+        public boolean equals(AmqpNull o){
+            return bean().equals(o);
         }
 
-        public boolean equivalent(AmqpType<?, ?> t) {
-            return bean().equivalent(t);
+        public int hashCode() {
+            return bean().hashCode();
         }
 
         public static AmqpNull.AmqpNullBuffer create(Encoded<Object> encoded) {



Mime
View raw message