You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cm...@apache.org on 2010/02/11 08:04:46 UTC
svn commit: r908857 [14/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...
Added: activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpOptions.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpOptions.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpOptions.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpOptions.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,178 @@
+/**
+ * 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.AmqpMap;
+import org.apache.activemq.amqp.protocol.types.AmqpOptions;
+import org.apache.activemq.util.buffer.Buffer;
+
+/**
+ * Represents a options map
+ * <p>
+ * and all keys except those beginning with the string "x-"
+ * are reserved.
+ * </p>
+ */
+public interface AmqpOptions extends AmqpMap {
+
+
+ public static class AmqpOptionsBean implements AmqpOptions{
+
+ private AmqpOptionsBuffer buffer;
+ private AmqpOptionsBean bean = this;
+ private HashMap<AmqpType<?,?>, AmqpType<?,?>> value;
+
+ protected AmqpOptionsBean() {
+ }
+
+ public AmqpOptionsBean(HashMap<AmqpType<?,?>, AmqpType<?,?>> value) {
+ this.value = value;
+ }
+
+ public AmqpOptionsBean(AmqpOptions.AmqpOptionsBean other) {
+ this.bean = other;
+ }
+
+ public final AmqpOptionsBean copy() {
+ return new AmqpOptions.AmqpOptionsBean(bean);
+ }
+
+ public final AmqpOptions.AmqpOptionsBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+ if(buffer == null) {
+ buffer = new AmqpOptionsBuffer(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(AmqpOptions.AmqpOptionsBean other) {
+ this.value = other.value;
+ bean = this;
+ }
+
+ public boolean equivalent(AmqpType<?,?> t){
+ if(this == t) {
+ return true;
+ }
+
+ if(t == null || !(t instanceof AmqpOptions)) {
+ return false;
+ }
+
+ return equivalent((AmqpOptions) t);
+ }
+
+ public boolean equivalent(AmqpOptions 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 AmqpOptionsBuffer extends AmqpMap.AmqpMapBuffer implements AmqpOptions{
+
+ private AmqpOptionsBean bean;
+
+ protected AmqpOptionsBuffer() {
+ super();
+ }
+
+ protected AmqpOptionsBuffer(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 AmqpOptions.AmqpOptionsBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+ return this;
+ }
+
+ protected AmqpOptions bean() {
+ if(bean == null) {
+ bean = new AmqpOptions.AmqpOptionsBean(encoded.getValue());
+ bean.buffer = this;
+ }
+ return bean;
+ }
+
+ public boolean equivalent(AmqpType<?, ?> t) {
+ return bean().equivalent(t);
+ }
+
+ public static AmqpOptions.AmqpOptionsBuffer create(Encoded<HashMap<AmqpType<?,?>, AmqpType<?,?>>> encoded) {
+ if(encoded.isNull()) {
+ return null;
+ }
+ return new AmqpOptions.AmqpOptionsBuffer(encoded);
+ }
+
+ public static AmqpOptions.AmqpOptionsBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+ return create(marshaller.unmarshalAmqpMap(in));
+ }
+
+ public static AmqpOptions.AmqpOptionsBuffer 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/AmqpProperties.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpProperties.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpProperties.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpProperties.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,686 @@
+/**
+ * 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.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 immutable properties of the Message
+ * <p>
+ * Message properties carry information about the Message.
+ * </p>
+ */
+public interface AmqpProperties extends AmqpList {
+
+
+
+ /**
+ * application Message identifier
+ * <p>
+ * Message-id is an optional property which uniquely identifies a Message within the
+ * Message system. The Message producer is usually responsible for setting the message-id
+ * in such a way that it is assured to be globally unique. The server MAY discard a Message
+ * as a duplicate if the value of the message-id matches that of a previously received
+ * Message sent to the same Node.
+ * </p>
+ */
+ public void setMessageId(Buffer messageId);
+
+ /**
+ * application Message identifier
+ * <p>
+ * Message-id is an optional property which uniquely identifies a Message within the
+ * Message system. The Message producer is usually responsible for setting the message-id
+ * in such a way that it is assured to be globally unique. The server MAY discard a Message
+ * as a duplicate if the value of the message-id matches that of a previously received
+ * Message sent to the same Node.
+ * </p>
+ */
+ public void setMessageId(AmqpBinary messageId);
+
+ /**
+ * application Message identifier
+ * <p>
+ * Message-id is an optional property which uniquely identifies a Message within the
+ * Message system. The Message producer is usually responsible for setting the message-id
+ * in such a way that it is assured to be globally unique. The server MAY discard a Message
+ * as a duplicate if the value of the message-id matches that of a previously received
+ * Message sent to the same Node.
+ * </p>
+ */
+ public Buffer getMessageId();
+
+ /**
+ * creating user id
+ * <p>
+ * The identity of the user responsible for producing the Message. The client sets this
+ * value, and it MAY be authenticated by intermediaries.
+ * </p>
+ */
+ public void setUserId(Buffer userId);
+
+ /**
+ * creating user id
+ * <p>
+ * The identity of the user responsible for producing the Message. The client sets this
+ * value, and it MAY be authenticated by intermediaries.
+ * </p>
+ */
+ public void setUserId(AmqpBinary userId);
+
+ /**
+ * creating user id
+ * <p>
+ * The identity of the user responsible for producing the Message. The client sets this
+ * value, and it MAY be authenticated by intermediaries.
+ * </p>
+ */
+ public Buffer getUserId();
+
+ /**
+ * the name of the Node the Message is destined for
+ * <p>
+ * The to field identifies the Node that is the intended destination of the Message. On any
+ * given transfer this may not be the Node at the receiving end of the Link.
+ * </p>
+ */
+ public void setTo(String to);
+
+ /**
+ * the name of the Node the Message is destined for
+ * <p>
+ * The to field identifies the Node that is the intended destination of the Message. On any
+ * given transfer this may not be the Node at the receiving end of the Link.
+ * </p>
+ */
+ public void setTo(AmqpString to);
+
+ /**
+ * the name of the Node the Message is destined for
+ * <p>
+ * The to field identifies the Node that is the intended destination of the Message. On any
+ * given transfer this may not be the Node at the receiving end of the Link.
+ * </p>
+ */
+ public String getTo();
+
+ /**
+ * the Node to send replies to
+ * <p>
+ * The name of the Node to send replies to.
+ * </p>
+ */
+ public void setReplyTo(String replyTo);
+
+ /**
+ * the Node to send replies to
+ * <p>
+ * The name of the Node to send replies to.
+ * </p>
+ */
+ public void setReplyTo(AmqpString replyTo);
+
+ /**
+ * the Node to send replies to
+ * <p>
+ * The name of the Node to send replies to.
+ * </p>
+ */
+ public String getReplyTo();
+
+ /**
+ * application correlation identifier
+ * <p>
+ * This is a client-specific id that may be used to mark or identify Messages between
+ * clients. The server ignores this field.
+ * </p>
+ */
+ public void setCorrelationId(Buffer correlationId);
+
+ /**
+ * application correlation identifier
+ * <p>
+ * This is a client-specific id that may be used to mark or identify Messages between
+ * clients. The server ignores this field.
+ * </p>
+ */
+ public void setCorrelationId(AmqpBinary correlationId);
+
+ /**
+ * application correlation identifier
+ * <p>
+ * This is a client-specific id that may be used to mark or identify Messages between
+ * clients. The server ignores this field.
+ * </p>
+ */
+ public Buffer getCorrelationId();
+
+ /**
+ * length of the combined payload in bytes
+ * <p>
+ * The total size in octets of the combined payload of all transfer commands that together
+ * make the Message.
+ * </p>
+ */
+ public void setContentLength(BigInteger contentLength);
+
+ /**
+ * length of the combined payload in bytes
+ * <p>
+ * The total size in octets of the combined payload of all transfer commands that together
+ * make the Message.
+ * </p>
+ */
+ public void setContentLength(AmqpUlong contentLength);
+
+ /**
+ * length of the combined payload in bytes
+ * <p>
+ * The total size in octets of the combined payload of all transfer commands that together
+ * make the Message.
+ * </p>
+ */
+ public BigInteger getContentLength();
+
+ /**
+ * MIME content type
+ * <p>
+ * The RFC-2046 MIME type for the Message content (such as "text/plain"). This is set by
+ * the originating client. As per RFC-2046 this may contain a charset parameter defining
+ * the character encoding used: e.g. 'text/plain; charset="utf-8"'.
+ * </p>
+ */
+ public void setContentType(String contentType);
+
+ /**
+ * MIME content type
+ * <p>
+ * The RFC-2046 MIME type for the Message content (such as "text/plain"). This is set by
+ * the originating client. As per RFC-2046 this may contain a charset parameter defining
+ * the character encoding used: e.g. 'text/plain; charset="utf-8"'.
+ * </p>
+ */
+ public void setContentType(AmqpSymbol contentType);
+
+ /**
+ * MIME content type
+ * <p>
+ * The RFC-2046 MIME type for the Message content (such as "text/plain"). This is set by
+ * the originating client. As per RFC-2046 this may contain a charset parameter defining
+ * the character encoding used: e.g. 'text/plain; charset="utf-8"'.
+ * </p>
+ */
+ public String getContentType();
+
+ public static class AmqpPropertiesBean implements AmqpProperties{
+
+ private AmqpPropertiesBuffer buffer;
+ private AmqpPropertiesBean bean = this;
+ private AmqpBinary messageId;
+ private AmqpBinary userId;
+ private AmqpString to;
+ private AmqpString replyTo;
+ private AmqpBinary correlationId;
+ private AmqpUlong contentLength;
+ private AmqpSymbol contentType;
+
+ public AmqpPropertiesBean() {
+ }
+
+ public AmqpPropertiesBean(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 AmqpPropertiesBean(AmqpProperties.AmqpPropertiesBean other) {
+ this.bean = other;
+ }
+
+ public final AmqpPropertiesBean copy() {
+ return new AmqpProperties.AmqpPropertiesBean(bean);
+ }
+
+ public final AmqpProperties.AmqpPropertiesBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+ if(buffer == null) {
+ buffer = new AmqpPropertiesBuffer(marshaller.encode(this));
+ }
+ return buffer;
+ }
+
+ public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+ getBuffer(marshaller).marshal(out, marshaller);
+ }
+
+
+ public void setMessageId(Buffer messageId) {
+ setMessageId(new AmqpBinary.AmqpBinaryBean(messageId));
+ }
+
+
+ public final void setMessageId(AmqpBinary messageId) {
+ copyCheck();
+ bean.messageId = messageId;
+ }
+
+ public final Buffer getMessageId() {
+ return bean.messageId.getValue();
+ }
+
+ public void setUserId(Buffer userId) {
+ setUserId(new AmqpBinary.AmqpBinaryBean(userId));
+ }
+
+
+ public final void setUserId(AmqpBinary userId) {
+ copyCheck();
+ bean.userId = userId;
+ }
+
+ public final Buffer getUserId() {
+ return bean.userId.getValue();
+ }
+
+ public void setTo(String to) {
+ setTo(new AmqpString.AmqpStringBean(to));
+ }
+
+
+ public final void setTo(AmqpString to) {
+ copyCheck();
+ bean.to = to;
+ }
+
+ public final String getTo() {
+ return bean.to.getValue();
+ }
+
+ public void setReplyTo(String replyTo) {
+ setReplyTo(new AmqpString.AmqpStringBean(replyTo));
+ }
+
+
+ public final void setReplyTo(AmqpString replyTo) {
+ copyCheck();
+ bean.replyTo = replyTo;
+ }
+
+ public final String getReplyTo() {
+ return bean.replyTo.getValue();
+ }
+
+ public void setCorrelationId(Buffer correlationId) {
+ setCorrelationId(new AmqpBinary.AmqpBinaryBean(correlationId));
+ }
+
+
+ public final void setCorrelationId(AmqpBinary correlationId) {
+ copyCheck();
+ bean.correlationId = correlationId;
+ }
+
+ public final Buffer getCorrelationId() {
+ return bean.correlationId.getValue();
+ }
+
+ public void setContentLength(BigInteger contentLength) {
+ setContentLength(new AmqpUlong.AmqpUlongBean(contentLength));
+ }
+
+
+ public final void setContentLength(AmqpUlong contentLength) {
+ copyCheck();
+ bean.contentLength = contentLength;
+ }
+
+ public final BigInteger getContentLength() {
+ return bean.contentLength.getValue();
+ }
+
+ public void setContentType(String contentType) {
+ setContentType(new AmqpSymbol.AmqpSymbolBean(contentType));
+ }
+
+
+ public final void setContentType(AmqpSymbol contentType) {
+ copyCheck();
+ bean.contentType = contentType;
+ }
+
+ public final String getContentType() {
+ return bean.contentType.getValue();
+ }
+
+ public void set(int index, AmqpType<?, ?> value) {
+ switch(index) {
+ case 0: {
+ setMessageId((AmqpBinary) value);
+ break;
+ }
+ case 1: {
+ setUserId((AmqpBinary) value);
+ break;
+ }
+ case 2: {
+ setTo((AmqpString) value);
+ break;
+ }
+ case 3: {
+ setReplyTo((AmqpString) value);
+ break;
+ }
+ case 4: {
+ setCorrelationId((AmqpBinary) value);
+ break;
+ }
+ case 5: {
+ setContentLength((AmqpUlong) value);
+ break;
+ }
+ case 6: {
+ setContentType((AmqpSymbol) value);
+ break;
+ }
+ default : {
+ throw new IndexOutOfBoundsException(String.valueOf(index));
+ }
+ }
+ }
+
+ public AmqpType<?, ?> get(int index) {
+ switch(index) {
+ case 0: {
+ return bean.messageId;
+ }
+ case 1: {
+ return bean.userId;
+ }
+ case 2: {
+ return bean.to;
+ }
+ case 3: {
+ return bean.replyTo;
+ }
+ case 4: {
+ return bean.correlationId;
+ }
+ case 5: {
+ return bean.contentLength;
+ }
+ case 6: {
+ return bean.contentType;
+ }
+ 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(AmqpProperties.AmqpPropertiesBean other) {
+ this.messageId= other.messageId;
+ this.userId= other.userId;
+ this.to= other.to;
+ this.replyTo= other.replyTo;
+ this.correlationId= other.correlationId;
+ this.contentLength= other.contentLength;
+ this.contentType= other.contentType;
+ bean = this;
+ }
+
+ public boolean equivalent(AmqpType<?,?> t){
+ if(this == t) {
+ return true;
+ }
+
+ if(t == null || !(t instanceof AmqpProperties)) {
+ return false;
+ }
+
+ return equivalent((AmqpProperties) t);
+ }
+
+ public boolean equivalent(AmqpProperties b) {
+
+ if(b.getMessageId() == null ^ getMessageId() == null) {
+ return false;
+ }
+ if(b.getMessageId() != null && !b.getMessageId().equals(getMessageId())){
+ return false;
+ }
+
+ if(b.getUserId() == null ^ getUserId() == null) {
+ return false;
+ }
+ if(b.getUserId() != null && !b.getUserId().equals(getUserId())){
+ return false;
+ }
+
+ if(b.getTo() == null ^ getTo() == null) {
+ return false;
+ }
+ if(b.getTo() != null && !b.getTo().equals(getTo())){
+ return false;
+ }
+
+ if(b.getReplyTo() == null ^ getReplyTo() == null) {
+ return false;
+ }
+ if(b.getReplyTo() != null && !b.getReplyTo().equals(getReplyTo())){
+ return false;
+ }
+
+ if(b.getCorrelationId() == null ^ getCorrelationId() == null) {
+ return false;
+ }
+ if(b.getCorrelationId() != null && !b.getCorrelationId().equals(getCorrelationId())){
+ return false;
+ }
+
+ if(b.getContentLength() == null ^ getContentLength() == null) {
+ return false;
+ }
+ if(b.getContentLength() != null && !b.getContentLength().equals(getContentLength())){
+ return false;
+ }
+
+ if(b.getContentType() == null ^ getContentType() == null) {
+ return false;
+ }
+ if(b.getContentType() != null && !b.getContentType().equals(getContentType())){
+ return false;
+ }
+ return true;
+ }
+ }
+
+ public static class AmqpPropertiesBuffer extends AmqpList.AmqpListBuffer implements AmqpProperties{
+
+ private AmqpPropertiesBean bean;
+
+ protected AmqpPropertiesBuffer(Encoded<IAmqpList> encoded) {
+ super(encoded);
+ }
+
+ public void setMessageId(Buffer messageId) {
+ bean().setMessageId(messageId);
+ }
+
+ public final void setMessageId(AmqpBinary messageId) {
+ bean().setMessageId(messageId);
+ }
+
+ public final Buffer getMessageId() {
+ return bean().getMessageId();
+ }
+
+ public void setUserId(Buffer userId) {
+ bean().setUserId(userId);
+ }
+
+ public final void setUserId(AmqpBinary userId) {
+ bean().setUserId(userId);
+ }
+
+ public final Buffer getUserId() {
+ return bean().getUserId();
+ }
+
+ public void setTo(String to) {
+ bean().setTo(to);
+ }
+
+ public final void setTo(AmqpString to) {
+ bean().setTo(to);
+ }
+
+ public final String getTo() {
+ return bean().getTo();
+ }
+
+ public void setReplyTo(String replyTo) {
+ bean().setReplyTo(replyTo);
+ }
+
+ public final void setReplyTo(AmqpString replyTo) {
+ bean().setReplyTo(replyTo);
+ }
+
+ public final String getReplyTo() {
+ return bean().getReplyTo();
+ }
+
+ public void setCorrelationId(Buffer correlationId) {
+ bean().setCorrelationId(correlationId);
+ }
+
+ public final void setCorrelationId(AmqpBinary correlationId) {
+ bean().setCorrelationId(correlationId);
+ }
+
+ public final Buffer getCorrelationId() {
+ return bean().getCorrelationId();
+ }
+
+ public void setContentLength(BigInteger contentLength) {
+ bean().setContentLength(contentLength);
+ }
+
+ public final void setContentLength(AmqpUlong contentLength) {
+ bean().setContentLength(contentLength);
+ }
+
+ public final BigInteger getContentLength() {
+ return bean().getContentLength();
+ }
+
+ public void setContentType(String contentType) {
+ bean().setContentType(contentType);
+ }
+
+ public final void setContentType(AmqpSymbol contentType) {
+ bean().setContentType(contentType);
+ }
+
+ public final String getContentType() {
+ return bean().getContentType();
+ }
+
+ 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 AmqpProperties.AmqpPropertiesBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+ return this;
+ }
+
+ protected AmqpProperties bean() {
+ if(bean == null) {
+ bean = new AmqpProperties.AmqpPropertiesBean(encoded.getValue());
+ bean.buffer = this;
+ }
+ return bean;
+ }
+
+ public boolean equivalent(AmqpType<?, ?> t) {
+ return bean().equivalent(t);
+ }
+
+ public static AmqpProperties.AmqpPropertiesBuffer create(Encoded<IAmqpList> encoded) {
+ if(encoded.isNull()) {
+ return null;
+ }
+ return new AmqpProperties.AmqpPropertiesBuffer(encoded);
+ }
+
+ public static AmqpProperties.AmqpPropertiesBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+ return create(marshaller.unmarshalAmqpProperties(in));
+ }
+
+ public static AmqpProperties.AmqpPropertiesBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+ return create(marshaller.decodeAmqpProperties(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/AmqpRejected.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpRejected.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpRejected.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpRejected.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,289 @@
+/**
+ * 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 rejected disposition
+ * <p>
+ * The rejected disposition is used to indicate that an incoming Message is invalid and
+ * therefore unprocessable. If an attempt to transfer a Message results in a reject from the
+ * recipient, the sender MUST add the supplied reject-properties to the Message header
+ * message-attrs. A rejected Message may be held at the node, forwarded to a different node
+ * (for instance a dead letter queue) or discarded depending on configuration at the node.
+ * </p>
+ */
+public interface AmqpRejected 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();
+
+ /**
+ * <p>
+ * The map supplied in this field will be placed in any rejected Message headers in the
+ * message-attrs map under the key "reject-properties".
+ * </p>
+ */
+ public void setRejectProperties(HashMap<AmqpType<?,?>, AmqpType<?,?>> rejectProperties);
+
+ /**
+ * <p>
+ * The map supplied in this field will be placed in any rejected Message headers in the
+ * message-attrs map under the key "reject-properties".
+ * </p>
+ */
+ public void setRejectProperties(AmqpMap rejectProperties);
+
+ /**
+ * <p>
+ * The map supplied in this field will be placed in any rejected Message headers in the
+ * message-attrs map under the key "reject-properties".
+ * </p>
+ */
+ public HashMap<AmqpType<?,?>, AmqpType<?,?>> getRejectProperties();
+
+ public static class AmqpRejectedBean implements AmqpRejected{
+
+ private AmqpRejectedBuffer buffer;
+ private AmqpRejectedBean bean = this;
+ private AmqpBoolean truncate;
+ private AmqpMap rejectProperties;
+ private HashMap<AmqpType<?,?>, AmqpType<?,?>> value;
+
+ public AmqpRejectedBean() {
+ }
+
+ public AmqpRejectedBean(HashMap<AmqpType<?,?>, AmqpType<?,?>> value) {
+ this.value = value;
+ }
+
+ public AmqpRejectedBean(AmqpRejected.AmqpRejectedBean other) {
+ this.bean = other;
+ }
+
+ public final AmqpRejectedBean copy() {
+ return new AmqpRejected.AmqpRejectedBean(bean);
+ }
+
+ public final AmqpRejected.AmqpRejectedBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+ if(buffer == null) {
+ buffer = new AmqpRejectedBuffer(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 setRejectProperties(HashMap<AmqpType<?,?>, AmqpType<?,?>> rejectProperties) {
+ setRejectProperties(new AmqpMap.AmqpMapBean(rejectProperties));
+ }
+
+
+ public final void setRejectProperties(AmqpMap rejectProperties) {
+ copyCheck();
+ bean.rejectProperties = rejectProperties;
+ }
+
+ public final HashMap<AmqpType<?,?>, AmqpType<?,?>> getRejectProperties() {
+ return bean.rejectProperties.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(AmqpRejected.AmqpRejectedBean other) {
+ this.truncate= other.truncate;
+ this.rejectProperties= other.rejectProperties;
+ bean = this;
+ }
+
+ public boolean equivalent(AmqpType<?,?> t){
+ if(this == t) {
+ return true;
+ }
+
+ if(t == null || !(t instanceof AmqpRejected)) {
+ return false;
+ }
+
+ return equivalent((AmqpRejected) t);
+ }
+
+ public boolean equivalent(AmqpRejected b) {
+
+ if(b.getTruncate() == null ^ getTruncate() == null) {
+ return false;
+ }
+ if(b.getTruncate() != null && !b.getTruncate().equals(getTruncate())){
+ return false;
+ }
+
+ if(b.getRejectProperties() == null ^ getRejectProperties() == null) {
+ return false;
+ }
+ if(b.getRejectProperties() != null && !b.getRejectProperties().equals(getRejectProperties())){
+ return false;
+ }
+ return true;
+ }
+ }
+
+ public static class AmqpRejectedBuffer extends AmqpMap.AmqpMapBuffer implements AmqpRejected{
+
+ private AmqpRejectedBean bean;
+
+ protected AmqpRejectedBuffer(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 setRejectProperties(HashMap<AmqpType<?,?>, AmqpType<?,?>> rejectProperties) {
+ bean().setRejectProperties(rejectProperties);
+ }
+
+ public final void setRejectProperties(AmqpMap rejectProperties) {
+ bean().setRejectProperties(rejectProperties);
+ }
+
+ public final HashMap<AmqpType<?,?>, AmqpType<?,?>> getRejectProperties() {
+ return bean().getRejectProperties();
+ }
+ 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 AmqpRejected.AmqpRejectedBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+ return this;
+ }
+
+ protected AmqpRejected bean() {
+ if(bean == null) {
+ bean = new AmqpRejected.AmqpRejectedBean(encoded.getValue());
+ bean.buffer = this;
+ }
+ return bean;
+ }
+
+ public boolean equivalent(AmqpType<?, ?> t) {
+ return bean().equivalent(t);
+ }
+
+ public static AmqpRejected.AmqpRejectedBuffer create(Encoded<HashMap<AmqpType<?,?>, AmqpType<?,?>>> encoded) {
+ if(encoded.isNull()) {
+ return null;
+ }
+ return new AmqpRejected.AmqpRejectedBuffer(encoded);
+ }
+
+ public static AmqpRejected.AmqpRejectedBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+ return create(marshaller.unmarshalAmqpRejected(in));
+ }
+
+ public static AmqpRejected.AmqpRejectedBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+ return create(marshaller.decodeAmqpRejected(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/AmqpReleased.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpReleased.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpReleased.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpReleased.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,454 @@
+/**
+ * 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 released disposition
+ * <p>
+ * The released disposition is used to indicate that a given transfer was not and will not be
+ * acted upon. The Messages carried by released transfers transition to the available state.
+ * Messages that have been released MAY subsequently be delivered out of order.
+ * Implementations SHOULD ensure that released Messages keep their position with respect to
+ * undelivered Messages of the same priority.
+ * </p>
+ */
+public interface AmqpReleased 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();
+
+ /**
+ * count the transfer as an unsuccessful delivery attempt
+ * <p>
+ * If the delivery-failed flag is set, any Messages released MUST have their
+ * delivery-failures count incremented.
+ * </p>
+ */
+ public void setDeliveryFailed(Boolean deliveryFailed);
+
+ /**
+ * count the transfer as an unsuccessful delivery attempt
+ * <p>
+ * If the delivery-failed flag is set, any Messages released MUST have their
+ * delivery-failures count incremented.
+ * </p>
+ */
+ public void setDeliveryFailed(AmqpBoolean deliveryFailed);
+
+ /**
+ * count the transfer as an unsuccessful delivery attempt
+ * <p>
+ * If the delivery-failed flag is set, any Messages released MUST have their
+ * delivery-failures count incremented.
+ * </p>
+ */
+ public Boolean getDeliveryFailed();
+
+ /**
+ * prevent redelivery
+ * <p>
+ * If the deliver-elsewhere is set, then any Messages released MUST NOT be redelivered to
+ * the releasing Link Endpoint.
+ * </p>
+ */
+ public void setDeliverElsewhere(Boolean deliverElsewhere);
+
+ /**
+ * prevent redelivery
+ * <p>
+ * If the deliver-elsewhere is set, then any Messages released MUST NOT be redelivered to
+ * the releasing Link Endpoint.
+ * </p>
+ */
+ public void setDeliverElsewhere(AmqpBoolean deliverElsewhere);
+
+ /**
+ * prevent redelivery
+ * <p>
+ * If the deliver-elsewhere is set, then any Messages released MUST NOT be redelivered to
+ * the releasing Link Endpoint.
+ * </p>
+ */
+ public Boolean getDeliverElsewhere();
+
+ /**
+ * message attributes
+ * <p>
+ * held in the
+ * Message's header section. Where the existing message-attrs of the Message contain an
+ * entry with the same key as an entry in this field, the value in this field associated
+ * with that key replaces the one in the existing headers; where the existing message-attrs
+ * has no such value, the value in this map is added.
+ * </p>
+ */
+ public void setMessageAttrs(AmqpMessageAttributes messageAttrs);
+
+ /**
+ * message attributes
+ * <p>
+ * held in the
+ * Message's header section. Where the existing message-attrs of the Message contain an
+ * entry with the same key as an entry in this field, the value in this field associated
+ * with that key replaces the one in the existing headers; where the existing message-attrs
+ * has no such value, the value in this map is added.
+ * </p>
+ */
+ public AmqpMessageAttributes getMessageAttrs();
+
+ /**
+ * delivery attributes
+ * <p>
+ * held in the
+ * Message's header section. Where the existing delivery-attrs of the Message contain an
+ * entry with the same key as an entry in this field, the value in this field associated
+ * with that key replaces the one in the existing headers; where the existing
+ * delivery-attrs has no such value, the value in this map is added.
+ * </p>
+ */
+ public void setDeliveryAttrs(AmqpMessageAttributes deliveryAttrs);
+
+ /**
+ * delivery attributes
+ * <p>
+ * held in the
+ * Message's header section. Where the existing delivery-attrs of the Message contain an
+ * entry with the same key as an entry in this field, the value in this field associated
+ * with that key replaces the one in the existing headers; where the existing
+ * delivery-attrs has no such value, the value in this map is added.
+ * </p>
+ */
+ public AmqpMessageAttributes getDeliveryAttrs();
+
+ public static class AmqpReleasedBean implements AmqpReleased{
+
+ private AmqpReleasedBuffer buffer;
+ private AmqpReleasedBean bean = this;
+ private AmqpBoolean truncate;
+ private AmqpBoolean deliveryFailed;
+ private AmqpBoolean deliverElsewhere;
+ private AmqpMessageAttributes messageAttrs;
+ private AmqpMessageAttributes deliveryAttrs;
+ private HashMap<AmqpType<?,?>, AmqpType<?,?>> value;
+
+ public AmqpReleasedBean() {
+ }
+
+ public AmqpReleasedBean(HashMap<AmqpType<?,?>, AmqpType<?,?>> value) {
+ this.value = value;
+ }
+
+ public AmqpReleasedBean(AmqpReleased.AmqpReleasedBean other) {
+ this.bean = other;
+ }
+
+ public final AmqpReleasedBean copy() {
+ return new AmqpReleased.AmqpReleasedBean(bean);
+ }
+
+ public final AmqpReleased.AmqpReleasedBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+ if(buffer == null) {
+ buffer = new AmqpReleasedBuffer(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 setDeliveryFailed(Boolean deliveryFailed) {
+ setDeliveryFailed(new AmqpBoolean.AmqpBooleanBean(deliveryFailed));
+ }
+
+
+ public final void setDeliveryFailed(AmqpBoolean deliveryFailed) {
+ copyCheck();
+ bean.deliveryFailed = deliveryFailed;
+ }
+
+ public final Boolean getDeliveryFailed() {
+ return bean.deliveryFailed.getValue();
+ }
+
+ public void setDeliverElsewhere(Boolean deliverElsewhere) {
+ setDeliverElsewhere(new AmqpBoolean.AmqpBooleanBean(deliverElsewhere));
+ }
+
+
+ public final void setDeliverElsewhere(AmqpBoolean deliverElsewhere) {
+ copyCheck();
+ bean.deliverElsewhere = deliverElsewhere;
+ }
+
+ public final Boolean getDeliverElsewhere() {
+ return bean.deliverElsewhere.getValue();
+ }
+
+ public final void setMessageAttrs(AmqpMessageAttributes messageAttrs) {
+ copyCheck();
+ bean.messageAttrs = messageAttrs;
+ }
+
+ public final AmqpMessageAttributes getMessageAttrs() {
+ return bean.messageAttrs;
+ }
+
+ public final void setDeliveryAttrs(AmqpMessageAttributes deliveryAttrs) {
+ copyCheck();
+ bean.deliveryAttrs = deliveryAttrs;
+ }
+
+ public final AmqpMessageAttributes getDeliveryAttrs() {
+ return bean.deliveryAttrs;
+ }
+ public void 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(AmqpReleased.AmqpReleasedBean other) {
+ this.truncate= other.truncate;
+ this.deliveryFailed= other.deliveryFailed;
+ this.deliverElsewhere= other.deliverElsewhere;
+ 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 AmqpReleased)) {
+ return false;
+ }
+
+ return equivalent((AmqpReleased) t);
+ }
+
+ public boolean equivalent(AmqpReleased b) {
+
+ if(b.getTruncate() == null ^ getTruncate() == null) {
+ return false;
+ }
+ if(b.getTruncate() != null && !b.getTruncate().equals(getTruncate())){
+ return false;
+ }
+
+ if(b.getDeliveryFailed() == null ^ getDeliveryFailed() == null) {
+ return false;
+ }
+ if(b.getDeliveryFailed() != null && !b.getDeliveryFailed().equals(getDeliveryFailed())){
+ return false;
+ }
+
+ if(b.getDeliverElsewhere() == null ^ getDeliverElsewhere() == null) {
+ return false;
+ }
+ if(b.getDeliverElsewhere() != null && !b.getDeliverElsewhere().equals(getDeliverElsewhere())){
+ return false;
+ }
+
+ 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 AmqpReleasedBuffer extends AmqpMap.AmqpMapBuffer implements AmqpReleased{
+
+ private AmqpReleasedBean bean;
+
+ protected AmqpReleasedBuffer(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 setDeliveryFailed(Boolean deliveryFailed) {
+ bean().setDeliveryFailed(deliveryFailed);
+ }
+
+ public final void setDeliveryFailed(AmqpBoolean deliveryFailed) {
+ bean().setDeliveryFailed(deliveryFailed);
+ }
+
+ public final Boolean getDeliveryFailed() {
+ return bean().getDeliveryFailed();
+ }
+
+ public void setDeliverElsewhere(Boolean deliverElsewhere) {
+ bean().setDeliverElsewhere(deliverElsewhere);
+ }
+
+ public final void setDeliverElsewhere(AmqpBoolean deliverElsewhere) {
+ bean().setDeliverElsewhere(deliverElsewhere);
+ }
+
+ public final Boolean getDeliverElsewhere() {
+ return bean().getDeliverElsewhere();
+ }
+
+ 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 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 AmqpReleased.AmqpReleasedBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+ return this;
+ }
+
+ protected AmqpReleased bean() {
+ if(bean == null) {
+ bean = new AmqpReleased.AmqpReleasedBean(encoded.getValue());
+ bean.buffer = this;
+ }
+ return bean;
+ }
+
+ public boolean equivalent(AmqpType<?, ?> t) {
+ return bean().equivalent(t);
+ }
+
+ public static AmqpReleased.AmqpReleasedBuffer create(Encoded<HashMap<AmqpType<?,?>, AmqpType<?,?>>> encoded) {
+ if(encoded.isNull()) {
+ return null;
+ }
+ return new AmqpReleased.AmqpReleasedBuffer(encoded);
+ }
+
+ public static AmqpReleased.AmqpReleasedBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+ return create(marshaller.unmarshalAmqpReleased(in));
+ }
+
+ public static AmqpReleased.AmqpReleasedBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+ return create(marshaller.decodeAmqpReleased(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/AmqpRelink.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpRelink.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpRelink.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpRelink.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,408 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.types;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import org.apache.activemq.amqp.protocol.AmqpCommand;
+import org.apache.activemq.amqp.protocol.AmqpCommandHandler;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpMarshaller;
+import org.apache.activemq.amqp.protocol.marshaller.Encoded;
+import org.apache.activemq.amqp.protocol.types.IAmqpList;
+import org.apache.activemq.util.buffer.Buffer;
+
+/**
+ * Represents a re-establish Link parameters
+ * <p>
+ * The relink command updates the source and/or target definition(s) associated with an
+ * existing link. This is the same as unlinking and relinking except you will not receive
+ * messages already successfully transferred along the link. Relinking will not always be
+ * possible, e.g. if the new and the old source refer to distinct nodes. If a relink is not
+ * possible, the receiver MUST unlink the link with an appropriate error before signaling the
+ * relink as executed.
+ * </p>
+ */
+public interface AmqpRelink extends AmqpList, AmqpCommand {
+
+
+
+ /**
+ * options map
+ */
+ public void setOptions(AmqpOptions options);
+
+ /**
+ * options map
+ */
+ public AmqpOptions getOptions();
+
+ /**
+ * identifies the Link
+ */
+ public void setHandle(AmqpHandle handle);
+
+ /**
+ * identifies the Link
+ */
+ public AmqpHandle getHandle();
+
+ /**
+ * the source for Messages
+ */
+ public void setSource(HashMap<AmqpType<?,?>, AmqpType<?,?>> source);
+
+ /**
+ * the source for Messages
+ */
+ public void setSource(AmqpMap source);
+
+ /**
+ * the source for Messages
+ */
+ public HashMap<AmqpType<?,?>, AmqpType<?,?>> getSource();
+
+ /**
+ * the target for Messages
+ */
+ public void setTarget(HashMap<AmqpType<?,?>, AmqpType<?,?>> target);
+
+ /**
+ * the target for Messages
+ */
+ public void setTarget(AmqpMap target);
+
+ /**
+ * the target for Messages
+ */
+ public HashMap<AmqpType<?,?>, AmqpType<?,?>> getTarget();
+
+ public static class AmqpRelinkBean implements AmqpRelink{
+
+ private AmqpRelinkBuffer buffer;
+ private AmqpRelinkBean bean = this;
+ private AmqpOptions options;
+ private AmqpHandle handle;
+ private AmqpMap source;
+ private AmqpMap target;
+
+ public AmqpRelinkBean() {
+ }
+
+ public AmqpRelinkBean(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 AmqpRelinkBean(AmqpRelink.AmqpRelinkBean other) {
+ this.bean = other;
+ }
+
+ public final AmqpRelinkBean copy() {
+ return new AmqpRelink.AmqpRelinkBean(bean);
+ }
+
+ public final void handle(AmqpCommandHandler handler) throws Exception {
+ handler.handleRelink(this);
+ }
+
+ public final AmqpRelink.AmqpRelinkBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+ if(buffer == null) {
+ buffer = new AmqpRelinkBuffer(marshaller.encode(this));
+ }
+ return buffer;
+ }
+
+ public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+ getBuffer(marshaller).marshal(out, marshaller);
+ }
+
+
+ public final void setOptions(AmqpOptions options) {
+ copyCheck();
+ bean.options = options;
+ }
+
+ public final AmqpOptions getOptions() {
+ return bean.options;
+ }
+
+ public final void setHandle(AmqpHandle handle) {
+ copyCheck();
+ bean.handle = handle;
+ }
+
+ public final AmqpHandle getHandle() {
+ return bean.handle;
+ }
+
+ public void setSource(HashMap<AmqpType<?,?>, AmqpType<?,?>> source) {
+ setSource(new AmqpMap.AmqpMapBean(source));
+ }
+
+
+ public final void setSource(AmqpMap source) {
+ copyCheck();
+ bean.source = source;
+ }
+
+ public final HashMap<AmqpType<?,?>, AmqpType<?,?>> getSource() {
+ return bean.source.getValue();
+ }
+
+ public void setTarget(HashMap<AmqpType<?,?>, AmqpType<?,?>> target) {
+ setTarget(new AmqpMap.AmqpMapBean(target));
+ }
+
+
+ public final void setTarget(AmqpMap target) {
+ copyCheck();
+ bean.target = target;
+ }
+
+ public final HashMap<AmqpType<?,?>, AmqpType<?,?>> getTarget() {
+ return bean.target.getValue();
+ }
+
+ public void set(int index, AmqpType<?, ?> value) {
+ switch(index) {
+ case 0: {
+ setOptions((AmqpOptions) value);
+ break;
+ }
+ case 1: {
+ setHandle((AmqpHandle) value);
+ break;
+ }
+ case 2: {
+ setSource((AmqpMap) value);
+ break;
+ }
+ case 3: {
+ setTarget((AmqpMap) 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.source;
+ }
+ case 3: {
+ return bean.target;
+ }
+ default : {
+ throw new IndexOutOfBoundsException(String.valueOf(index));
+ }
+ }
+ }
+
+ public int getListCount() {
+ return 4;
+ }
+
+ public IAmqpList getValue() {
+ return bean;
+ }
+
+ public Iterator<AmqpType<?, ?>> iterator() {
+ return new AmqpListIterator(bean);
+ }
+
+
+ private final void copyCheck() {
+ if(buffer != null) {;
+ throw new IllegalStateException("unwriteable");
+ }
+ if(bean != this) {;
+ copy(bean);
+ }
+ }
+
+ private final void copy(AmqpRelink.AmqpRelinkBean other) {
+ this.options= other.options;
+ this.handle= other.handle;
+ this.source= other.source;
+ this.target= other.target;
+ bean = this;
+ }
+
+ public boolean equivalent(AmqpType<?,?> t){
+ if(this == t) {
+ return true;
+ }
+
+ if(t == null || !(t instanceof AmqpRelink)) {
+ return false;
+ }
+
+ return equivalent((AmqpRelink) t);
+ }
+
+ public boolean equivalent(AmqpRelink 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.getSource() == null ^ getSource() == null) {
+ return false;
+ }
+ if(b.getSource() != null && !b.getSource().equals(getSource())){
+ return false;
+ }
+
+ if(b.getTarget() == null ^ getTarget() == null) {
+ return false;
+ }
+ if(b.getTarget() != null && !b.getTarget().equals(getTarget())){
+ return false;
+ }
+ return true;
+ }
+ }
+
+ public static class AmqpRelinkBuffer extends AmqpList.AmqpListBuffer implements AmqpRelink{
+
+ private AmqpRelinkBean bean;
+
+ protected AmqpRelinkBuffer(Encoded<IAmqpList> encoded) {
+ super(encoded);
+ }
+
+ public final void setOptions(AmqpOptions options) {
+ bean().setOptions(options);
+ }
+
+ public final AmqpOptions getOptions() {
+ return bean().getOptions();
+ }
+
+ public final void setHandle(AmqpHandle handle) {
+ bean().setHandle(handle);
+ }
+
+ public final AmqpHandle getHandle() {
+ return bean().getHandle();
+ }
+
+ public void setSource(HashMap<AmqpType<?,?>, AmqpType<?,?>> source) {
+ bean().setSource(source);
+ }
+
+ public final void setSource(AmqpMap source) {
+ bean().setSource(source);
+ }
+
+ public final HashMap<AmqpType<?,?>, AmqpType<?,?>> getSource() {
+ return bean().getSource();
+ }
+
+ public void setTarget(HashMap<AmqpType<?,?>, AmqpType<?,?>> target) {
+ bean().setTarget(target);
+ }
+
+ public final void setTarget(AmqpMap target) {
+ bean().setTarget(target);
+ }
+
+ public final HashMap<AmqpType<?,?>, AmqpType<?,?>> getTarget() {
+ return bean().getTarget();
+ }
+
+ 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 AmqpRelink.AmqpRelinkBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+ return this;
+ }
+
+ protected AmqpRelink bean() {
+ if(bean == null) {
+ bean = new AmqpRelink.AmqpRelinkBean(encoded.getValue());
+ bean.buffer = this;
+ }
+ return bean;
+ }
+
+ public final void handle(AmqpCommandHandler handler) throws Exception {
+ handler.handleRelink(this);
+ }
+
+ public boolean equivalent(AmqpType<?, ?> t) {
+ return bean().equivalent(t);
+ }
+
+ public static AmqpRelink.AmqpRelinkBuffer create(Encoded<IAmqpList> encoded) {
+ if(encoded.isNull()) {
+ return null;
+ }
+ return new AmqpRelink.AmqpRelinkBuffer(encoded);
+ }
+
+ public static AmqpRelink.AmqpRelinkBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+ return create(marshaller.unmarshalAmqpRelink(in));
+ }
+
+ public static AmqpRelink.AmqpRelinkBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+ return create(marshaller.decodeAmqpRelink(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/AmqpSaslChallenge.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpSaslChallenge.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpSaslChallenge.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpSaslChallenge.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,319 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.types;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import org.apache.activemq.amqp.protocol.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 security mechanism challenge
+ * <p>
+ * Send the SASL challenge data as defined by the SASL specification.
+ * </p>
+ */
+public interface AmqpSaslChallenge extends AmqpList {
+
+
+
+ /**
+ * options map
+ */
+ public void setOptions(HashMap<AmqpType<?,?>, AmqpType<?,?>> options);
+
+ /**
+ * options map
+ */
+ public void setOptions(AmqpMap options);
+
+ /**
+ * options map
+ */
+ public HashMap<AmqpType<?,?>, AmqpType<?,?>> getOptions();
+
+ /**
+ * security challenge data
+ * <p>
+ * Challenge information, a block of opaque binary data passed to the security
+ * mechanism.
+ * </p>
+ */
+ public void setChallenge(Buffer challenge);
+
+ /**
+ * security challenge data
+ * <p>
+ * Challenge information, a block of opaque binary data passed to the security
+ * mechanism.
+ * </p>
+ */
+ public void setChallenge(AmqpBinary challenge);
+
+ /**
+ * security challenge data
+ * <p>
+ * Challenge information, a block of opaque binary data passed to the security
+ * mechanism.
+ * </p>
+ */
+ public Buffer getChallenge();
+
+ public static class AmqpSaslChallengeBean implements AmqpSaslChallenge{
+
+ private AmqpSaslChallengeBuffer buffer;
+ private AmqpSaslChallengeBean bean = this;
+ private AmqpMap options;
+ private AmqpBinary challenge;
+
+ public AmqpSaslChallengeBean() {
+ }
+
+ public AmqpSaslChallengeBean(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 AmqpSaslChallengeBean(AmqpSaslChallenge.AmqpSaslChallengeBean other) {
+ this.bean = other;
+ }
+
+ public final AmqpSaslChallengeBean copy() {
+ return new AmqpSaslChallenge.AmqpSaslChallengeBean(bean);
+ }
+
+ public final AmqpSaslChallenge.AmqpSaslChallengeBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+ if(buffer == null) {
+ buffer = new AmqpSaslChallengeBuffer(marshaller.encode(this));
+ }
+ return buffer;
+ }
+
+ public final void marshal(DataOutput out, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError{
+ getBuffer(marshaller).marshal(out, marshaller);
+ }
+
+
+ public void setOptions(HashMap<AmqpType<?,?>, AmqpType<?,?>> options) {
+ setOptions(new AmqpMap.AmqpMapBean(options));
+ }
+
+
+ public final void setOptions(AmqpMap options) {
+ copyCheck();
+ bean.options = options;
+ }
+
+ public final HashMap<AmqpType<?,?>, AmqpType<?,?>> getOptions() {
+ return bean.options.getValue();
+ }
+
+ public void setChallenge(Buffer challenge) {
+ setChallenge(new AmqpBinary.AmqpBinaryBean(challenge));
+ }
+
+
+ public final void setChallenge(AmqpBinary challenge) {
+ copyCheck();
+ bean.challenge = challenge;
+ }
+
+ public final Buffer getChallenge() {
+ return bean.challenge.getValue();
+ }
+
+ public void set(int index, AmqpType<?, ?> value) {
+ switch(index) {
+ case 0: {
+ setOptions((AmqpMap) value);
+ break;
+ }
+ case 1: {
+ setChallenge((AmqpBinary) 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.challenge;
+ }
+ 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(AmqpSaslChallenge.AmqpSaslChallengeBean other) {
+ this.options= other.options;
+ this.challenge= other.challenge;
+ bean = this;
+ }
+
+ public boolean equivalent(AmqpType<?,?> t){
+ if(this == t) {
+ return true;
+ }
+
+ if(t == null || !(t instanceof AmqpSaslChallenge)) {
+ return false;
+ }
+
+ return equivalent((AmqpSaslChallenge) t);
+ }
+
+ public boolean equivalent(AmqpSaslChallenge b) {
+
+ if(b.getOptions() == null ^ getOptions() == null) {
+ return false;
+ }
+ if(b.getOptions() != null && !b.getOptions().equals(getOptions())){
+ return false;
+ }
+
+ if(b.getChallenge() == null ^ getChallenge() == null) {
+ return false;
+ }
+ if(b.getChallenge() != null && !b.getChallenge().equals(getChallenge())){
+ return false;
+ }
+ return true;
+ }
+ }
+
+ public static class AmqpSaslChallengeBuffer extends AmqpList.AmqpListBuffer implements AmqpSaslChallenge{
+
+ private AmqpSaslChallengeBean bean;
+
+ protected AmqpSaslChallengeBuffer(Encoded<IAmqpList> encoded) {
+ super(encoded);
+ }
+
+ public void setOptions(HashMap<AmqpType<?,?>, AmqpType<?,?>> options) {
+ bean().setOptions(options);
+ }
+
+ public final void setOptions(AmqpMap options) {
+ bean().setOptions(options);
+ }
+
+ public final HashMap<AmqpType<?,?>, AmqpType<?,?>> getOptions() {
+ return bean().getOptions();
+ }
+
+ public void setChallenge(Buffer challenge) {
+ bean().setChallenge(challenge);
+ }
+
+ public final void setChallenge(AmqpBinary challenge) {
+ bean().setChallenge(challenge);
+ }
+
+ public final Buffer getChallenge() {
+ return bean().getChallenge();
+ }
+
+ 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 AmqpSaslChallenge.AmqpSaslChallengeBuffer getBuffer(AmqpMarshaller marshaller) throws AmqpEncodingError{
+ return this;
+ }
+
+ protected AmqpSaslChallenge bean() {
+ if(bean == null) {
+ bean = new AmqpSaslChallenge.AmqpSaslChallengeBean(encoded.getValue());
+ bean.buffer = this;
+ }
+ return bean;
+ }
+
+ public boolean equivalent(AmqpType<?, ?> t) {
+ return bean().equivalent(t);
+ }
+
+ public static AmqpSaslChallenge.AmqpSaslChallengeBuffer create(Encoded<IAmqpList> encoded) {
+ if(encoded.isNull()) {
+ return null;
+ }
+ return new AmqpSaslChallenge.AmqpSaslChallengeBuffer(encoded);
+ }
+
+ public static AmqpSaslChallenge.AmqpSaslChallengeBuffer create(DataInput in, AmqpMarshaller marshaller) throws IOException, AmqpEncodingError {
+ return create(marshaller.unmarshalAmqpSaslChallenge(in));
+ }
+
+ public static AmqpSaslChallenge.AmqpSaslChallengeBuffer create(Buffer buffer, int offset, AmqpMarshaller marshaller) throws AmqpEncodingError {
+ return create(marshaller.decodeAmqpSaslChallenge(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/AmqpSaslCode.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpSaslCode.java?rev=908857&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpSaslCode.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-amqp/src/main/java/org/apache/activemq/amqp/protocol/types/AmqpSaslCode.java Thu Feb 11 07:04:21 2010
@@ -0,0 +1,87 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * his work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.amqp.protocol.types;
+
+import java.lang.Short;
+import java.util.HashMap;
+import org.apache.activemq.amqp.protocol.marshaller.AmqpEncodingError;
+import org.apache.activemq.amqp.protocol.types.AmqpUbyte;
+
+/**
+ * Represents a codes to indicate the outcome of the sasl dialog
+ */
+public enum AmqpSaslCode {
+
+ /**
+ * <p>
+ * Connection authentication succeeded.
+ * </p>
+ */
+ OK(new Short("0")),
+ /**
+ * <p>
+ * Connection authentication failed due to an unspecified problem with the supplied
+ * credentials.
+ * </p>
+ */
+ AUTH(new Short("1")),
+ /**
+ * <p>
+ * Connection authentication failed due to a system error.
+ * </p>
+ */
+ SYS(new Short("2")),
+ /**
+ * <p>
+ * Connection authentication failed due to a system error that is unlikely to be corrected
+ * without intervention.
+ * </p>
+ */
+ SYS_PERM(new Short("3")),
+ /**
+ * <p>
+ * Connection authentication failed due to a transient system error.
+ * </p>
+ */
+ SYS_TEMP(new Short("4"));
+
+ private static final HashMap<Short, AmqpSaslCode> LOOKUP = new HashMap<Short, AmqpSaslCode>(2);
+ static {
+ for (AmqpSaslCode saslCode : AmqpSaslCode.values()) {
+ LOOKUP.put(saslCode.value.getValue(), saslCode);
+ }
+ }
+
+ private final AmqpUbyte value;
+
+ private AmqpSaslCode(Short value) {
+ this.value = new AmqpUbyte.AmqpUbyteBean(value);
+ }
+
+ public final AmqpUbyte getValue() {
+ return value;
+ }
+
+ public static final AmqpSaslCode get(AmqpUbyte value) throws AmqpEncodingError{
+ AmqpSaslCode saslCode= LOOKUP.get(value.getValue());
+ if (saslCode == null) {
+ //TODO perhaps this should be an IllegalArgumentException?
+ throw new AmqpEncodingError("Unknown saslCode: " + value + " expected one of " + LOOKUP.keySet());
+ }
+ return saslCode;
+ }
+}
\ No newline at end of file