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/06/18 12:56:21 UTC
[1/2] qpid-proton git commit: first round of filling out jython shims;
most of the python reactor examples pass in jython now with the exception of
the ones that depend on file descriptors and tornado
Repository: qpid-proton
Updated Branches:
refs/heads/proton-j-reactor 2d3cefc45 -> 5ed6de432
first round of filling out jython shims; most of the python reactor examples pass in jython now with the exception of the ones that depend on file descriptors and tornado
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/a3d9d433
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/a3d9d433
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/a3d9d433
Branch: refs/heads/proton-j-reactor
Commit: a3d9d43383ba262df78502dda1e0009aea519141
Parents: 2d3cefc
Author: Rafael Schloming <rh...@alum.mit.edu>
Authored: Thu Jun 18 06:35:06 2015 -0400
Committer: Rafael Schloming <rh...@alum.mit.edu>
Committed: Thu Jun 18 06:35:06 2015 -0400
----------------------------------------------------------------------
.../apache/qpid/proton/engine/BaseHandler.java | 8 +++
.../org/apache/qpid/proton/engine/Delivery.java | 2 +-
.../org/apache/qpid/proton/engine/Event.java | 2 +-
.../org/apache/qpid/proton/engine/Record.java | 1 +
.../qpid/proton/engine/impl/DeliveryImpl.java | 7 +++
.../qpid/proton/engine/impl/EventImpl.java | 10 +++
.../qpid/proton/engine/impl/RecordImpl.java | 8 +++
.../qpid/proton/message/impl/MessageImpl.java | 20 ++++++
proton-j/src/main/resources/ccodec.py | 2 +-
proton-j/src/main/resources/cengine.py | 25 ++++----
proton-j/src/main/resources/chandlers.py | 17 ++++-
proton-j/src/main/resources/cmessage.py | 3 +
proton-j/src/main/resources/cobject.py | 33 +++++++++-
proton-j/src/main/resources/compat.py | 8 +++
proton-j/src/main/resources/cproton.py | 1 +
proton-j/src/main/resources/creactor.py | 65 +++++++++++++++++++-
proton-j/src/main/resources/csasl.py | 2 +-
proton-j/src/main/resources/ctypes.py | 21 +++++++
18 files changed, 212 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/proton-j/src/main/java/org/apache/qpid/proton/engine/BaseHandler.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/BaseHandler.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/BaseHandler.java
index 02e10d5..c9c5d51 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/BaseHandler.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/BaseHandler.java
@@ -32,6 +32,14 @@ import java.util.Iterator;
public class BaseHandler implements Handler
{
+ public static Handler getHandler(Record r) {
+ return r.get(Handler.class, Handler.class);
+ }
+
+ public static void setHandler(Record r, Handler handler) {
+ r.set(Handler.class, Handler.class, handler);
+ }
+
public static Handler getHandler(Extendable ext) {
return ext.attachments().get(Handler.class, Handler.class);
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/proton-j/src/main/java/org/apache/qpid/proton/engine/Delivery.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/Delivery.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/Delivery.java
index e42e56e..d08efc2 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/Delivery.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/Delivery.java
@@ -28,7 +28,7 @@ import org.apache.qpid.proton.amqp.transport.DeliveryState;
* Whilst a message is logically a long-lived object, a delivery is short-lived - it
* is only intended to be used by the application until it is settled and all its data has been read.
*/
-public interface Delivery
+public interface Delivery extends Extendable
{
public byte[] getTag();
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/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 d69b282..743b6d0 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,7 +30,7 @@ import org.apache.qpid.proton.reactor.Task;
*
*/
-public interface Event
+public interface Event extends Extendable
{
public enum Type {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/proton-j/src/main/java/org/apache/qpid/proton/engine/Record.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/Record.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/Record.java
index 1496449..e97948d 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/Record.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/Record.java
@@ -31,5 +31,6 @@ public interface Record
<T> T get(Object key, Class<T> klass);
<T> void set(Object key, Class<T> klass, T value);
+ void clear();
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/DeliveryImpl.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/DeliveryImpl.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/DeliveryImpl.java
index 566b84a..3136d7a 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/DeliveryImpl.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/DeliveryImpl.java
@@ -23,6 +23,7 @@ package org.apache.qpid.proton.engine.impl;
import java.util.Arrays;
import org.apache.qpid.proton.engine.Delivery;
+import org.apache.qpid.proton.engine.Record;
import org.apache.qpid.proton.engine.Transport;
import org.apache.qpid.proton.amqp.transport.DeliveryState;
@@ -39,6 +40,7 @@ public class DeliveryImpl implements Delivery
private DeliveryImpl _transportWorkPrev;
boolean _transportWork;
+ private Record _attachments = new RecordImpl();
private Object _context;
private final byte[] _tag;
@@ -402,6 +404,11 @@ public class DeliveryImpl implements Delivery
_context = context;
}
+ public Record attachments()
+ {
+ return _attachments;
+ }
+
@Override
public String toString()
{
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/EventImpl.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/EventImpl.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/EventImpl.java
index 6abec58..1210eca 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/EventImpl.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/EventImpl.java
@@ -27,6 +27,7 @@ import org.apache.qpid.proton.engine.Delivery;
import org.apache.qpid.proton.engine.Event;
import org.apache.qpid.proton.engine.Handler;
import org.apache.qpid.proton.engine.Link;
+import org.apache.qpid.proton.engine.Record;
import org.apache.qpid.proton.engine.Session;
import org.apache.qpid.proton.engine.Transport;
import org.apache.qpid.proton.reactor.Reactor;
@@ -44,6 +45,7 @@ class EventImpl implements Event
Type type;
Object context;
EventImpl next;
+ RecordImpl attachments = new RecordImpl();
EventImpl()
{
@@ -54,12 +56,14 @@ class EventImpl implements Event
{
this.type = type;
this.context = context;
+ this.attachments.clear();
}
void clear()
{
type = null;
context = null;
+ attachments.clear();
}
@Override
@@ -318,10 +322,16 @@ class EventImpl implements Event
}
@Override
+ public Record attachments() {
+ return attachments;
+ }
+
+ @Override
public Event copy()
{
EventImpl newEvent = new EventImpl();
newEvent.init(type, context);
+ newEvent.attachments.copy(attachments);
return newEvent;
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/RecordImpl.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/RecordImpl.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/RecordImpl.java
index 849e694..85408cb 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/RecordImpl.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/RecordImpl.java
@@ -43,4 +43,12 @@ public class RecordImpl implements Record
return klass.cast(values.get(key));
}
+ public void clear() {
+ values.clear();
+ }
+
+ void copy(RecordImpl src) {
+ values.putAll(src.values);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/proton-j/src/main/java/org/apache/qpid/proton/message/impl/MessageImpl.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/message/impl/MessageImpl.java b/proton-j/src/main/java/org/apache/qpid/proton/message/impl/MessageImpl.java
index c43ba3e..9ea09a2 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/message/impl/MessageImpl.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/message/impl/MessageImpl.java
@@ -859,4 +859,24 @@ public class MessageImpl implements ProtonJMessage
return MessageError.OK;
}
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Message{");
+ if (_header != null) {
+ sb.append("header=");
+ sb.append(_header);
+ }
+ if (_properties != null) {
+ sb.append("properties=");
+ sb.append(_properties);
+ }
+ if (_body != null) {
+ sb.append("body=");
+ sb.append(_body);
+ }
+ sb.append("}");
+ return sb.toString();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/proton-j/src/main/resources/ccodec.py
----------------------------------------------------------------------
diff --git a/proton-j/src/main/resources/ccodec.py b/proton-j/src/main/resources/ccodec.py
index 629fe0a..fb86735 100644
--- a/proton-j/src/main/resources/ccodec.py
+++ b/proton-j/src/main/resources/ccodec.py
@@ -23,7 +23,7 @@ from org.apache.qpid.proton.codec.Data import DataType
from java.util import UUID as JUUID, Date as JDate
from java.nio import ByteBuffer
-from jarray import array, zeros
+from compat import array, zeros
# from proton/codec.h
PN_NULL = 1
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/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 6c45f33..b5cd703 100644
--- a/proton-j/src/main/resources/cengine.py
+++ b/proton-j/src/main/resources/cengine.py
@@ -28,7 +28,7 @@ from org.apache.qpid.proton.engine import EndpointState, Sender, \
Receiver, Transport as _Transport, TransportException
from java.util import EnumSet
-from jarray import array, zeros
+from compat import array, zeros
from cerror import *
from ccodec import *
@@ -143,7 +143,6 @@ class endpoint_wrapper:
def __init__(self, impl):
self.impl = impl
- self.attachments = {}
self.condition = pn_condition()
self.remote_condition = pn_condition()
@@ -215,7 +214,7 @@ def pn_connection_remote_desired_capabilities(conn):
return array2dat(conn.impl.getRemoteDesiredCapabilities(), PN_SYMBOL)
def pn_connection_attachments(conn):
- return conn.attachments
+ return conn.impl.attachments()
def pn_connection_set_container(conn, name):
conn.impl.setContainer(name)
@@ -264,7 +263,7 @@ def pn_session(conn):
return wrap(conn.impl.session(), pn_session_wrapper)
def pn_session_attachments(ssn):
- return ssn.attachments
+ return ssn.impl.attachments()
def pn_session_state(ssn):
return endpoint_state(ssn.impl)
@@ -524,7 +523,7 @@ class pn_link_wrapper(endpoint_wrapper):
self.impl.setTarget(self.target.encode())
def pn_link_attachments(link):
- return link.attachments
+ return link.impl.attachments()
def pn_link_source(link):
link.source.decode(link.impl.getSource())
@@ -801,7 +800,6 @@ class pn_delivery_wrapper:
def __init__(self, impl):
self.impl = impl
- self.attachments = {}
self.local = pn_disposition()
self.remote = pn_disposition()
@@ -812,7 +810,7 @@ def pn_delivery_tag(dlv):
return dlv.impl.getTag().tostring()
def pn_delivery_attachments(dlv):
- return dlv.attachments
+ return dlv.impl.attachments()
def pn_delivery_partial(dlv):
return dlv.impl.isPartial()
@@ -861,7 +859,6 @@ def pn_delivery_settle(dlv):
class pn_transport_wrapper:
def __init__(self, impl):
self.impl = impl
- self.attachments = {}
self.server = False
self.condition = pn_condition()
@@ -869,7 +866,7 @@ def pn_transport():
return wrap(Proton.transport(), pn_transport_wrapper)
def pn_transport_attachments(trans):
- return trans.attachments
+ return trans.impl.attachments()
def pn_transport_set_server(trans):
trans.server = True;
@@ -1021,7 +1018,6 @@ class pn_event:
def __init__(self, impl):
self.impl = impl
- self.attachments = {}
def pn_collector_peek(coll):
ev = coll.peek()
@@ -1037,7 +1033,7 @@ def pn_collector_free(coll):
pass
def pn_event_reactor(event):
- return None
+ return event.impl.getReactor()
def pn_event_connection(event):
return wrap(event.impl.getConnection(), pn_connection_wrapper)
@@ -1056,6 +1052,7 @@ def pn_event_transport(event):
from org.apache.qpid.proton.engine.impl import ConnectionImpl, SessionImpl, \
SenderImpl, ReceiverImpl, DeliveryImpl, TransportImpl
+from org.apache.qpid.proton.reactor.impl import TaskImpl
J2C = {
ConnectionImpl: "pn_connection",
@@ -1063,7 +1060,8 @@ J2C = {
SenderImpl: "pn_link",
ReceiverImpl: "pn_link",
DeliveryImpl: "pn_delivery",
- TransportImpl: "pn_transport"
+ TransportImpl: "pn_transport",
+ TaskImpl: "pn_task"
}
wrappers = {
@@ -1072,6 +1070,7 @@ wrappers = {
"pn_link": lambda x: wrap(x, pn_link_wrapper),
"pn_delivery": lambda x: wrap(x, pn_delivery_wrapper),
"pn_transport": lambda x: wrap(x, pn_transport_wrapper),
+ "pn_task": lambda x: x,
"pn_void": lambda x: x
}
@@ -1092,4 +1091,4 @@ def pn_event_category(event):
return event.impl.getCategory()
def pn_event_attachments(event):
- return event.attachments
+ return event.impl.attachments()
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/proton-j/src/main/resources/chandlers.py
----------------------------------------------------------------------
diff --git a/proton-j/src/main/resources/chandlers.py b/proton-j/src/main/resources/chandlers.py
index 429d0a3..aa5bd19 100644
--- a/proton-j/src/main/resources/chandlers.py
+++ b/proton-j/src/main/resources/chandlers.py
@@ -18,13 +18,26 @@
#
from cerror import Skipped
+from org.apache.qpid.proton.reactor import FlowController, Handshaker
+from org.apache.qpid.proton.engine import BaseHandler
# from proton/handlers.h
def pn_flowcontroller(window):
- raise Skipped()
+ return FlowController(window)
def pn_handshaker():
- raise Skipped()
+ return Handshaker()
def pn_iohandler():
raise Skipped()
+
+from cengine import pn_event, pn_event_type
+
+class pn_pyhandler(BaseHandler):
+
+ def __init__(self, pyobj):
+ self.pyobj = pyobj
+
+ def onUnhandled(self, event):
+ ev = pn_event(event)
+ self.pyobj.dispatch(ev, pn_event_type(ev))
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/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 6035d54..6e003ad 100644
--- a/proton-j/src/main/resources/cmessage.py
+++ b/proton-j/src/main/resources/cmessage.py
@@ -78,6 +78,9 @@ class pn_message_wrapper:
bod = AmqpValue(bod)
self.impl.setBody(bod)
+ def __repr__(self):
+ return self.impl.toString()
+
def pn_message():
return pn_message_wrapper()
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/proton-j/src/main/resources/cobject.py
----------------------------------------------------------------------
diff --git a/proton-j/src/main/resources/cobject.py b/proton-j/src/main/resources/cobject.py
index 18ad7e9..140e62a 100644
--- a/proton-j/src/main/resources/cobject.py
+++ b/proton-j/src/main/resources/cobject.py
@@ -41,19 +41,48 @@ def pn_cast_pn_delivery(obj):
def pn_cast_pn_transport(obj):
return obj
+def pn_cast_pn_reactor(obj):
+ return obj
+
+def pn_cast_pn_task(obj):
+ return obj
+
PN_PYREF = None
def pn_record_def(record, key, clazz):
pass
+from java.lang import Object
+
def pn_record_get(record, key):
- return record.get(key)
+ return record.get(key, Object)
def pn_record_set(record, key, value):
- record[key] = value
+ record.set(key, Object, value)
def pn_incref(obj):
pass
def pn_decref(obj):
pass
+
+def pn_free(obj):
+ pass
+
+from java.lang import StringBuilder
+
+def pn_string(st):
+ sb = StringBuilder()
+ if st:
+ sb.append(st)
+ return sb
+
+def pn_string_get(sb):
+ return sb.toString()
+
+def pn_inspect(obj, st):
+ if obj is None:
+ st.append("null")
+ else:
+ st.append(repr(obj))
+ return 0
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/proton-j/src/main/resources/compat.py
----------------------------------------------------------------------
diff --git a/proton-j/src/main/resources/compat.py b/proton-j/src/main/resources/compat.py
new file mode 100644
index 0000000..bdff669
--- /dev/null
+++ b/proton-j/src/main/resources/compat.py
@@ -0,0 +1,8 @@
+import sys
+from jarray import zeros, array as _array
+
+if (sys.version_info[0] == 2 and sys.version_info[1] == 5):
+ array = _array
+else:
+ def array(obj, code):
+ return obj
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/proton-j/src/main/resources/cproton.py
----------------------------------------------------------------------
diff --git a/proton-j/src/main/resources/cproton.py b/proton-j/src/main/resources/cproton.py
index a4ad018..16cb660 100644
--- a/proton-j/src/main/resources/cproton.py
+++ b/proton-j/src/main/resources/cproton.py
@@ -27,6 +27,7 @@ against both the C and Java protocol implementations.
PN_VERSION_MAJOR = 0
PN_VERSION_MINOR = 0
+from ctypes import *
from cobject import *
from cerror import *
from ccodec import *
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/proton-j/src/main/resources/creactor.py
----------------------------------------------------------------------
diff --git a/proton-j/src/main/resources/creactor.py b/proton-j/src/main/resources/creactor.py
index 7ba22d4..d21e830 100644
--- a/proton-j/src/main/resources/creactor.py
+++ b/proton-j/src/main/resources/creactor.py
@@ -18,9 +18,70 @@
#
from cerror import Skipped
+from cengine import wrap, pn_connection_wrapper
+
+from org.apache.qpid.proton.reactor import Reactor
+from org.apache.qpid.proton.engine import BaseHandler
# from proton/reactor.h
def pn_reactor():
- raise Skipped()
+ return Reactor.Factory.create()
def pn_reactor_attachments(r):
- raise Skipped()
+ return r.attachments()
+def pn_reactor_get_global_handler(r):
+ return r.getGlobalHandler()
+def pn_reactor_set_global_handler(r, h):
+ r.setGlobalHandler(h)
+def pn_reactor_get_handler(r):
+ return r.getHandler()
+def pn_reactor_set_handler(r, h):
+ r.setHandler(h)
+def pn_reactor_set_timeout(r, t):
+ r.setTimeout(t)
+def pn_reactor_get_timeout(r):
+ return r.getTimeout()
+def pn_reactor_schedule(r, t, h):
+ return r.schedule(t, h)
+def pn_reactor_yield(r):
+ getattr(r, "yield")()
+def pn_reactor_start(r):
+ r.start()
+def pn_reactor_process(r):
+ return r.process()
+def pn_reactor_stop(r):
+ return r.stop()
+def pn_reactor_selectable(r):
+ return r.selectable()
+def pn_reactor_connection(r, h):
+ return wrap(r.connection(h), pn_connection_wrapper)
+def pn_reactor_acceptor(r, host, port, handler):
+ return r.acceptor(host, int(port), handler)
+
+def pn_handler_add(h, c):
+ h.add(c)
+def pn_handler_dispatch(h, ev, et):
+ ev.impl.dispatch(h)
+def pn_record_set_handler(r, h):
+ BaseHandler.setHandler(r, h)
+def pn_record_get_handler(r):
+ return BaseHandler.getHandler(r)
+
+def pn_task_attachments(t):
+ return t.attachments()
+
+def pn_selectable_attachments(s):
+ return s.attachments()
+
+def pn_acceptor_close(a):
+ a.close()
+
+def pn_object_reactor(o):
+ if hasattr(o, "impl"):
+ if hasattr(o.impl, "getSession"):
+ return o.impl.getSession().getConnection().getReactor()
+ elif hasattr(o.impl, "getConnection"):
+ return o.impl.getConnection().getReactor()
+ else:
+ return o.impl.getReactor()
+ else:
+ return o.getReactor()
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/proton-j/src/main/resources/csasl.py
----------------------------------------------------------------------
diff --git a/proton-j/src/main/resources/csasl.py b/proton-j/src/main/resources/csasl.py
index ea5e489..a48c2ba 100644
--- a/proton-j/src/main/resources/csasl.py
+++ b/proton-j/src/main/resources/csasl.py
@@ -18,7 +18,7 @@
#
from org.apache.qpid.proton.engine import Sasl
-from jarray import array, zeros
+from compat import array, zeros
from cerror import *
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a3d9d433/proton-j/src/main/resources/ctypes.py
----------------------------------------------------------------------
diff --git a/proton-j/src/main/resources/ctypes.py b/proton-j/src/main/resources/ctypes.py
new file mode 100644
index 0000000..bd88b17
--- /dev/null
+++ b/proton-j/src/main/resources/ctypes.py
@@ -0,0 +1,21 @@
+#
+# 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.
+#
+
+# from proton/types.h
+PN_MILLIS_MAX = 4294967295
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/2] qpid-proton git commit: added more shim for selectabes;
cat and echo still don't work because you can't select on files in
java
Posted by rh...@apache.org.
added more shim for selectabes; cat and echo still don't work because you can't select on files in java
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/5ed6de43
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/5ed6de43
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/5ed6de43
Branch: refs/heads/proton-j-reactor
Commit: 5ed6de4321037fda7e8fd4730aab5b10a70c84bc
Parents: a3d9d43
Author: Rafael Schloming <rh...@alum.mit.edu>
Authored: Thu Jun 18 06:53:23 2015 -0400
Committer: Rafael Schloming <rh...@alum.mit.edu>
Committed: Thu Jun 18 06:53:23 2015 -0400
----------------------------------------------------------------------
proton-j/src/main/resources/cengine.py | 6 ++++--
proton-j/src/main/resources/cobject.py | 3 +++
proton-j/src/main/resources/creactor.py | 3 +++
3 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5ed6de43/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 b5cd703..5ecaaad 100644
--- a/proton-j/src/main/resources/cengine.py
+++ b/proton-j/src/main/resources/cengine.py
@@ -1052,7 +1052,7 @@ def pn_event_transport(event):
from org.apache.qpid.proton.engine.impl import ConnectionImpl, SessionImpl, \
SenderImpl, ReceiverImpl, DeliveryImpl, TransportImpl
-from org.apache.qpid.proton.reactor.impl import TaskImpl
+from org.apache.qpid.proton.reactor.impl import TaskImpl, SelectableImpl
J2C = {
ConnectionImpl: "pn_connection",
@@ -1061,7 +1061,8 @@ J2C = {
ReceiverImpl: "pn_link",
DeliveryImpl: "pn_delivery",
TransportImpl: "pn_transport",
- TaskImpl: "pn_task"
+ TaskImpl: "pn_task",
+ SelectableImpl: "pn_selectable"
}
wrappers = {
@@ -1071,6 +1072,7 @@ wrappers = {
"pn_delivery": lambda x: wrap(x, pn_delivery_wrapper),
"pn_transport": lambda x: wrap(x, pn_transport_wrapper),
"pn_task": lambda x: x,
+ "pn_selectable": lambda x: x,
"pn_void": lambda x: x
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5ed6de43/proton-j/src/main/resources/cobject.py
----------------------------------------------------------------------
diff --git a/proton-j/src/main/resources/cobject.py b/proton-j/src/main/resources/cobject.py
index 140e62a..33ab438 100644
--- a/proton-j/src/main/resources/cobject.py
+++ b/proton-j/src/main/resources/cobject.py
@@ -47,6 +47,9 @@ def pn_cast_pn_reactor(obj):
def pn_cast_pn_task(obj):
return obj
+def pn_cast_pn_selectable(obj):
+ return obj
+
PN_PYREF = None
def pn_record_def(record, key, clazz):
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5ed6de43/proton-j/src/main/resources/creactor.py
----------------------------------------------------------------------
diff --git a/proton-j/src/main/resources/creactor.py b/proton-j/src/main/resources/creactor.py
index d21e830..e179b23 100644
--- a/proton-j/src/main/resources/creactor.py
+++ b/proton-j/src/main/resources/creactor.py
@@ -72,6 +72,9 @@ def pn_task_attachments(t):
def pn_selectable_attachments(s):
return s.attachments()
+def pn_selectable_set_fd(s, fd):
+ s.setChannel(fd.getChannel())
+
def pn_acceptor_close(a):
a.close()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org