activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmacn...@apache.org
Subject svn commit: r908857 [9/17] - in /activemq/sandbox/activemq-apollo-actor/activemq-amqp: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/activemq/ src/main/java/org/apache/activemq/amqp/ src/main/jav...
Date Thu, 11 Feb 2010 07:04:46 GMT
Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpAttach.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpAttach.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpAttach.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpAttach.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,580 @@
+/**
+ * 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.lang.Long;
+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 attach to the named Session
+ * <p>
+ * Indicate that a Session endpoint has been attached to a Connection. A Session MUST NOT be
+ * mapped to more than one Connection at a time.
+ * </p>
+ */
+public interface AmqpAttach extends AmqpList, AmqpCommand {
+
+
+
+    /**
+     * options map
+     */
+    public void setOptions(AmqpOptions options);
+
+    /**
+     * options map
+     */
+    public AmqpOptions getOptions();
+
+    /**
+     * the Session name
+     * <p>
+     * The name of the Session whose endpoint has been attached to the Connection.
+     * </p>
+     */
+    public void setName(AmqpSessionName name);
+
+    /**
+     * the Session name
+     * <p>
+     * The name of the Session whose endpoint has been attached to the Connection.
+     * </p>
+     */
+    public AmqpSessionName getName();
+
+    /**
+     * true iff the Session endpoint has never been attached
+     * <p>
+     * This field, if set, indicates that the Session endpoint is newly created and has never
+     * been attached to another endpoint.
+     * </p>
+     */
+    public void setOpening(Boolean opening);
+
+    /**
+     * true iff the Session endpoint has never been attached
+     * <p>
+     * This field, if set, indicates that the Session endpoint is newly created and has never
+     * been attached to another endpoint.
+     * </p>
+     */
+    public void setOpening(AmqpBoolean opening);
+
+    /**
+     * true iff the Session endpoint has never been attached
+     * <p>
+     * This field, if set, indicates that the Session endpoint is newly created and has never
+     * been attached to another endpoint.
+     * </p>
+     */
+    public Boolean getOpening();
+
+    /**
+     * the id of the last command received
+     * <p>
+     * The id of the last received command. This field MUST be set if and only if the Session
+     * has received commands. This field indicates where replay will begin when resuming a
+     * Session.
+     * </p>
+     */
+    public void setReceived(AmqpSequenceNo received);
+
+    /**
+     * the id of the last command received
+     * <p>
+     * The id of the last received command. This field MUST be set if and only if the Session
+     * has received commands. This field indicates where replay will begin when resuming a
+     * Session.
+     * </p>
+     */
+    public AmqpSequenceNo getReceived();
+
+    /**
+     * the Session timeout
+     * <p>
+     * The Session timeout indicates how long a detached endpoint will be kept without an
+     * associated Connection. If not set, the endpoint will be kept indefinitely.
+     * </p>
+     */
+    public void setTimeout(Long timeout);
+
+    /**
+     * the Session timeout
+     * <p>
+     * The Session timeout indicates how long a detached endpoint will be kept without an
+     * associated Connection. If not set, the endpoint will be kept indefinitely.
+     * </p>
+     */
+    public void setTimeout(AmqpUint timeout);
+
+    /**
+     * the Session timeout
+     * <p>
+     * The Session timeout indicates how long a detached endpoint will be kept without an
+     * associated Connection. If not set, the endpoint will be kept indefinitely.
+     * </p>
+     */
+    public Long getTimeout();
+
+    /**
+     * the desired txn-level
+     */
+    public void setTxnMode(AmqpTxnLevel txnMode);
+
+    /**
+     * the desired txn-level
+     */
+    public AmqpTxnLevel getTxnMode();
+
+    /**
+     * the maximum supported txn-level
+     */
+    public void setTxnSupport(AmqpTxnLevel txnSupport);
+
+    /**
+     * the maximum supported txn-level
+     */
+    public AmqpTxnLevel getTxnSupport();
+
+    public static class AmqpAttachBean implements AmqpAttach{
+
+        private AmqpAttachBuffer buffer;
+        private AmqpAttachBean bean = this;
+        private AmqpOptions options;
+        private AmqpSessionName name;
+        private AmqpBoolean opening;
+        private AmqpSequenceNo received;
+        private AmqpUint timeout;
+        private AmqpTxnLevel txnMode;
+        private AmqpTxnLevel txnSupport;
+
+        public AmqpAttachBean() {
+        }
+
+        public AmqpAttachBean(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 AmqpAttachBean(AmqpAttach.AmqpAttachBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpAttachBean copy() {
+            return new AmqpAttach.AmqpAttachBean(bean);
+        }
+
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleAttach(this);
+        }
+
+        public final AmqpAttach.AmqpAttachBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpAttachBuffer(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 setOpening(Boolean opening) {
+            setOpening(new AmqpBoolean.AmqpBooleanBean(opening));
+        }
+
+
+        public final void setOpening(AmqpBoolean opening) {
+            copyCheck();
+            bean.opening = opening;
+        }
+
+        public final Boolean getOpening() {
+            return bean.opening.getValue();
+        }
+
+        public final void setReceived(AmqpSequenceNo received) {
+            copyCheck();
+            bean.received = received;
+        }
+
+        public final AmqpSequenceNo getReceived() {
+            return bean.received;
+        }
+
+        public void setTimeout(Long timeout) {
+            setTimeout(new AmqpUint.AmqpUintBean(timeout));
+        }
+
+
+        public final void setTimeout(AmqpUint timeout) {
+            copyCheck();
+            bean.timeout = timeout;
+        }
+
+        public final Long getTimeout() {
+            return bean.timeout.getValue();
+        }
+
+        public final void setTxnMode(AmqpTxnLevel txnMode) {
+            copyCheck();
+            bean.txnMode = txnMode;
+        }
+
+        public final AmqpTxnLevel getTxnMode() {
+            return bean.txnMode;
+        }
+
+        public final void setTxnSupport(AmqpTxnLevel txnSupport) {
+            copyCheck();
+            bean.txnSupport = txnSupport;
+        }
+
+        public final AmqpTxnLevel getTxnSupport() {
+            return bean.txnSupport;
+        }
+
+        public void set(int index, AmqpType<?, ?> value) {
+            switch(index) {
+            case 0: {
+                setOptions((AmqpOptions) value);
+                break;
+            }
+            case 1: {
+                setName((AmqpSessionName) value);
+                break;
+            }
+            case 2: {
+                setOpening((AmqpBoolean) value);
+                break;
+            }
+            case 3: {
+                setReceived((AmqpSequenceNo) value);
+                break;
+            }
+            case 4: {
+                setTimeout((AmqpUint) value);
+                break;
+            }
+            case 5: {
+                setTxnMode(AmqpTxnLevel.get((AmqpUbyte)value));
+                break;
+            }
+            case 6: {
+                setTxnSupport(AmqpTxnLevel.get((AmqpUbyte)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.opening;
+            }
+            case 3: {
+                return bean.received;
+            }
+            case 4: {
+                return bean.timeout;
+            }
+            case 5: {
+                if(txnMode == null) {
+                    return null;
+                }
+                return txnMode.getValue();
+            }
+            case 6: {
+                if(txnSupport == null) {
+                    return null;
+                }
+                return txnSupport.getValue();
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
+        }
+
+        public int getListCount() {
+            return 7;
+        }
+
+        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(AmqpAttach.AmqpAttachBean other) {
+            this.options= other.options;
+            this.name= other.name;
+            this.opening= other.opening;
+            this.received= other.received;
+            this.timeout= other.timeout;
+            this.txnMode= other.txnMode;
+            this.txnSupport= other.txnSupport;
+            bean = this;
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpAttach)) {
+                return false;
+            }
+
+            return equivalent((AmqpAttach) t);
+        }
+
+        public boolean equivalent(AmqpAttach 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.getOpening() == null ^ getOpening() == null) {
+                return false;
+            }
+            if(b.getOpening() != null && !b.getOpening().equals(getOpening())){ 
+                return false;
+            }
+
+            if(b.getReceived() == null ^ getReceived() == null) {
+                return false;
+            }
+            if(b.getReceived() != null && !b.getReceived().equals(getReceived())){ 
+                return false;
+            }
+
+            if(b.getTimeout() == null ^ getTimeout() == null) {
+                return false;
+            }
+            if(b.getTimeout() != null && !b.getTimeout().equals(getTimeout())){ 
+                return false;
+            }
+
+            if(b.getTxnMode() == null ^ getTxnMode() == null) {
+                return false;
+            }
+            if(b.getTxnMode() != null && !b.getTxnMode().equals(getTxnMode())){ 
+                return false;
+            }
+
+            if(b.getTxnSupport() == null ^ getTxnSupport() == null) {
+                return false;
+            }
+            if(b.getTxnSupport() != null && !b.getTxnSupport().equals(getTxnSupport())){ 
+                return false;
+            }
+            return true;
+        }
+    }
+
+    public static class AmqpAttachBuffer extends AmqpList.AmqpListBuffer implements AmqpAttach{
+
+        private AmqpAttachBean bean;
+
+        protected AmqpAttachBuffer(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 setOpening(Boolean opening) {
+            bean().setOpening(opening);
+        }
+
+        public final void setOpening(AmqpBoolean opening) {
+            bean().setOpening(opening);
+        }
+
+        public final Boolean getOpening() {
+            return bean().getOpening();
+        }
+
+        public final void setReceived(AmqpSequenceNo received) {
+            bean().setReceived(received);
+        }
+
+        public final AmqpSequenceNo getReceived() {
+            return bean().getReceived();
+        }
+
+    public void setTimeout(Long timeout) {
+            bean().setTimeout(timeout);
+        }
+
+        public final void setTimeout(AmqpUint timeout) {
+            bean().setTimeout(timeout);
+        }
+
+        public final Long getTimeout() {
+            return bean().getTimeout();
+        }
+
+        public final void setTxnMode(AmqpTxnLevel txnMode) {
+            bean().setTxnMode(txnMode);
+        }
+
+        public final AmqpTxnLevel getTxnMode() {
+            return bean().getTxnMode();
+        }
+
+        public final void setTxnSupport(AmqpTxnLevel txnSupport) {
+            bean().setTxnSupport(txnSupport);
+        }
+
+        public final AmqpTxnLevel getTxnSupport() {
+            return bean().getTxnSupport();
+        }
+
+        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 AmqpAttach.AmqpAttachBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpAttach bean() {
+            if(bean == null) {
+                bean = new AmqpAttach.AmqpAttachBean(encoded.getValue());
+                bean.buffer = this;
+            }
+            return bean;
+        }
+
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleAttach(this);
+        }
+
+        public boolean equivalent(AmqpType<?, ?> t) {
+            return bean().equivalent(t);
+        }
+
+        public static AmqpAttach.AmqpAttachBuffer create(Encoded<IAmqpList> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpAttach.AmqpAttachBuffer(encoded);
+        }
+
+        public static AmqpAttach.AmqpAttachBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpAttach(in));
+        }
+
+        public static AmqpAttach.AmqpAttachBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpAttach(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/AmqpBar.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpBar.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpBar.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpBar.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,341 @@
+/**
+ * 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 establish a barrier for Message acknowledgments on a Link
+ * <p>
+ * Messages transferred along this Link from the Message specified in the bar command and
+ * onwards will remain unacknowledged despite Session level acknowledgments that include
+ * them.
+ * </p>
+ */
+public interface AmqpBar 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();
+
+    /**
+     * <p>
+     * If the barrier field is not set then the barrier is removed.
+     * </p>
+     */
+    public void setBarrier(AmqpDeliveryTag barrier);
+
+    /**
+     * <p>
+     * If the barrier field is not set then the barrier is removed.
+     * </p>
+     */
+    public AmqpDeliveryTag getBarrier();
+
+    public static class AmqpBarBean implements AmqpBar{
+
+        private AmqpBarBuffer buffer;
+        private AmqpBarBean bean = this;
+        private AmqpOptions options;
+        private AmqpHandle handle;
+        private AmqpDeliveryTag barrier;
+
+        public AmqpBarBean() {
+        }
+
+        public AmqpBarBean(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 AmqpBarBean(AmqpBar.AmqpBarBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpBarBean copy() {
+            return new AmqpBar.AmqpBarBean(bean);
+        }
+
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleBar(this);
+        }
+
+        public final AmqpBar.AmqpBarBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpBarBuffer(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 final void setBarrier(AmqpDeliveryTag barrier) {
+            copyCheck();
+            bean.barrier = barrier;
+        }
+
+        public final AmqpDeliveryTag getBarrier() {
+            return bean.barrier;
+        }
+
+        public void set(int index, AmqpType<?, ?> value) {
+            switch(index) {
+            case 0: {
+                setOptions((AmqpOptions) value);
+                break;
+            }
+            case 1: {
+                setHandle((AmqpHandle) value);
+                break;
+            }
+            case 2: {
+                setBarrier((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.barrier;
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
+        }
+
+        public int getListCount() {
+            return 3;
+        }
+
+        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(AmqpBar.AmqpBarBean other) {
+            this.options= other.options;
+            this.handle= other.handle;
+            this.barrier= other.barrier;
+            bean = this;
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpBar)) {
+                return false;
+            }
+
+            return equivalent((AmqpBar) t);
+        }
+
+        public boolean equivalent(AmqpBar 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.getBarrier() == null ^ getBarrier() == null) {
+                return false;
+            }
+            if(b.getBarrier() != null && !b.getBarrier().equals(getBarrier())){ 
+                return false;
+            }
+            return true;
+        }
+    }
+
+    public static class AmqpBarBuffer extends AmqpList.AmqpListBuffer implements AmqpBar{
+
+        private AmqpBarBean bean;
+
+        protected AmqpBarBuffer(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 final void setBarrier(AmqpDeliveryTag barrier) {
+            bean().setBarrier(barrier);
+        }
+
+        public final AmqpDeliveryTag getBarrier() {
+            return bean().getBarrier();
+        }
+
+        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 AmqpBar.AmqpBarBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpBar bean() {
+            if(bean == null) {
+                bean = new AmqpBar.AmqpBarBean(encoded.getValue());
+                bean.buffer = this;
+            }
+            return bean;
+        }
+
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleBar(this);
+        }
+
+        public boolean equivalent(AmqpType<?, ?> t) {
+            return bean().equivalent(t);
+        }
+
+        public static AmqpBar.AmqpBarBuffer create(Encoded<IAmqpList> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpBar.AmqpBarBuffer(encoded);
+        }
+
+        public static AmqpBar.AmqpBarBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpBar(in));
+        }
+
+        public static AmqpBar.AmqpBarBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpBar(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/AmqpBinary.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpBinary.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpBinary.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpBinary.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,180 @@
+/**
+ * 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.util.buffer.Buffer;
+
+/**
+ * Represents a a sequence of octets
+ */
+public interface AmqpBinary extends AmqpType<AmqpBinary.AmqpBinaryBean, AmqpBinary.AmqpBinaryBuffer> {
+
+
+    public Buffer getValue();
+
+    public static class AmqpBinaryBean implements AmqpBinary{
+
+        private AmqpBinaryBuffer buffer;
+        private AmqpBinaryBean bean = this;
+        private Buffer value;
+
+        protected AmqpBinaryBean() {
+        }
+
+        public AmqpBinaryBean(Buffer value) {
+            this.value = value;
+        }
+
+        public AmqpBinaryBean(AmqpBinary.AmqpBinaryBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpBinaryBean copy() {
+            return bean;
+        }
+
+        public final AmqpBinary.AmqpBinaryBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpBinaryBuffer(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 AmqpBinary)) {
+                return false;
+            }
+
+            return equivalent((AmqpBinary) o);
+        }
+
+        public int hashCode() {
+            if(getValue() == null) {
+                return AmqpBinary.AmqpBinaryBean.class.hashCode();
+            }
+            return getValue().hashCode();
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpBinary)) {
+                return false;
+            }
+
+            return equivalent((AmqpBinary) t);
+        }
+
+        public boolean equivalent(AmqpBinary 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 AmqpBinaryBuffer implements AmqpBinary, AmqpBuffer< Buffer> {
+
+        private AmqpBinaryBean bean;
+        protected Encoded<Buffer> encoded;
+
+        protected AmqpBinaryBuffer() {
+        }
+
+        protected AmqpBinaryBuffer(Encoded<Buffer> encoded) {
+            this.encoded = encoded;
+        }
+
+        public final Encoded<Buffer> getEncoded() throws AmqpEncodingError{
+            return encoded;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            encoded.marshal(out);
+        }
+
+        public Buffer getValue() {
+            return bean().getValue();
+        }
+
+        public AmqpBinary.AmqpBinaryBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpBinary bean() {
+            if(bean == null) {
+                bean = new AmqpBinary.AmqpBinaryBean(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 AmqpBinary.AmqpBinaryBuffer create(Encoded<Buffer> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpBinary.AmqpBinaryBuffer(encoded);
+        }
+
+        public static AmqpBinary.AmqpBinaryBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpBinary(in));
+        }
+
+        public static AmqpBinary.AmqpBinaryBuffer 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/AmqpBoolean.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpBoolean.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpBoolean.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpBoolean.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.Boolean;
+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 represents a true or false value
+ */
+public interface AmqpBoolean extends AmqpType<AmqpBoolean.AmqpBooleanBean, AmqpBoolean.AmqpBooleanBuffer> {
+
+
+    public Boolean getValue();
+
+    public static class AmqpBooleanBean implements AmqpBoolean{
+
+        private AmqpBooleanBuffer buffer;
+        private AmqpBooleanBean bean = this;
+        private Boolean value;
+
+        protected AmqpBooleanBean() {
+        }
+
+        public AmqpBooleanBean(Boolean value) {
+            this.value = value;
+        }
+
+        public AmqpBooleanBean(AmqpBoolean.AmqpBooleanBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpBooleanBean copy() {
+            return bean;
+        }
+
+        public final AmqpBoolean.AmqpBooleanBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpBooleanBuffer(marshaller.encode(this));
+            }
+            return buffer;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            getBuffer(marshaller).marshal(out, marshaller);
+        }
+
+
+        public Boolean getValue() {
+            return bean.value;
+        }
+
+
+        public boolean equals(Object o){
+            if(this == o) {
+                return true;
+            }
+
+            if(o == null || !(o instanceof AmqpBoolean)) {
+                return false;
+            }
+
+            return equivalent((AmqpBoolean) o);
+        }
+
+        public int hashCode() {
+            if(getValue() == null) {
+                return AmqpBoolean.AmqpBooleanBean.class.hashCode();
+            }
+            return getValue().hashCode();
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpBoolean)) {
+                return false;
+            }
+
+            return equivalent((AmqpBoolean) t);
+        }
+
+        public boolean equivalent(AmqpBoolean 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 AmqpBooleanBuffer implements AmqpBoolean, AmqpBuffer< Boolean> {
+
+        private AmqpBooleanBean bean;
+        protected Encoded<Boolean> encoded;
+
+        protected AmqpBooleanBuffer() {
+        }
+
+        protected AmqpBooleanBuffer(Encoded<Boolean> encoded) {
+            this.encoded = encoded;
+        }
+
+        public final Encoded<Boolean> getEncoded() throws AmqpEncodingError{
+            return encoded;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            encoded.marshal(out);
+        }
+
+        public Boolean getValue() {
+            return bean().getValue();
+        }
+
+        public AmqpBoolean.AmqpBooleanBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpBoolean bean() {
+            if(bean == null) {
+                bean = new AmqpBoolean.AmqpBooleanBean(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 AmqpBoolean.AmqpBooleanBuffer create(Encoded<Boolean> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpBoolean.AmqpBooleanBuffer(encoded);
+        }
+
+        public static AmqpBoolean.AmqpBooleanBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpBoolean(in));
+        }
+
+        public static AmqpBoolean.AmqpBooleanBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpBoolean(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/AmqpBuffer.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpBuffer.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpBuffer.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpBuffer.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,25 @@
+/**
+ * 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 org.apache.activemq.amqp.protocol.marshaller.Encoded;
+
+public interface AmqpBuffer<V> {
+
+    public Encoded<V> getEncoded();
+    
+}

Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpByte.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpByte.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpByte.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpByte.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.Byte;
+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 integer in the range -(2^7) to 2^7 - 1
+ */
+public interface AmqpByte extends AmqpType<AmqpByte.AmqpByteBean, AmqpByte.AmqpByteBuffer> {
+
+
+    public Byte getValue();
+
+    public static class AmqpByteBean implements AmqpByte{
+
+        private AmqpByteBuffer buffer;
+        private AmqpByteBean bean = this;
+        private Byte value;
+
+        protected AmqpByteBean() {
+        }
+
+        public AmqpByteBean(Byte value) {
+            this.value = value;
+        }
+
+        public AmqpByteBean(AmqpByte.AmqpByteBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpByteBean copy() {
+            return bean;
+        }
+
+        public final AmqpByte.AmqpByteBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpByteBuffer(marshaller.encode(this));
+            }
+            return buffer;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            getBuffer(marshaller).marshal(out, marshaller);
+        }
+
+
+        public Byte getValue() {
+            return bean.value;
+        }
+
+
+        public boolean equals(Object o){
+            if(this == o) {
+                return true;
+            }
+
+            if(o == null || !(o instanceof AmqpByte)) {
+                return false;
+            }
+
+            return equivalent((AmqpByte) o);
+        }
+
+        public int hashCode() {
+            if(getValue() == null) {
+                return AmqpByte.AmqpByteBean.class.hashCode();
+            }
+            return getValue().hashCode();
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpByte)) {
+                return false;
+            }
+
+            return equivalent((AmqpByte) t);
+        }
+
+        public boolean equivalent(AmqpByte 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 AmqpByteBuffer implements AmqpByte, AmqpBuffer< Byte> {
+
+        private AmqpByteBean bean;
+        protected Encoded<Byte> encoded;
+
+        protected AmqpByteBuffer() {
+        }
+
+        protected AmqpByteBuffer(Encoded<Byte> encoded) {
+            this.encoded = encoded;
+        }
+
+        public final Encoded<Byte> getEncoded() throws AmqpEncodingError{
+            return encoded;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            encoded.marshal(out);
+        }
+
+        public Byte getValue() {
+            return bean().getValue();
+        }
+
+        public AmqpByte.AmqpByteBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpByte bean() {
+            if(bean == null) {
+                bean = new AmqpByte.AmqpByteBean(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 AmqpByte.AmqpByteBuffer create(Encoded<Byte> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpByte.AmqpByteBuffer(encoded);
+        }
+
+        public static AmqpByte.AmqpByteBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpByte(in));
+        }
+
+        public static AmqpByte.AmqpByteBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpByte(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/AmqpChar.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpChar.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpChar.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpChar.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.Integer;
+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 a single unicode character
+ */
+public interface AmqpChar extends AmqpType<AmqpChar.AmqpCharBean, AmqpChar.AmqpCharBuffer> {
+
+
+    public Integer getValue();
+
+    public static class AmqpCharBean implements AmqpChar{
+
+        private AmqpCharBuffer buffer;
+        private AmqpCharBean bean = this;
+        private Integer value;
+
+        protected AmqpCharBean() {
+        }
+
+        public AmqpCharBean(Integer value) {
+            this.value = value;
+        }
+
+        public AmqpCharBean(AmqpChar.AmqpCharBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpCharBean copy() {
+            return bean;
+        }
+
+        public final AmqpChar.AmqpCharBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpCharBuffer(marshaller.encode(this));
+            }
+            return buffer;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            getBuffer(marshaller).marshal(out, marshaller);
+        }
+
+
+        public Integer getValue() {
+            return bean.value;
+        }
+
+
+        public boolean equals(Object o){
+            if(this == o) {
+                return true;
+            }
+
+            if(o == null || !(o instanceof AmqpChar)) {
+                return false;
+            }
+
+            return equivalent((AmqpChar) o);
+        }
+
+        public int hashCode() {
+            if(getValue() == null) {
+                return AmqpChar.AmqpCharBean.class.hashCode();
+            }
+            return getValue().hashCode();
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpChar)) {
+                return false;
+            }
+
+            return equivalent((AmqpChar) t);
+        }
+
+        public boolean equivalent(AmqpChar 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 AmqpCharBuffer implements AmqpChar, AmqpBuffer< Integer> {
+
+        private AmqpCharBean bean;
+        protected Encoded<Integer> encoded;
+
+        protected AmqpCharBuffer() {
+        }
+
+        protected AmqpCharBuffer(Encoded<Integer> encoded) {
+            this.encoded = encoded;
+        }
+
+        public final Encoded<Integer> getEncoded() throws AmqpEncodingError{
+            return encoded;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            encoded.marshal(out);
+        }
+
+        public Integer getValue() {
+            return bean().getValue();
+        }
+
+        public AmqpChar.AmqpCharBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpChar bean() {
+            if(bean == null) {
+                bean = new AmqpChar.AmqpCharBean(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 AmqpChar.AmqpCharBuffer create(Encoded<Integer> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpChar.AmqpCharBuffer(encoded);
+        }
+
+        public static AmqpChar.AmqpCharBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpChar(in));
+        }
+
+        public static AmqpChar.AmqpCharBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpChar(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/AmqpClose.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpClose.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpClose.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpClose.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 signal a Connection close
+ * <p>
+ * Sending a close signals that the sender will not be sending any more commands or controls
+ * on the Connection. This control MUST be the last command or control written to a
+ * Connection by the sender.
+ * </p>
+ */
+public interface AmqpClose extends AmqpList, AmqpCommand {
+
+
+
+    /**
+     * options map
+     */
+    public void setOptions(AmqpOptions options);
+
+    /**
+     * options map
+     */
+    public AmqpOptions getOptions();
+
+    /**
+     * error causing the close
+     * <p>
+     * If set, this field indicates that the Connection is being closed due to an exceptional
+     * condition. The value of the field should contain details on the cause of the exception.
+     * </p>
+     */
+    public void setException(AmqpConnectionError exception);
+
+    /**
+     * error causing the close
+     * <p>
+     * If set, this field indicates that the Connection is being closed due to an exceptional
+     * condition. The value of the field should contain details on the cause of the exception.
+     * </p>
+     */
+    public AmqpConnectionError getException();
+
+    public static class AmqpCloseBean implements AmqpClose{
+
+        private AmqpCloseBuffer buffer;
+        private AmqpCloseBean bean = this;
+        private AmqpOptions options;
+        private AmqpConnectionError exception;
+
+        public AmqpCloseBean() {
+        }
+
+        public AmqpCloseBean(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 AmqpCloseBean(AmqpClose.AmqpCloseBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpCloseBean copy() {
+            return new AmqpClose.AmqpCloseBean(bean);
+        }
+
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleClose(this);
+        }
+
+        public final AmqpClose.AmqpCloseBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpCloseBuffer(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 setException(AmqpConnectionError exception) {
+            copyCheck();
+            bean.exception = exception;
+        }
+
+        public final AmqpConnectionError getException() {
+            return bean.exception;
+        }
+
+        public void set(int index, AmqpType<?, ?> value) {
+            switch(index) {
+            case 0: {
+                setOptions((AmqpOptions) value);
+                break;
+            }
+            case 1: {
+                setException((AmqpConnectionError) 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.exception;
+            }
+            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(AmqpClose.AmqpCloseBean other) {
+            this.options= other.options;
+            this.exception= other.exception;
+            bean = this;
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpClose)) {
+                return false;
+            }
+
+            return equivalent((AmqpClose) t);
+        }
+
+        public boolean equivalent(AmqpClose b) {
+
+            if(b.getOptions() == null ^ getOptions() == null) {
+                return false;
+            }
+            if(b.getOptions() != null && !b.getOptions().equals(getOptions())){ 
+                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 AmqpCloseBuffer extends AmqpList.AmqpListBuffer implements AmqpClose{
+
+        private AmqpCloseBean bean;
+
+        protected AmqpCloseBuffer(Encoded<IAmqpList> encoded) {
+            super(encoded);
+        }
+
+        public final void setOptions(AmqpOptions options) {
+            bean().setOptions(options);
+        }
+
+        public final AmqpOptions getOptions() {
+            return bean().getOptions();
+        }
+
+        public final void setException(AmqpConnectionError exception) {
+            bean().setException(exception);
+        }
+
+        public final AmqpConnectionError 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 AmqpClose.AmqpCloseBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpClose bean() {
+            if(bean == null) {
+                bean = new AmqpClose.AmqpCloseBean(encoded.getValue());
+                bean.buffer = this;
+            }
+            return bean;
+        }
+
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleClose(this);
+        }
+
+        public boolean equivalent(AmqpType<?, ?> t) {
+            return bean().equivalent(t);
+        }
+
+        public static AmqpClose.AmqpCloseBuffer create(Encoded<IAmqpList> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpClose.AmqpCloseBuffer(encoded);
+        }
+
+        public static AmqpClose.AmqpCloseBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpClose(in));
+        }
+
+        public static AmqpClose.AmqpCloseBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpClose(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/AmqpCompleted.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpCompleted.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpCompleted.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpCompleted.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,228 @@
+/**
+ * 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.HashMap;
+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 the completed disposition
+ * <p>
+ * The completed disposition is used to indicate that the Message has been processed at this
+ * time, and can be moved to the ARCHIVED state. For a destructive link this is the default
+ * presumptive disposition.
+ * </p>
+ */
+public interface AmqpCompleted extends AmqpMap {
+
+
+
+    /**
+     * permit truncation of the remaining transfer
+     * <p>
+     * The truncate flag, if true, indicates that the receiver is not interested in the rest of
+     * the Message content, and the sender is free to omit it.
+     * </p>
+     */
+    public void setTruncate(Boolean truncate);
+
+    /**
+     * permit truncation of the remaining transfer
+     * <p>
+     * The truncate flag, if true, indicates that the receiver is not interested in the rest of
+     * the Message content, and the sender is free to omit it.
+     * </p>
+     */
+    public void setTruncate(AmqpBoolean truncate);
+
+    /**
+     * permit truncation of the remaining transfer
+     * <p>
+     * The truncate flag, if true, indicates that the receiver is not interested in the rest of
+     * the Message content, and the sender is free to omit it.
+     * </p>
+     */
+    public Boolean getTruncate();
+
+    public static class AmqpCompletedBean implements AmqpCompleted{
+
+        private AmqpCompletedBuffer buffer;
+        private AmqpCompletedBean bean = this;
+        private AmqpBoolean truncate;
+        private HashMap<AmqpType<?,?>, AmqpType<?,?>> value;
+
+        public AmqpCompletedBean() {
+        }
+
+        public AmqpCompletedBean(HashMap<AmqpType<?,?>, AmqpType<?,?>> value) {
+            this.value = value;
+        }
+
+        public AmqpCompletedBean(AmqpCompleted.AmqpCompletedBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpCompletedBean copy() {
+            return new AmqpCompleted.AmqpCompletedBean(bean);
+        }
+
+        public final AmqpCompleted.AmqpCompletedBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpCompletedBuffer(marshaller.encode(this));
+            }
+            return buffer;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            getBuffer(marshaller).marshal(out, marshaller);
+        }
+
+
+        public void setTruncate(Boolean truncate) {
+            setTruncate(new AmqpBoolean.AmqpBooleanBean(truncate));
+        }
+
+
+        public final void setTruncate(AmqpBoolean truncate) {
+            copyCheck();
+            bean.truncate = truncate;
+        }
+
+        public final Boolean getTruncate() {
+            return bean.truncate.getValue();
+        }
+        public void put(AmqpType<?, ?> key, AmqpType<?, ?> value) {
+            bean.value.put(key, value);
+        }
+
+        public AmqpType<?, ?> get(AmqpType<?, ?> key) {
+            return bean.value.get(key);
+        }
+
+        public HashMap<AmqpType<?,?>, AmqpType<?,?>> getValue() {
+            return bean.value;
+        }
+
+
+        private final void copyCheck() {
+            if(buffer != null) {;
+                throw new IllegalStateException("unwriteable");
+            }
+            if(bean != this) {;
+                copy(bean);
+            }
+        }
+
+        private final void copy(AmqpCompleted.AmqpCompletedBean other) {
+            this.truncate= other.truncate;
+            bean = this;
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpCompleted)) {
+                return false;
+            }
+
+            return equivalent((AmqpCompleted) t);
+        }
+
+        public boolean equivalent(AmqpCompleted b) {
+
+            if(b.getTruncate() == null ^ getTruncate() == null) {
+                return false;
+            }
+            if(b.getTruncate() != null && !b.getTruncate().equals(getTruncate())){ 
+                return false;
+            }
+            return true;
+        }
+    }
+
+    public static class AmqpCompletedBuffer extends AmqpMap.AmqpMapBuffer implements AmqpCompleted{
+
+        private AmqpCompletedBean bean;
+
+        protected AmqpCompletedBuffer(Encoded<HashMap<AmqpType<?,?>, AmqpType<?,?>>> encoded) {
+            super(encoded);
+        }
+
+    public void setTruncate(Boolean truncate) {
+            bean().setTruncate(truncate);
+        }
+
+        public final void setTruncate(AmqpBoolean truncate) {
+            bean().setTruncate(truncate);
+        }
+
+        public final Boolean getTruncate() {
+            return bean().getTruncate();
+        }
+        public void put(AmqpType<?, ?> key, AmqpType<?, ?> value) {
+            bean().put(key, value);
+        }
+
+        public AmqpType<?, ?> get(AmqpType<?, ?> key) {
+            return bean().get(key);
+        }
+
+        public HashMap<AmqpType<?,?>, AmqpType<?,?>> getValue() {
+            return bean().getValue();
+        }
+
+        public AmqpCompleted.AmqpCompletedBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpCompleted bean() {
+            if(bean == null) {
+                bean = new AmqpCompleted.AmqpCompletedBean(encoded.getValue());
+                bean.buffer = this;
+            }
+            return bean;
+        }
+
+        public boolean equivalent(AmqpType<?, ?> t) {
+            return bean().equivalent(t);
+        }
+
+        public static AmqpCompleted.AmqpCompletedBuffer create(Encoded<HashMap<AmqpType<?,?>, AmqpType<?,?>>> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpCompleted.AmqpCompletedBuffer(encoded);
+        }
+
+        public static AmqpCompleted.AmqpCompletedBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpCompleted(in));
+        }
+
+        public static AmqpCompleted.AmqpCompletedBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpCompleted(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/AmqpConnectionError.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpConnectionError.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpConnectionError.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpConnectionError.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,369 @@
+/**
+ * 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.HashMap;
+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 details of a Connection error
+ */
+public interface AmqpConnectionError extends AmqpList {
+
+
+
+    /**
+     * Connection close code
+     * <p>
+     * A numeric code indicating the reason for the Connection closure.
+     * </p>
+     */
+    public void setErrorCode(AmqpConnectionErrorCode errorCode);
+
+    /**
+     * Connection close code
+     * <p>
+     * A numeric code indicating the reason for the Connection closure.
+     * </p>
+     */
+    public AmqpConnectionErrorCode getErrorCode();
+
+    /**
+     * descriptive text about the exception
+     * <p>
+     * This text supplies any supplementary details not indicated by the error-code.
+     * This text can be logged as an aid to resolving issues.
+     * </p>
+     */
+    public void setDescription(String description);
+
+    /**
+     * descriptive text about the exception
+     * <p>
+     * This text supplies any supplementary details not indicated by the error-code.
+     * This text can be logged as an aid to resolving issues.
+     * </p>
+     */
+    public void setDescription(AmqpString description);
+
+    /**
+     * descriptive text about the exception
+     * <p>
+     * This text supplies any supplementary details not indicated by the error-code.
+     * This text can be logged as an aid to resolving issues.
+     * </p>
+     */
+    public String getDescription();
+
+    /**
+     * 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 static class AmqpConnectionErrorBean implements AmqpConnectionError{
+
+        private AmqpConnectionErrorBuffer buffer;
+        private AmqpConnectionErrorBean bean = this;
+        private AmqpConnectionErrorCode errorCode;
+        private AmqpString description;
+        private AmqpMap errorInfo;
+
+        public AmqpConnectionErrorBean() {
+        }
+
+        public AmqpConnectionErrorBean(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 AmqpConnectionErrorBean(AmqpConnectionError.AmqpConnectionErrorBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpConnectionErrorBean copy() {
+            return new AmqpConnectionError.AmqpConnectionErrorBean(bean);
+        }
+
+        public final AmqpConnectionError.AmqpConnectionErrorBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpConnectionErrorBuffer(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(AmqpConnectionErrorCode errorCode) {
+            copyCheck();
+            bean.errorCode = errorCode;
+        }
+
+        public final AmqpConnectionErrorCode getErrorCode() {
+            return bean.errorCode;
+        }
+
+        public void setDescription(String description) {
+            setDescription(new AmqpString.AmqpStringBean(description));
+        }
+
+
+        public final void setDescription(AmqpString description) {
+            copyCheck();
+            bean.description = description;
+        }
+
+        public final String getDescription() {
+            return bean.description.getValue();
+        }
+
+        public void setErrorInfo(HashMap<AmqpType<?,?>, AmqpType<?,?>> errorInfo) {
+            setErrorInfo(new AmqpMap.AmqpMapBean(errorInfo));
+        }
+
+
+        public final void setErrorInfo(AmqpMap errorInfo) {
+            copyCheck();
+            bean.errorInfo = errorInfo;
+        }
+
+        public final HashMap<AmqpType<?,?>, AmqpType<?,?>> getErrorInfo() {
+            return bean.errorInfo.getValue();
+        }
+
+        public void set(int index, AmqpType<?, ?> value) {
+            switch(index) {
+            case 0: {
+                setErrorCode(AmqpConnectionErrorCode.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 int getListCount() {
+            return 3;
+        }
+
+        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(AmqpConnectionError.AmqpConnectionErrorBean other) {
+            this.errorCode= other.errorCode;
+            this.description= other.description;
+            this.errorInfo= other.errorInfo;
+            bean = this;
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpConnectionError)) {
+                return false;
+            }
+
+            return equivalent((AmqpConnectionError) t);
+        }
+
+        public boolean equivalent(AmqpConnectionError b) {
+
+            if(b.getErrorCode() == null ^ getErrorCode() == null) {
+                return false;
+            }
+            if(b.getErrorCode() != null && !b.getErrorCode().equals(getErrorCode())){ 
+                return false;
+            }
+
+            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 static class AmqpConnectionErrorBuffer extends AmqpList.AmqpListBuffer implements AmqpConnectionError{
+
+        private AmqpConnectionErrorBean bean;
+
+        protected AmqpConnectionErrorBuffer(Encoded<IAmqpList> encoded) {
+            super(encoded);
+        }
+
+        public final void setErrorCode(AmqpConnectionErrorCode errorCode) {
+            bean().setErrorCode(errorCode);
+        }
+
+        public final AmqpConnectionErrorCode getErrorCode() {
+            return bean().getErrorCode();
+        }
+
+    public void setDescription(String description) {
+            bean().setDescription(description);
+        }
+
+        public final void setDescription(AmqpString description) {
+            bean().setDescription(description);
+        }
+
+        public final String getDescription() {
+            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() {
+            return bean().getErrorInfo();
+        }
+
+        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 AmqpConnectionError.AmqpConnectionErrorBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpConnectionError bean() {
+            if(bean == null) {
+                bean = new AmqpConnectionError.AmqpConnectionErrorBean(encoded.getValue());
+                bean.buffer = this;
+            }
+            return bean;
+        }
+
+        public boolean equivalent(AmqpType<?, ?> t) {
+            return bean().equivalent(t);
+        }
+
+        public static AmqpConnectionError.AmqpConnectionErrorBuffer create(Encoded<IAmqpList> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpConnectionError.AmqpConnectionErrorBuffer(encoded);
+        }
+
+        public static AmqpConnectionError.AmqpConnectionErrorBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpConnectionError(in));
+        }
+
+        public static AmqpConnectionError.AmqpConnectionErrorBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpConnectionError(buffer, offset));
+        }
+    }
+}
\ No newline at end of file



Mime
View raw message