activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmacn...@apache.org
Subject svn commit: r908857 [11/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/AmqpFilterSet.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFilterSet.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFilterSet.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFilterSet.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,177 @@
+/**
+ * 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 org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpMarshaller;
+import org.apache.activemq.amqp.protocol.marshaller.Encoded;
+import org.apache.activemq.amqp.protocol.types.AmqpFilterSet;
+import org.apache.activemq.amqp.protocol.types.AmqpMap;
+import org.apache.activemq.util.buffer.Buffer;
+
+/**
+ * <p>
+ * . A message will pass through a filter-set if and only
+ * if it passes through each of the named filters
+ * </p>
+ */
+public interface AmqpFilterSet extends AmqpMap {
+
+
+    public static class AmqpFilterSetBean implements AmqpFilterSet{
+
+        private AmqpFilterSetBuffer buffer;
+        private AmqpFilterSetBean bean = this;
+        private HashMap<AmqpType<?,?>, AmqpType<?,?>> value;
+
+        protected AmqpFilterSetBean() {
+        }
+
+        public AmqpFilterSetBean(HashMap<AmqpType<?,?>, AmqpType<?,?>> value) {
+            this.value = value;
+        }
+
+        public AmqpFilterSetBean(AmqpFilterSet.AmqpFilterSetBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpFilterSetBean copy() {
+            return new AmqpFilterSet.AmqpFilterSetBean(bean);
+        }
+
+        public final AmqpFilterSet.AmqpFilterSetBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpFilterSetBuffer(marshaller.encode(this));
+            }
+            return buffer;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            getBuffer(marshaller).marshal(out, marshaller);
+        }
+
+        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(AmqpFilterSet.AmqpFilterSetBean other) {
+            this.value = other.value;
+            bean = this;
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpFilterSet)) {
+                return false;
+            }
+
+            return equivalent((AmqpFilterSet) t);
+        }
+
+        public boolean equivalent(AmqpFilterSet 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 AmqpFilterSetBuffer extends AmqpMap.AmqpMapBuffer implements AmqpFilterSet{
+
+        private AmqpFilterSetBean bean;
+
+        protected AmqpFilterSetBuffer() {
+            super();
+        }
+
+        protected AmqpFilterSetBuffer(Encoded<HashMap<AmqpType<?,?>, AmqpType<?,?>>> encoded) {
+            super(encoded);
+        }
+        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 AmqpFilterSet.AmqpFilterSetBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpFilterSet bean() {
+            if(bean == null) {
+                bean = new AmqpFilterSet.AmqpFilterSetBean(encoded.getValue());
+                bean.buffer = this;
+            }
+            return bean;
+        }
+
+        public boolean equivalent(AmqpType<?, ?> t) {
+            return bean().equivalent(t);
+        }
+
+        public static AmqpFilterSet.AmqpFilterSetBuffer create(Encoded<HashMap<AmqpType<?,?>, AmqpType<?,?>>> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpFilterSet.AmqpFilterSetBuffer(encoded);
+        }
+
+        public static AmqpFilterSet.AmqpFilterSetBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpMap(in));
+        }
+
+        public static AmqpFilterSet.AmqpFilterSetBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpMap(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/AmqpFloat.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFloat.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFloat.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFloat.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.Float;
+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 32-bit floating point number (IEEE 754-2008 binary32)
+ */
+public interface AmqpFloat extends AmqpType<AmqpFloat.AmqpFloatBean, AmqpFloat.AmqpFloatBuffer> {
+
+
+    public Float getValue();
+
+    public static class AmqpFloatBean implements AmqpFloat{
+
+        private AmqpFloatBuffer buffer;
+        private AmqpFloatBean bean = this;
+        private Float value;
+
+        protected AmqpFloatBean() {
+        }
+
+        public AmqpFloatBean(Float value) {
+            this.value = value;
+        }
+
+        public AmqpFloatBean(AmqpFloat.AmqpFloatBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpFloatBean copy() {
+            return bean;
+        }
+
+        public final AmqpFloat.AmqpFloatBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpFloatBuffer(marshaller.encode(this));
+            }
+            return buffer;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            getBuffer(marshaller).marshal(out, marshaller);
+        }
+
+
+        public Float getValue() {
+            return bean.value;
+        }
+
+
+        public boolean equals(Object o){
+            if(this == o) {
+                return true;
+            }
+
+            if(o == null || !(o instanceof AmqpFloat)) {
+                return false;
+            }
+
+            return equivalent((AmqpFloat) o);
+        }
+
+        public int hashCode() {
+            if(getValue() == null) {
+                return AmqpFloat.AmqpFloatBean.class.hashCode();
+            }
+            return getValue().hashCode();
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpFloat)) {
+                return false;
+            }
+
+            return equivalent((AmqpFloat) t);
+        }
+
+        public boolean equivalent(AmqpFloat b) {
+            if(b == null) {
+                return false;
+            }
+
+            if(b.getValue() == null ^ getValue() == null) {
+                return false;
+            }
+
+            return b.getValue() == null || b.getValue().equals(getValue());
+        }
+    }
+
+    public static class AmqpFloatBuffer implements AmqpFloat, AmqpBuffer< Float> {
+
+        private AmqpFloatBean bean;
+        protected Encoded<Float> encoded;
+
+        protected AmqpFloatBuffer() {
+        }
+
+        protected AmqpFloatBuffer(Encoded<Float> encoded) {
+            this.encoded = encoded;
+        }
+
+        public final Encoded<Float> getEncoded() throws AmqpEncodingError{
+            return encoded;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            encoded.marshal(out);
+        }
+
+        public Float getValue() {
+            return bean().getValue();
+        }
+
+        public AmqpFloat.AmqpFloatBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpFloat bean() {
+            if(bean == null) {
+                bean = new AmqpFloat.AmqpFloatBean(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 AmqpFloat.AmqpFloatBuffer create(Encoded<Float> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpFloat.AmqpFloatBuffer(encoded);
+        }
+
+        public static AmqpFloat.AmqpFloatBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpFloat(in));
+        }
+
+        public static AmqpFloat.AmqpFloatBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpFloat(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/AmqpFlow.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFlow.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFlow.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFlow.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,349 @@
+/**
+ * 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 update the transfer-limit for a Link
+ * <p>
+ * This command updates the transfer-limit for the specified Link.
+ * </p>
+ */
+public interface AmqpFlow extends AmqpList, AmqpCommand {
+
+
+
+    /**
+     * options map
+     */
+    public void setOptions(AmqpOptions options);
+
+    /**
+     * options map
+     */
+    public AmqpOptions getOptions();
+
+    /**
+     * the Link handle
+     * <p>
+     * Identifies the Link whose transfer-limit is to be updated.
+     * </p>
+     */
+    public void setHandle(AmqpHandle handle);
+
+    /**
+     * the Link handle
+     * <p>
+     * Identifies the Link whose transfer-limit is to be updated.
+     * </p>
+     */
+    public AmqpHandle getHandle();
+
+    /**
+     * the Link transfer-limit
+     * <p>
+     * The updated value for the transfer-limit. This is the limit beyond which the sent
+     * transfer-count for the Link may not exceed. This is an absolute number and must
+     * wraparound and compare according to RFC-1982 serial number arithmetic. If this is not
+     * set, there is no limit and transfers may be sent until a limit is imposed.
+     * </p>
+     */
+    public void setLimit(AmqpSequenceNo limit);
+
+    /**
+     * the Link transfer-limit
+     * <p>
+     * The updated value for the transfer-limit. This is the limit beyond which the sent
+     * transfer-count for the Link may not exceed. This is an absolute number and must
+     * wraparound and compare according to RFC-1982 serial number arithmetic. If this is not
+     * set, there is no limit and transfers may be sent until a limit is imposed.
+     * </p>
+     */
+    public AmqpSequenceNo getLimit();
+
+    public static class AmqpFlowBean implements AmqpFlow{
+
+        private AmqpFlowBuffer buffer;
+        private AmqpFlowBean bean = this;
+        private AmqpOptions options;
+        private AmqpHandle handle;
+        private AmqpSequenceNo limit;
+
+        public AmqpFlowBean() {
+        }
+
+        public AmqpFlowBean(IAmqpList value) {
+            //TODO we should defer decoding of the described type:
+            for(int i = 0; i < value.getListCount(); i++) {
+                set(i, value.get(i));
+            }
+        }
+
+        public AmqpFlowBean(AmqpFlow.AmqpFlowBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpFlowBean copy() {
+            return new AmqpFlow.AmqpFlowBean(bean);
+        }
+
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleFlow(this);
+        }
+
+        public final AmqpFlow.AmqpFlowBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpFlowBuffer(marshaller.encode(this));
+            }
+            return buffer;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            getBuffer(marshaller).marshal(out, marshaller);
+        }
+
+
+        public final void setOptions(AmqpOptions options) {
+            copyCheck();
+            bean.options = options;
+        }
+
+        public final AmqpOptions getOptions() {
+            return bean.options;
+        }
+
+        public final void setHandle(AmqpHandle handle) {
+            copyCheck();
+            bean.handle = handle;
+        }
+
+        public final AmqpHandle getHandle() {
+            return bean.handle;
+        }
+
+        public final void setLimit(AmqpSequenceNo limit) {
+            copyCheck();
+            bean.limit = limit;
+        }
+
+        public final AmqpSequenceNo getLimit() {
+            return bean.limit;
+        }
+
+        public void set(int index, AmqpType<?, ?> value) {
+            switch(index) {
+            case 0: {
+                setOptions((AmqpOptions) value);
+                break;
+            }
+            case 1: {
+                setHandle((AmqpHandle) value);
+                break;
+            }
+            case 2: {
+                setLimit((AmqpSequenceNo) value);
+                break;
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
+        }
+
+        public AmqpType<?, ?> get(int index) {
+            switch(index) {
+            case 0: {
+                return bean.options;
+            }
+            case 1: {
+                return bean.handle;
+            }
+            case 2: {
+                return bean.limit;
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
+        }
+
+        public int getListCount() {
+            return 3;
+        }
+
+        public 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(AmqpFlow.AmqpFlowBean other) {
+            this.options= other.options;
+            this.handle= other.handle;
+            this.limit= other.limit;
+            bean = this;
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpFlow)) {
+                return false;
+            }
+
+            return equivalent((AmqpFlow) t);
+        }
+
+        public boolean equivalent(AmqpFlow 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.getLimit() == null ^ getLimit() == null) {
+                return false;
+            }
+            if(b.getLimit() != null && !b.getLimit().equals(getLimit())){ 
+                return false;
+            }
+            return true;
+        }
+    }
+
+    public static class AmqpFlowBuffer extends AmqpList.AmqpListBuffer implements AmqpFlow{
+
+        private AmqpFlowBean bean;
+
+        protected AmqpFlowBuffer(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 setLimit(AmqpSequenceNo limit) {
+            bean().setLimit(limit);
+        }
+
+        public final AmqpSequenceNo getLimit() {
+            return bean().getLimit();
+        }
+
+        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 AmqpFlow.AmqpFlowBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpFlow bean() {
+            if(bean == null) {
+                bean = new AmqpFlow.AmqpFlowBean(encoded.getValue());
+                bean.buffer = this;
+            }
+            return bean;
+        }
+
+        public final void handle(AmqpCommandHandler handler) throws Exception {
+            handler.handleFlow(this);
+        }
+
+        public boolean equivalent(AmqpType<?, ?> t) {
+            return bean().equivalent(t);
+        }
+
+        public static AmqpFlow.AmqpFlowBuffer create(Encoded<IAmqpList> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpFlow.AmqpFlowBuffer(encoded);
+        }
+
+        public static AmqpFlow.AmqpFlowBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpFlow(in));
+        }
+
+        public static AmqpFlow.AmqpFlowBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpFlow(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/AmqpFooter.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFooter.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFooter.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFooter.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,291 @@
+/**
+ * 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.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 transport footers for a Message
+ */
+public interface AmqpFooter extends AmqpList {
+
+
+
+    /**
+     * message attributes
+     * <p>
+     * command and
+     * dispositions which allow for updates to the message-attrs.
+     * </p>
+     */
+    public void setMessageAttrs(AmqpMessageAttributes messageAttrs);
+
+    /**
+     * message attributes
+     * <p>
+     * command and
+     * dispositions which allow for updates to the message-attrs.
+     * </p>
+     */
+    public AmqpMessageAttributes getMessageAttrs();
+
+    /**
+     * delivery attributes
+     * <p>
+     * command and dispositions which allow for updates
+     * to the delivery-attrs.
+     * </p>
+     */
+    public void setDeliveryAttrs(AmqpMessageAttributes deliveryAttrs);
+
+    /**
+     * delivery attributes
+     * <p>
+     * command and dispositions which allow for updates
+     * to the delivery-attrs.
+     * </p>
+     */
+    public AmqpMessageAttributes getDeliveryAttrs();
+
+    public static class AmqpFooterBean implements AmqpFooter{
+
+        private AmqpFooterBuffer buffer;
+        private AmqpFooterBean bean = this;
+        private AmqpMessageAttributes messageAttrs;
+        private AmqpMessageAttributes deliveryAttrs;
+
+        public AmqpFooterBean() {
+        }
+
+        public AmqpFooterBean(IAmqpList value) {
+            //TODO we should defer decoding of the described type:
+            for(int i = 0; i < value.getListCount(); i++) {
+                set(i, value.get(i));
+            }
+        }
+
+        public AmqpFooterBean(AmqpFooter.AmqpFooterBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpFooterBean copy() {
+            return new AmqpFooter.AmqpFooterBean(bean);
+        }
+
+        public final AmqpFooter.AmqpFooterBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpFooterBuffer(marshaller.encode(this));
+            }
+            return buffer;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            getBuffer(marshaller).marshal(out, marshaller);
+        }
+
+
+        public final void setMessageAttrs(AmqpMessageAttributes messageAttrs) {
+            copyCheck();
+            bean.messageAttrs = messageAttrs;
+        }
+
+        public final AmqpMessageAttributes getMessageAttrs() {
+            return bean.messageAttrs;
+        }
+
+        public final void setDeliveryAttrs(AmqpMessageAttributes deliveryAttrs) {
+            copyCheck();
+            bean.deliveryAttrs = deliveryAttrs;
+        }
+
+        public final AmqpMessageAttributes getDeliveryAttrs() {
+            return bean.deliveryAttrs;
+        }
+
+        public void set(int index, AmqpType<?, ?> value) {
+            switch(index) {
+            case 0: {
+                setMessageAttrs((AmqpMessageAttributes) value);
+                break;
+            }
+            case 1: {
+                setDeliveryAttrs((AmqpMessageAttributes) value);
+                break;
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
+        }
+
+        public AmqpType<?, ?> get(int index) {
+            switch(index) {
+            case 0: {
+                return bean.messageAttrs;
+            }
+            case 1: {
+                return bean.deliveryAttrs;
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
+        }
+
+        public int getListCount() {
+            return 2;
+        }
+
+        public 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(AmqpFooter.AmqpFooterBean other) {
+            this.messageAttrs= other.messageAttrs;
+            this.deliveryAttrs= other.deliveryAttrs;
+            bean = this;
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpFooter)) {
+                return false;
+            }
+
+            return equivalent((AmqpFooter) t);
+        }
+
+        public boolean equivalent(AmqpFooter b) {
+
+            if(b.getMessageAttrs() == null ^ getMessageAttrs() == null) {
+                return false;
+            }
+            if(b.getMessageAttrs() != null && !b.getMessageAttrs().equals(getMessageAttrs())){ 
+                return false;
+            }
+
+            if(b.getDeliveryAttrs() == null ^ getDeliveryAttrs() == null) {
+                return false;
+            }
+            if(b.getDeliveryAttrs() != null && !b.getDeliveryAttrs().equals(getDeliveryAttrs())){ 
+                return false;
+            }
+            return true;
+        }
+    }
+
+    public static class AmqpFooterBuffer extends AmqpList.AmqpListBuffer implements AmqpFooter{
+
+        private AmqpFooterBean bean;
+
+        protected AmqpFooterBuffer(Encoded<IAmqpList> encoded) {
+            super(encoded);
+        }
+
+        public final void setMessageAttrs(AmqpMessageAttributes messageAttrs) {
+            bean().setMessageAttrs(messageAttrs);
+        }
+
+        public final AmqpMessageAttributes getMessageAttrs() {
+            return bean().getMessageAttrs();
+        }
+
+        public final void setDeliveryAttrs(AmqpMessageAttributes deliveryAttrs) {
+            bean().setDeliveryAttrs(deliveryAttrs);
+        }
+
+        public final AmqpMessageAttributes getDeliveryAttrs() {
+            return bean().getDeliveryAttrs();
+        }
+
+        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 AmqpFooter.AmqpFooterBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpFooter bean() {
+            if(bean == null) {
+                bean = new AmqpFooter.AmqpFooterBean(encoded.getValue());
+                bean.buffer = this;
+            }
+            return bean;
+        }
+
+        public boolean equivalent(AmqpType<?, ?> t) {
+            return bean().equivalent(t);
+        }
+
+        public static AmqpFooter.AmqpFooterBuffer create(Encoded<IAmqpList> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpFooter.AmqpFooterBuffer(encoded);
+        }
+
+        public static AmqpFooter.AmqpFooterBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpFooter(in));
+        }
+
+        public static AmqpFooter.AmqpFooterBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpFooter(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/AmqpFragment.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFragment.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFragment.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpFragment.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,521 @@
+/**
+ * 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.math.BigInteger;
+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 a Message fragment
+ * <p>
+ * A Message fragment may contain an entire single section Message, an entire section, or an
+ * arbitrary fragment of a single section. A fragment cannot contain data from more than one
+ * section.
+ * </p>
+ */
+public interface AmqpFragment extends AmqpList {
+
+
+
+    /**
+     * indicates the fragment is the first in the Section
+     * <p>
+     * If this flag is true, then the beginning of the payload corresponds with a section
+     * boundary within the Message.
+     * </p>
+     */
+    public void setFirst(Boolean first);
+
+    /**
+     * indicates the fragment is the first in the Section
+     * <p>
+     * If this flag is true, then the beginning of the payload corresponds with a section
+     * boundary within the Message.
+     * </p>
+     */
+    public void setFirst(AmqpBoolean first);
+
+    /**
+     * indicates the fragment is the first in the Section
+     * <p>
+     * If this flag is true, then the beginning of the payload corresponds with a section
+     * boundary within the Message.
+     * </p>
+     */
+    public Boolean getFirst();
+
+    /**
+     * indicates the fragment is the last in the Section
+     * <p>
+     * If this flag is true, then the end of the payload corresponds with a section boundary
+     * within the Message.
+     * </p>
+     */
+    public void setLast(Boolean last);
+
+    /**
+     * indicates the fragment is the last in the Section
+     * <p>
+     * If this flag is true, then the end of the payload corresponds with a section boundary
+     * within the Message.
+     * </p>
+     */
+    public void setLast(AmqpBoolean last);
+
+    /**
+     * indicates the fragment is the last in the Section
+     * <p>
+     * If this flag is true, then the end of the payload corresponds with a section boundary
+     * within the Message.
+     * </p>
+     */
+    public Boolean getLast();
+
+    /**
+     * indicates the format of the Message section
+     * <p>
+     * The format code indicates the format of the current section of the Message. A Message
+     * may have multiple sections, and therefore multiple format codes, however the format code
+     * is only permitted to change at section boundaries.
+     * </p>
+     */
+    public void setFormatCode(Long formatCode);
+
+    /**
+     * indicates the format of the Message section
+     * <p>
+     * The format code indicates the format of the current section of the Message. A Message
+     * may have multiple sections, and therefore multiple format codes, however the format code
+     * is only permitted to change at section boundaries.
+     * </p>
+     */
+    public void setFormatCode(AmqpUint formatCode);
+
+    /**
+     * indicates the format of the Message section
+     * <p>
+     * The format code indicates the format of the current section of the Message. A Message
+     * may have multiple sections, and therefore multiple format codes, however the format code
+     * is only permitted to change at section boundaries.
+     * </p>
+     */
+    public Long getFormatCode();
+
+    /**
+     * the payload offset within the Message
+     */
+    public void setFragmentOffset(BigInteger fragmentOffset);
+
+    /**
+     * the payload offset within the Message
+     */
+    public void setFragmentOffset(AmqpUlong fragmentOffset);
+
+    /**
+     * the payload offset within the Message
+     */
+    public BigInteger getFragmentOffset();
+
+    /**
+     * Message data
+     */
+    public void setPayload(Buffer payload);
+
+    /**
+     * Message data
+     */
+    public void setPayload(AmqpBinary payload);
+
+    /**
+     * Message data
+     */
+    public Buffer getPayload();
+
+    public static class AmqpFragmentBean implements AmqpFragment{
+
+        private AmqpFragmentBuffer buffer;
+        private AmqpFragmentBean bean = this;
+        private AmqpBoolean first;
+        private AmqpBoolean last;
+        private AmqpUint formatCode;
+        private AmqpUlong fragmentOffset;
+        private AmqpBinary payload;
+
+        public AmqpFragmentBean() {
+        }
+
+        public AmqpFragmentBean(IAmqpList value) {
+            //TODO we should defer decoding of the described type:
+            for(int i = 0; i < value.getListCount(); i++) {
+                set(i, value.get(i));
+            }
+        }
+
+        public AmqpFragmentBean(AmqpFragment.AmqpFragmentBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpFragmentBean copy() {
+            return new AmqpFragment.AmqpFragmentBean(bean);
+        }
+
+        public final AmqpFragment.AmqpFragmentBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpFragmentBuffer(marshaller.encode(this));
+            }
+            return buffer;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            getBuffer(marshaller).marshal(out, marshaller);
+        }
+
+
+        public void setFirst(Boolean first) {
+            setFirst(new AmqpBoolean.AmqpBooleanBean(first));
+        }
+
+
+        public final void setFirst(AmqpBoolean first) {
+            copyCheck();
+            bean.first = first;
+        }
+
+        public final Boolean getFirst() {
+            return bean.first.getValue();
+        }
+
+        public void setLast(Boolean last) {
+            setLast(new AmqpBoolean.AmqpBooleanBean(last));
+        }
+
+
+        public final void setLast(AmqpBoolean last) {
+            copyCheck();
+            bean.last = last;
+        }
+
+        public final Boolean getLast() {
+            return bean.last.getValue();
+        }
+
+        public void setFormatCode(Long formatCode) {
+            setFormatCode(new AmqpUint.AmqpUintBean(formatCode));
+        }
+
+
+        public final void setFormatCode(AmqpUint formatCode) {
+            copyCheck();
+            bean.formatCode = formatCode;
+        }
+
+        public final Long getFormatCode() {
+            return bean.formatCode.getValue();
+        }
+
+        public void setFragmentOffset(BigInteger fragmentOffset) {
+            setFragmentOffset(new AmqpUlong.AmqpUlongBean(fragmentOffset));
+        }
+
+
+        public final void setFragmentOffset(AmqpUlong fragmentOffset) {
+            copyCheck();
+            bean.fragmentOffset = fragmentOffset;
+        }
+
+        public final BigInteger getFragmentOffset() {
+            return bean.fragmentOffset.getValue();
+        }
+
+        public void setPayload(Buffer payload) {
+            setPayload(new AmqpBinary.AmqpBinaryBean(payload));
+        }
+
+
+        public final void setPayload(AmqpBinary payload) {
+            copyCheck();
+            bean.payload = payload;
+        }
+
+        public final Buffer getPayload() {
+            return bean.payload.getValue();
+        }
+
+        public void set(int index, AmqpType<?, ?> value) {
+            switch(index) {
+            case 0: {
+                setFirst((AmqpBoolean) value);
+                break;
+            }
+            case 1: {
+                setLast((AmqpBoolean) value);
+                break;
+            }
+            case 2: {
+                setFormatCode((AmqpUint) value);
+                break;
+            }
+            case 3: {
+                setFragmentOffset((AmqpUlong) value);
+                break;
+            }
+            case 4: {
+                setPayload((AmqpBinary) value);
+                break;
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
+        }
+
+        public AmqpType<?, ?> get(int index) {
+            switch(index) {
+            case 0: {
+                return bean.first;
+            }
+            case 1: {
+                return bean.last;
+            }
+            case 2: {
+                return bean.formatCode;
+            }
+            case 3: {
+                return bean.fragmentOffset;
+            }
+            case 4: {
+                return bean.payload;
+            }
+            default : {
+                throw new IndexOutOfBoundsException(String.valueOf(index));
+            }
+            }
+        }
+
+        public int getListCount() {
+            return 5;
+        }
+
+        public IAmqpList getValue() {
+            return bean;
+        }
+
+        public Iterator<AmqpType<?, ?>> iterator() {
+            return new AmqpListIterator(bean);
+        }
+
+
+        private final void copyCheck() {
+            if(buffer != null) {;
+                throw new IllegalStateException("unwriteable");
+            }
+            if(bean != this) {;
+                copy(bean);
+            }
+        }
+
+        private final void copy(AmqpFragment.AmqpFragmentBean other) {
+            this.first= other.first;
+            this.last= other.last;
+            this.formatCode= other.formatCode;
+            this.fragmentOffset= other.fragmentOffset;
+            this.payload= other.payload;
+            bean = this;
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpFragment)) {
+                return false;
+            }
+
+            return equivalent((AmqpFragment) t);
+        }
+
+        public boolean equivalent(AmqpFragment b) {
+
+            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;
+            }
+
+            if(b.getFormatCode() == null ^ getFormatCode() == null) {
+                return false;
+            }
+            if(b.getFormatCode() != null && !b.getFormatCode().equals(getFormatCode())){ 
+                return false;
+            }
+
+            if(b.getFragmentOffset() == null ^ getFragmentOffset() == null) {
+                return false;
+            }
+            if(b.getFragmentOffset() != null && !b.getFragmentOffset().equals(getFragmentOffset())){ 
+                return false;
+            }
+
+            if(b.getPayload() == null ^ getPayload() == null) {
+                return false;
+            }
+            if(b.getPayload() != null && !b.getPayload().equals(getPayload())){ 
+                return false;
+            }
+            return true;
+        }
+    }
+
+    public static class AmqpFragmentBuffer extends AmqpList.AmqpListBuffer implements AmqpFragment{
+
+        private AmqpFragmentBean bean;
+
+        protected AmqpFragmentBuffer(Encoded<IAmqpList> encoded) {
+            super(encoded);
+        }
+
+    public void setFirst(Boolean first) {
+            bean().setFirst(first);
+        }
+
+        public final void setFirst(AmqpBoolean first) {
+            bean().setFirst(first);
+        }
+
+        public final Boolean getFirst() {
+            return bean().getFirst();
+        }
+
+    public void setLast(Boolean last) {
+            bean().setLast(last);
+        }
+
+        public final void setLast(AmqpBoolean last) {
+            bean().setLast(last);
+        }
+
+        public final Boolean getLast() {
+            return bean().getLast();
+        }
+
+    public void setFormatCode(Long formatCode) {
+            bean().setFormatCode(formatCode);
+        }
+
+        public final void setFormatCode(AmqpUint formatCode) {
+            bean().setFormatCode(formatCode);
+        }
+
+        public final Long getFormatCode() {
+            return bean().getFormatCode();
+        }
+
+    public void setFragmentOffset(BigInteger fragmentOffset) {
+            bean().setFragmentOffset(fragmentOffset);
+        }
+
+        public final void setFragmentOffset(AmqpUlong fragmentOffset) {
+            bean().setFragmentOffset(fragmentOffset);
+        }
+
+        public final BigInteger getFragmentOffset() {
+            return bean().getFragmentOffset();
+        }
+
+    public void setPayload(Buffer payload) {
+            bean().setPayload(payload);
+        }
+
+        public final void setPayload(AmqpBinary payload) {
+            bean().setPayload(payload);
+        }
+
+        public final Buffer getPayload() {
+            return bean().getPayload();
+        }
+
+        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 AmqpFragment.AmqpFragmentBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpFragment bean() {
+            if(bean == null) {
+                bean = new AmqpFragment.AmqpFragmentBean(encoded.getValue());
+                bean.buffer = this;
+            }
+            return bean;
+        }
+
+        public boolean equivalent(AmqpType<?, ?> t) {
+            return bean().equivalent(t);
+        }
+
+        public static AmqpFragment.AmqpFragmentBuffer create(Encoded<IAmqpList> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpFragment.AmqpFragmentBuffer(encoded);
+        }
+
+        public static AmqpFragment.AmqpFragmentBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpFragment(in));
+        }
+
+        public static AmqpFragment.AmqpFragmentBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpFragment(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/AmqpHandle.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpHandle.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpHandle.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpHandle.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,171 @@
+/**
+ * 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.Long;
+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.AmqpHandle;
+import org.apache.activemq.amqp.protocol.types.AmqpUint;
+import org.apache.activemq.util.buffer.Buffer;
+
+/**
+ * Represents a the handle of a Link
+ * <p>
+ * command and subsequently used
+ * by endpoints as a shorthand to refer to the Link in all outgoing commands. The two
+ * endpoints may potentially use different handles to refer to the same Link. Link handles
+ * may be reused once a Link is closed for both send and receive.
+ * </p>
+ */
+public interface AmqpHandle extends AmqpUint {
+
+
+    public static class AmqpHandleBean implements AmqpHandle{
+
+        private AmqpHandleBuffer buffer;
+        private AmqpHandleBean bean = this;
+        private Long value;
+
+        protected AmqpHandleBean() {
+        }
+
+        public AmqpHandleBean(Long value) {
+            this.value = value;
+        }
+
+        public AmqpHandleBean(AmqpHandle.AmqpHandleBean other) {
+            this.bean = other;
+        }
+
+        public final AmqpHandleBean copy() {
+            return bean;
+        }
+
+        public final AmqpHandle.AmqpHandleBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            if(buffer == null) {
+                buffer = new AmqpHandleBuffer(marshaller.encode(this));
+            }
+            return buffer;
+        }
+
+        public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+            getBuffer(marshaller).marshal(out, marshaller);
+        }
+
+
+        public Long getValue() {
+            return bean.value;
+        }
+
+
+        public boolean equals(Object o){
+            if(this == o) {
+                return true;
+            }
+
+            if(o == null || !(o instanceof AmqpHandle)) {
+                return false;
+            }
+
+            return equivalent((AmqpHandle) o);
+        }
+
+        public int hashCode() {
+            if(getValue() == null) {
+                return AmqpHandle.AmqpHandleBean.class.hashCode();
+            }
+            return getValue().hashCode();
+        }
+
+        public boolean equivalent(AmqpType<?,?> t){
+            if(this == t) {
+                return true;
+            }
+
+            if(t == null || !(t instanceof AmqpHandle)) {
+                return false;
+            }
+
+            return equivalent((AmqpHandle) t);
+        }
+
+        public boolean equivalent(AmqpHandle 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 AmqpHandleBuffer extends AmqpUint.AmqpUintBuffer implements AmqpHandle{
+
+        private AmqpHandleBean bean;
+
+        protected AmqpHandleBuffer() {
+            super();
+        }
+
+        protected AmqpHandleBuffer(Encoded<Long> encoded) {
+            super(encoded);
+        }
+
+        public Long getValue() {
+            return bean().getValue();
+        }
+
+        public AmqpHandle.AmqpHandleBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+            return this;
+        }
+
+        protected AmqpHandle bean() {
+            if(bean == null) {
+                bean = new AmqpHandle.AmqpHandleBean(encoded.getValue());
+                bean.buffer = this;
+            }
+            return bean;
+        }
+
+        public boolean equivalent(AmqpType<?, ?> t) {
+            return bean().equivalent(t);
+        }
+
+        public static AmqpHandle.AmqpHandleBuffer create(Encoded<Long> encoded) {
+            if(encoded.isNull()) {
+                return null;
+            }
+            return new AmqpHandle.AmqpHandleBuffer(encoded);
+        }
+
+        public static AmqpHandle.AmqpHandleBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+            return create(marshaller.unmarshalAmqpUint(in));
+        }
+
+        public static AmqpHandle.AmqpHandleBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+            return create(marshaller.decodeAmqpUint(buffer, offset));
+        }
+    }
+}
\ No newline at end of file



Mime
View raw message