Re: Data interface in Proton-J

2013-06-18 Thread Rob Godfrey
On 18 June 2013 23:45, Leon Mlakar l...@digiverse.si wrote:


 Fetched them, thank you. It does help indeed


Great


 , At the first glance it looks like more than just 30% done.


I may have done a bit more work on it over the weekend :)

I didn't really want to check in something that was really no more than a
couple of hours of half-thought messing around (so now you have *several*
hours of half thought messing around checked in for you to look at :) ).


 I even manged to integrate the stuff into my project and get the DataImpl
 instance through the factory with no problems.


Excellent.


 Will take a closer look in the next days, though. All this proton stuff is
 still pretty much new to me, so I might have some basic questions (like
 what exactly should narrow and widen do :-) later on.


An excellent question... the fact that I didn't know was possibly one
reason why I didn't implement them (I think Rafi did tell me once what they
are supposed to be for)...


 But let me first got through the sources and dig through whatever archives
 I manage to find.


Great - just ping me if you have any problems.

Cheers,
Rob



 Cheers,

 Leon



 On 6/18/13 10:30 AM, Rob Godfrey wrote:

 OK - I've just committed [1] the initial pass at the Data implementation.

 Not yet implemented are the copy, append, narrow and widen operations...
 or
 much in the way of checking errors are handled the same way as the C, etc.

 If find issues and/or want to contribute patches you can attach
 comments/patch files to the JIRA [2].

 Hope this helps,
 Rob

 [1] https://svn.apache.org/**r1494067 https://svn.apache.org/r1494067
 [2] 
 https://issues.apache.org/**jira/browse/PROTON-339https://issues.apache.org/jira/browse/PROTON-339


 On 14 June 2013 16:13, Rob Godfrey rob.j.godf...@gmail.com wrote:

  T

 [...]



Data interface in Proton-J

2013-06-14 Thread Leon Mlakar

Hello everybody,

I've been following this list for quite a while but so far had no reason
to take part in discussions.

However, these days I'm porting some C++ code that is using Proton-C to
talk to peers to Java. The C++ code uses pn_data_put_* functions from
codec module to compose the body of the message and pn_data_get_*
counterparts to decompose it at the other end.

In Java, the Proton-Api's Data interface (org.apache.qpid.proton.codec)
seems to provide the same functionality. But as far as I could see no
class is actually implementing the interface, and the
DataFactoryImpl.createData(long) is only throwing the exception which
indicates that this operation is not supported. I've seen this in both
0.4 package and on the Git's trunk.

Is this a part of functionality that is merely not implemented yet, or
something that is not planned to get implemented at all? In either case,
what would be the alternate methods to put together the message body in
a way that could be understood by C++ code? And vice versa?

The use of Java bindings to Proton-C is not the preferred way to go.

Thanks and best regards,

Leon



Re: Data interface in Proton-J

2013-06-14 Thread Rob Godfrey
That would be great!

Let me have a dig around over the weekend and see if I can find it (I have
*lots* of machines where it might be on :-( I should probably be more
organised).


Cheers,
Rob


On 14 June 2013 16:01, Leon Mlakar l...@digiverse.si wrote:


 Hi Rob,

 thanks for reply. It got me thinking ... since Data interface is not a
 history and will be around, to do things The Right Way I'll have to
 implement parts of it myself anyway. So I might as well take a shot in
 adding missing 70%, or at least some part of them, on top of your 30% :-).
 Is there any chance for you to you dig up what you've got so far and get it
 over to me somehow?

 Best regards,

 Leon

  Hi Leon,

 As you have noticed a pure Java implementation of the Data interface is
 not
 yet available (I think I have a 30% complete implementation sitting
 somewhere on an old laptop, but I never got round to finishing it).  It
 will get implemented eventually, but it's not currently being worked on as
 far as I know.

 The Java implementation was built upon a codec which serializes objects in
 Java form into AMQP binary data. On the Java implementation of the Message
 class there is a method setBody(Section body).  So, in Java, to send an
 amqp value message containing a map, you could do something like:

 import org.apache.qpid.proton.amqp.**messaging.AmqpValue;
 import org.apache.qpid.proton.amqp.**Symbol;

 ...

 Map map = new LinkedHashMap();
 map.put(symbol, Symbol.valueOf(a symbol));
 map.put(int, 21);
 ...
 AmqpValue body = new AmqpBody(map);

 message.setBody(body);

 Hope this helps,
 Rob


 On 14 June 2013 15:22, Leon Mlakar l...@digiverse.si wrote:

  Hello everybody,

 I've been following this list for quite a while but so far had no reason
 to take part in discussions.

 However, these days I'm porting some C++ code that is using Proton-C to
 talk to peers to Java. The C++ code uses pn_data_put_* functions from
 codec module to compose the body of the message and pn_data_get_*
 counterparts to decompose it at the other end.

 In Java, the Proton-Api's Data interface (org.apache.qpid.proton.codec)
 seems to provide the same functionality. But as far as I could see no
 class is actually implementing the interface, and the
 DataFactoryImpl.createData(long) is only throwing the exception
 which

 indicates that this operation is not supported. I've seen this in both
 0.4 package and on the Git's trunk.

 Is this a part of functionality that is merely not implemented yet, or
 something that is not planned to get implemented at all? In either case,
 what would be the alternate methods to put together the message body in
 a way that could be understood by C++ code? And vice versa?

 The use of Java bindings to Proton-C is not the preferred way to go.

 Thanks and best regards,

 Leon