activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmacn...@apache.org
Subject svn commit: r908857 [10/17] - in /activemq/sandbox/activemq-apollo-actor/activemq-amqp: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/activemq/ src/main/java/org/apache/activemq/amqp/ src/main/ja...
Date Thu, 11 Feb 2010 07:04:46 GMT
Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpConnectionErrorCode.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpConnectionErrorCode.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpConnectionErrorCode.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpConnectionErrorCode.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.types;
+
+import java.lang.Integer;
+import java.util.HashMap;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.types.AmqpUshort;
+
+/**
+ * Represents a codes used to indicate the reason for closure
+ */
+public enum AmqpConnectionErrorCode {
+
+    /**
+     * <p>
+     * An operator intervened to close the Connection for some reason. The client may retry at
+     * some later date.
+     * </p>
+     */
+    CONNECTION_FORCED(new Integer("320")),
+    /**
+     * <p>
+     * The peer closed the connection because of an internal error. The peer may require
+     * intervention by an operator in order to resume normal operations.
+     * </p>
+     */
+    INTERNAL_ERROR(new Integer("500")),
+    /**
+     * <p>
+     * A valid frame header cannot be formed from the incoming byte stream.
+     * </p>
+     */
+    FRAMING_ERROR(new Integer("501"));
+
+    private static final HashMap<Integer, AmqpConnectionErrorCode> LOOKUP = new HashMap<Integer, AmqpConnectionErrorCode>(2);
+    static {
+        for (AmqpConnectionErrorCode connectionErrorCode : AmqpConnectionErrorCode.values()) {
+            LOOKUP.put(connectionErrorCode.value.getValue(), connectionErrorCode);
+        }
+    }
+
+    private final AmqpUshort value;
+
+    private AmqpConnectionErrorCode(Integer value) {
+        this.value = new AmqpUshort.AmqpUshortBean(value);
+    }
+
+    public final AmqpUshort getValue() {
+        return value;
+    }
+
+    public static final AmqpConnectionErrorCode get(AmqpUshort value) throws AmqpEncodingError{
+        AmqpConnectionErrorCode connectionErrorCode= LOOKUP.get(value.getValue());
+        if (connectionErrorCode == null) {
+            //TODO perhaps this should be an IllegalArgumentException?
+            throw new AmqpEncodingError("Unknown connectionErrorCode: " + value + " expected one of " + LOOKUP.keySet());
+        }
+        return connectionErrorCode;
+    }
+}
\ No newline at end of file

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDeliveryTag.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDeliveryTag.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDeliveryTag.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDeliveryTag.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,161 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.types;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+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.AmqpBinary;
+import org.apache.activemq.amqp.protocol.types.AmqpDeliveryTag;
+import org.apache.activemq.util.buffer.Buffer;
+
+public interface AmqpDeliveryTag extends AmqpBinary {
+
+
+    public static class AmqpDeliveryTagBean implements AmqpDeliveryTag{
+
+        private AmqpDeliveryTagBuffer buffer;
+        private AmqpDeliveryTagBean bean = this;
+        private Buffer value;
+
+        protected AmqpDeliveryTagBean() {
+        }
+
+        public AmqpDeliveryTagBean(Buffer value) {
+            this.value = value;
+        }
+
+        public AmqpDeliveryTagBean(AmqpDeliveryTag.AmqpDeliveryTagBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpDeliveryTagBean copy() {
+            return bean;
+        }
+
+        public final AmqpDeliveryTag.AmqpDeliveryTagBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpDeliveryTagBuffer(marshaller.encode(this));
+            }
+            return buffer;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            getBuffer(marshaller).marshal(out, marshaller);
+        }
+
+
+        public Buffer getValue() {
+            return bean.value;
+        }
+
+
+        public boolean equals(Object o){
+            if(this == o) {
+                return true;
+            }
+
+            if(o == null || !(o instanceof AmqpDeliveryTag)) {
+                return false;
+            }
+
+            return equivalent((AmqpDeliveryTag) o);
+        }
+
+        public int hashCode() {
+            if(getValue() == null) {
+                return AmqpDeliveryTag.AmqpDeliveryTagBean.class.hashCode();
+            }
+            return getValue().hashCode();
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpDeliveryTag)) {
+                return false;
+            }
+
+            return equivalent((AmqpDeliveryTag) t);
+        }
+
+        public boolean equivalent(AmqpDeliveryTag b) {
+            if(b == null) {
+                return false;
+            }
+
+            if(b.getValue() == null ^ getValue() == null) {
+                return false;
+            }
+
+            return b.getValue() == null || b.getValue().equals(getValue());
+        }
+    }
+
+    public static class AmqpDeliveryTagBuffer extends AmqpBinary.AmqpBinaryBuffer implements AmqpDeliveryTag{
+
+        private AmqpDeliveryTagBean bean;
+
+        protected AmqpDeliveryTagBuffer() {
+            super();
+        }
+
+        protected AmqpDeliveryTagBuffer(Encoded<Buffer> encoded) {
+            super(encoded);
+        }
+
+        public Buffer getValue() {
+            return bean().getValue();
+        }
+
+        public AmqpDeliveryTag.AmqpDeliveryTagBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpDeliveryTag bean() {
+            if(bean == null) {
+                bean = new AmqpDeliveryTag.AmqpDeliveryTagBean(encoded.getValue());
+                bean.buffer = this;
+            }
+            return bean;
+        }
+
+        public boolean equivalent(AmqpType<?, ?> t) {
+            return bean().equivalent(t);
+        }
+
+        public static AmqpDeliveryTag.AmqpDeliveryTagBuffer create(Encoded<Buffer> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpDeliveryTag.AmqpDeliveryTagBuffer(encoded);
+        }
+
+        public static AmqpDeliveryTag.AmqpDeliveryTagBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpBinary(in));
+        }
+
+        public static AmqpDeliveryTag.AmqpDeliveryTagBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpBinary(buffer, offset));
+        }
+    }
+}
\ No newline at end of file

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDetach.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDetach.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDetach.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDetach.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,412 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.types;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.lang.Boolean;
+import java.util.Iterator;
+import org.apache.activemq.amqp.protocol.AmqpCommand;
+import org.apache.activemq.amqp.protocol.AmqpCommandHandler;
+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.IAmqpList;
+import org.apache.activemq.util.buffer.Buffer;
+
+/**
+ * Represents a detach from the named Session
+ * <p>
+ * Indicates that the endpoint is being detached from the Connection.
+ * </p>
+ */
+public interface AmqpDetach extends AmqpList, AmqpCommand {
+
+
+
+    /**
+     * options map
+     */
+    public void setOptions(AmqpOptions options);
+
+    /**
+     * options map
+     */
+    public AmqpOptions getOptions();
+
+    /**
+     * the Session name
+     * <p>
+     * Identifies the detaching Session.
+     * </p>
+     */
+    public void setName(AmqpSessionName name);
+
+    /**
+     * the Session name
+     * <p>
+     * Identifies the detaching Session.
+     * </p>
+     */
+    public AmqpSessionName getName();
+
+    /**
+     * <p>
+     * This field, if set, indicates that the Session endpoint will be destroyed when fully
+     * detached.
+     * </p>
+     */
+    public void setClosing(Boolean closing);
+
+    /**
+     * <p>
+     * This field, if set, indicates that the Session endpoint will be destroyed when fully
+     * detached.
+     * </p>
+     */
+    public void setClosing(AmqpBoolean closing);
+
+    /**
+     * <p>
+     * This field, if set, indicates that the Session endpoint will be destroyed when fully
+     * detached.
+     * </p>
+     */
+    public Boolean getClosing();
+
+    /**
+     * error causing the detach
+     * <p>
+     * If set, this field indicates that the Session is being detached due to an exceptional
+     * condition. The value of the field should contain details on the cause of the exception.
+     * </p>
+     */
+    public void setException(AmqpSessionError exception);
+
+    /**
+     * error causing the detach
+     * <p>
+     * If set, this field indicates that the Session is being detached due to an exceptional
+     * condition. The value of the field should contain details on the cause of the exception.
+     * </p>
+     */
+    public AmqpSessionError getException();
+
+    public static class AmqpDetachBean implements AmqpDetach{
+
+        private AmqpDetachBuffer buffer;
+        private AmqpDetachBean bean = this;
+        private AmqpOptions options;
+        private AmqpSessionName name;
+        private AmqpBoolean closing;
+        private AmqpSessionError exception;
+
+        public AmqpDetachBean() {
+        }
+
+        public AmqpDetachBean(IAmqpList value) {
+            //TODO we should defer decoding of the described type:
+            for(int i = 0; i < value.getListCount(); i++) {
+                set(i, value.get(i));
+            }
+        }
+
+        public AmqpDetachBean(AmqpDetach.AmqpDetachBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpDetachBean copy() {
+            return new AmqpDetach.AmqpDetachBean(bean);
+        }
+
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleDetach(this);
+        }
+
+        public final AmqpDetach.AmqpDetachBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpDetachBuffer(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 setName(AmqpSessionName name) {
+            copyCheck();
+            bean.name = name;
+        }
+
+        public final AmqpSessionName getName() {
+            return bean.name;
+        }
+
+        public void setClosing(Boolean closing) {
+            setClosing(new AmqpBoolean.AmqpBooleanBean(closing));
+        }
+
+
+        public final void setClosing(AmqpBoolean closing) {
+            copyCheck();
+            bean.closing = closing;
+        }
+
+        public final Boolean getClosing() {
+            return bean.closing.getValue();
+        }
+
+        public final void setException(AmqpSessionError exception) {
+            copyCheck();
+            bean.exception = exception;
+        }
+
+        public final AmqpSessionError getException() {
+            return bean.exception;
+        }
+
+        public void set(int index, AmqpType<?, ?> value) {
+            switch(index) {
+            case 0: {
+                setOptions((AmqpOptions) value);
+                break;
+            }
+            case 1: {
+                setName((AmqpSessionName) value);
+                break;
+            }
+            case 2: {
+                setClosing((AmqpBoolean) value);
+                break;
+            }
+            case 3: {
+                setException((AmqpSessionError) 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: {
+                return bean.closing;
+            }
+            case 3: {
+                return bean.exception;
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
+        }
+
+        public int getListCount() {
+            return 4;
+        }
+
+        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(AmqpDetach.AmqpDetachBean other) {
+            this.options= other.options;
+            this.name= other.name;
+            this.closing= other.closing;
+            this.exception= other.exception;
+            bean = this;
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpDetach)) {
+                return false;
+            }
+
+            return equivalent((AmqpDetach) t);
+        }
+
+        public boolean equivalent(AmqpDetach b) {
+
+            if(b.getOptions() == null ^ getOptions() == null) {
+                return false;
+            }
+            if(b.getOptions() != null && !b.getOptions().equals(getOptions())){ 
+                return false;
+            }
+
+            if(b.getName() == null ^ getName() == null) {
+                return false;
+            }
+            if(b.getName() != null && !b.getName().equals(getName())){ 
+                return false;
+            }
+
+            if(b.getClosing() == null ^ getClosing() == null) {
+                return false;
+            }
+            if(b.getClosing() != null && !b.getClosing().equals(getClosing())){ 
+                return false;
+            }
+
+            if(b.getException() == null ^ getException() == null) {
+                return false;
+            }
+            if(b.getException() != null && !b.getException().equivalent(getException())){ 
+                return false;
+            }
+            return true;
+        }
+    }
+
+    public static class AmqpDetachBuffer extends AmqpList.AmqpListBuffer implements AmqpDetach{
+
+        private AmqpDetachBean bean;
+
+        protected AmqpDetachBuffer(Encoded<IAmqpList> encoded) {
+            super(encoded);
+        }
+
+        public final void setOptions(AmqpOptions options) {
+            bean().setOptions(options);
+        }
+
+        public final AmqpOptions getOptions() {
+            return bean().getOptions();
+        }
+
+        public final void setName(AmqpSessionName name) {
+            bean().setName(name);
+        }
+
+        public final AmqpSessionName getName() {
+            return bean().getName();
+        }
+
+    public void setClosing(Boolean closing) {
+            bean().setClosing(closing);
+        }
+
+        public final void setClosing(AmqpBoolean closing) {
+            bean().setClosing(closing);
+        }
+
+        public final Boolean getClosing() {
+            return bean().getClosing();
+        }
+
+        public final void setException(AmqpSessionError exception) {
+            bean().setException(exception);
+        }
+
+        public final AmqpSessionError getException() {
+            return bean().getException();
+        }
+
+        public void set(int index, AmqpType<?, ?> value) {
+            bean().set(index, value);
+        }
+
+        public AmqpType<?, ?> get(int index) {
+            return bean().get(index);
+        }
+
+        public int getListCount() {
+            return bean().getListCount();
+        }
+
+        public Iterator<AmqpType<?, ?>> iterator() {
+            return bean().iterator();
+        }
+
+        public IAmqpList getValue() {
+            return bean().getValue();
+        }
+
+        public AmqpDetach.AmqpDetachBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpDetach bean() {
+            if(bean == null) {
+                bean = new AmqpDetach.AmqpDetachBean(encoded.getValue());
+                bean.buffer = this;
+            }
+            return bean;
+        }
+
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleDetach(this);
+        }
+
+        public boolean equivalent(AmqpType<?, ?> t) {
+            return bean().equivalent(t);
+        }
+
+        public static AmqpDetach.AmqpDetachBuffer create(Encoded<IAmqpList> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpDetach.AmqpDetachBuffer(encoded);
+        }
+
+        public static AmqpDetach.AmqpDetachBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpDetach(in));
+        }
+
+        public static AmqpDetach.AmqpDetachBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpDetach(buffer, offset));
+        }
+    }
+}
\ No newline at end of file

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDirection.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDirection.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDirection.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDirection.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.types;
+
+import java.lang.Short;
+import java.util.HashMap;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.types.AmqpUbyte;
+
+/**
+ * Represents a Link direction
+ */
+public enum AmqpDirection {
+
+    INCOMING(new Short("0")),
+    OUTGOING(new Short("1"));
+
+    private static final HashMap<Short, AmqpDirection> LOOKUP = new HashMap<Short, AmqpDirection>(2);
+    static {
+        for (AmqpDirection direction : AmqpDirection.values()) {
+            LOOKUP.put(direction.value.getValue(), direction);
+        }
+    }
+
+    private final AmqpUbyte value;
+
+    private AmqpDirection(Short value) {
+        this.value = new AmqpUbyte.AmqpUbyteBean(value);
+    }
+
+    public final AmqpUbyte getValue() {
+        return value;
+    }
+
+    public static final AmqpDirection get(AmqpUbyte value) throws AmqpEncodingError{
+        AmqpDirection direction= LOOKUP.get(value.getValue());
+        if (direction == null) {
+            //TODO perhaps this should be an IllegalArgumentException?
+            throw new AmqpEncodingError("Unknown direction: " + value + " expected one of " + LOOKUP.keySet());
+        }
+        return direction;
+    }
+}
\ No newline at end of file

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDisposition.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDisposition.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDisposition.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDisposition.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,420 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.types;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import org.apache.activemq.amqp.protocol.AmqpCommand;
+import org.apache.activemq.amqp.protocol.AmqpCommandHandler;
+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.IAmqpList;
+import org.apache.activemq.util.buffer.Buffer;
+
+/**
+ * Represents a alter disposition of transfers on a Link
+ * <p>
+ * Establish a non-default disposition for a set of Link transfers. Normally the default
+ * disposition of a transfer is communicated to the sending Node when a Link transfer is
+ * acknowledged. The disposition command may be used to explicitly communicate a non-default
+ * disposition prior to the transfer being acknowledged. The behavior is undefined if more
+ * than one disposition is supplied for the same delivery-tag. Dispositions for acknowledged
+ * transfers are ignored.
+ * </p>
+ */
+public interface AmqpDisposition extends AmqpList, AmqpCommand {
+
+
+
+    /**
+     * options map
+     */
+    public void setOptions(AmqpOptions options);
+
+    /**
+     * options map
+     */
+    public AmqpOptions getOptions();
+
+    /**
+     * <p>
+     * Specifies the Link to which the barrier applies.
+     * </p>
+     */
+    public void setHandle(AmqpHandle handle);
+
+    /**
+     * <p>
+     * Specifies the Link to which the barrier applies.
+     * </p>
+     */
+    public AmqpHandle getHandle();
+
+    public void setDisposition(HashMap<AmqpType<?,?>, AmqpType<?,?>> disposition);
+
+    public void setDisposition(AmqpMap disposition);
+
+    public HashMap<AmqpType<?,?>, AmqpType<?,?>> getDisposition();
+
+    public void setFirst(AmqpDeliveryTag first);
+
+    public AmqpDeliveryTag getFirst();
+
+    public void setLast(AmqpDeliveryTag last);
+
+    public AmqpDeliveryTag getLast();
+
+    public static class AmqpDispositionBean implements AmqpDisposition{
+
+        private AmqpDispositionBuffer buffer;
+        private AmqpDispositionBean bean = this;
+        private AmqpOptions options;
+        private AmqpHandle handle;
+        private AmqpMap disposition;
+        private AmqpDeliveryTag first;
+        private AmqpDeliveryTag last;
+
+        public AmqpDispositionBean() {
+        }
+
+        public AmqpDispositionBean(IAmqpList value) {
+            //TODO we should defer decoding of the described type:
+            for(int i = 0; i < value.getListCount(); i++) {
+                set(i, value.get(i));
+            }
+        }
+
+        public AmqpDispositionBean(AmqpDisposition.AmqpDispositionBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpDispositionBean copy() {
+            return new AmqpDisposition.AmqpDispositionBean(bean);
+        }
+
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleDisposition(this);
+        }
+
+        public final AmqpDisposition.AmqpDispositionBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpDispositionBuffer(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 setHandle(AmqpHandle handle) {
+            copyCheck();
+            bean.handle = handle;
+        }
+
+        public final AmqpHandle getHandle() {
+            return bean.handle;
+        }
+
+        public void setDisposition(HashMap<AmqpType<?,?>, AmqpType<?,?>> disposition) {
+            setDisposition(new AmqpMap.AmqpMapBean(disposition));
+        }
+
+
+        public final void setDisposition(AmqpMap disposition) {
+            copyCheck();
+            bean.disposition = disposition;
+        }
+
+        public final HashMap<AmqpType<?,?>, AmqpType<?,?>> getDisposition() {
+            return bean.disposition.getValue();
+        }
+
+        public final void setFirst(AmqpDeliveryTag first) {
+            copyCheck();
+            bean.first = first;
+        }
+
+        public final AmqpDeliveryTag getFirst() {
+            return bean.first;
+        }
+
+        public final void setLast(AmqpDeliveryTag last) {
+            copyCheck();
+            bean.last = last;
+        }
+
+        public final AmqpDeliveryTag getLast() {
+            return bean.last;
+        }
+
+        public void set(int index, AmqpType<?, ?> value) {
+            switch(index) {
+            case 0: {
+                setOptions((AmqpOptions) value);
+                break;
+            }
+            case 1: {
+                setHandle((AmqpHandle) value);
+                break;
+            }
+            case 2: {
+                setDisposition((AmqpMap) value);
+                break;
+            }
+            case 3: {
+                setFirst((AmqpDeliveryTag) value);
+                break;
+            }
+            case 4: {
+                setLast((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.handle;
+            }
+            case 2: {
+                return bean.disposition;
+            }
+            case 3: {
+                return bean.first;
+            }
+            case 4: {
+                return bean.last;
+            }
+            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(AmqpDisposition.AmqpDispositionBean other) {
+            this.options= other.options;
+            this.handle= other.handle;
+            this.disposition= other.disposition;
+            this.first= other.first;
+            this.last= other.last;
+            bean = this;
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpDisposition)) {
+                return false;
+            }
+
+            return equivalent((AmqpDisposition) t);
+        }
+
+        public boolean equivalent(AmqpDisposition b) {
+
+            if(b.getOptions() == null ^ getOptions() == null) {
+                return false;
+            }
+            if(b.getOptions() != null && !b.getOptions().equals(getOptions())){ 
+                return false;
+            }
+
+            if(b.getHandle() == null ^ getHandle() == null) {
+                return false;
+            }
+            if(b.getHandle() != null && !b.getHandle().equals(getHandle())){ 
+                return false;
+            }
+
+            if(b.getDisposition() == null ^ getDisposition() == null) {
+                return false;
+            }
+            if(b.getDisposition() != null && !b.getDisposition().equals(getDisposition())){ 
+                return false;
+            }
+
+            if(b.getFirst() == null ^ getFirst() == null) {
+                return false;
+            }
+            if(b.getFirst() != null && !b.getFirst().equals(getFirst())){ 
+                return false;
+            }
+
+            if(b.getLast() == null ^ getLast() == null) {
+                return false;
+            }
+            if(b.getLast() != null && !b.getLast().equals(getLast())){ 
+                return false;
+            }
+            return true;
+        }
+    }
+
+    public static class AmqpDispositionBuffer extends AmqpList.AmqpListBuffer implements AmqpDisposition{
+
+        private AmqpDispositionBean bean;
+
+        protected AmqpDispositionBuffer(Encoded<IAmqpList> encoded) {
+            super(encoded);
+        }
+
+        public final void setOptions(AmqpOptions options) {
+            bean().setOptions(options);
+        }
+
+        public final AmqpOptions getOptions() {
+            return bean().getOptions();
+        }
+
+        public final void setHandle(AmqpHandle handle) {
+            bean().setHandle(handle);
+        }
+
+        public final AmqpHandle getHandle() {
+            return bean().getHandle();
+        }
+
+    public void setDisposition(HashMap<AmqpType<?,?>, AmqpType<?,?>> disposition) {
+            bean().setDisposition(disposition);
+        }
+
+        public final void setDisposition(AmqpMap disposition) {
+            bean().setDisposition(disposition);
+        }
+
+        public final HashMap<AmqpType<?,?>, AmqpType<?,?>> getDisposition() {
+            return bean().getDisposition();
+        }
+
+        public final void setFirst(AmqpDeliveryTag first) {
+            bean().setFirst(first);
+        }
+
+        public final AmqpDeliveryTag getFirst() {
+            return bean().getFirst();
+        }
+
+        public final void setLast(AmqpDeliveryTag last) {
+            bean().setLast(last);
+        }
+
+        public final AmqpDeliveryTag getLast() {
+            return bean().getLast();
+        }
+
+        public void set(int index, AmqpType<?, ?> value) {
+            bean().set(index, value);
+        }
+
+        public AmqpType<?, ?> get(int index) {
+            return bean().get(index);
+        }
+
+        public int getListCount() {
+            return bean().getListCount();
+        }
+
+        public Iterator<AmqpType<?, ?>> iterator() {
+            return bean().iterator();
+        }
+
+        public IAmqpList getValue() {
+            return bean().getValue();
+        }
+
+        public AmqpDisposition.AmqpDispositionBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpDisposition bean() {
+            if(bean == null) {
+                bean = new AmqpDisposition.AmqpDispositionBean(encoded.getValue());
+                bean.buffer = this;
+            }
+            return bean;
+        }
+
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleDisposition(this);
+        }
+
+        public boolean equivalent(AmqpType<?, ?> t) {
+            return bean().equivalent(t);
+        }
+
+        public static AmqpDisposition.AmqpDispositionBuffer create(Encoded<IAmqpList> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpDisposition.AmqpDispositionBuffer(encoded);
+        }
+
+        public static AmqpDisposition.AmqpDispositionBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpDisposition(in));
+        }
+
+        public static AmqpDisposition.AmqpDispositionBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpDisposition(buffer, offset));
+        }
+    }
+}
\ No newline at end of file

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDistributionMode.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDistributionMode.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDistributionMode.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDistributionMode.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.types;
+
+import java.lang.Long;
+import java.util.HashMap;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.types.AmqpUint;
+
+/**
+ * Represents a Link distribution policy
+ * <p>
+ * Policies for distributing Messages when multiple Links are connected to the same Node.
+ * </p>
+ */
+public enum AmqpDistributionMode {
+
+    /**
+     * <p>
+     * once successfully transferred over the Link, the Message will no longer be available to
+     * other Links from the same Node
+     * </p>
+     */
+    DESTRUCTIVE(new Long("1")),
+    /**
+     * <p>
+     * once successfully transferred over the Link, the Message is still available for other
+     * Links from the same Node
+     * </p>
+     */
+    NON_DESTRUCTIVE(new Long("2"));
+
+    private static final HashMap<Long, AmqpDistributionMode> LOOKUP = new HashMap<Long, AmqpDistributionMode>(2);
+    static {
+        for (AmqpDistributionMode distributionMode : AmqpDistributionMode.values()) {
+            LOOKUP.put(distributionMode.value.getValue(), distributionMode);
+        }
+    }
+
+    private final AmqpUint value;
+
+    private AmqpDistributionMode(Long value) {
+        this.value = new AmqpUint.AmqpUintBean(value);
+    }
+
+    public final AmqpUint getValue() {
+        return value;
+    }
+
+    public static final AmqpDistributionMode get(AmqpUint value) throws AmqpEncodingError{
+        AmqpDistributionMode distributionMode= LOOKUP.get(value.getValue());
+        if (distributionMode == null) {
+            //TODO perhaps this should be an IllegalArgumentException?
+            throw new AmqpEncodingError("Unknown distributionMode: " + value + " expected one of " + LOOKUP.keySet());
+        }
+        return distributionMode;
+    }
+}
\ No newline at end of file

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDouble.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDouble.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDouble.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDouble.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,181 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.types;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.lang.Double;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpMarshaller;
+import org.apache.activemq.amqp.protocol.marshaller.Encoded;
+import org.apache.activemq.util.buffer.Buffer;
+
+/**
+ * Represents a 64-bit floating point number (IEEE 754-2008 binary64)
+ */
+public interface AmqpDouble extends AmqpType<AmqpDouble.AmqpDoubleBean, AmqpDouble.AmqpDoubleBuffer> {
+
+
+    public Double getValue();
+
+    public static class AmqpDoubleBean implements AmqpDouble{
+
+        private AmqpDoubleBuffer buffer;
+        private AmqpDoubleBean bean = this;
+        private Double value;
+
+        protected AmqpDoubleBean() {
+        }
+
+        public AmqpDoubleBean(Double value) {
+            this.value = value;
+        }
+
+        public AmqpDoubleBean(AmqpDouble.AmqpDoubleBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpDoubleBean copy() {
+            return bean;
+        }
+
+        public final AmqpDouble.AmqpDoubleBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpDoubleBuffer(marshaller.encode(this));
+            }
+            return buffer;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            getBuffer(marshaller).marshal(out, marshaller);
+        }
+
+
+        public Double getValue() {
+            return bean.value;
+        }
+
+
+        public boolean equals(Object o){
+            if(this == o) {
+                return true;
+            }
+
+            if(o == null || !(o instanceof AmqpDouble)) {
+                return false;
+            }
+
+            return equivalent((AmqpDouble) o);
+        }
+
+        public int hashCode() {
+            if(getValue() == null) {
+                return AmqpDouble.AmqpDoubleBean.class.hashCode();
+            }
+            return getValue().hashCode();
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpDouble)) {
+                return false;
+            }
+
+            return equivalent((AmqpDouble) t);
+        }
+
+        public boolean equivalent(AmqpDouble b) {
+            if(b == null) {
+                return false;
+            }
+
+            if(b.getValue() == null ^ getValue() == null) {
+                return false;
+            }
+
+            return b.getValue() == null || b.getValue().equals(getValue());
+        }
+    }
+
+    public static class AmqpDoubleBuffer implements AmqpDouble, AmqpBuffer< Double> {
+
+        private AmqpDoubleBean bean;
+        protected Encoded<Double> encoded;
+
+        protected AmqpDoubleBuffer() {
+        }
+
+        protected AmqpDoubleBuffer(Encoded<Double> encoded) {
+            this.encoded = encoded;
+        }
+
+        public final Encoded<Double> getEncoded() throws AmqpEncodingError{
+            return encoded;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            encoded.marshal(out);
+        }
+
+        public Double getValue() {
+            return bean().getValue();
+        }
+
+        public AmqpDouble.AmqpDoubleBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpDouble bean() {
+            if(bean == null) {
+                bean = new AmqpDouble.AmqpDoubleBean(encoded.getValue());
+                bean.buffer = this;
+            }
+            return bean;
+        }
+
+        public boolean equals(Object o){
+            return bean().equals(o);
+        }
+
+        public int hashCode() {
+            return bean().hashCode();
+        }
+
+        public boolean equivalent(AmqpType<?, ?> t) {
+            return bean().equivalent(t);
+        }
+
+        public static AmqpDouble.AmqpDoubleBuffer create(Encoded<Double> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpDouble.AmqpDoubleBuffer(encoded);
+        }
+
+        public static AmqpDouble.AmqpDoubleBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpDouble(in));
+        }
+
+        public static AmqpDouble.AmqpDoubleBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpDouble(buffer, offset));
+        }
+    }
+}
\ No newline at end of file

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDrain.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDrain.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDrain.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpDrain.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,298 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.types;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Iterator;
+import org.apache.activemq.amqp.protocol.AmqpCommand;
+import org.apache.activemq.amqp.protocol.AmqpCommandHandler;
+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.IAmqpList;
+import org.apache.activemq.util.buffer.Buffer;
+
+/**
+ * Represents a drain the Link of immediately available transfers and stop it
+ * <p>
+ * This command causes any immediately available Message transfers to be sent up to the
+ * pre-existing transfer-limit. If the number of immediately available Message transfers is
+ * insufficient to reach the pre-existing transfer-limit, the transfer-limit is reset to the
+ * sent transfer-count. When this command completes, the transfer-limit will always equal the
+ * sent transfer-count.
+ * </p>
+ */
+public interface AmqpDrain extends AmqpList, AmqpCommand {
+
+
+
+    /**
+     * options map
+     */
+    public void setOptions(AmqpOptions options);
+
+    /**
+     * options map
+     */
+    public AmqpOptions getOptions();
+
+    /**
+     * the Link handle
+     * <p>
+     * Identifies the Link to be drained.
+     * </p>
+     */
+    public void setHandle(AmqpHandle handle);
+
+    /**
+     * the Link handle
+     * <p>
+     * Identifies the Link to be drained.
+     * </p>
+     */
+    public AmqpHandle getHandle();
+
+    public static class AmqpDrainBean implements AmqpDrain{
+
+        private AmqpDrainBuffer buffer;
+        private AmqpDrainBean bean = this;
+        private AmqpOptions options;
+        private AmqpHandle handle;
+
+        public AmqpDrainBean() {
+        }
+
+        public AmqpDrainBean(IAmqpList value) {
+            //TODO we should defer decoding of the described type:
+            for(int i = 0; i < value.getListCount(); i++) {
+                set(i, value.get(i));
+            }
+        }
+
+        public AmqpDrainBean(AmqpDrain.AmqpDrainBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpDrainBean copy() {
+            return new AmqpDrain.AmqpDrainBean(bean);
+        }
+
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleDrain(this);
+        }
+
+        public final AmqpDrain.AmqpDrainBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpDrainBuffer(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 setHandle(AmqpHandle handle) {
+            copyCheck();
+            bean.handle = handle;
+        }
+
+        public final AmqpHandle getHandle() {
+            return bean.handle;
+        }
+
+        public void set(int index, AmqpType<?, ?> value) {
+            switch(index) {
+            case 0: {
+                setOptions((AmqpOptions) value);
+                break;
+            }
+            case 1: {
+                setHandle((AmqpHandle) 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.handle;
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
+        }
+
+        public int getListCount() {
+            return 2;
+        }
+
+        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(AmqpDrain.AmqpDrainBean other) {
+            this.options= other.options;
+            this.handle= other.handle;
+            bean = this;
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpDrain)) {
+                return false;
+            }
+
+            return equivalent((AmqpDrain) t);
+        }
+
+        public boolean equivalent(AmqpDrain b) {
+
+            if(b.getOptions() == null ^ getOptions() == null) {
+                return false;
+            }
+            if(b.getOptions() != null && !b.getOptions().equals(getOptions())){ 
+                return false;
+            }
+
+            if(b.getHandle() == null ^ getHandle() == null) {
+                return false;
+            }
+            if(b.getHandle() != null && !b.getHandle().equals(getHandle())){ 
+                return false;
+            }
+            return true;
+        }
+    }
+
+    public static class AmqpDrainBuffer extends AmqpList.AmqpListBuffer implements AmqpDrain{
+
+        private AmqpDrainBean bean;
+
+        protected AmqpDrainBuffer(Encoded<IAmqpList> encoded) {
+            super(encoded);
+        }
+
+        public final void setOptions(AmqpOptions options) {
+            bean().setOptions(options);
+        }
+
+        public final AmqpOptions getOptions() {
+            return bean().getOptions();
+        }
+
+        public final void setHandle(AmqpHandle handle) {
+            bean().setHandle(handle);
+        }
+
+        public final AmqpHandle getHandle() {
+            return bean().getHandle();
+        }
+
+        public void set(int index, AmqpType<?, ?> value) {
+            bean().set(index, value);
+        }
+
+        public AmqpType<?, ?> get(int index) {
+            return bean().get(index);
+        }
+
+        public int getListCount() {
+            return bean().getListCount();
+        }
+
+        public Iterator<AmqpType<?, ?>> iterator() {
+            return bean().iterator();
+        }
+
+        public IAmqpList getValue() {
+            return bean().getValue();
+        }
+
+        public AmqpDrain.AmqpDrainBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpDrain bean() {
+            if(bean == null) {
+                bean = new AmqpDrain.AmqpDrainBean(encoded.getValue());
+                bean.buffer = this;
+            }
+            return bean;
+        }
+
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleDrain(this);
+        }
+
+        public boolean equivalent(AmqpType<?, ?> t) {
+            return bean().equivalent(t);
+        }
+
+        public static AmqpDrain.AmqpDrainBuffer create(Encoded<IAmqpList> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpDrain.AmqpDrainBuffer(encoded);
+        }
+
+        public static AmqpDrain.AmqpDrainBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpDrain(in));
+        }
+
+        public static AmqpDrain.AmqpDrainBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpDrain(buffer, offset));
+        }
+    }
+}
\ No newline at end of file

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpEnlist.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpEnlist.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpEnlist.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpEnlist.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,439 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.types;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.lang.Boolean;
+import java.util.Iterator;
+import org.apache.activemq.amqp.protocol.AmqpCommand;
+import org.apache.activemq.amqp.protocol.AmqpCommandHandler;
+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.IAmqpList;
+import org.apache.activemq.util.buffer.Buffer;
+
+/**
+ * Represents a associate the current transactional work with a distributed transaction
+ * <p>
+ * Associates the current transactional unit of work with the distributed transaction
+ * identified by the supplied xid.
+ * </p>
+ * <p>
+ * This command is only used by the peer acting as the Transaction Controller for a Session
+ * that is in the distributed or promotable transaction mode. When used on a Session that is
+ * in the distributed transaction mode, this command must be issued before any transactional
+ * work is performed within a given transactional unit. When used on a Session that is in the
+ * promotable transaction mode, this command may be used at any time. In either case, at most
+ * one enlist command may appear within any given unit of transactional work.
+ * </p>
+ */
+public interface AmqpEnlist extends AmqpList, AmqpCommand {
+
+
+
+    /**
+     * options map
+     */
+    public void setOptions(AmqpOptions options);
+
+    /**
+     * options map
+     */
+    public AmqpOptions getOptions();
+
+    /**
+     * Transaction xid
+     * <p>
+     * Specifies the xid of the transaction branch in which to enlist.
+     * </p>
+     */
+    public void setXid(AmqpXid xid);
+
+    /**
+     * Transaction xid
+     * <p>
+     * Specifies the xid of the transaction branch in which to enlist.
+     * </p>
+     */
+    public AmqpXid getXid();
+
+    /**
+     * Join with existing xid flag
+     * <p>
+     * Indicate whether this is joining an already associated xid. Indicate that the enlist
+     * applies to joining a transaction previously seen.
+     * </p>
+     */
+    public void setJoin(Boolean join);
+
+    /**
+     * Join with existing xid flag
+     * <p>
+     * Indicate whether this is joining an already associated xid. Indicate that the enlist
+     * applies to joining a transaction previously seen.
+     * </p>
+     */
+    public void setJoin(AmqpBoolean join);
+
+    /**
+     * Join with existing xid flag
+     * <p>
+     * Indicate whether this is joining an already associated xid. Indicate that the enlist
+     * applies to joining a transaction previously seen.
+     * </p>
+     */
+    public Boolean getJoin();
+
+    /**
+     * Resume flag
+     * <p>
+     * Indicate that the enlist applies to resuming a suspended transaction branch.
+     * </p>
+     */
+    public void setResume(Boolean resume);
+
+    /**
+     * Resume flag
+     * <p>
+     * Indicate that the enlist applies to resuming a suspended transaction branch.
+     * </p>
+     */
+    public void setResume(AmqpBoolean resume);
+
+    /**
+     * Resume flag
+     * <p>
+     * Indicate that the enlist applies to resuming a suspended transaction branch.
+     * </p>
+     */
+    public Boolean getResume();
+
+    public static class AmqpEnlistBean implements AmqpEnlist{
+
+        private AmqpEnlistBuffer buffer;
+        private AmqpEnlistBean bean = this;
+        private AmqpOptions options;
+        private AmqpXid xid;
+        private AmqpBoolean join;
+        private AmqpBoolean resume;
+
+        public AmqpEnlistBean() {
+        }
+
+        public AmqpEnlistBean(IAmqpList value) {
+            //TODO we should defer decoding of the described type:
+            for(int i = 0; i < value.getListCount(); i++) {
+                set(i, value.get(i));
+            }
+        }
+
+        public AmqpEnlistBean(AmqpEnlist.AmqpEnlistBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpEnlistBean copy() {
+            return new AmqpEnlist.AmqpEnlistBean(bean);
+        }
+
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleEnlist(this);
+        }
+
+        public final AmqpEnlist.AmqpEnlistBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpEnlistBuffer(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 setXid(AmqpXid xid) {
+            copyCheck();
+            bean.xid = xid;
+        }
+
+        public final AmqpXid getXid() {
+            return bean.xid;
+        }
+
+        public void setJoin(Boolean join) {
+            setJoin(new AmqpBoolean.AmqpBooleanBean(join));
+        }
+
+
+        public final void setJoin(AmqpBoolean join) {
+            copyCheck();
+            bean.join = join;
+        }
+
+        public final Boolean getJoin() {
+            return bean.join.getValue();
+        }
+
+        public void setResume(Boolean resume) {
+            setResume(new AmqpBoolean.AmqpBooleanBean(resume));
+        }
+
+
+        public final void setResume(AmqpBoolean resume) {
+            copyCheck();
+            bean.resume = resume;
+        }
+
+        public final Boolean getResume() {
+            return bean.resume.getValue();
+        }
+
+        public void set(int index, AmqpType<?, ?> value) {
+            switch(index) {
+            case 0: {
+                setOptions((AmqpOptions) value);
+                break;
+            }
+            case 1: {
+                setXid((AmqpXid) value);
+                break;
+            }
+            case 2: {
+                setJoin((AmqpBoolean) value);
+                break;
+            }
+            case 3: {
+                setResume((AmqpBoolean) 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.xid;
+            }
+            case 2: {
+                return bean.join;
+            }
+            case 3: {
+                return bean.resume;
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
+        }
+
+        public int getListCount() {
+            return 4;
+        }
+
+        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(AmqpEnlist.AmqpEnlistBean other) {
+            this.options= other.options;
+            this.xid= other.xid;
+            this.join= other.join;
+            this.resume= other.resume;
+            bean = this;
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpEnlist)) {
+                return false;
+            }
+
+            return equivalent((AmqpEnlist) t);
+        }
+
+        public boolean equivalent(AmqpEnlist b) {
+
+            if(b.getOptions() == null ^ getOptions() == null) {
+                return false;
+            }
+            if(b.getOptions() != null && !b.getOptions().equals(getOptions())){ 
+                return false;
+            }
+
+            if(b.getXid() == null ^ getXid() == null) {
+                return false;
+            }
+            if(b.getXid() != null && !b.getXid().equivalent(getXid())){ 
+                return false;
+            }
+
+            if(b.getJoin() == null ^ getJoin() == null) {
+                return false;
+            }
+            if(b.getJoin() != null && !b.getJoin().equals(getJoin())){ 
+                return false;
+            }
+
+            if(b.getResume() == null ^ getResume() == null) {
+                return false;
+            }
+            if(b.getResume() != null && !b.getResume().equals(getResume())){ 
+                return false;
+            }
+            return true;
+        }
+    }
+
+    public static class AmqpEnlistBuffer extends AmqpList.AmqpListBuffer implements AmqpEnlist{
+
+        private AmqpEnlistBean bean;
+
+        protected AmqpEnlistBuffer(Encoded<IAmqpList> encoded) {
+            super(encoded);
+        }
+
+        public final void setOptions(AmqpOptions options) {
+            bean().setOptions(options);
+        }
+
+        public final AmqpOptions getOptions() {
+            return bean().getOptions();
+        }
+
+        public final void setXid(AmqpXid xid) {
+            bean().setXid(xid);
+        }
+
+        public final AmqpXid getXid() {
+            return bean().getXid();
+        }
+
+    public void setJoin(Boolean join) {
+            bean().setJoin(join);
+        }
+
+        public final void setJoin(AmqpBoolean join) {
+            bean().setJoin(join);
+        }
+
+        public final Boolean getJoin() {
+            return bean().getJoin();
+        }
+
+    public void setResume(Boolean resume) {
+            bean().setResume(resume);
+        }
+
+        public final void setResume(AmqpBoolean resume) {
+            bean().setResume(resume);
+        }
+
+        public final Boolean getResume() {
+            return bean().getResume();
+        }
+
+        public void set(int index, AmqpType<?, ?> value) {
+            bean().set(index, value);
+        }
+
+        public AmqpType<?, ?> get(int index) {
+            return bean().get(index);
+        }
+
+        public int getListCount() {
+            return bean().getListCount();
+        }
+
+        public Iterator<AmqpType<?, ?>> iterator() {
+            return bean().iterator();
+        }
+
+        public IAmqpList getValue() {
+            return bean().getValue();
+        }
+
+        public AmqpEnlist.AmqpEnlistBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpEnlist bean() {
+            if(bean == null) {
+                bean = new AmqpEnlist.AmqpEnlistBean(encoded.getValue());
+                bean.buffer = this;
+            }
+            return bean;
+        }
+
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleEnlist(this);
+        }
+
+        public boolean equivalent(AmqpType<?, ?> t) {
+            return bean().equivalent(t);
+        }
+
+        public static AmqpEnlist.AmqpEnlistBuffer create(Encoded<IAmqpList> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpEnlist.AmqpEnlistBuffer(encoded);
+        }
+
+        public static AmqpEnlist.AmqpEnlistBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpEnlist(in));
+        }
+
+        public static AmqpEnlist.AmqpEnlistBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpEnlist(buffer, offset));
+        }
+    }
+}
\ No newline at end of file

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFilter.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFilter.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFilter.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFilter.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,290 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.types;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.lang.String;
+import java.util.Iterator;
+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.IAmqpList;
+import org.apache.activemq.util.buffer.Buffer;
+
+/**
+ * Represents a the predicate to filter the Messages admitted onto the Link
+ */
+public interface AmqpFilter extends AmqpList {
+
+
+
+    /**
+     * the type of the filter
+     */
+    public void setFilterType(String filterType);
+
+    /**
+     * the type of the filter
+     */
+    public void setFilterType(AmqpSymbol filterType);
+
+    /**
+     * the type of the filter
+     */
+    public String getFilterType();
+
+    /**
+     * the filter predicate
+     */
+    public void setFilter(AmqpType<?, ?> filter);
+
+    /**
+     * the filter predicate
+     */
+    public AmqpType<?, ?> getFilter();
+
+    public static class AmqpFilterBean implements AmqpFilter{
+
+        private AmqpFilterBuffer buffer;
+        private AmqpFilterBean bean = this;
+        private AmqpSymbol filterType;
+        private AmqpType<?, ?> filter;
+
+        public AmqpFilterBean() {
+        }
+
+        public AmqpFilterBean(IAmqpList value) {
+            //TODO we should defer decoding of the described type:
+            for(int i = 0; i < value.getListCount(); i++) {
+                set(i, value.get(i));
+            }
+        }
+
+        public AmqpFilterBean(AmqpFilter.AmqpFilterBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpFilterBean copy() {
+            return new AmqpFilter.AmqpFilterBean(bean);
+        }
+
+        public final AmqpFilter.AmqpFilterBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpFilterBuffer(marshaller.encode(this));
+            }
+            return buffer;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            getBuffer(marshaller).marshal(out, marshaller);
+        }
+
+
+        public void setFilterType(String filterType) {
+            setFilterType(new AmqpSymbol.AmqpSymbolBean(filterType));
+        }
+
+
+        public final void setFilterType(AmqpSymbol filterType) {
+            copyCheck();
+            bean.filterType = filterType;
+        }
+
+        public final String getFilterType() {
+            return bean.filterType.getValue();
+        }
+
+        public final void setFilter(AmqpType<?, ?> filter) {
+            copyCheck();
+            bean.filter = filter;
+        }
+
+        public final AmqpType<?, ?> getFilter() {
+            return bean.filter;
+        }
+
+        public void set(int index, AmqpType<?, ?> value) {
+            switch(index) {
+            case 0: {
+                setFilterType((AmqpSymbol) value);
+                break;
+            }
+            case 1: {
+                setFilter((AmqpType<?, ?>) value);
+                break;
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
+        }
+
+        public AmqpType<?, ?> get(int index) {
+            switch(index) {
+            case 0: {
+                return bean.filterType;
+            }
+            case 1: {
+                return bean.filter;
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
+        }
+
+        public int getListCount() {
+            return 2;
+        }
+
+        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(AmqpFilter.AmqpFilterBean other) {
+            this.filterType= other.filterType;
+            this.filter= other.filter;
+            bean = this;
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpFilter)) {
+                return false;
+            }
+
+            return equivalent((AmqpFilter) t);
+        }
+
+        public boolean equivalent(AmqpFilter b) {
+
+            if(b.getFilterType() == null ^ getFilterType() == null) {
+                return false;
+            }
+            if(b.getFilterType() != null && !b.getFilterType().equals(getFilterType())){ 
+                return false;
+            }
+
+            if(b.getFilter() == null ^ getFilter() == null) {
+                return false;
+            }
+            if(b.getFilter() != null && !b.getFilter().equals(getFilter())){ 
+                return false;
+            }
+            return true;
+        }
+    }
+
+    public static class AmqpFilterBuffer extends AmqpList.AmqpListBuffer implements AmqpFilter{
+
+        private AmqpFilterBean bean;
+
+        protected AmqpFilterBuffer(Encoded<IAmqpList> encoded) {
+            super(encoded);
+        }
+
+    public void setFilterType(String filterType) {
+            bean().setFilterType(filterType);
+        }
+
+        public final void setFilterType(AmqpSymbol filterType) {
+            bean().setFilterType(filterType);
+        }
+
+        public final String getFilterType() {
+            return bean().getFilterType();
+        }
+
+        public final void setFilter(AmqpType<?, ?> filter) {
+            bean().setFilter(filter);
+        }
+
+        public final AmqpType<?, ?> getFilter() {
+            return bean().getFilter();
+        }
+
+        public void set(int index, AmqpType<?, ?> value) {
+            bean().set(index, value);
+        }
+
+        public AmqpType<?, ?> get(int index) {
+            return bean().get(index);
+        }
+
+        public int getListCount() {
+            return bean().getListCount();
+        }
+
+        public Iterator<AmqpType<?, ?>> iterator() {
+            return bean().iterator();
+        }
+
+        public IAmqpList getValue() {
+            return bean().getValue();
+        }
+
+        public AmqpFilter.AmqpFilterBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpFilter bean() {
+            if(bean == null) {
+                bean = new AmqpFilter.AmqpFilterBean(encoded.getValue());
+                bean.buffer = this;
+            }
+            return bean;
+        }
+
+        public boolean equivalent(AmqpType<?, ?> t) {
+            return bean().equivalent(t);
+        }
+
+        public static AmqpFilter.AmqpFilterBuffer create(Encoded<IAmqpList> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpFilter.AmqpFilterBuffer(encoded);
+        }
+
+        public static AmqpFilter.AmqpFilterBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpFilter(in));
+        }
+
+        public static AmqpFilter.AmqpFilterBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpFilter(buffer, offset));
+        }
+    }
+}
\ No newline at end of file



Mime
View raw message