You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by bo...@apache.org on 2015/08/18 14:26:21 UTC

[2/2] qpid-proton git commit: NO-JIRA: Add missing proton-j binding shims

NO-JIRA: Add missing proton-j binding shims


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

Branch: refs/heads/master
Commit: 484bca48cacdcfe77c1a213832f813d76fb8564d
Parents: f7ea21d
Author: Bozo Dragojevic <bo...@digiverse.si>
Authored: Wed Jul 1 13:16:13 2015 +0200
Committer: Bozo Dragojevic <bo...@digiverse.si>
Committed: Tue Aug 18 14:25:39 2015 +0200

----------------------------------------------------------------------
 proton-j/src/main/resources/cengine.py  | 10 ++++++++++
 proton-j/src/main/resources/cmessage.py | 23 ++++++++++++++++-------
 2 files changed, 26 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/484bca48/proton-j/src/main/resources/cengine.py
----------------------------------------------------------------------
diff --git a/proton-j/src/main/resources/cengine.py b/proton-j/src/main/resources/cengine.py
index 019a9ac..4b0d57c 100644
--- a/proton-j/src/main/resources/cengine.py
+++ b/proton-j/src/main/resources/cengine.py
@@ -650,6 +650,12 @@ def pn_link_credit(link):
 def pn_link_queued(link):
   return link.impl.getQueued()
 
+def pn_link_get_drain(link):
+  return link.impl.getDrain();
+
+def pn_link_set_drain(link, drain):
+  return link.impl.setDrain(drain);
+
 def pn_link_unsettled(link):
   return link.impl.getUnsettled()
 
@@ -924,6 +930,10 @@ def pn_transport_unbind(trans):
   trans.impl.unbind()
   return 0
 
+def pn_transport_set_pytracer(trans, tracer):
+  import warnings
+  warnings.warn("TODO pn_transport_set_tracer", stacklevel=2)
+
 def pn_transport_trace(trans, n):
   trans.impl.trace(n)
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/484bca48/proton-j/src/main/resources/cmessage.py
----------------------------------------------------------------------
diff --git a/proton-j/src/main/resources/cmessage.py b/proton-j/src/main/resources/cmessage.py
index 56c8d49..d406bea 100644
--- a/proton-j/src/main/resources/cmessage.py
+++ b/proton-j/src/main/resources/cmessage.py
@@ -18,10 +18,11 @@
 #
 from org.apache.qpid.proton import Proton
 from org.apache.qpid.proton.amqp.messaging import AmqpValue, AmqpSequence, \
-  Data as DataSection
+  Data as DataSection, ApplicationProperties, MessageAnnotations, DeliveryAnnotations
 
 from ccodec import *
 from cerror import *
+from org.apache.qpid.proton.amqp import Binary
 
 # from proton/message.h
 PN_DATA = 0
@@ -52,9 +53,13 @@ class pn_message_wrapper:
     self.id.next()
     obj2dat(self.impl.getCorrelationId(), self.correlation_id)
     self.correlation_id.next()
-    obj2dat(self.impl.getDeliveryAnnotations(), self.instructions)
-    obj2dat(self.impl.getMessageAnnotations(), self.annotations)
-    obj2dat(self.impl.getApplicationProperties(), self.properties)
+    def peel(x):
+       if x is not None:
+         return x.getValue()
+       return None
+    obj2dat(peel(self.impl.getDeliveryAnnotations()), self.instructions)
+    obj2dat(peel(self.impl.getMessageAnnotations()), self.annotations)
+    obj2dat(peel(self.impl.getApplicationProperties()), self.properties)
     bod = self.impl.getBody()
     if bod is not None: bod = bod.getValue()
     obj2dat(bod, self.body)
@@ -62,9 +67,13 @@ class pn_message_wrapper:
   def pre_encode(self):
     self.impl.setMessageId(dat2obj(self.id))
     self.impl.setCorrelationId(dat2obj(self.correlation_id))
-    self.impl.setDeliveryAnnotations(dat2obj(self.instructions))
-    self.impl.setMessageAnnotations(dat2obj(self.annotations))
-    self.impl.setApplicationProperties(dat2obj(self.properties))
+    def wrap(x, wrapper):
+      if x is not None:
+        return wrapper(x)
+      return None
+    self.impl.setDeliveryAnnotations(wrap(dat2obj(self.instructions), DeliveryAnnotations))
+    self.impl.setMessageAnnotations(wrap(dat2obj(self.annotations), MessageAnnotations))
+    self.impl.setApplicationProperties(wrap(dat2obj(self.properties), ApplicationProperties))
     bod = dat2obj(self.body)
     if self.inferred:
       if isinstance(bod, bytes):


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