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 2014/02/06 14:51:21 UTC

svn commit: r1565256 [1/2] - in /qpid/proton/trunk: ./ proton-j/src/main/java/org/apache/qpid/proton/codec/ proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ proton-j/src/main/java/org/apache/qpid/proton/driver/ proton-j/src/main/java/org/apach...

Author: rhs
Date: Thu Feb  6 13:51:20 2014
New Revision: 1565256

URL: http://svn.apache.org/r1565256
Log:
PROTON-511: updated the java shim to adapt directly to the cproton API defined by swig

Added:
    qpid/proton/trunk/proton-j/src/main/resources/ccodec.py
    qpid/proton/trunk/proton-j/src/main/resources/cdriver.py
    qpid/proton/trunk/proton-j/src/main/resources/cengine.py
    qpid/proton/trunk/proton-j/src/main/resources/cerror.py
    qpid/proton/trunk/proton-j/src/main/resources/cmessage.py
    qpid/proton/trunk/proton-j/src/main/resources/cmessenger.py
    qpid/proton/trunk/proton-j/src/main/resources/cproton.py
    qpid/proton/trunk/proton-j/src/main/resources/csasl.py
    qpid/proton/trunk/proton-j/src/main/resources/cssl.py
Removed:
    qpid/proton/trunk/proton-j/src/main/resources/proton.py
Modified:
    qpid/proton/trunk/config.sh
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/Data.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/MapType.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/AbstractElement.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ArrayElement.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/AtomicElement.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DataImpl.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DescribedTypeElement.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/Element.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ListElement.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/MapElement.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Connector.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Listener.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/ConnectorImpl.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/ListenerImpl.java
    qpid/proton/trunk/proton-j/src/main/resources/   (props changed)
    qpid/proton/trunk/tests/java/org/apache/qpid/proton/JythonTest.java
    qpid/proton/trunk/tests/pom.xml
    qpid/proton/trunk/tests/python/proton_tests/common.py
    qpid/proton/trunk/tests/python/proton_tests/engine.py
    qpid/proton/trunk/tests/python/proton_tests/sasl.py

Modified: qpid/proton/trunk/config.sh
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/config.sh?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/config.sh (original)
+++ qpid/proton/trunk/config.sh Thu Feb  6 13:51:20 2014
@@ -39,8 +39,8 @@ fi
 
 # Python & Jython
 export PYTHON_BINDINGS=$PROTON_BINDINGS/python
-export COMMON_PYPATH=$PROTON_HOME/tests/python
-export PYTHONPATH=$COMMON_PYPATH:$PROTON_HOME/proton-c/bindings/python:$PYTHON_BINDINGS
+export COMMON_PYPATH=$PROTON_HOME/tests/python:$PROTON_HOME/proton-c/bindings/python
+export PYTHONPATH=$COMMON_PYPATH:$PYTHON_BINDINGS
 export JYTHONPATH=$COMMON_PYPATH:$PROTON_HOME/proton-j/src/main/resources:$PROTON_JARS
 export CLASSPATH=$PROTON_JARS
 

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/Data.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/Data.java?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/Data.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/Data.java Thu Feb  6 13:51:20 2014
@@ -163,6 +163,8 @@ public interface Data
     void narrow();
     void widen();
 
+    String format();
+
     // void dump();
 
 

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/MapType.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/MapType.java?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/MapType.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/MapType.java Thu Feb  6 13:51:20 2014
@@ -150,7 +150,7 @@ public class MapType extends AbstractPri
             int size = decoder.readRawInt();
             // todo - limit the decoder with size
             int count = decoder.readRawInt();
-            Map map = new HashMap(count);
+            Map map = new LinkedHashMap(count);
             for(int i = 0; i < count; i++)
             {
                 Object key = decoder.readObject();
@@ -231,7 +231,7 @@ public class MapType extends AbstractPri
             // todo - limit the decoder with size
             int count = ((int)decoder.readRawByte()) & 0xff;
 
-            Map map = new HashMap(count);
+            Map map = new LinkedHashMap(count);
             for(int i = 0; i < count; i++)
             {
                 Object key = decoder.readObject();

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/AbstractElement.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/AbstractElement.java?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/AbstractElement.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/AbstractElement.java Thu Feb  6 13:51:20 2014
@@ -64,4 +64,79 @@ abstract class AbstractElement<T> implem
     {
         _next = elt;
     }
+
+    @Override
+    public void setPrev(Element elt)
+    {
+        _prev = elt;
+    }
+
+    @Override
+    public void setParent(Element elt)
+    {
+        _parent = elt;
+    }
+
+    @Override
+    public Element replaceWith(Element elt)
+    {
+        if (_parent != null) {
+            elt = _parent.checkChild(elt);
+        }
+
+        elt.setPrev(_prev);
+        elt.setNext(_next);
+        elt.setParent(_parent);
+
+        if (_prev != null) {
+            _prev.setNext(elt);
+        }
+        if (_next != null) {
+            _next.setPrev(elt);
+        }
+
+        if (_parent != null && _parent.child() == this) {
+            _parent.setChild(elt);
+        }
+
+        return elt;
+    }
+
+    @Override
+    public String toString()
+    {
+        return String.format("%s[%h]{parent=%h, prev=%h, next=%h}",
+                             this.getClass().getSimpleName(),
+                             System.identityHashCode(this),
+                             System.identityHashCode(_parent),
+                             System.identityHashCode(_prev),
+                             System.identityHashCode(_next));
+    }
+
+    abstract String startSymbol();
+
+    abstract String stopSymbol();
+
+    @Override
+    public void render(StringBuilder sb)
+    {
+        if (canEnter()) {
+            sb.append(startSymbol());
+            Element el = child();
+            boolean first = true;
+            while (el != null) {
+                if (first) {
+                    first = false;
+                } else {
+                    sb.append(", ");
+                }
+                el.render(sb);
+                el = el.next();
+            }
+            sb.append(stopSymbol());
+        } else {
+            sb.append(getDataType()).append(" ").append(getValue());
+        }
+    }
+
 }

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ArrayElement.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ArrayElement.java?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ArrayElement.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ArrayElement.java Thu Feb  6 13:51:20 2014
@@ -355,6 +355,12 @@ class ArrayElement extends AbstractEleme
     }
 
     @Override
+    public void setChild(Element elt)
+    {
+        _first = elt;
+    }
+
+    @Override
     public Element addChild(Element element)
     {
         if(isDescribed() || element.getDataType() == _arrayType)
@@ -367,6 +373,7 @@ class ArrayElement extends AbstractEleme
             Element replacement = coerce(element);
             if(replacement != null)
             {
+                _first = replacement;
                 return replacement;
             }
             throw new IllegalArgumentException("Attempting to add instance of " + element.getDataType() + " to array of " + _arrayType);
@@ -375,45 +382,44 @@ class ArrayElement extends AbstractEleme
 
     private Element coerce(Element element)
     {
-        /*switch (_arrayType)
+        switch (_arrayType)
         {
-            case INT:
-
-                int i;
-                switch (element.getDataType())
-                {
-                    case BYTE:
-                        i = ((ByteElement)element).getValue().intValue();
-                        break;
-                    case SHORT:
-                        i = ((ShortElement)element).getValue().intValue();
-                        break;
-                    case LONG:
-                        i = ((LongElement)element).getValue().intValue();
-                        break;
-                    default:
-                        return null;
-                }
-                return new IntegerElement(element.parent(),element.prev(),i);
-
+        case INT:
+            int i;
+            switch (element.getDataType())
+            {
+            case BYTE:
+                i = ((ByteElement)element).getValue().intValue();
+                break;
+            case SHORT:
+                i = ((ShortElement)element).getValue().intValue();
+                break;
             case LONG:
-                long l;
-                switch (element.getDataType())
-                {
-                    case BYTE:
-                        l = ((ByteElement)element).getValue().longValue();
-                        break;
-                    case SHORT:
-                        l = ((ShortElement)element).getValue().longValue();
-                        break;
-                    case INT:
-                        l = ((IntegerElement)element).getValue().longValue();
-                        break;
-                    default:
-                        return null;
-                }
-                return new LongElement(element.parent(),element.prev(),l);
-        }*/
+                i = ((LongElement)element).getValue().intValue();
+                break;
+            default:
+                return null;
+            }
+            return new IntegerElement(element.parent(),element.prev(),i);
+
+        case LONG:
+            long l;
+            switch (element.getDataType())
+            {
+            case BYTE:
+                l = ((ByteElement)element).getValue().longValue();
+                break;
+            case SHORT:
+                l = ((ShortElement)element).getValue().longValue();
+                break;
+            case INT:
+                l = ((IntegerElement)element).getValue().longValue();
+                break;
+            default:
+                return null;
+            }
+            return new LongElement(element.parent(),element.prev(),l);
+        }
         return null;
     }
 
@@ -459,4 +465,15 @@ class ArrayElement extends AbstractEleme
     {
         return _arrayType;
     }
+
+    @Override
+    String startSymbol() {
+        return String.format("%s%s[", isDescribed() ? "D" : "", getArrayDataType());
+    }
+
+    @Override
+    String stopSymbol() {
+        return "]";
+    }
+
 }

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/AtomicElement.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/AtomicElement.java?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/AtomicElement.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/AtomicElement.java Thu Feb  6 13:51:20 2014
@@ -32,7 +32,12 @@ abstract class AtomicElement<T> extends 
     @Override
     public Element child()
     {
-        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void setChild(Element elt)
+    {
         throw new UnsupportedOperationException();
     }
 
@@ -54,4 +59,15 @@ abstract class AtomicElement<T> extends 
     {
         throw new UnsupportedOperationException();
     }
+
+    @Override
+    String startSymbol() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    String stopSymbol() {
+        throw new UnsupportedOperationException();
+    }
+
 }

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DataImpl.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DataImpl.java?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DataImpl.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DataImpl.java Thu Feb  6 13:51:20 2014
@@ -187,7 +187,12 @@ public class DataImpl implements Data
         {
             if(_current == null)
             {
-                element = _parent.addChild(element);
+                if (_parent == null) {
+                    _first = _first.replaceWith(element);
+                    element = _first;
+                } else {
+                    element = _parent.addChild(element);
+                }
             }
             else
             {
@@ -780,7 +785,7 @@ public class DataImpl implements Data
     @Override
     public Object getObject()
     {
-        return _current.getValue();
+        return _current == null ? null : _current.getValue();
     }
 
     @Override
@@ -863,4 +868,45 @@ public class DataImpl implements Data
         throw new ProtonUnsupportedOperationException();
     }
 
-}
\ No newline at end of file
+
+    @Override
+    public String format()
+    {
+        StringBuilder sb = new StringBuilder();
+        Element el = _first;
+        boolean first = true;
+        while (el != null) {
+            if (first) {
+                first = false;
+            } else {
+                sb.append(", ");
+            }
+            el.render(sb);
+            el = el.next();
+        }
+
+        return sb.toString();
+    }
+
+    private void render(StringBuilder sb, Element el)
+    {
+        if (el == null) return;
+        sb.append("    ").append(el).append("\n");
+        if (el.canEnter()) {
+            render(sb, el.child());
+        }
+        render(sb, el.next());
+    }
+
+    @Override
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+        render(sb, _first);
+        return String.format("Data[current=%h, parent=%h]{\n%s}",
+                             System.identityHashCode(_current),
+                             System.identityHashCode(_parent),
+                             sb);
+    }
+
+}

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DescribedTypeElement.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DescribedTypeElement.java?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DescribedTypeElement.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DescribedTypeElement.java Thu Feb  6 13:51:20 2014
@@ -140,6 +140,12 @@ class DescribedTypeElement extends Abstr
     }
 
     @Override
