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/28 22:54:48 UTC

[1/3] qpid-proton git commit: Fixed errors in frame header.

Repository: qpid-proton
Updated Branches:
  refs/heads/rajith-codec a43be6a41 -> 8ff9063d6


Fixed errors in frame header.


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

Branch: refs/heads/rajith-codec
Commit: 89647412067fb1785f5d02a9751a3bb8f4b240f3
Parents: a43be6a
Author: Rajith Attapattu <ra...@apache.org>
Authored: Fri Aug 28 16:53:17 2015 -0400
Committer: Rajith Attapattu <ra...@apache.org>
Committed: Fri Aug 28 16:53:17 2015 -0400

----------------------------------------------------------------------
 .../qpid/proton/engine/impl/FrameWriter2.java   | 24 ++++++++++++++++----
 1 file changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/89647412/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameWriter2.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameWriter2.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameWriter2.java
index ba222f7..757302e 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameWriter2.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameWriter2.java
@@ -20,6 +20,8 @@
  */
 package org.apache.qpid.proton.engine.impl;
 
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
 import java.nio.ByteBuffer;
 import java.util.List;
 import java.util.Map;
@@ -140,11 +142,11 @@ class FrameWriter2
     private void endFrame(int channel)
     {
         int frameSize = _position - _frameStart;
-        _encoder.setPosition(_frameStart);
-        _encoder.putInt(frameSize);
-        _encoder.putByte((byte) 2);
-        _encoder.putByte(_frameType);
-        _encoder.putShort((short) channel);
+        ByteBuffer buf = ByteBuffer.wrap(_buffer, _frameStart, 8);
+        buf.putInt(frameSize);
+        buf.put((byte)2);
+        buf.put(_frameType);
+        buf.putShort((short) channel);
     }
 
     void writeFrame(int channel, Object frameBody, ByteBuffer payload, Runnable onPayloadTooLarge)
@@ -205,6 +207,18 @@ class FrameWriter2
         }
         endFrame(channel);
         _framesOutput += 1;
+        try
+        {
+            FileOutputStream fout = new FileOutputStream("/home/rajith/data/" + ((Performative) frameBody).getClass().getSimpleName());
+            fout.write(_buffer, _read, _position);
+            fout.flush();
+            fout.close();
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        
     }
 
     void writeFrame(Object frameBody)


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


[3/3] qpid-proton git commit: Resolved issues around handling the Flow performative.

Posted by ra...@apache.org.
Resolved issues around handling the Flow performative.


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

Branch: refs/heads/rajith-codec
Commit: 8ff9063d6015166c54630bcb71c62864ff49e8a8
Parents: 374aa9c
Author: Rajith Attapattu <ra...@apache.org>
Authored: Fri Aug 28 16:54:14 2015 -0400
Committer: Rajith Attapattu <ra...@apache.org>
Committed: Fri Aug 28 16:54:14 2015 -0400

----------------------------------------------------------------------
 .../qpid/proton/engine/impl/TransportImpl2.java | 37 ++++++++------------
 .../org/apache/qpid/proton/transport2/Flow.java |  2 +-
 2 files changed, 16 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8ff9063d/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl2.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl2.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl2.java
index 82b504e..8ae4a4c 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl2.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl2.java
@@ -740,7 +740,7 @@ public class TransportImpl2 extends EndpointImpl
                                 attach.setInitialDeliveryCount(0);
                             }
 
-                            //writeFrame(transportSession.getLocalChannel(), attach, null, null);
+                            writeFrame(transportSession.getLocalChannel(), attach, null, null);
                             transportLink.sentAttach();
                         }
                     }
