You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ra...@apache.org on 2015/08/14 21:07:54 UTC
[21/50] [abbrv] qpid-proton git commit: Added the various outcome
types for message delivery.
Added the various outcome types for message delivery.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/de241e30
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/de241e30
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/de241e30
Branch: refs/heads/rajith-codec
Commit: de241e3067605a94c749c970ce02e072dc360c01
Parents: a571d11
Author: Rajith Attapattu <ra...@apache.org>
Authored: Mon May 4 17:47:06 2015 -0400
Committer: Rajith Attapattu <ra...@apache.org>
Committed: Thu Jul 9 09:12:38 2015 -0400
----------------------------------------------------------------------
.../apache/qpid/proton/message2/Accepted.java | 73 +++++++++++
.../qpid/proton/message2/LifetimePolicy.java | 19 ++-
.../apache/qpid/proton/message2/Modified.java | 121 +++++++++++++++++++
.../apache/qpid/proton/message2/Outcome.java | 26 ++++
.../apache/qpid/proton/message2/Received.java | 100 +++++++++++++++
.../apache/qpid/proton/message2/Rejected.java | 90 ++++++++++++++
.../apache/qpid/proton/message2/Released.java | 66 ++++++++++
7 files changed, 490 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/de241e30/proton-j/src/main/java/org/apache/qpid/proton/message2/Accepted.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/message2/Accepted.java b/proton-j/src/main/java/org/apache/qpid/proton/message2/Accepted.java
new file mode 100644
index 0000000..4c5caa9
--- /dev/null
+++ b/proton-j/src/main/java/org/apache/qpid/proton/message2/Accepted.java
@@ -0,0 +1,73 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this 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.qpid.proton.message2;
+
+import org.apache.qpid.proton.codec2.DecodeException;
+import org.apache.qpid.proton.codec2.DescribedTypeFactory;
+import org.apache.qpid.proton.codec2.Encodable;
+import org.apache.qpid.proton.codec2.Encoder;
+import org.apache.qpid.proton.transport.DeliveryState;
+
+public final class Accepted implements DeliveryState, Outcome, Encodable
+{
+ public final static long DESCRIPTOR_LONG = 0x0000000000000024L;
+
+ public final static String DESCRIPTOR_STRING = "amqp:accepted:list";
+
+ public final static Factory FACTORY = new Factory();
+
+ private static final Accepted INSTANCE = new Accepted();
+
+ /**
+ * TODO should this (and other DeliveryStates) have a private constructor??
+ */
+ public Accepted()
+ {
+ }
+
+ @Override
+ public void encode(Encoder encoder)
+ {
+ encoder.putDescriptor();
+ encoder.putUlong(DESCRIPTOR_LONG);
+ encoder.end();
+ }
+
+ public static final class Factory implements DescribedTypeFactory
+ {
+ public Object create(Object in) throws DecodeException
+ {
+ return INSTANCE;
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Accepted{}";
+ }
+
+ public static Accepted getInstance()
+ {
+ return INSTANCE;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/de241e30/proton-j/src/main/java/org/apache/qpid/proton/message2/LifetimePolicy.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/message2/LifetimePolicy.java b/proton-j/src/main/java/org/apache/qpid/proton/message2/LifetimePolicy.java
index e0ada46..d74181f 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/message2/LifetimePolicy.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/message2/LifetimePolicy.java
@@ -27,11 +27,10 @@ import org.apache.qpid.proton.codec2.Encoder;
public enum LifetimePolicy implements Encodable, DescribedTypeFactory
{
- DELETE_ON_CLOSE_TYPE(0x000000000000002bL, "amqp:delete-on-close:list"),
- DELETE_ON_NO_LINKS_TYPE(0x000000000000002cL, "amqp:delete-on-no-links:list"),
- DELETE_ON_NO_MSGS_TYPE(0x000000000000002dL, "amqp:delete-on-no-messages:list"),
- DELETE_ON_NO_LINKS_OR_MSGS_TYPE(0x000000000000002eL, "amqp:delete-on-no-links-or-messages:list")
- ;
+ DELETE_ON_CLOSE_TYPE(0x000000000000002bL, "amqp:delete-on-close:list"), DELETE_ON_NO_LINKS_TYPE(
+ 0x000000000000002cL, "amqp:delete-on-no-links:list"), DELETE_ON_NO_MSGS_TYPE(0x000000000000002dL,
+ "amqp:delete-on-no-messages:list"), DELETE_ON_NO_LINKS_OR_MSGS_TYPE(0x000000000000002eL,
+ "amqp:delete-on-no-links-or-messages:list");
public final long _descLong;
@@ -43,6 +42,16 @@ public enum LifetimePolicy implements Encodable, DescribedTypeFactory
_descString = descString;
}
+ public long getLongDesc()
+ {
+ return _descLong;
+ }
+
+ public String getStringDesc()
+ {
+ return _descString;
+ }
+
@Override
public void encode(Encoder encoder)
{
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/de241e30/proton-j/src/main/java/org/apache/qpid/proton/message2/Modified.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/message2/Modified.java b/proton-j/src/main/java/org/apache/qpid/proton/message2/Modified.java
new file mode 100644
index 0000000..f9f549f
--- /dev/null
+++ b/proton-j/src/main/java/org/apache/qpid/proton/message2/Modified.java
@@ -0,0 +1,121 @@
+/*
+ *
+z* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this 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.qpid.proton.message2;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.qpid.proton.codec2.CodecHelper;
+import org.apache.qpid.proton.codec2.DecodeException;
+import org.apache.qpid.proton.codec2.DescribedTypeFactory;
+import org.apache.qpid.proton.codec2.Encodable;
+import org.apache.qpid.proton.codec2.Encoder;
+import org.apache.qpid.proton.transport.DeliveryState;
+
+public final class Modified implements DeliveryState, Outcome, Encodable
+{
+ public final static long DESCRIPTOR_LONG = 0x0000000000000027L;
+
+ public final static String DESCRIPTOR_STRING = "amqp:modified:list";
+
+ public final static Factory FACTORY = new Factory();
+
+ private Boolean _deliveryFailed;
+
+ private Boolean _undeliverableHere;
+
+ private Map<Object, Object> _messageAnnotations;
+
+ public Boolean getDeliveryFailed()
+ {
+ return _deliveryFailed;
+ }
+
+ public void setDeliveryFailed(Boolean deliveryFailed)
+ {
+ _deliveryFailed = deliveryFailed;
+ }
+
+ public Boolean getUndeliverableHere()
+ {
+ return _undeliverableHere;
+ }
+
+ public void setUndeliverableHere(Boolean undeliverableHere)
+ {
+ _undeliverableHere = undeliverableHere;
+ }
+
+ public Map<Object, Object> getMessageAnnotations()
+ {
+ return _messageAnnotations;
+ }
+
+ public void setMessageAnnotations(Map<Object, Object> messageAnnotations)
+ {
+ _messageAnnotations = messageAnnotations;
+ }
+
+ @Override
+ public void encode(Encoder encoder)
+ {
+ encoder.putDescriptor();
+ encoder.putUlong(DESCRIPTOR_LONG);
+ encoder.putList();
+ encoder.putBoolean(_deliveryFailed);
+ encoder.putBoolean(_undeliverableHere);
+ CodecHelper.encodeMap(encoder, _messageAnnotations);
+ encoder.end();
+ }
+
+ public static final class Factory implements DescribedTypeFactory
+ {
+ @SuppressWarnings("unchecked")
+ public Object create(Object in) throws DecodeException
+ {
+ List<Object> l = (List<Object>) in;
+ Modified modified = new Modified();
+
+ switch (3 - l.size())
+ {
+
+ case 0:
+ modified.setMessageAnnotations((Map<Object, Object>) l.get(2));
+ case 1:
+ modified.setUndeliverableHere((Boolean) l.get(1));
+ case 2:
+ modified.setDeliveryFailed((Boolean) l.get(0));
+ }
+ return modified;
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Modified{" +
+ "deliveryFailed=" + _deliveryFailed +
+ ", undeliverableHere=" + _undeliverableHere +
+ ", messageAnnotations=" + _messageAnnotations +
+ '}';
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/de241e30/proton-j/src/main/java/org/apache/qpid/proton/message2/Outcome.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/message2/Outcome.java b/proton-j/src/main/java/org/apache/qpid/proton/message2/Outcome.java
new file mode 100644
index 0000000..d2bb8aa
--- /dev/null
+++ b/proton-j/src/main/java/org/apache/qpid/proton/message2/Outcome.java
@@ -0,0 +1,26 @@
+package org.apache.qpid.proton.message2;
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this 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.
+ *
+ */
+
+public interface Outcome
+{
+}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/de241e30/proton-j/src/main/java/org/apache/qpid/proton/message2/Received.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/message2/Received.java b/proton-j/src/main/java/org/apache/qpid/proton/message2/Received.java
new file mode 100644
index 0000000..5c102ef
--- /dev/null
+++ b/proton-j/src/main/java/org/apache/qpid/proton/message2/Received.java
@@ -0,0 +1,100 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this 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.qpid.proton.message2;
+
+import java.util.List;
+
+import org.apache.qpid.proton.codec2.DecodeException;
+import org.apache.qpid.proton.codec2.DescribedTypeFactory;
+import org.apache.qpid.proton.codec2.Encodable;
+import org.apache.qpid.proton.codec2.Encoder;
+import org.apache.qpid.proton.transport.DeliveryState;
+
+public final class Received implements DeliveryState, Encodable
+{
+ public final static long DESCRIPTOR_LONG = 0x0000000000000023L;
+
+ public final static String DESCRIPTOR_STRING = "amqp:received:list";
+
+ public final static Factory FACTORY = new Factory();
+
+ private int _sectionNumber;
+
+ private long _sectionOffset;
+
+ public int getSectionNumber()
+ {
+ return _sectionNumber;
+ }
+
+ public void setSectionNumber(int sectionNumber)
+ {
+ _sectionNumber = sectionNumber;
+ }
+
+ public long getSectionOffset()
+ {
+ return _sectionOffset;
+ }
+
+ public void setSectionOffset(long sectionOffset)
+ {
+ _sectionOffset = sectionOffset;
+ }
+
+ @Override
+ public void encode(Encoder encoder)
+ {
+ encoder.putDescriptor();
+ encoder.putUlong(DESCRIPTOR_LONG);
+ encoder.putList();
+ encoder.putUint(_sectionNumber);
+ encoder.putUlong(_sectionOffset);
+ encoder.end();
+ }
+
+ public static final class Factory implements DescribedTypeFactory
+ {
+ @SuppressWarnings("unchecked")
+ public Object create(Object in) throws DecodeException
+ {
+ List<Object> l = (List<Object>) in;
+ Received received = new Received();
+
+ switch (2 - l.size())
+ {
+
+ case 0:
+ received.setSectionOffset((long) l.get(1));
+ case 1:
+ received.setSectionNumber((int) l.get(0));
+ }
+ return received;
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Received{" + "sectionNumber=" + _sectionNumber + ", sectionOffset=" + _sectionOffset + '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/de241e30/proton-j/src/main/java/org/apache/qpid/proton/message2/Rejected.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/message2/Rejected.java b/proton-j/src/main/java/org/apache/qpid/proton/message2/Rejected.java
new file mode 100644
index 0000000..90cbb56
--- /dev/null
+++ b/proton-j/src/main/java/org/apache/qpid/proton/message2/Rejected.java
@@ -0,0 +1,90 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this 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.qpid.proton.message2;
+
+import java.util.List;
+
+import org.apache.qpid.proton.codec2.DecodeException;
+import org.apache.qpid.proton.codec2.DescribedTypeFactory;
+import org.apache.qpid.proton.codec2.Encodable;
+import org.apache.qpid.proton.codec2.Encoder;
+import org.apache.qpid.proton.transport.DeliveryState;
+import org.apache.qpid.proton.transport.ErrorCondition;
+
+public final class Rejected implements DeliveryState, Outcome, Encodable
+{
+ public final static long DESCRIPTOR_LONG = 0x0000000000000025L;
+
+ public final static String DESCRIPTOR_STRING = "amqp:rejected:list";
+
+ public final static Factory FACTORY = new Factory();
+
+ private ErrorCondition _error;
+
+ public ErrorCondition getError()
+ {
+ return _error;
+ }
+
+ public void setError(ErrorCondition error)
+ {
+ _error = error;
+ }
+
+ @Override
+ public void encode(Encoder encoder)
+ {
+ encoder.putDescriptor();
+ encoder.putUlong(DESCRIPTOR_LONG);
+ encoder.putList();
+ if (_error != null)
+ {
+ _error.encode(encoder);
+ }
+ else
+ {
+ encoder.putNull();
+ }
+ encoder.end();
+ }
+
+ public static final class Factory implements DescribedTypeFactory
+ {
+ @SuppressWarnings("unchecked")
+ public Object create(Object in) throws DecodeException
+ {
+ List<Object> l = (List<Object>) in;
+ Rejected rejected = new Rejected();
+ if (l.size() == 1)
+ {
+ rejected.setError((ErrorCondition) l.get(0));
+ }
+ return rejected;
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Rejected{error=" + _error + "}";
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/de241e30/proton-j/src/main/java/org/apache/qpid/proton/message2/Released.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/message2/Released.java b/proton-j/src/main/java/org/apache/qpid/proton/message2/Released.java
new file mode 100644
index 0000000..4635e94
--- /dev/null
+++ b/proton-j/src/main/java/org/apache/qpid/proton/message2/Released.java
@@ -0,0 +1,66 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this 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.qpid.proton.message2;
+
+import org.apache.qpid.proton.codec2.DecodeException;
+import org.apache.qpid.proton.codec2.DescribedTypeFactory;
+import org.apache.qpid.proton.codec2.Encodable;
+import org.apache.qpid.proton.codec2.Encoder;
+import org.apache.qpid.proton.transport.DeliveryState;
+
+public final class Released implements DeliveryState, Outcome, Encodable
+{
+ public final static long DESCRIPTOR_LONG = 0x0000000000000026L;
+
+ public final static String DESCRIPTOR_STRING = "amqp:released:list";
+
+ public final static Factory FACTORY = new Factory();
+
+ private static final Released INSTANCE = new Released();
+
+ @Override
+ public void encode(Encoder encoder)
+ {
+ encoder.putDescriptor();
+ encoder.putUlong(DESCRIPTOR_LONG);
+ encoder.end();
+ }
+
+ public static final class Factory implements DescribedTypeFactory
+ {
+ public Object create(Object in) throws DecodeException
+ {
+ return INSTANCE;
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Released{}";
+ }
+
+ public static Released getInstance()
+ {
+ return INSTANCE;
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org