+    public void setChild(Element elt)
+    {
+        _first = elt;
+    }
+
+    @Override
     public Element checkChild(Element element)
     {
         if(element.prev() != _first)
@@ -157,4 +163,14 @@ class DescribedTypeElement extends Abstr
         return element;
     }
 
+    @Override
+    String startSymbol() {
+        return "(";
+    }
+
+    @Override
+    String stopSymbol() {
+        return ")";
+    }
+
 }

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/Element.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/Element.java?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/Element.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/Element.java Thu Feb  6 13:51:20 2014
@@ -35,11 +35,19 @@ interface Element<T>
     Element prev();
     Element child();
     Element parent();
+
     void setNext(Element elt);
+    void setPrev(Element elt);
+    void setParent(Element elt);
+    void setChild(Element elt);
 
-    Element addChild(Element element);
+    Element replaceWith(Element elt);
 
+    Element addChild(Element element);
     Element checkChild(Element element);
 
     boolean canEnter();
+
+    void render(StringBuilder sb);
+
 }

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ListElement.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ListElement.java?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ListElement.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ListElement.java Thu Feb  6 13:51:20 2014
@@ -202,11 +202,16 @@ class ListElement extends AbstractElemen
     @Override
     public Element child()
     {
-        // TODO
         return _first;
     }
 
     @Override
+    public void setChild(Element elt)
+    {
+        _first = elt;
+    }
+
+    @Override
     public Element checkChild(Element element)
     {
         return element;
@@ -219,4 +224,14 @@ class ListElement extends AbstractElemen
         return element;
     }
 
+    @Override
+    String startSymbol() {
+        return "[";
+    }
+
+    @Override
+    String stopSymbol() {
+        return "]";
+    }
+
 }

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/MapElement.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/MapElement.java?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/MapElement.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/MapElement.java Thu Feb  6 13:51:20 2014
@@ -200,6 +200,12 @@ class MapElement extends AbstractElement
     }
 
     @Override
+    public void setChild(Element elt)
+    {
+        _first = elt;
+    }
+
+    @Override
     public Element checkChild(Element element)
     {
         return element;
@@ -212,4 +218,14 @@ class MapElement extends AbstractElement
         return element;
     }
 
+    @Override
+    String startSymbol() {
+        return "{";
+    }
+
+    @Override
+    String stopSymbol() {
+        return "}";
+    }
+
 }

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Connector.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Connector.java?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Connector.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Connector.java Thu Feb  6 13:51:20 2014
@@ -23,6 +23,7 @@ package org.apache.qpid.proton.driver;
 import java.io.IOException;
 import org.apache.qpid.proton.engine.Connection;
 import org.apache.qpid.proton.engine.Sasl;
+import org.apache.qpid.proton.engine.Transport;
 
 /**
  * Intermediates between a proton engine {@link Connection} and the I/O
@@ -65,6 +66,13 @@ public interface Connector<C>
     Sasl sasl();
 
     /**
+     * Access the Transport associated with the connector.
+     *
+     */
+
+    Transport getTransport();
+
+    /**
      * Access the AMQP Connection associated with the connector.
      *
      * @return the connection context for the connector, or null if none.

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Listener.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Listener.java?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Listener.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Listener.java Thu Feb  6 13:51:20 2014
@@ -46,6 +46,12 @@ public interface Listener<C>
     C getContext();
 
     /**
+     * Set the application context that is associated with this listener.
+     *
+     */
+    void setContext(C ctx);
+
+    /**
      * Close the socket used by the listener.
      *
      */

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/ConnectorImpl.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/ConnectorImpl.java?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/ConnectorImpl.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/ConnectorImpl.java Thu Feb  6 13:51:20 2014
@@ -25,6 +25,7 @@ import java.nio.channels.SocketChannel;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.apache.qpid.proton.Proton;
 import org.apache.qpid.proton.driver.Connector;
 import org.apache.qpid.proton.driver.Listener;
 import org.apache.qpid.proton.engine.Connection;
@@ -49,7 +50,7 @@ class ConnectorImpl<C> implements Connec
     private C _context;
 
     private Connection _connection;
-    private Transport _transport = null;
+    private Transport _transport = Proton.transport();
     private SelectionKey _key;
     private ConnectorState _state = UNINITIALIZED;
 
@@ -207,7 +208,12 @@ class ConnectorImpl<C> implements Connec
     public void setConnection(Connection connection)
     {
         _connection = connection;
-        _transport = TransportFactory.getDefaultTransportFactory().transport(_connection);
+        _transport.bind(_connection);
+    }
+
+    public Transport getTransport()
+    {
+        return _transport;
     }
 
     public C getContext()

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/ListenerImpl.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/ListenerImpl.java?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/ListenerImpl.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/ListenerImpl.java Thu Feb  6 13:51:20 2014
@@ -31,7 +31,7 @@ import org.apache.qpid.proton.driver.Lis
 
 class ListenerImpl<C> implements Listener<C>
 {
-    private final C _context;
+    private C _context;
     private final ServerSocketChannel _channel;
     private final DriverImpl _driver;
     private final Logger _logger = Logger.getLogger("proton.driver");
@@ -65,7 +65,7 @@ class ListenerImpl<C> implements Listene
             if(c != null)
             {
                 c.configureBlocking(false);
-                return _driver.createServerConnector(c, _context, this);
+                return _driver.createServerConnector(c, null, this);
             }
         }
         catch (IOException e)
@@ -80,6 +80,11 @@ class ListenerImpl<C> implements Listene
         return _context;
     }
 