@@ -1140,33 +1140,26 @@ public class TransportImpl2 extends EndpointImpl
     public void handleFlow(Flow flow, Integer channel)
     {
         TransportSession transportSession = _remoteSessions.get(channel);
+        org.apache.qpid.proton.amqp.transport.Flow f = new org.apache.qpid.proton.amqp.transport.Flow();
+        f.setAvailable(UnsignedInteger.valueOf(flow.getAvailable()));
+        f.setDeliveryCount(UnsignedInteger.valueOf(flow.getDeliveryCount()));
+        f.setDrain(f.getDrain());
+        f.setEcho(flow.getEcho());
+        f.setHandle(UnsignedInteger.valueOf(flow.getHandle()));
+        f.setIncomingWindow(UnsignedInteger.valueOf(flow.getIncomingWindow()));
+        f.setLinkCredit(UnsignedInteger.valueOf(flow.getLinkCredit()));
+        f.setNextIncomingId(UnsignedInteger.valueOf(flow.getNextIncomingId()));
+        f.setOutgoingWindow(UnsignedInteger.valueOf(flow.getNextOutgoingId()));
+        f.setOutgoingWindow(UnsignedInteger.valueOf(flow.getOutgoingWindow()));
+        f.setProperties(flow.getProperties());
+        
         if(transportSession == null)
         {
             // TODO - fail due to attach on non-begun session
         }
         else
         {
-            int inext = flow.getNextIncomingId();
-            int iwin = flow.getIncomingWindow();
-
-            if(inext != -1)
-            {
-                transportSession.setRemoteNextIncomingId(UnsignedInteger.valueOf(inext));
-                transportSession.setRemoteIncomingWindow(UnsignedInteger.valueOf(inext+iwin-transportSession.getNextOutgoingId().intValue()));
-            }
-            else
-            {
-                transportSession.setRemoteIncomingWindow(UnsignedInteger.valueOf(iwin));
-            }
-            transportSession.setRemoteNextOutgoingId(UnsignedInteger.valueOf(flow.getNextOutgoingId()));
-            transportSession.setRemoteOutgoingWindow(UnsignedInteger.valueOf(flow.getOutgoingWindow()));
-
-            if(flow.getHandle() != -1)
-            {
-                TransportLink transportLink = transportSession.getLinkFromRemoteHandle(UnsignedInteger.valueOf(flow.getHandle()));
-                transportLink.setRemoteLinkCredit(UnsignedInteger.valueOf(flow.getLinkCredit()));
-                transportLink.setRemoteDeliveryCount(UnsignedInteger.valueOf(flow.getDeliveryCount()));
-            }
+            transportSession.handleFlow(f);
         }
 
     }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8ff9063d/proton-j/src/main/java/org/apache/qpid/proton/transport2/Flow.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/transport2/Flow.java b/proton-j/src/main/java/org/apache/qpid/proton/transport2/Flow.java
index b3b4de5..4cb92de 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/transport2/Flow.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/transport2/Flow.java
@@ -209,7 +209,7 @@ public final class Flow implements Encodable, Performative
             case 2:
                 flow.setDrain(l.get(8) == null ? false : (Boolean) l.get(8));
             case 3:
-                flow.setAvailable((Integer) l.get(7));
+                flow.setAvailable(l.get(7) == null ? -1 : (Integer)l.get(7));
             case 4:
                 flow.setLinkCredit((Integer) l.get(6));
             case 5:


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


[2/3] qpid-proton git commit: Bug fixes.

Posted by ra...@apache.org.
Bug fixes.


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

Branch: refs/heads/rajith-codec
Commit: 374aa9c47e694f0d347b8f5df38dfae86e4d7db4
Parents: 8964741
Author: Rajith Attapattu <ra...@apache.org>
Authored: Fri Aug 28 16:53:49 2015 -0400
Committer: Rajith Attapattu <ra...@apache.org>
Committed: Fri Aug 28 16:53:49 2015 -0400

----------------------------------------------------------------------
 .../proton/engine/impl/LegacyTypeHelper.java    | 124 ++++++++++++-------
 .../apache/qpid/proton/transport2/Begin.java    |   2 +-
 .../apache/qpid/proton/transport2/Transfer.java |   9 +-
 3 files changed, 85 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/374aa9c4/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/LegacyTypeHelper.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/LegacyTypeHelper.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/LegacyTypeHelper.java
