You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2015/01/06 20:28:36 UTC

[3/5] qpid-proton git commit: added Event.wrap

added Event.wrap


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

Branch: refs/heads/master
Commit: 8b0b25a7267c4b44cb8633589ee79dd777e31023
Parents: cb68d3c
Author: Rafael Schloming <rh...@alum.mit.edu>
Authored: Tue Jan 6 14:20:21 2015 -0500
Committer: Rafael Schloming <rh...@alum.mit.edu>
Committed: Tue Jan 6 14:27:37 2015 -0500

----------------------------------------------------------------------
 proton-c/bindings/python/proton/__init__.py     | 26 ++++++++++++--------
 .../org/apache/qpid/proton/engine/Event.java    |  3 +++
 proton-j/src/main/resources/cengine.py          |  3 +++
 3 files changed, 22 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8b0b25a7/proton-c/bindings/python/proton/__init__.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/__init__.py b/proton-c/bindings/python/proton/__init__.py
index b54b445..439e040 100644
--- a/proton-c/bindings/python/proton/__init__.py
+++ b/proton-c/bindings/python/proton/__init__.py
@@ -3273,16 +3273,7 @@ class Collector:
     pn_collector_put(self._impl, PN_PYREF, pn_py2void(obj), etype.number)
 
   def peek(self):
-    event = pn_collector_peek(self._impl)
-    if event is None:
-      return None
-
-    clazz = pn_class_name(pn_event_class(event))
-    context = wrappers[clazz](pn_event_context(event))
-    if isinstance(context, EventBase):
-      return context
-    else:
-      return Event(clazz, context, EventType.TYPES[pn_event_type(event)])
+    return Event.wrap(pn_collector_peek(self._impl))
 
   def pop(self):
     ev = self.peek()
@@ -3324,6 +3315,21 @@ class EventBase(object):
 
 class Event(EventBase):
 
+  @staticmethod
+  def wrap(impl):
+    if impl is None:
+      return None
+
+    clazz = pn_class_name(pn_event_class(impl))
+    context = wrappers[clazz](pn_event_context(impl))
+    if isinstance(context, EventBase):
+      return context
+    else:
+      return Event(clazz, context, EventType.TYPES[pn_event_type(impl)])
+
+  REACTOR_INIT = EventType(PN_REACTOR_INIT, "on_reactor_init")
+  REACTOR_FINAL = EventType(PN_REACTOR_FINAL, "on_reactor_final")
+
   CONNECTION_INIT = EventType(PN_CONNECTION_INIT, "on_connection_init")
   CONNECTION_BOUND = EventType(PN_CONNECTION_BOUND, "on_connection_bound")
   CONNECTION_UNBOUND = EventType(PN_CONNECTION_UNBOUND, "on_connection_unbound")

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8b0b25a7/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java
index 3b299a6..52a2ed3 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java
@@ -30,6 +30,9 @@ public interface Event
 {
 
     public enum Type {
+        REACTOR_INIT,
+        REACTOR_FINAL,
+
         CONNECTION_INIT,
         CONNECTION_BOUND,
         CONNECTION_UNBOUND,

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8b0b25a7/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 c0f6392..6d0fc8f 100644
--- a/proton-j/src/main/resources/cengine.py
+++ b/proton-j/src/main/resources/cengine.py
@@ -950,6 +950,9 @@ def pn_transport_condition(trans):
 
 from org.apache.qpid.proton.engine import Event
 
+PN_REACTOR_INIT = Event.Type.REACTOR_INIT
+PN_REACTOR_FINAL = Event.Type.REACTOR_FINAL
+
 PN_CONNECTION_INIT = Event.Type.CONNECTION_INIT
 PN_CONNECTION_BOUND = Event.Type.CONNECTION_BOUND
 PN_CONNECTION_UNBOUND = Event.Type.CONNECTION_UNBOUND


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