+    public void setContext(C context)
+    {
+        _context = context;
+    }
+
     public void close() throws IOException
     {
         _channel.socket().close();

Propchange: qpid/proton/trunk/proton-j/src/main/resources/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Feb  6 13:51:20 2014
@@ -0,0 +1 @@
+*.class

Added: qpid/proton/trunk/proton-j/src/main/resources/ccodec.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/resources/ccodec.py?rev=1565256&view=auto
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/resources/ccodec.py (added)
+++ qpid/proton/trunk/proton-j/src/main/resources/ccodec.py Thu Feb  6 13:51:20 2014
@@ -0,0 +1,339 @@
+#
+# 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 org.apache.qpid.proton import Proton
+from org.apache.qpid.proton.amqp import Symbol, UnsignedByte, UnsignedInteger, \
+  UnsignedLong, Decimal32, Decimal64, Decimal128
+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 proton/codec.h
+PN_NULL = 1
+PN_BOOL = 2
+PN_UBYTE = 3
+PN_BYTE = 4
+PN_USHORT = 5
+PN_SHORT = 6
+PN_UINT = 7
+PN_INT = 8
+PN_CHAR = 9
+PN_ULONG = 10
+PN_LONG = 11
+PN_TIMESTAMP = 12
+PN_FLOAT = 13
+PN_DOUBLE = 14
+PN_DECIMAL32 = 15
+PN_DECIMAL64 = 16
+PN_DECIMAL128 = 17
+PN_UUID = 18
+PN_BINARY = 19
+PN_STRING = 20
+PN_SYMBOL = 21
+PN_DESCRIBED = 22
+PN_ARRAY = 23
+PN_LIST = 24
+PN_MAP = 25
+
+DATA_TYPES_J2P = {}
+DATA_TYPES_P2J = {}
+
+def DATA_TYPES(jtype, ptype):
+  DATA_TYPES_J2P[jtype] = ptype
+  DATA_TYPES_P2J[ptype] = jtype
+
+DATA_TYPES(DataType.NULL, PN_NULL)
+DATA_TYPES(DataType.BOOL, PN_BOOL)
+DATA_TYPES(DataType.UBYTE, PN_UBYTE)
+DATA_TYPES(DataType.USHORT, PN_USHORT)
+DATA_TYPES(DataType.UINT, PN_UINT)
+DATA_TYPES(DataType.ULONG, PN_ULONG)
+DATA_TYPES(DataType.SHORT, PN_SHORT)
+DATA_TYPES(DataType.INT, PN_INT)
+DATA_TYPES(DataType.LONG, PN_LONG)
+DATA_TYPES(DataType.CHAR, PN_CHAR)
+DATA_TYPES(DataType.TIMESTAMP, PN_TIMESTAMP)
+DATA_TYPES(DataType.FLOAT, PN_FLOAT)
+DATA_TYPES(DataType.DOUBLE, PN_DOUBLE)
+DATA_TYPES(DataType.DECIMAL32, PN_DECIMAL32)
+DATA_TYPES(DataType.DECIMAL64, PN_DECIMAL64)
+DATA_TYPES(DataType.DECIMAL128, PN_DECIMAL128)
+DATA_TYPES(DataType.BINARY, PN_BINARY)
+DATA_TYPES(DataType.STRING, PN_STRING)
+DATA_TYPES(DataType.SYMBOL, PN_SYMBOL)
+DATA_TYPES(DataType.UUID, PN_UUID)
+DATA_TYPES(DataType.LIST, PN_LIST)
+DATA_TYPES(DataType.MAP, PN_MAP)
+DATA_TYPES(DataType.ARRAY, PN_ARRAY)
+DATA_TYPES(DataType.DESCRIBED, PN_DESCRIBED)
+
+def pn_data(capacity):
+  return Proton.data(capacity)
+
+def pn_data_put_null(data):
+  data.putNull()
+  return 0
+
+def pn_data_put_bool(data, b):
+  data.putBoolean(b)
+  return 0
+
+def pn_data_get_bool(data):
+  return data.getBoolean()
+
+def pn_data_get_ubyte(data):
+  return data.getUnsignedByte().longValue()
+
+def pn_data_put_ubyte(data, u):
+  data.putUnsignedByte(UnsignedByte.valueOf(u))
+  return 0
+
+def pn_data_get_ushort(data):
+  return data.getUnsignedShort().longValue()
+
+def pn_data_put_ushort(data, u):
+  data.putUnsignedShort(UnsignedShort.valueOf(u))
+  return 0
+
+def pn_data_get_uint(data):
+  return data.getUnsignedInteger().longValue()
+
+def pn_data_put_uint(data, u):
+  data.putUnsignedInteger(UnsignedInteger.valueOf(u))
+  return 0
+
+def pn_data_put_ulong(data, u):
+  data.putUnsignedLong(UnsignedLong.valueOf(u))
+  return 0
+
+def pn_data_get_ulong(data):
+  return data.getUnsignedLong().longValue()
+
+def pn_data_get_short(data):
+  return data.getShort()
+
+def pn_data_put_short(data, s):
+  data.putShort(s)
+  return 0
+
+def pn_data_put_int(data, i):
+  data.putInt(i)
+  return 0
+
+def pn_data_get_int(data):
+  return data.getInt()
+
+def pn_data_put_long(data, l):
+  data.putLong(l)
+  return 0
+
+def pn_data_get_long(data):
+  return data.getLong()
+
+def pn_data_put_char(data, c):
+  data.putChar(c)
+  return 0
+
+def pn_data_get_char(data):
+  return data.getChar()
+
+def pn_data_put_timestamp(data, t):
+  data.putTimestamp(JDate(t))
+  return 0
+
+def pn_data_get_timestamp(data):
+  return data.getTimestamp().getTime()
+
+def pn_data_put_float(data, f):
+  data.putFloat(f)
+  return 0
+
+def pn_data_get_float(data):
+  return data.getFloat()
+
+def pn_data_put_double(data, d):
+  data.putDouble(d)
+  return 0
+
+def pn_data_get_double(data):
+  return data.getDouble()
+
+def pn_data_put_decimal32(data, d):
+  data.putDecimal32(Decimal32(d))
+  return 0
+
+def pn_data_get_decimal32(data):
+  return data.getDecimal32().getBits()
+
+def pn_data_put_decimal64(data, d):
+  data.putDecimal64(Decimal64(d))
+  return 0
+
+def pn_data_get_decimal64(data):
+  return data.getDecimal64().getBits()
+
+def pn_data_put_decimal128(data, d):
+  data.putDecimal128(Decimal128(array(d, 'b')))
+  return 0
+
+def pn_data_get_decimal128(data):
+  return data.getDecimal128().asBytes().tostring()
+
+def pn_data_put_binary(data, b):
+  data.putBinary(array(b, 'b'))
+  return 0
+
+def pn_data_get_binary(data):
+  return data.getBinary().getArray().tostring()
+
+def pn_data_put_string(data, s):
+  data.putString(s)
+  return 0
+
+def pn_data_get_string(data):
+  return data.getString()
+
+def pn_data_put_symbol(data, s):
+  data.putSymbol(Symbol.valueOf(s))
+  return 0
+
+def pn_data_get_symbol(data):
+  return data.getSymbol().toString()
+
+def pn_data_put_uuid(data, u):
+  bb = ByteBuffer.wrap(array(u, 'b'))
+  first = bb.getLong()
+  second = bb.getLong()
+  data.putUUID(JUUID(first, second))
+  return 0
+
+def pn_data_get_uuid(data):
+  u = data.getUUID()
+  ba = zeros(16, 'b')
+  bb = ByteBuffer.wrap(ba)
+  bb.putLong(u.getMostSignificantBits())
+  bb.putLong(u.getLeastSignificantBits())
+  return ba.tostring()
+
+def pn_data_put_list(data):
+  data.putList()
+  return 0
+
+def pn_data_get_list(data):
+  return data.getList()
+
+def pn_data_put_map(data):
+  data.putMap()
+  return 0
+
+def pn_data_put_array(data, described, type):
+  data.putArray(described, DATA_TYPES_P2J[type])
+  return 0
+
+def pn_data_get_array(data):
+  return data.getArray()
+
+def pn_data_is_array_described(data):
+  return data.isArrayDescribed()
+
+def pn_data_get_array_type(data):
+  return DATA_TYPES_J2P[data.getArrayType()]
+
+def pn_data_put_described(data):
+  data.putDescribed()
+  return 0
+
+def pn_data_rewind(data):
+  data.rewind()
+
+def pn_data_next(data):
+  t = data.next()
+  return t != None
+
+def pn_data_enter(data):
+  return data.enter()
+
+def pn_data_exit(data):
+  return data.exit()
+
+def pn_data_type(data):
+  t = data.type()
+  if t is None:
+    return -1
+  else:
+    return DATA_TYPES_J2P[t]
+
+def pn_data_encode(data, size):
+  enc = data.encode().getArray().tostring()
+  if len(enc) > size:
+    return PN_OVERFLOW, None
+  else:
+    return len(enc), enc
+
+def pn_data_decode(data, encoded):
+  return data.decode(ByteBuffer.wrap(array(encoded, 'b')))
+
+def pn_data_narrow(data):
+  data.narrow()
+
+def pn_data_widen(data):
+  data.widen()
+
+def pn_data_copy(data, src):
+  data.copy(src)
+
+def pn_data_format(data, n):
+  return 0, data.format()
+
+def pn_data_clear(data):
+  data.clear()
+
+def pn_data_free(data):
+  pass
+
+def dat2obj(dat):
+  dat.rewind()
+  if dat.next():
+    return dat.getObject()
+  else:
+    return None
+
+def obj2dat(obj, dat=None):
+  if dat is None:
+    dat = pn_data(0)
+  else:
+    dat.clear()
+  if obj:
+    dat.putObject(obj)
+  dat.rewind()
+  return dat
+
+def array2dat(ary, atype, dat=None):
+  if dat is None:
+    dat = pn_data(0)
+  else:
+    dat.clear()
+  if ary:
+    pn_data_put_array(dat, False, atype)
+    pn_data_enter(dat)
+    for o in ary:
+      dat.putObject(o)
+  dat.rewind()
+  return dat

Added: qpid/proton/trunk/proton-j/src/main/resources/cdriver.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/resources/cdriver.py?rev=1565256&view=auto
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/resources/cdriver.py (added)
+++ qpid/proton/trunk/proton-j/src/main/resources/cdriver.py Thu Feb  6 13:51:20 2014
@@ -0,0 +1,69 @@
+#
+# 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 org.apache.qpid.proton import Proton
+
+# from proton/driver.h
+
+def pn_driver():
+  return Proton.driver()
+
+def pn_driver_wait(drv, t):
+  drv.doWait(t)
+
+def pn_driver_listener(drv):
+  return drv.listener()
+
+def pn_driver_connector(drv):
+  return drv.connector()
+
+def pn_listener(drv, host, port, ctx):
+  return drv.createListener(host, int(port), ctx)
+
+def pn_listener_context(l):
+  return l.getContext()
+
+def pn_listener_set_context(l, v):
+  l.setContext(v)
+
+def pn_listener_accept(l):
+  return l.accept()
+
+def pn_connector(drv, host, port, ctx):
+  return drv.createConnector(host, int(port), ctx)
+
+def pn_connector_context(c):
+  return c.getContext()
+
+def pn_connector_set_context(c, v):
+  c.setContext(v)
+
+def pn_connector_set_connection(c, conn):
+  c.setConnection(conn.impl)
+
+def pn_connector_connection(c):
+  return wrap(c.getConnection(), pn_connection_wrapper)
+
+def pn_connector_transport(c):
+  return wrap(c.getTransport(), pn_transport_wrapper)
+
+def pn_connector_process(c):
+  return c.process()
+
+def pn_connector_closed(c):
+  return c.isClosed()

Added: qpid/proton/trunk/proton-j/src/main/resources/cengine.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/resources/cengine.py?rev=1565256&view=auto
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/resources/cengine.py (added)
+++ qpid/proton/trunk/proton-j/src/main/resources/cengine.py Thu Feb  6 13:51:20 2014
@@ -0,0 +1,910 @@
+#
+# 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 org.apache.qpid.proton import Proton
+from org.apache.qpid.proton.amqp import Symbol
+from org.apache.qpid.proton.amqp.messaging import Source, Target, \
+  TerminusDurability, TerminusExpiryPolicy, Received, Accepted, \
+  Rejected, Released, Modified
+from org.apache.qpid.proton.amqp.transaction import Coordinator
+from org.apache.qpid.proton.amqp.transport import ErrorCondition, \
+  SenderSettleMode, ReceiverSettleMode
+from org.apache.qpid.proton.engine import EndpointState, Sender, \
+  Receiver, TransportException
+
+from java.util import EnumSet
+from jarray import array, zeros
+
+from cerror import *
+from ccodec import *
+
+# from proton/engine.h
+PN_LOCAL_UNINIT = 1
+PN_LOCAL_ACTIVE = 2
+PN_LOCAL_CLOSED = 4
+PN_REMOTE_UNINIT = 8
+PN_REMOTE_ACTIVE = 16
+PN_REMOTE_CLOSED = 32
+
+PN_SND_UNSETTLED = 0
+PN_SND_SETTLED = 1
+PN_SND_MIXED = 2
+
+PN_RCV_FIRST = 0
+PN_RCV_SECOND = 1
+
+PN_UNSPECIFIED = 0
+PN_SOURCE = 1
+PN_TARGET = 2
+PN_COORDINATOR = 3
+
+PN_NONDURABLE = 0
+PN_CONFIGURATION = 1
+PN_DELIVERIES = 2
+
+PN_LINK_CLOSE = 0
+PN_SESSION_CLOSE = 1
+PN_CONNECTION_CLOSE = 2
+PN_NEVER = 3
+
+PN_DIST_MODE_UNSPECIFIED = 0
+PN_DIST_MODE_COPY = 1
+PN_DIST_MODE_MOVE = 2
+
+PN_RECEIVED = (0x0000000000000023)
+PN_ACCEPTED = (0x0000000000000024)
+PN_REJECTED = (0x0000000000000025)
+PN_RELEASED = (0x0000000000000026)
+PN_MODIFIED = (0x0000000000000027)
+
+PN_TRACE_OFF = (0)
+PN_TRACE_RAW = (1)
+PN_TRACE_FRM = (2)
+PN_TRACE_DRV = (4)
+
+def wrap(obj, wrapper):
+  if obj:
+    ctx = obj.getContext()
+    if not ctx:
+      ctx = wrapper(obj)
+      obj.setContext(ctx)
+    return ctx
+
+class pn_condition:
+
+  def __init__(self):
+    self.name = None
+    self.description = None
+    self.info = pn_data(0)
+
+  def decode(self, impl):
+    if impl is None:
+      self.name = None
+      self.description = None
+      self.info.clear()
+    else:
+      self.name = impl.getCondition().toString()
+      self.description = impl.getDescription()
+      obj2dat(impl.getInfo(), self.info)
+
+  def encode(self):
+    if self.name is None:
+      return None
+    else:
+      impl = ErrorCondition()
+      impl.setCondition(Symbol.valueOf(self.name))
+      impl.setDescription(self.description)
+      impl.setInfo(dat2obj(self.info))
+      return impl
+
+def pn_condition_is_set(cond):
+  return bool(cond.name)
+
+def pn_condition_get_name(cond):
+  return cond.name
+
+def pn_condition_set_name(cond, name):
+  cond.name = name
+
+def pn_condition_get_description(cond):
+  return cond.description
+
+def pn_condition_set_description(cond, description):
+  cond.description = description
+
+def pn_condition_clear(cond):
+  cond.name = None
+  cond.description = None
+  cond.info.clear()
+
+def pn_condition_info(cond):
+  return cond.info
+
+class endpoint_wrapper:
+
+  def __init__(self, impl):
+    self.impl = impl
+    self.context = None
+    self.condition = pn_condition()
+    self.remote_condition = pn_condition()
+
+  def on_close(self):
+    cond = self.condition.encode()
+    if cond:
+      self.impl.setCondition(cond)
+
+def remote_condition(self):
+  self.remote_condition.decode(self.impl.getRemoteCondition())
+  return self.remote_condition
+
+class pn_connection_wrapper(endpoint_wrapper):
+
+  def __init__(self, impl):
+    endpoint_wrapper.__init__(self, impl)
+    self.properties = pn_data(0)
+    self.offered_capabilities = pn_data(0)
+    self.desired_capabilities = pn_data(0)
+
+def pn_connection():
+  return wrap(Proton.connection(), pn_connection_wrapper)
+
+def set2mask(local, remote):
+  mask = 0
+  if local.contains(EndpointState.UNINITIALIZED):
+    mask |= PN_LOCAL_UNINIT
+  if local.contains(EndpointState.ACTIVE):
+    mask |= PN_LOCAL_ACTIVE
+  if local.contains(EndpointState.CLOSED):
+    mask |= PN_LOCAL_CLOSED
+  if remote.contains(EndpointState.UNINITIALIZED):
+    mask |= PN_REMOTE_UNINIT
+  if remote.contains(EndpointState.ACTIVE):
+    mask |= PN_REMOTE_ACTIVE
+  if remote.contains(EndpointState.CLOSED):
+    mask |= PN_REMOTE_CLOSED
+  return mask
+
+def endpoint_state(impl):
+  return set2mask(EnumSet.of(impl.getLocalState()),
+                  EnumSet.of(impl.getRemoteState()))
+
+def pn_connection_state(conn):
+  return endpoint_state(conn.impl)
+
+def pn_connection_condition(conn):
+  return conn.condition
+
+def pn_connection_remote_condition(conn):
+  return remote_condition(conn)
+
+def pn_connection_properties(conn):
+  return conn.properties
+
+def pn_connection_remote_properties(conn):
+  return obj2dat(conn.impl.getRemoteProperties())
+
+def pn_connection_offered_capabilities(conn):
+  return conn.offered_capabilities
+
+def pn_connection_remote_offered_capabilities(conn):
+  return array2dat(conn.impl.getRemoteOfferedCapabilities(), PN_SYMBOL)
+
+def pn_connection_desired_capabilities(conn):
+  return conn.desired_capabilities
+
+def pn_connection_remote_desired_capabilities(conn):
+  return array2dat(conn.impl.getRemoteDesiredCapabilities(), PN_SYMBOL)
+
+def pn_connection_get_context(conn):
+  return conn.context
+
+def pn_connection_set_context(conn, ctx):
+  conn.context = ctx
+
+def pn_connection_set_container(conn, name):
+  conn.impl.setContainer(name)
+
+def pn_connection_remote_container(conn):
+  return conn.impl.getRemoteContainer()
+
+def pn_connection_set_hostname(conn, name):
+  conn.impl.setHostname(name)
+
+def pn_connection_remote_hostname(conn):
+  return conn.impl.getRemoteHostname()
+
+def pn_connection_open(conn):
+  props = dat2obj(conn.properties)
+  offered = dat2obj(conn.offered_capabilities)
+  desired = dat2obj(conn.desired_capabilities)
+  if props:
+    conn.impl.setProperties(props)
+  if offered:
+    conn.impl.setOfferedCapabilities(array(list(offered), Symbol))
+  if desired:
+    conn.impl.setDesiredCapabilities(array(list(desired), Symbol))
+  conn.impl.open()
+
+def pn_connection_close(conn):
+  conn.on_close()
+  conn.impl.close()
+
+class pn_session_wrapper(endpoint_wrapper):
+  pass
+
+def pn_session(conn):
+  return wrap(conn.impl.session(), pn_session_wrapper)
+
+def pn_session_get_context(ssn):
+  return ssn.context
+
+def pn_session_set_context(ssn, ctx):
+  ssn.context = ctx
+
+def pn_session_state(ssn):
+  return endpoint_state(ssn.impl)
+
+def pn_session_get_incoming_capacity(ssn):
+  return ssn.impl.getIncomingCapacity()
+
+def pn_session_set_incoming_capacity(ssn, capacity):
+  ssn.impl.setIncomingCapacity(capacity)
+
+def pn_session_incoming_bytes(ssn):
+  return ssn.impl.getIncomingBytes()
+
+def pn_session_outgoing_bytes(ssn):
+  return ssn.impl.getOutgoingBytes()
+
+def pn_session_condition(ssn):
+  return ssn.condition
+
+def pn_session_remote_condition(ssn):
+  return remote_condition(ssn)
+
+def pn_session_open(ssn):
+  ssn.impl.open()
+
+def pn_session_close(ssn):
+  ssn.on_close()
+  ssn.impl.close()
+
+def mask2set(mask):
+  local = []
+  remote = []
+  if PN_LOCAL_UNINIT & mask:
+    local.append(EndpointState.UNINITIALIZED)
+  if PN_LOCAL_ACTIVE & mask:
+    local.append(EndpointState.ACTIVE)
+  if PN_LOCAL_CLOSED & mask:
+    local.append(EndpointState.CLOSED)
+  if PN_REMOTE_UNINIT & mask:
+    remote.append(EndpointState.UNINITIALIZED)
+  if PN_REMOTE_ACTIVE & mask:
+    remote.append(EndpointState.ACTIVE)
+  if PN_REMOTE_CLOSED & mask:
+    remote.append(EndpointState.CLOSED)
+
+  if local:
+    local = EnumSet.of(*local)
+  else:
+    local = None
+  if remote:
+    remote = EnumSet.of(*remote)
+  else:
+    remote = None
+
+  return local, remote
+
+def pn_session_head(conn, mask):
+  local, remote = mask2set(mask)
+  return wrap(conn.impl.sessionHead(local, remote), pn_session_wrapper)
+
+def pn_session_connection(ssn):
+  return wrap(ssn.impl.getConnection(), pn_connection_wrapper)
+
+def pn_sender(ssn, name):
+  return wrap(ssn.impl.sender(name), pn_link_wrapper)
+
+def pn_receiver(ssn, name):
+  return wrap(ssn.impl.receiver(name), pn_link_wrapper)
+
+TERMINUS_TYPES_J2P = {
+  Source: PN_SOURCE,
+  Target: PN_TARGET,
+  Coordinator: PN_COORDINATOR,
+  None.__class__: PN_UNSPECIFIED
+}
+
+TERMINUS_TYPES_P2J = {
+  PN_SOURCE: Source,
+  PN_TARGET: Target,
+  PN_COORDINATOR: Coordinator,
+  PN_UNSPECIFIED: lambda: None
+}
+
+DURABILITY_P2J = {
+  PN_NONDURABLE: TerminusDurability.NONE,
+  PN_CONFIGURATION: TerminusDurability.CONFIGURATION,
+  PN_DELIVERIES: TerminusDurability.UNSETTLED_STATE
+}
+
+DURABILITY_J2P = {
+  TerminusDurability.NONE: PN_NONDURABLE,
+  TerminusDurability.CONFIGURATION: PN_CONFIGURATION,
+  TerminusDurability.UNSETTLED_STATE: PN_DELIVERIES
+}
+
+EXPIRY_POLICY_P2J = {
+  PN_LINK_CLOSE: TerminusExpiryPolicy.LINK_DETACH,
+  PN_SESSION_CLOSE: TerminusExpiryPolicy.SESSION_END,
+  PN_CONNECTION_CLOSE: TerminusExpiryPolicy.CONNECTION_CLOSE,
+  PN_NEVER: TerminusExpiryPolicy.NEVER
+}
+
+EXPIRY_POLICY_J2P = {
+  TerminusExpiryPolicy.LINK_DETACH: PN_LINK_CLOSE,
+  TerminusExpiryPolicy.SESSION_END: PN_SESSION_CLOSE,
+  TerminusExpiryPolicy.CONNECTION_CLOSE: PN_CONNECTION_CLOSE,
+  TerminusExpiryPolicy.NEVER: PN_NEVER
+}
+
+DISTRIBUTION_MODE_P2J = {
+  PN_DIST_MODE_UNSPECIFIED: None,
+  PN_DIST_MODE_COPY: Symbol.valueOf("copy"),
+  PN_DIST_MODE_MOVE: Symbol.valueOf("move")
+}
+
+DISTRIBUTION_MODE_J2P = {
+  None: PN_DIST_MODE_UNSPECIFIED,
+  Symbol.valueOf("copy"): PN_DIST_MODE_COPY,
+  Symbol.valueOf("move"): PN_DIST_MODE_MOVE
+}
+
+class pn_terminus:
+
+  def __init__(self, type):
+    self.type = type
+    self.address = None
+    self.durability = PN_NONDURABLE
+    self.expiry_policy = PN_SESSION_CLOSE
+    self.distribution_mode = PN_DIST_MODE_UNSPECIFIED
+    self.timeout = 0
+    self.dynamic = False
+    self.properties = pn_data(0)
+    self.capabilities = pn_data(0)
+    self.outcomes = pn_data(0)
+    self.filter = pn_data(0)
+
+  def copy(self, src):
+    self.type = src.type
+    self.address = src.address
+    self.durability = src.durability
+    self.expiry_policy = src.expiry_policy
+    self.timeout = src.timeout
+    self.dynamic = src.dynamic
+    self.properties = src.properties
+    self.capabilities = src.capabilities
+    self.outcomes = src.outcomes
+    self.filter = src.filter
+
+  def decode(self, impl):
+    if impl is not None:
+      self.type = TERMINUS_TYPES_J2P[impl.__class__]
+      self.address = impl.getAddress()
+      self.durability = DURABILITY_J2P[impl.getDurable()]
+      self.expiry_policy = EXPIRY_POLICY_J2P[impl.getExpiryPolicy()]
+      self.timeout = impl.getTimeout().longValue()
+      self.dynamic = impl.getDynamic()
+      obj2dat(impl.getDynamicNodeProperties(), self.properties)
+      array2dat(impl.getCapabilities(), PN_SYMBOL, self.capabilities)
+      if self.type == PN_SOURCE:
+        self.distribution_mode = DISTRIBUTION_MODE_J2P[impl.getDistributionMode()]
+        array2dat(impl.getOutcomes(), PN_SYMBOL, self.outcomes)
+        obj2dat(impl.getFilter(), self.filter)
+
+  def encode(self):
+    impl = TERMINUS_TYPES_P2J[self.type]()
+    if impl is not None:
+      impl.setAddress(self.address)
+      impl.setDurable(DURABILITY_P2J[self.durability])
+      impl.setExpiryPolicy(EXPIRY_POLICY_P2J[self.expiry_policy])
+      impl.setTimeout(UnsignedInteger.valueOf(self.timeout))
+      impl.setDynamic(self.dynamic)
+      props = dat2obj(self.properties)
+      caps = dat2obj(self.capabilities)
+      if props: impl.setDynamicNodeProperties(props)
+      if caps:
+        impl.setCapabilities(*array(list(caps), Symbol))
+      if self.type == PN_SOURCE:
+        impl.setDistributionMode(DISTRIBUTION_MODE_P2J[self.distribution_mode])
+        outcomes = dat2obj(self.outcomes)
+        filter = dat2obj(self.filter)
+        if outcomes: impl.setOutcomes(outcomes)
+        if filter: impl.setFilter(filter)
+    return impl
+
+def pn_terminus_get_type(terminus):
+  return terminus.type
+
+def pn_terminus_set_type(terminus, type):
+  terminus.type = type
+  return 0
+
+def pn_terminus_get_address(terminus):
+  return terminus.address
+
+def pn_terminus_set_address(terminus, address):
+  terminus.address = address
+  return 0
+
+def pn_terminus_get_durability(terminus):
+  return terminus.durability
+
+def pn_terminus_get_expiry_policy(terminus):
+  return terminus.expiry_policy
+
+def pn_terminus_set_timeout(terminus, timeout):
+  terminus.timeout = timeout
+  return 0
+
+def pn_terminus_get_timeout(terminus):
+  return terminus.timeout
+
+def pn_terminus_get_distribution_mode(terminus):
+  return terminus.distribution_mode
+
+def pn_terminus_set_distribution_mode(terminus, mode):
+  terminus.distribution_mode = mode
+  return 0
+
+def pn_terminus_is_dynamic(terminus):
+  return terminus.dynamic
+
+def pn_terminus_set_dynamic(terminus, dynamic):
+  terminus.dynamic = dynamic
+  return 0
+
+def pn_terminus_properties(terminus):
+  return terminus.properties
+
+def pn_terminus_capabilities(terminus):
+  return terminus.capabilities
+
+def pn_terminus_outcomes(terminus):
+  return terminus.outcomes
+
+def pn_terminus_filter(terminus):
+  return terminus.filter
+
+def pn_terminus_copy(terminus, src):
+  terminus.copy(src)
+  return 0
+
+class pn_link_wrapper(endpoint_wrapper):
+
+  def __init__(self, impl):
+    endpoint_wrapper.__init__(self, impl)
+    self.source = pn_terminus(PN_SOURCE)
+    self.remote_source = pn_terminus(PN_UNSPECIFIED)
+    self.target = pn_terminus(PN_TARGET)
+    self.remote_target = pn_terminus(PN_UNSPECIFIED)
+
+  def on_open(self):
+    self.impl.setSource(self.source.encode())
+    self.impl.setTarget(self.target.encode())
+
+def pn_link_get_context(link):
+  return link.context
+
+def pn_link_set_context(link, ctx):
+  link.context = ctx
+
+def pn_link_source(link):
+  link.source.decode(link.impl.getSource())
+  return link.source
+
+def pn_link_remote_source(link):
+  link.remote_source.decode(link.impl.getRemoteSource())
+  return link.remote_source
+
+def pn_link_target(link):
+  link.target.decode(link.impl.getTarget())
+  return link.target
+
+def pn_link_remote_target(link):
+  link.remote_target.decode(link.impl.getRemoteTarget())
+  return link.remote_target
+
+def pn_link_condition(link):
+  return link.condition
+
+def pn_link_remote_condition(link):
+  return remote_condition(link)
+
+SND_SETTLE_MODE_P2J = {
+  PN_SND_UNSETTLED: SenderSettleMode.UNSETTLED,
+  PN_SND_SETTLED: SenderSettleMode.SETTLED,
+  PN_SND_MIXED: SenderSettleMode.MIXED,
+  None: None
+}
+
+SND_SETTLE_MODE_J2P = {
+  SenderSettleMode.UNSETTLED: PN_SND_UNSETTLED,
+  SenderSettleMode.SETTLED: PN_SND_SETTLED,
+  SenderSettleMode.MIXED: PN_SND_MIXED,
+  None: None
+}
+
+def pn_link_set_snd_settle_mode(link, mode):
+  link.impl.setSenderSettleMode(SND_SETTLE_MODE_P2J[mode])
+
+def pn_link_snd_settle_mode(link):
+  return SND_SETTLE_MODE_J2P[link.impl.getSenderSettleMode()]
+
+def pn_link_remote_snd_settle_mode(link):
+  return SND_SETTLE_MODE_J2P[link.impl.getRemoteSenderSettleMode()]
+
+RCV_SETTLE_MODE_P2J = {
+  PN_RCV_FIRST: ReceiverSettleMode.FIRST,
+  PN_RCV_SECOND: ReceiverSettleMode.SECOND,
+  None: None
+}
+
+RCV_SETTLE_MODE_J2P = {
+  ReceiverSettleMode.FIRST: PN_RCV_FIRST,
+  ReceiverSettleMode.SECOND: PN_RCV_SECOND,
+  None: None
+}
+
+def pn_link_set_rcv_settle_mode(link, mode):
+  link.impl.setReceiverSettleMode(RCV_SETTLE_MODE_P2J[mode])
+
+def pn_link_rcv_settle_mode(link):
+  return RCV_SETTLE_MODE_J2P[link.impl.getReceiverSettleMode()]
+
+def pn_link_remote_rcv_settle_mode(link):
+  return RCV_SETTLE_MODE_J2P[link.impl.getRemoteReceiverSettleMode()]
+
+def pn_link_is_sender(link):
+  return isinstance(link.impl, Sender)
+
+def pn_link_head(conn, mask):
+  local, remote = mask2set(mask)
+  return wrap(conn.impl.linkHead(local, remote), pn_link_wrapper)
+
+def pn_link_next(link, mask):
+  local, remote = mask2set(mask)
+  return wrap(link.impl.next(local, remote), pn_link_wrapper)
+
+def pn_link_session(link):
+  return wrap(link.impl.getSession(), pn_session_wrapper)
+
+def pn_link_state(link):
+  return endpoint_state(link.impl)
+
+def pn_link_name(link):
+  return link.impl.getName()
+
+def pn_link_open(link):
+  link.on_open()
+  link.impl.open()
+
+def pn_link_close(link):
+  link.on_close()
+  link.impl.close()
+
+def pn_link_flow(link, n):
+  link.impl.flow(n)
+
+def pn_link_drain(link, n):
+  link.impl.drain(n)
+
+def pn_link_drained(link):
+  return link.impl.drained()
+
+def pn_link_draining(link):
+  return link.impl.draining()
+
+def pn_link_credit(link):
+  return link.impl.getCredit()
+
+def pn_link_queued(link):
+  return link.impl.getQueued()
+
+def pn_link_unsettled(link):
+  return link.impl.getUnsettled()
+
+def pn_link_send(link, bytes):
+  return link.impl.send(array(bytes, 'b'), 0, len(bytes))
+
+def pn_link_recv(link, limit):
+  ary = zeros(limit, 'b')
+  n = link.impl.recv(ary, 0, limit)
+  if n >= 0:
+    bytes = ary[:n].tostring()
+  else:
+    bytes = None
+  return n, bytes
+
+def pn_link_advance(link):
+  return link.impl.advance()
+
+def pn_link_current(link):
+  return wrap(link.impl.current(), pn_delivery_wrapper)
+
+def pn_work_head(conn):
+  return wrap(conn.impl.getWorkHead(), pn_delivery_wrapper)
+
+def pn_work_next(dlv):
+  return wrap(dlv.impl.getWorkNext(), pn_delivery_wrapper)
+
+DELIVERY_STATES = {
+  Received: PN_RECEIVED,
+  Accepted: PN_ACCEPTED,
+  Rejected: PN_REJECTED,
+  Released: PN_RELEASED,
+  Modified: PN_MODIFIED,
+  None.__class__: 0
+  }
+
+DISPOSITIONS = {
+  PN_RECEIVED: Received,
+  PN_ACCEPTED: Accepted,
+  PN_REJECTED: Rejected,
+  PN_RELEASED: Released,
+  PN_MODIFIED: Modified,
+  0: lambda: None
+}
+
+class pn_disposition:
+
+  def __init__(self):
+    self.type = 0
+    self.data = pn_data(0)
+    self.failed = False
+    self.undeliverable = False
+    self.annotations = pn_data(0)
+    self.condition = pn_condition()
+    self.section_number = 0
+    self.section_offset = 0
+
+  def decode(self, impl):
+    self.type = DELIVERY_STATES[impl.__class__]
+
+    if self.type == PN_REJECTED:
+      self.condition.decode(impl.getError())
+    else:
+      pn_condition_clear(self.condition)
+
+    if self.type == PN_MODIFIED:
+      self.failed = impl.getDeliveryFailed()
+      self.undeliverable = impl.getUndeliverableHere()
+      obj2dat(impl.getMessageAnnotations(), self.annotations)
+    else:
+      self.failed = False
+      self.undeliverable = False
+      pn_data_clear(self.annotations)
+
+    if self.type == PN_RECEIVED:
+      self.section_number = impl.getSectionNumber().longValue()
+      self.section_offset = impl.getSectionOffset().longValue()
+    else:
+      self.section_number = 0
+      self.section_offset = 0
+
+    self.data.clear()
+    if impl:
+      # XXX
+      #self.data.putObject(impl)
+      pass
+    self.data.rewind()
+
+  def encode(self):
+    if self.type not in DISPOSITIONS:
+      raise Skipped()
+    impl = DISPOSITIONS[self.type]()
+
+    if impl is None:
+      return impl
+
+    if self.type == PN_REJECTED:
+      impl.setError(self.condition.encode())
+
+    if self.type == PN_MODIFIED:
+      impl.setDeliveryFailed(self.failed)
+      impl.setUndeliverableHere(self.undeliverable)
+      ann = dat2obj(self.annotations)
+      if ann: impl.setMessageAnnotations(ann)
+
+    if self.type == PN_RECEIVED:
+      if self.section_number:
+        impl.setSectionNumber(UnsignedInteger.valueOf(self.section_number))
+      if self.section_offset:
+        impl.setSectionOffset(UnsignedLong.valueOf(self.section_offset))
+
+    return impl
+
+def pn_disposition_type(dsp):
+  return dsp.type
+
+def pn_disposition_is_failed(dsp):
+  return dsp.failed
+
+def pn_disposition_set_failed(dsp, failed):
+  dsp.failed = failed
+
+def pn_disposition_is_undeliverable(dsp):
+  return dsp.undeliverable
+
+def pn_disposition_set_undeliverable(dsp, undeliverable):
+  dsp.undeliverable = undeliverable
+
+def pn_disposition_data(dsp):
+  return dsp.data
+
+def pn_disposition_annotations(dsp):
+  return dsp.annotations
+
+def pn_disposition_condition(dsp):
+  return dsp.condition
+
+def pn_disposition_get_section_number(dsp):
+  return dsp.section_number
+
+def pn_disposition_set_section_number(dsp, number):
+  dsp.section_number = number
+
+def pn_disposition_get_section_offset(dsp):
+  return dsp.section_offset
+
+def pn_disposition_set_section_offset(dsp, offset):
+  dsp.section_offset = offset
+
+class pn_delivery_wrapper:
+
+  def __init__(self, impl):
+    self.impl = impl
+    self.context = None
+    self.local = pn_disposition()
+    self.remote = pn_disposition()
+
+def pn_delivery(link, tag):
+  return wrap(link.impl.delivery(array(tag, 'b')), pn_delivery_wrapper)
+
+def pn_delivery_tag(dlv):
+  return dlv.impl.getTag().tostring()
+
+def pn_delivery_get_context(dlv):
+  return dlv.context
+
+def pn_delivery_set_context(dlv, ctx):
+  dlv.context = ctx
+
+def pn_delivery_pending(dlv):
+  return dlv.impl.pending()
+
+def pn_delivery_writable(dlv):
+  return dlv.impl.isWritable()
+
+def pn_delivery_readable(dlv):
+  return dlv.impl.isReadable()
+
+def pn_delivery_updated(dlv):
+  return dlv.impl.isUpdated()
+
+def pn_delivery_settled(dlv):
+  return dlv.impl.remotelySettled()
+
+def pn_delivery_local(dlv):
+  dlv.local.decode(dlv.impl.getLocalState())
+  return dlv.local
+
+def pn_delivery_local_state(dlv):
+  dlv.local.decode(dlv.impl.getLocalState())
+  return dlv.local.type
+
+def pn_delivery_remote(dlv):
+  dlv.remote.decode(dlv.impl.getRemoteState())
+  return dlv.remote
+
+def pn_delivery_remote_state(dlv):
+  dlv.remote.decode(dlv.impl.getRemoteState())
+  return dlv.remote.type
+
+def pn_delivery_update(dlv, state):
+  dlv.local.type = state
+  dlv.impl.disposition(dlv.local.encode())
+
+def pn_delivery_settle(dlv):
+  dlv.impl.settle()
+
+class pn_transport_wrapper:
+
+  def __init__(self, impl):
+    self.impl = impl
+    self.error = pn_error(0, None)
+
+def pn_transport():
+  return wrap(Proton.transport(), pn_transport_wrapper)
+
+def pn_transport_get_max_frame(trans):
+  return trans.impl.getMaxFrameSize()
+
+def pn_transport_set_max_frame(trans, value):
+  trans.impl.setMaxFrameSize(value)
+
+def pn_transport_get_remote_max_frame(trans):
+  return trans.impl.getRemoteMaxFrameSize()
+
+def pn_transport_set_idle_timeout(trans, value):
+  raise Skipped()
+
+def pn_transport_bind(trans, conn):
+  trans.impl.bind(conn.impl)
+  return 0
+
+def pn_transport_trace(trans, n):
+  # XXX
+  pass
+
+def pn_transport_pending(trans):
+  try:
+    return trans.impl.pending()
+  except TransportException, e:
+    return trans.error.set(PN_ERR, str(e))
+
+def pn_transport_peek(trans, size):
+  bb = trans.impl.head()
+  size = min(bb.remaining(), size)
+  ba = zeros(size, 'b')
+  bb.get(ba)
+  return 0, ba.tostring()
+
+def pn_transport_pop(trans, size):
+  trans.impl.pop(size)
+
+def pn_transport_capacity(trans):
+  return trans.impl.capacity()
+
+def pn_transport_push(trans, input):
+  cap = pn_transport_capacity(trans)
+  if cap < 0:
+    return cap
+  elif len(input) > cap:
+    return PN_OVERFLOW
+  else:
+    bb = trans.impl.tail()
+    bb.put(array(input, 'b'))
+    try:
+      trans.impl.process()
+      return 0
+    except TransportException, e:
+      trans.error = pn_error(PN_ERR, str(e))
+      return PN_ERR
+
+def pn_transport_close_tail(trans):
+  try:
+    trans.impl.close_tail()
+    return 0
+  except TransportException, e:
+    trans.error = pn_error(PN_ERR, str(e))
+    return PN_ERR
+
+def pn_transport_error(trans):
+  return trans.error

Added: qpid/proton/trunk/proton-j/src/main/resources/cerror.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/resources/cerror.py?rev=1565256&view=auto
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/resources/cerror.py (added)
+++ qpid/proton/trunk/proton-j/src/main/resources/cerror.py Thu Feb  6 13:51:20 2014
@@ -0,0 +1,49 @@
+#
+# 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/error.h
+PN_EOS = -1
+PN_ERR = -2
+PN_OVERFLOW = -3
+PN_UNDERFLOW = -4
+PN_STATE_ERR = -5
+PN_ARG_ERR = -6
+PN_TIMEOUT =-7
+PN_INTR = -8
+PN_INPROGRESS =-9
+
+class pn_error:
+
+  def __init__(self, code, text):
+    self.code = code
+    self.text = text
+
+  def set(self, code, text):
+    self.code = code
+    self.text = text
+    return self.code
+
+def pn_error_code(err):
+  return err.code
+
+def pn_error_text(err):
+  return err.text
+
+class Skipped(Exception):
+  skipped = True

Added: qpid/proton/trunk/proton-j/src/main/resources/cmessage.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/resources/cmessage.py?rev=1565256&view=auto
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/resources/cmessage.py (added)
+++ qpid/proton/trunk/proton-j/src/main/resources/cmessage.py Thu Feb  6 13:51:20 2014
@@ -0,0 +1,274 @@
+#
+# 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 org.apache.qpid.proton import Proton
+from org.apache.qpid.proton.amqp.messaging import AmqpValue, AmqpSequence, \
+  Data as DataSection
+from org.apache.qpid.proton.message import MessageFormat
+
+from ccodec import *
+from cerror import *
+
+# from proton/message.h
+PN_DATA = 0
+PN_TEXT = 1
+PN_AMQP = 2
+PN_JSON = 3
+
+PN_DEFAULT_PRIORITY = 4
+
+class pn_message_wrapper:
+
+  def __init__(self):
+    self.inferred = False
+    self.impl = Proton.message()
+    self.id = pn_data(0)
+    self.correlation_id = pn_data(0)
+    self.instructions = pn_data(0)
+    self.annotations = pn_data(0)
+    self.properties = pn_data(0)
+    self.body = pn_data(0)
+
+  def decode(self, impl):
+    self.impl = impl
+    self.post_decode()
+
+  def post_decode(self):
+    obj2dat(self.impl.getMessageId(), self.id)
+    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)
+    bod = self.impl.getBody()
+    if bod is not None: bod = bod.getValue()
+    obj2dat(bod, self.body)
+
+  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))
+    bod = dat2obj(self.body)
+    if self.inferred:
+      if isinstance(bod, bytes):
+        bod = DataSection(Binary(array(bod, 'b')))
+      elif isinstance(bod, list):
+        bod = AmqpSequence(bod)
+      else:
+        bod = AmqpValue(bod)
+    else:
+      bod = AmqpValue(bod)
+    self.impl.setBody(bod)
+
+def pn_message():
+  return pn_message_wrapper()
+
+def pn_message_id(msg):
+  return msg.id
+
+def pn_message_correlation_id(msg):
+  return msg.correlation_id
+
+def pn_message_get_address(msg):
+  return msg.impl.getAddress()
+
+def pn_message_set_address(msg, address):
+  msg.impl.setAddress(address)
+  return 0
+
+def pn_message_get_reply_to(msg):
+  return msg.impl.getReplyTo()
+
+def pn_message_set_reply_to(msg, address):
+  msg.impl.setReplyTo(address)
+  return 0
+
+def pn_message_get_reply_to_group_id(msg):
+  return msg.impl.getReplyToGroupId()
+
+def pn_message_set_reply_to_group_id(msg, id):
+  msg.impl.setReplyToGroupId(id)
+  return 0
+
+def pn_message_get_group_sequence(msg):
+  return msg.impl.getGroupSequence()
+
+def pn_message_set_group_sequence(msg, seq):
+  msg.impl.setGroupSequence(seq)
+  return 0
+
+def pn_message_get_group_id(msg):
+  return msg.impl.getGroupId()
+
+def pn_message_set_group_id(msg, id):
+  msg.impl.setGroupId(id)
+  return 0
+
+def pn_message_is_first_acquirer(msg):
+  return msg.impl.isFirstAcquirer()
+
+def pn_message_set_first_acquirer(msg, b):
+  msg.impl.setFirstAcquirer(b)
+  return 0
+
+def pn_message_is_durable(msg):
+  return msg.impl.isDurable()
+
+def pn_message_set_durable(msg, b):
+  msg.impl.setDurable(b)
+  return 0
+
+def pn_message_get_delivery_count(msg):
+  return msg.impl.getDeliveryCount()
+
+def pn_message_set_delivery_count(msg, c):
+  msg.impl.setDeliveryCount(c)
+  return 0
+
+def pn_message_get_creation_time(msg):
+  return msg.impl.getCreationTime()
+
+def pn_message_set_creation_time(msg, t):
+  msg.impl.setCreationTime(t)
+  return 0
+
+def pn_message_get_expiry_time(msg):
+  return msg.impl.getExpiryTime()
+
+def pn_message_set_expiry_time(msg, t):
+  msg.impl.setExpiryTime(t)
+  return 0
+
+def pn_message_get_content_type(msg):
+  return msg.impl.getContentType()
+
+def pn_message_set_content_type(msg, ct):
+  msg.impl.setContentType(ct)
+  return 0
+
+def pn_message_get_content_encoding(msg):
+  return msg.impl.getContentEncoding()
+
+def pn_message_set_content_encoding(msg, ct):
+  msg.impl.setContentEncoding(ct)
+  return 0
+
+def pn_message_get_subject(msg):
+  return msg.impl.getSubject()
+
+def pn_message_set_subject(msg, value):
+  msg.impl.setSubject(value)
+  return 0
+
+def pn_message_get_priority(msg):
+  return msg.impl.getPriority()
+
+def pn_message_set_priority(msg, p):
+  msg.impl.setPriority(p)
+  return 0
+
+def pn_message_get_ttl(msg):
+  return msg.impl.getTtl()
+
+def pn_message_set_ttl(msg, ttl):
+  msg.impl.setTtl(ttl)
+  return 0
+
+def pn_message_get_user_id(msg):
+  uid = msg.impl.getUserId()
+  if uid is None:
+    return ""
+  else:
+    return uid.tostring()
+
+def pn_message_set_user_id(msg, uid):
+  msg.impl.setUserId(uid)
+  return 0
+
+def pn_message_instructions(msg):
+  return msg.instructions
+
+def pn_message_annotations(msg):
+  return msg.annotations
+
+def pn_message_properties(msg):
+  return msg.properties
+
+def pn_message_body(msg):
+  return msg.body
+
+def pn_message_decode(msg, data, n):
+  n = msg.impl.decode(array(data, 'b'), 0, len(data))
+  msg.post_decode()
+  return n
+
+from java.nio import BufferOverflowException
+
+def pn_message_encode(msg, size):
+  msg.pre_encode()
+  ba = zeros(size, 'b')
+  # XXX: shouldn't have to use the try/catch
+  try:
+    n = msg.impl.encode(ba, 0, size)
+    if n >= 0:
+      return n, ba[:n].tostring()
+    else:
+      return n
+  except BufferOverflowException, e:
+    return PN_OVERFLOW, None
+
+
+MESSAGE_FORMAT_J2P = {
+  MessageFormat.DATA: PN_DATA,
+  MessageFormat.TEXT: PN_TEXT,
+  MessageFormat.AMQP: PN_AMQP,
+  MessageFormat.JSON: PN_JSON
+}
+
+MESSAGE_FORMAT_P2J = {
+  PN_DATA: MessageFormat.DATA,
+  PN_TEXT: MessageFormat.TEXT,
+  PN_AMQP: MessageFormat.AMQP,
+  PN_JSON: MessageFormat.JSON
+}
+
+
+def pn_message_set_format(msg, format):
+  msg.impl.setMessageFormat(MESSAGE_FORMAT_P2J[format])
+  return 0
+
+def pn_message_clear(msg):
+  msg.impl.clear()
+
+def pn_message_load(msg, data):
+  msg.impl.load(data)
+  return 0
+
+from array import array as array_type
+
+def pn_message_save(msg, size):
+  data = msg.impl.save()
+  if data is None:
+    return 0, ""
+  elif isinstance(data, array_type):
+    return 0, data.tostring()
+  else:
+    return 0, data