index 949e0a8..db75f8e 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/LegacyTypeHelper.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/LegacyTypeHelper.java
@@ -242,65 +242,93 @@ public class LegacyTypeHelper
 
     public static Source convertFromLegacySource(org.apache.qpid.proton.amqp.transport.Source source)
     {
-        org.apache.qpid.proton.amqp.messaging.Source legacy = (org.apache.qpid.proton.amqp.messaging.Source) source;
-        Source s = new Source();
-        s.setAddress(legacy.getAddress());
-        s.setCapabilities(convertToStringArray(legacy.getCapabilities()));
-        // s.setDefaultOutcome(legacy.getDefaultOutcome());
-        s.setDistributionMode(legacy.getDistributionMode() == null ? null : legacy.getDistributionMode().toString());
-        s.setDurable(TerminusDurability.get(legacy.getDurable().getValue().byteValue()));
-        s.setDynamic(legacy.getDynamic());
-        s.setDynamicNodeProperties(legacy.getDynamicNodeProperties());
-        s.setExpiryPolicy(TerminusExpiryPolicy.getEnum(legacy.getExpiryPolicy().getPolicy().toString()));
-        s.setFilter(legacy.getFilter());
-        s.setOutcomes(convertToStringArray(legacy.getOutcomes()));
-        s.setTimeout(legacy.getTimeout().intValue());
-        return s;
+        if (source == null)
+        {
+            return null;
+        }
+        else
+        {
+            org.apache.qpid.proton.amqp.messaging.Source legacy = (org.apache.qpid.proton.amqp.messaging.Source) source;
+            Source s = new Source();
+            s.setAddress(legacy.getAddress());
+            s.setCapabilities(convertToStringArray(legacy.getCapabilities()));
+            // s.setDefaultOutcome(legacy.getDefaultOutcome());
+            s.setDistributionMode(legacy.getDistributionMode() == null ? null : legacy.getDistributionMode().toString());
+            s.setDurable(TerminusDurability.get(legacy.getDurable().getValue().byteValue()));
+            s.setDynamic(legacy.getDynamic());
+            s.setDynamicNodeProperties(legacy.getDynamicNodeProperties());
+            s.setExpiryPolicy(TerminusExpiryPolicy.getEnum(legacy.getExpiryPolicy().getPolicy().toString()));
+            s.setFilter(legacy.getFilter());
+            s.setOutcomes(convertToStringArray(legacy.getOutcomes()));
+            s.setTimeout(legacy.getTimeout().intValue());
+            return s;
+        }
     }
 
     public static Target convertFromLegacyTarget(org.apache.qpid.proton.amqp.transport.Target target)
     {
-        org.apache.qpid.proton.amqp.messaging.Target legacy = (org.apache.qpid.proton.amqp.messaging.Target) target;
-        Target t = new Target();
-        t.setAddress(legacy.getAddress());
-        t.setCapabilities(convertToStringArray(legacy.getCapabilities()));
-
-        t.setDurable(TerminusDurability.get(legacy.getDurable().getValue().byteValue()));
-        t.setDynamic(legacy.getDynamic());
-        t.setDynamicNodeProperties(legacy.getDynamicNodeProperties());
-        t.setExpiryPolicy(TerminusExpiryPolicy.getEnum(legacy.getExpiryPolicy().getPolicy().toString()));
-        t.setTimeout(legacy.getTimeout().intValue());
-        return t;
+        if (target == null)
+        {
+            return null;
+        }
+        else
+        {
+            org.apache.qpid.proton.amqp.messaging.Target legacy = (org.apache.qpid.proton.amqp.messaging.Target) target;
+            Target t = new Target();
+            t.setAddress(legacy.getAddress());
+            t.setCapabilities(convertToStringArray(legacy.getCapabilities()));
+    
+            t.setDurable(TerminusDurability.get(legacy.getDurable().getValue().byteValue()));
+            t.setDynamic(legacy.getDynamic());
+            t.setDynamicNodeProperties(legacy.getDynamicNodeProperties());
+            t.setExpiryPolicy(TerminusExpiryPolicy.getEnum(legacy.getExpiryPolicy().getPolicy().toString()));
+            t.setTimeout(legacy.getTimeout().intValue());
+            return t;
+        }
     }
 
     public static org.apache.qpid.proton.amqp.transport.Source convertToLegacySource(Source s)
     {
-        org.apache.qpid.proton.amqp.messaging.Source legacy = new org.apache.qpid.proton.amqp.messaging.Source();
-        legacy.setAddress(s.getAddress());
-        legacy.setCapabilities(convertToSymbolArray(s.getCapabilities()));
-        // legacy.setDefaultOutcome(s.getDefaultOutcome());
-        legacy.setDistributionMode(s.getDistributionMode() == null ? null : Symbol.valueOf(s.getDistributionMode().toString()));
-        legacy.setDurable(org.apache.qpid.proton.amqp.messaging.TerminusDurability.get(UnsignedInteger.valueOf(s
-                .getDurable().getValue())));
-        legacy.setDynamic(s.getDynamic());
-        legacy.setDynamicNodeProperties(s.getDynamicNodeProperties());
-        legacy.setFilter(s.getFilter());
-        legacy.setOutcomes(convertToSymbolArray(s.getOutcomes()));
-        legacy.setTimeout(UnsignedInteger.valueOf(s.getTimeout()));
-        return legacy;
+        if (s == null)
+        {
+            return null;
+        }
+        else
+        {
+            org.apache.qpid.proton.amqp.messaging.Source legacy = new org.apache.qpid.proton.amqp.messaging.Source();
+            legacy.setAddress(s.getAddress());
+            legacy.setCapabilities(convertToSymbolArray(s.getCapabilities()));
+            // legacy.setDefaultOutcome(s.getDefaultOutcome());
+            legacy.setDistributionMode(s.getDistributionMode() == null ? null : Symbol.valueOf(s.getDistributionMode().toString()));
+            legacy.setDurable(org.apache.qpid.proton.amqp.messaging.TerminusDurability.get(UnsignedInteger.valueOf(s
+                    .getDurable().getValue())));
+            legacy.setDynamic(s.getDynamic());
+            legacy.setDynamicNodeProperties(s.getDynamicNodeProperties());
+            legacy.setFilter(s.getFilter());
+            legacy.setOutcomes(convertToSymbolArray(s.getOutcomes()));
+            legacy.setTimeout(UnsignedInteger.valueOf(s.getTimeout()));
+            return legacy;
+        }
     }
     
     public static org.apache.qpid.proton.amqp.transport.Target convertToLegacyTarget(Target target)
     {
-        org.apache.qpid.proton.amqp.messaging.Target legacy = new org.apache.qpid.proton.amqp.messaging.Target();
-        legacy.setAddress(target.getAddress());
-        legacy.setCapabilities(convertToSymbolArray(target.getCapabilities()));
-
-        legacy.setDurable(org.apache.qpid.proton.amqp.messaging.TerminusDurability.get(UnsignedInteger.valueOf((int)target.getDurable().getValue())));
-        legacy.setDynamic(target.getDynamic());
-        legacy.setDynamicNodeProperties(target.getDynamicNodeProperties());
-        legacy.setExpiryPolicy(org.apache.qpid.proton.amqp.messaging.TerminusExpiryPolicy.valueOf(target.getExpiryPolicy().toString()));
-        legacy.setTimeout(UnsignedInteger.valueOf(target.getTimeout()));
-        return legacy;
+        if (target == null)
+        {
+            return null;
+        }
+        else
+        {
+            org.apache.qpid.proton.amqp.messaging.Target legacy = new org.apache.qpid.proton.amqp.messaging.Target();
+            legacy.setAddress(target.getAddress());
+            legacy.setCapabilities(convertToSymbolArray(target.getCapabilities()));
+    
+            legacy.setDurable(org.apache.qpid.proton.amqp.messaging.TerminusDurability.get(UnsignedInteger.valueOf((int)target.getDurable().getValue())));
+            legacy.setDynamic(target.getDynamic());
+            legacy.setDynamicNodeProperties(target.getDynamicNodeProperties());
+            legacy.setExpiryPolicy(org.apache.qpid.proton.amqp.messaging.TerminusExpiryPolicy.valueOf(target.getExpiryPolicy().toString()));
+            legacy.setTimeout(UnsignedInteger.valueOf(target.getTimeout()));
+            return legacy;
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/374aa9c4/proton-j/src/main/java/org/apache/qpid/proton/transport2/Begin.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/transport2/Begin.java b/proton-j/src/main/java/org/apache/qpid/proton/transport2/Begin.java
index 63218d7..f8d3a1c 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/transport2/Begin.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/transport2/Begin.java
@@ -194,7 +194,7 @@ public final class Begin implements Encodable, Performative
             case 6:
                 begin.setNextOutgoingId(l.get(1) == null ? 0 : (Integer) l.get(1));
             case 7:
-                begin.setRemoteChannel(l.get(0) == null ? -1 : (Integer) l.get(0));
+                begin.setRemoteChannel(l.get(0) == null ? -1 : ((Short)l.get(0)).intValue());
             }
 
             return begin;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/374aa9c4/proton-j/src/main/java/org/apache/qpid/proton/transport2/Transfer.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/transport2/Transfer.java b/proton-j/src/main/java/org/apache/qpid/proton/transport2/Transfer.java
index aad782e..82e71de 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/transport2/Transfer.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/transport2/Transfer.java
@@ -180,7 +180,14 @@ public final class Transfer implements Encodable, Performative
         encoder.putUint(_messageFormat);
         encoder.putBoolean(_settled);
         encoder.putBoolean(_more);
-        encoder.putUbyte(_rcvSettleMode.getValue());
+        if (_rcvSettleMode == null)
+        {
+            encoder.putNull();
+        }
+        else
+        {
+            encoder.putUbyte(_rcvSettleMode.getValue());
+        }
         if (_state == null)
         {
             encoder.putNull();


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