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:38 UTC

[05/50] [abbrv] qpid-proton git commit: Exploring an approach for handling AMQP Performatives. Checked in some skeleton code.

Exploring an approach for handling AMQP Performatives.
Checked in some skeleton code.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/40607e4f
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/40607e4f
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/40607e4f

Branch: refs/heads/rajith-codec
Commit: 40607e4f3509be3012e92e6ba6efc942c05e6fb4
Parents: d92fbb0
Author: Rajith Attapattu <ra...@apache.org>
Authored: Wed Jan 28 13:49:59 2015 -0500
Committer: Rajith Attapattu <ra...@apache.org>
Committed: Thu Jul 9 09:12:37 2015 -0400

----------------------------------------------------------------------
 .../qpid/proton/amqp/transport2/Flow.java       | 168 +++++++++++++++++++
 .../proton/codec2/TransportTypesDecoder.java    | 102 +++++++++++
 .../proton/codec2/TransportTypesEncoder.java    |  62 +++++++
 3 files changed, 332 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40607e4f/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport2/Flow.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport2/Flow.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport2/Flow.java
new file mode 100644
index 0000000..388cbef
--- /dev/null
+++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport2/Flow.java
@@ -0,0 +1,168 @@
+
+/*
+*
+* 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.amqp.transport2;
+
+import java.util.Map;
+
+public class Flow
+{
+    private long _nextIncomingId;
+    private long _incomingWindow;
+    private long _nextOutgoingId;
+    private long _outgoingWindow;
+    private long _handle;
+    private long _deliveryCount;
+    private long _linkCredit;
+    private long _available;
+    private boolean _drain;
+    private boolean _echo;
+    private Map _properties;
+
+    public long getNextIncomingId()
+    {
+        return _nextIncomingId;
+    }
+
+    public void setNextIncomingId(long nextIncomingId)
+    {
+        _nextIncomingId = nextIncomingId;
+    }
+
+    public long getIncomingWindow()
+    {
+        return _incomingWindow;
+    }
+
+    public void setIncomingWindow(long incomingWindow)
+    {
+        _incomingWindow = incomingWindow;
+    }
+
+    public long getNextOutgoingId()
+    {
+        return _nextOutgoingId;
+    }
+
+    public void setNextOutgoingId(long nextOutgoingId)
+    {
+        _nextOutgoingId = nextOutgoingId;
+    }
+
+    public long getOutgoingWindow()
+    {
+        return _outgoingWindow;
+    }
+
+    public void setOutgoingWindow(long outgoingWindow)
+    {
+         _outgoingWindow = outgoingWindow;
+    }
+
+    public long getHandle()
+    {
+        return _handle;
+    }
+
+    public void setHandle(long handle)
+    {
+        _handle = handle;
+    }
+
+    public long getDeliveryCount()
+    {
+        return _deliveryCount;
+    }
+
+    public void setDeliveryCount(long deliveryCount)
+    {
+        _deliveryCount = deliveryCount;
+    }
+
+    public long getLinkCredit()
+    {
+        return _linkCredit;
+    }
+
+    public void setLinkCredit(long linkCredit)
+    {
+        _linkCredit = linkCredit;
+    }
+
+    public long getAvailable()
+    {
+        return _available;
+    }
+
+    public void setAvailable(long available)
+    {
+        _available = available;
+    }
+
+    public boolean getDrain()
+    {
+        return _drain;
+    }
+
+    public void setDrain(boolean drain)
+    {
+        _drain = drain;
+    }
+
+    public boolean getEcho()
+    {
+        return _echo;
+    }
+
+    public void setEcho(boolean echo)
+    {
+        _echo = echo;
+    }
+
+    public Map getProperties()
+    {
+        return _properties;
+    }
+
+    public void setProperties(Map properties)
+    {
+        _properties = properties;
+    }
+
+    @Override
+    public String toString()
+    {
+        return "Flow{" +
+               "nextIncomingId=" + _nextIncomingId +
+               ", incomingWindow=" + _incomingWindow +
+               ", nextOutgoingId=" + _nextOutgoingId +
+               ", outgoingWindow=" + _outgoingWindow +
+               ", handle=" + _handle +
+               ", deliveryCount=" + _deliveryCount +
+               ", linkCredit=" + _linkCredit +
+               ", available=" + _available +
+               ", drain=" + _drain +
+               ", echo=" + _echo +
+               ", properties=" + _properties +
+               '}';
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40607e4f/proton-j/src/main/java/org/apache/qpid/proton/codec2/TransportTypesDecoder.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec2/TransportTypesDecoder.java b/proton-j/src/main/java/org/apache/qpid/proton/codec2/TransportTypesDecoder.java
new file mode 100644
index 0000000..a262760
--- /dev/null
+++ b/proton-j/src/main/java/org/apache/qpid/proton/codec2/TransportTypesDecoder.java
@@ -0,0 +1,102 @@
+/*
+ *
+ * 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.codec2;
+
+import org.apache.qpid.proton.amqp.transport2.Flow;
+
+public class TransportTypesDecoder
+{
+    public static Open decodeOpen(Decoder decoder)
+    {
+
+    }
+
+    public static Flow decodeFlow(Decoder decoder)
+    {
+        final Flow flow = new Flow();
+        DataHandler dh = new AbstractDataHandler()
+        {
+
+            int index = 0;
+
+            public void onLong(org.apache.qpid.proton.codec2.Decoder d)
+            {
+                switch (index)
+                {
+                case 0:
+                    flow.setNextIncomingId(d.getLongBits());
+                    index++;
+                    break;
+                case 1:
+                    flow.setIncomingWindow(d.getLongBits());
+                    index++;
+                    break;
+                case 2:
+                    flow.setNextOutgoingId(d.getLongBits());
+                    index++;
+                    break;
+                case 3:
+                    flow.setOutgoingWindow(d.getLongBits());
+                    index++;
+                    break;
+                case 4:
+                    flow.setHandle(d.getLongBits());
+                    index++;
+                    break;
+                case 5:
+                    flow.setDeliveryCount(d.getLongBits());
+                    index++;
+                    break;
+                case 6:
+                    flow.setLinkCredit(d.getLongBits());
+                    index++;
+                    break;
+                case 7:
+                    flow.setAvailable(d.getLongBits());
+                    index++;
+                    break;
+                }
+            }
+
+            public void onBoolean(org.apache.qpid.proton.codec2.Decoder d)
+            {
+                switch (index)
+                {
+                case 8:
+                    flow.setDrain(); // what should be used here?
+                    index++;
+                    break;
+                case 9:
+                    flow.setEcho(); // what should be used here?
+                    index++;
+                    break;
+                }
+            }
+
+            public void onMap(org.apache.qpid.proton.codec2.Decoder d)
+            {
+                flow.setProperties(decodeMap(d)); //
+            }
+        };
+
+        return flow;
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40607e4f/proton-j/src/main/java/org/apache/qpid/proton/codec2/TransportTypesEncoder.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec2/TransportTypesEncoder.java b/proton-j/src/main/java/org/apache/qpid/proton/codec2/TransportTypesEncoder.java
new file mode 100644
index 0000000..c7c888c
--- /dev/null
+++ b/proton-j/src/main/java/org/apache/qpid/proton/codec2/TransportTypesEncoder.java
@@ -0,0 +1,62 @@
+/*
+ *
+ * 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.codec2;
+
+import org.apache.qpid.proton.amqp.transport2.Flow;
+
+public class TransportTypesEncoder
+{
+    public static void encodeOpen(Encoder encoder, Open open)
+    {
+
+    }
+
+    public static void encodeFlow(Encoder encoder, Flow flow)
+    {
+        encoder.putDescriptor();
+        encoder.putUlong(0x0000000000000013L);
+        encoder.putList();
+        // unsigned int ?
+        encoder.putLong(flow.getNextIncomingId());
+        encoder.putLong(flow.getIncomingWindow());
+        encoder.putLong(flow.getNextOutgoingId());
+        encoder.putLong(flow.getOutgoingWindow());
+        encoder.putLong(flow.getHandle());
+        encoder.putLong(flow.getDeliveryCount());
+        encoder.putLong(flow.getLinkCredit());
+        encoder.putLong(flow.getAvailable());
+        if (flow.getDrain())
+        {
+            encoder.putBoolean(true);
+        }
+        if (flow.getEcho())
+        {
+            encoder.putBoolean(true);
+        }
+        if (flow.getProperties() != null && flow.getProperties().size() > 0)
+        {
+            encoder.putMap();
+            // ..... handle map
+            encoder.end();
+        }
+        encoder.end();
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org