Added: qpid/proton/trunk/proton-j/src/main/resources/cmessenger.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/resources/cmessenger.py?rev=1565256&view=auto
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/resources/cmessenger.py (added)
+++ qpid/proton/trunk/proton-j/src/main/resources/cmessenger.py Thu Feb  6 13:51:20 2014
@@ -0,0 +1,201 @@
+#
+# 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 org.apache.qpid.proton import Proton
+from org.apache.qpid.proton.messenger import Messenger, Status
+from org.apache.qpid.proton import InterruptException, TimeoutException
+
+from cerror import *
+
+# from proton/messenger.h
+PN_STATUS_UNKNOWN = 0
+PN_STATUS_PENDING = 1
+PN_STATUS_ACCEPTED = 2
+PN_STATUS_REJECTED = 3
+PN_STATUS_RELEASED = 4
+PN_STATUS_MODIFIED = 5
+PN_STATUS_ABORTED = 6
+PN_STATUS_SETTLED = 7
+
+PN_CUMULATIVE = 1
+
+class pn_messenger_wrapper:
+
+  def __init__(self, impl):
+    self.impl = impl
+    self.error = pn_error(0, None)
+
+def pn_messenger(name):
+  return pn_messenger_wrapper(Proton.messenger(name));
+
+def pn_messenger_error(m):
+  return m.error
+
+def pn_messenger_set_timeout(m, t):
+  m.impl.setTimeout(t)
+  return 0
+
+def pn_messenger_set_blocking(m, b):
+  m.impl.setBlocking(b)
+  return 0
+
+def pn_messenger_set_certificate(m, c):
+  raise Skipped()
+
+def pn_messenger_set_incoming_window(m, w):
+  m.impl.setIncomingWindow(w)
+  return 0
+
+def pn_messenger_set_outgoing_window(m, w):
+  m.impl.setOutgoingWindow(w)
+  return 0
+
+def pn_messenger_start(m):
+  m.impl.start()
+  return 0
+
+# XXX: ???
+def pn_messenger_work(m, t):
+  try:
+    if m.impl.work(t):
+      return 1
+    else:
+      return PN_TIMEOUT
+  except InterruptException, e:
+    return PN_INTR
+
+class pn_subscription:
+
+  def __init__(self):
+    pass
+
+def pn_messenger_subscribe(m, source):
+  m.impl.subscribe(source)
+  return pn_subscription()
+
+def pn_messenger_route(m, pattern, address):
+  m.impl.route(pattern, address)
+  return 0
+
+def pn_messenger_rewrite(m, pattern, address):
+  m.impl.rewrite(pattern, address)
+  return 0
+
+def pn_messenger_interrupt(m):
+  m.impl.interrupt()
+  return 0
+
+def pn_messenger_buffered(m, t):
+  raise Skipped()
+
+def pn_messenger_stop(m):
+  m.impl.stop()
+  return 0
+
+def pn_messenger_stopped(m):
+  return m.impl.stopped()
+
+def pn_messenger_put(m, msg):
+  msg.pre_encode()
+  m.impl.put(msg.impl)
+  return 0
+
+def pn_messenger_outgoing_tracker(m):
+  return m.impl.outgoingTracker()
+
+def pn_messenger_send(m, n):
+  try:
+    m.impl.send(n)
+    return 0
+  except InterruptException, e:
+    return PN_INTR
+  except TimeoutException, e:
+    return PN_TIMEOUT
+
+def pn_messenger_recv(m, n):
+  try:
+    m.impl.recv(n)
+    return 0
+  except InterruptException, e:
+    return PN_INTR
+  except TimeoutException, e:
+    return PN_TIMEOUT
+
+def pn_messenger_receiving(m):
+  return m.impl.receiving()
+
+def pn_messenger_incoming(m):
+  return m.impl.incoming()
+
+def pn_messenger_outgoing(m):
+  return m.impl.outgoing()
+
+def pn_messenger_get(m, msg):
+  mimpl = m.impl.get()
+  if msg:
+    msg.decode(mimpl)
+  return 0
+
+def pn_messenger_incoming_tracker(m):
+  return m.impl.incomingTracker()
+
+def pn_messenger_accept(m, tracker, flags):
+  if flags:
+    m.impl.accept(tracker, Messenger.CUMULATIVE)
+  else:
+    m.impl.accept(tracker, 0)
+  return 0
+
+def pn_messenger_reject(m, tracker, flags):
+  if flags:
+    m.impl.reject(tracker, Messenger.CUMULATIVE)
+  else:
+    m.impl.reject(tracker, 0)
+  return 0
+
+def pn_messenger_settle(m, tracker, flags):
+  if flags:
+    m.impl.settle(tracker, Messenger.CUMULATIVE)
+  else:
+    m.impl.settle(tracker, 0)
+  return 0
+
+STATUS_P2J = {
+  PN_STATUS_UNKNOWN: Status.UNKNOWN,
+  PN_STATUS_PENDING: Status.PENDING,
+  PN_STATUS_ACCEPTED: Status.ACCEPTED,
+  PN_STATUS_REJECTED: Status.REJECTED,
+  PN_STATUS_RELEASED: Status.RELEASED,
+  PN_STATUS_MODIFIED: Status.MODIFIED,
+  PN_STATUS_ABORTED: Status.ABORTED,
+  PN_STATUS_SETTLED: Status.SETTLED
+}
+
+STATUS_J2P = {
+  Status.UNKNOWN: PN_STATUS_UNKNOWN,
+  Status.PENDING: PN_STATUS_PENDING,
+  Status.ACCEPTED: PN_STATUS_ACCEPTED,
+  Status.REJECTED: PN_STATUS_REJECTED,
+  Status.RELEASED: PN_STATUS_RELEASED,
+  Status.MODIFIED: PN_STATUS_MODIFIED,
+  Status.ABORTED: PN_STATUS_ABORTED,
+  Status.SETTLED: PN_STATUS_SETTLED
+}
+
+def pn_messenger_status(m, tracker):
+  return STATUS_J2P[m.impl.getStatus(tracker)]

Added: qpid/proton/trunk/proton-j/src/main/resources/cproton.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/resources/cproton.py?rev=1565256&view=auto
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/resources/cproton.py (added)
+++ qpid/proton/trunk/proton-j/src/main/resources/cproton.py Thu Feb  6 13:51:20 2014
@@ -0,0 +1,33 @@
+#
+# 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.
+#
+
+"""
+The cproton module defines a java implementation of the C interface as
+exposed to python via swig. This allows tests defined in python to run
+against both the C and Java protocol implementations.
+"""
+
+from cerror import *
+from ccodec import *
+from cengine import *
+from csasl import *
+from cssl import *
+from cdriver import *
+from cmessenger import *
+from cmessage import *

Added: qpid/proton/trunk/proton-j/src/main/resources/csasl.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/resources/csasl.py?rev=1565256&view=auto
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/resources/csasl.py (added)
+++ qpid/proton/trunk/proton-j/src/main/resources/csasl.py Thu Feb  6 13:51:20 2014
@@ -0,0 +1,101 @@
+#
+# 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 org.apache.qpid.proton.engine import Sasl
+
+from jarray import array, zeros
+
+from cerror import *
+
+# from proton/sasl.h
+PN_SASL_NONE=-1
+PN_SASL_OK=0
+PN_SASL_AUTH=1
+PN_SASL_SYS=2
+PN_SASL_PERM=3
+PN_SASL_TEMP=4
+
+PN_SASL_CONF = 0
+PN_SASL_IDLE = 1
+PN_SASL_STEP = 2
+PN_SASL_PASS = 3
+PN_SASL_FAIL = 4
+
+def pn_sasl(tp):
+  return tp.impl.sasl()
+
+SASL_STATES = {
+  Sasl.SaslState.PN_SASL_CONF: PN_SASL_CONF,
+  Sasl.SaslState.PN_SASL_IDLE: PN_SASL_IDLE,
+  Sasl.SaslState.PN_SASL_STEP: PN_SASL_STEP,
+  Sasl.SaslState.PN_SASL_PASS: PN_SASL_PASS,
+  Sasl.SaslState.PN_SASL_FAIL: PN_SASL_FAIL
+  }
+
+SASL_OUTCOMES_P2J = {
+  PN_SASL_NONE: Sasl.PN_SASL_NONE,
+  PN_SASL_OK: Sasl.PN_SASL_OK,
+  PN_SASL_AUTH: Sasl.PN_SASL_AUTH,
+  PN_SASL_SYS: Sasl.PN_SASL_SYS,
+  PN_SASL_PERM: Sasl.PN_SASL_PERM,
+  PN_SASL_TEMP: Sasl.PN_SASL_TEMP
+}
+
+SASL_OUTCOMES_J2P = {
+  Sasl.PN_SASL_NONE: PN_SASL_NONE,
+  Sasl.PN_SASL_OK: PN_SASL_OK,
+  Sasl.PN_SASL_AUTH: PN_SASL_AUTH,
+  Sasl.PN_SASL_SYS: PN_SASL_SYS,
+  Sasl.PN_SASL_PERM: PN_SASL_PERM,
+  Sasl.PN_SASL_TEMP: PN_SASL_TEMP
+}
+
+def pn_sasl_state(sasl):
+  return SASL_STATES[sasl.getState()]
+
+def pn_sasl_mechanisms(sasl, mechs):
+  sasl.setMechanisms(*mechs.split())
+
+def pn_sasl_client(sasl):
+  sasl.client()
+
+def pn_sasl_server(sasl):
+  sasl.server()
+
+def pn_sasl_done(sasl, outcome):
+  sasl.done(SASL_OUTCOMES_P2J[outcome])
+
+def pn_sasl_outcome(sasl):
+  return SASL_OUTCOMES_J2P[sasl.getOutcome()]
+
+def pn_sasl_plain(sasl, user, password):
+  sasl.plain(user, password)
+
+def pn_sasl_recv(sasl, size):
+  if size < sasl.pending():
+    return PN_OVERFLOW, None
+  else:
+    ba = zeros(size, 'b')
+    n = sasl.recv(ba, 0, size)
+    if n >= 0:
+      return n, ba[:n].tostring()
+    else:
+      return n, None
+
+def pn_sasl_send(sasl, data, size):
+  return sasl.send(array(data, 'b'), 0, size)

Added: qpid/proton/trunk/proton-j/src/main/resources/cssl.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/resources/cssl.py?rev=1565256&view=auto
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/resources/cssl.py (added)
+++ qpid/proton/trunk/proton-j/src/main/resources/cssl.py Thu Feb  6 13:51:20 2014
@@ -0,0 +1,111 @@
+#
+# 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 org.apache.qpid.proton import Proton
+from org.apache.qpid.proton.engine import SslDomain
+
+from cerror import *
+
+# from proton/ssl.h
+PN_SSL_MODE_CLIENT = 1
+PN_SSL_MODE_SERVER = 2
+
+PN_SSL_RESUME_UNKNOWN = 0
+PN_SSL_RESUME_NEW = 1
+PN_SSL_RESUME_REUSED = 2
+
+PN_SSL_VERIFY_NULL=0
+PN_SSL_VERIFY_PEER=1
+PN_SSL_ANONYMOUS_PEER=2
+PN_SSL_VERIFY_PEER_NAME=3
+
+PN_SSL_MODE_J2P = {
+  SslDomain.Mode.CLIENT: PN_SSL_MODE_CLIENT,
+  SslDomain.Mode.SERVER: PN_SSL_MODE_SERVER
+}
+
+PN_SSL_MODE_P2J = {
+  PN_SSL_MODE_CLIENT: SslDomain.Mode.CLIENT,
+  PN_SSL_MODE_SERVER: SslDomain.Mode.SERVER
+}
+
+def pn_ssl_domain(mode):
+  domain = Proton.sslDomain()
+  domain.init(PN_SSL_MODE_P2J[mode])
+  return domain
+
+def pn_ssl_domain_set_credentials(domain, certificate_file, private_key_file, password):
+  domain.setCredentials(certificate_file, private_key_file, password)
+  return 0
+
+def pn_ssl_domain_set_trusted_ca_db(domain, trusted_db):
+  domain.setTrustedCaDb(trusted_db)
+  return 0
+
+PN_VERIFY_MODE_J2P = {
+  None: PN_SSL_VERIFY_NULL,
+  SslDomain.VerifyMode.VERIFY_PEER: PN_SSL_VERIFY_PEER,
+  SslDomain.VerifyMode.VERIFY_PEER_NAME: PN_SSL_VERIFY_PEER_NAME,
+  SslDomain.VerifyMode.ANONYMOUS_PEER: PN_SSL_ANONYMOUS_PEER
+}
+
+PN_VERIFY_MODE_P2J = {
+  PN_SSL_VERIFY_NULL: None,
+  PN_SSL_VERIFY_PEER: SslDomain.VerifyMode.VERIFY_PEER,
+  PN_SSL_VERIFY_PEER_NAME: SslDomain.VerifyMode.VERIFY_PEER_NAME,
+  PN_SSL_ANONYMOUS_PEER: SslDomain.VerifyMode.ANONYMOUS_PEER
+}
+
+def pn_ssl_domain_set_peer_authentication(domain, mode, trusted=None):
+  domain.setPeerAuthentication(PN_VERIFY_MODE_P2J[mode])
+  if trusted:
+    domain.setTrustedCaDb(trusted)
+  return 0
+
+def pn_ssl_domain_allow_unsecured_client(domain):
+  domain.allowUnsecuredClient(True)
+  return 0
+
+class pn_ssl_wrapper:
+
+  def __init__(self, transport):
+    self.impl = None
+    self.transport = transport
+
+def pn_ssl(transport):
+  if getattr(transport, "ssl", None) is not None:
+    return transport.ssl
+  else:
+    transport.ssl = pn_ssl_wrapper(transport)
+    return transport.ssl
+
+def pn_ssl_init(ssl, domain, session_id):
+  # XXX: session_id
+  ssl.impl = ssl.transport.impl.ssl(domain, None)
+
+def pn_ssl_resume_status(ssl):
+  raise Skipped()
+
+def pn_ssl_get_cipher_name(ssl, size):
+  name = ssl.impl.getCipherName()
+  return (bool(name), name)
+
+def pn_ssl_get_protocol_name(ssl, size):
+  name = ssl.impl.getProtocolName()
+  return (bool(name), name)
+

Modified: qpid/proton/trunk/tests/java/org/apache/qpid/proton/JythonTest.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/java/org/apache/qpid/proton/JythonTest.java?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/tests/java/org/apache/qpid/proton/JythonTest.java (original)
+++ qpid/proton/trunk/tests/java/org/apache/qpid/proton/JythonTest.java Thu Feb  6 13:51:20 2014
@@ -45,6 +45,7 @@ public class JythonTest
     private static final Logger LOGGER = Logger.getLogger(JythonTest.class.getName());
 
     /* System properties expected to be defined in test/pom.xml */
+    private static final String PROTON_JYTHON_BINDING = "protonJythonBinding";
     private static final String PROTON_JYTHON_TEST_ROOT = "protonJythonTestRoot";
     private static final String PROTON_JYTHON_TEST_SCRIPT = "protonJythonTestScript";
     private static final String PROTON_JYTHON_TESTS_XML_OUTPUT_DIRECTORY = "protonJythonTestXmlOutputDirectory";
@@ -65,11 +66,13 @@ public class JythonTest
     public void test() throws Exception
     {
         String testScript = getJythonTestScript();
+        String binding = getJythonBinding();
         String testRoot = getJythonTestRoot();
         String xmlReportFile = getOptionalXmlReportFilename();
         String ignoreFile = getOptionalIgnoreFile();
 
         PythonInterpreter interp = createInterpreterWithArgs(xmlReportFile, ignoreFile);
+        interp.getSystemState().path.insert(0, new PyString(binding));
         interp.getSystemState().path.insert(0, new PyString(testRoot));
 
         LOGGER.info("About to call Jython test script: '" + testScript
@@ -166,6 +169,17 @@ public class JythonTest
         return testScript.getAbsolutePath();
     }
 
+    private String getJythonBinding() throws FileNotFoundException
+    {
+        String str = getNonNullSystemProperty(PROTON_JYTHON_BINDING, "System property '%s' must provide the location of the python test root");
+        File file = new File(str);
+        if (!file.isDirectory())
+        {
+            throw new FileNotFoundException("Binding location '" + file + "' should be a directory.");
+        }
+        return file.getAbsolutePath();
+    }
+
 
     private String getJythonTestRoot() throws FileNotFoundException
     {

Modified: qpid/proton/trunk/tests/pom.xml
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/pom.xml?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/tests/pom.xml (original)
+++ qpid/proton/trunk/tests/pom.xml Thu Feb  6 13:51:20 2014
@@ -68,6 +68,7 @@ directory &lt;basedir&gt;/build/proton-c
           <systemPropertyVariables>
             <protonJythonIgnoreFile>${basedir}/java/pythonTests.ignore</protonJythonIgnoreFile>
             <protonJythonTestRoot>${basedir}/python</protonJythonTestRoot>
+            <protonJythonBinding>${basedir}/../proton-c/bindings/python</protonJythonBinding>
             <protonJythonTestScript>${basedir}/python/proton-test</protonJythonTestScript>
             <protonJythonTestXmlOutputDirectory>${testReportOutputDirectory}</protonJythonTestXmlOutputDirectory>
             <java.util.logging.config.file>${project.build.outputDirectory}/logging.properties</java.util.logging.config.file>

Modified: qpid/proton/trunk/tests/python/proton_tests/common.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/python/proton_tests/common.py?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/tests/python/proton_tests/common.py (original)
+++ qpid/proton/trunk/tests/python/proton_tests/common.py Thu Feb  6 13:51:20 2014
@@ -336,8 +336,6 @@ class MessengerApp(object):
 
     def start(self, verbose=False):
         """ Begin executing the test """
-        if sys.platform.startswith("java"):
-            raise Skipped("Skipping soak tests - not supported under Jython")
         cmd = self.cmdline()
         self._verbose = verbose
         if self._verbose:

Modified: qpid/proton/trunk/tests/python/proton_tests/engine.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/python/proton_tests/engine.py?rev=1565256&r1=1565255&r2=1565256&view=diff
==============================================================================
--- qpid/proton/trunk/tests/python/proton_tests/engine.py (original)
+++ qpid/proton/trunk/tests/python/proton_tests/engine.py Thu Feb  6 13:51:20 2014
@@ -555,7 +555,7 @@ class TerminusConfig:
       for c in self.capabilities:
         terminus.capabilities.put_symbol(c)
     if self.filter is not None:
-      terminus.filter.put_list()
+      terminus.filter.put_map()
       terminus.filter.enter()
       for (t, v) in self.filter:
         setter = getattr(terminus.filter, "put_%s" % t)
@@ -615,7 +615,7 @@ class TransferTest(Test):
     assert d.readable
 
     bytes = self.rcv.recv(1024)
-    assert bytes == msg
+    assert bytes == msg, (bytes, msg)
 
     bytes = self.rcv.recv(1024)
     assert bytes == ""
@@ -1634,11 +1634,16 @@ class PipelineTest(Test):
 
     assert rcv.queued == 0, rcv.queued
 
+import sys
+from common import Skipped
+
 class ServerTest(Test):
 
   def testKeepalive(self):
     """ Verify that idle frames are sent to keep a Connection alive
     """
+    if "java" in sys.platform:
+      raise Skipped()
     idle_timeout_secs = self.delay
     self.server = common.TestServerDrain()
     self.server.start()
@@ -1684,6 +1689,8 @@ class ServerTest(Test):
     """ Verify that a Connection is terminated properly when Idle frames do not
     arrive in a timely manner.
     """
+    if "java" in sys.platform:
+      raise Skipped()
     idle_timeout_secs = self.delay
     self.server = common.TestServerDrain(idle_timeout=idle_timeout_secs)
     self.server.start()



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