Re: Handling collections with Aegis in JAX-RS

2009-08-21 Thread Benson Margulies
Sergey,

You have to be kidding me. The test (testReadWriteComplexMap) writes a
plain bean and then expects to read a map. Of course if fails!

--benson


On Fri, Aug 21, 2009 at 6:38 AM, Sergey
Beryozkinsergey.beryoz...@iona.com wrote:

 Hi Benson

 if you could look at any of these tests or at least point me in the right
 direction then it would be great.
 I know you're busy - so just look at it whenever you get a chance, not
 urgent...

 cheers, Sergey


 Sergey Beryozkin-2 wrote:



 Hi Benson

 I can't make the Aegis tests writing/reading collections working in CXF
 JAX-RS.
 I've found that AegisProviderTest#testReadWriteComplexMap is still
 @Ignored, it might've passed for you because it was @Ignored :-)

 I've also added testWriteCollections() (which writes ListAegisTestBean)
 to AegisJSONProviderTest. I also updated DataBindingJSONProviderTest, one
 of its internal classes to return ListBook. AegisJSONProvider extends
 AegisElementProvider, DataBindingJSONProvider extends DataBindingProvider
 which actually (in this case) delegates to Aegis DataBinding.

 AegisJSONProviderTest fails at the write time, it can't find the mapping
 for List. DataBindingJSONProviderTest fails early at the Aegis DataBinding
 initialization time for the same reason. I thought Lists were supported by
 default ? I haven't found any exam[le showing how a type mapping for Lists
 can be created.
 Can you please, whenever you have a chance, have a look at these tests ?

 thanks, Sergey



 --
 View this message in context: 
 http://www.nabble.com/Handling-collections-with-Aegis-in-JAX-RS-tp24933144p25076146.html
 Sent from the cxf-dev mailing list archive at Nabble.com.




Re: Handling collections with Aegis in JAX-RS

2009-08-21 Thread Sergey Beryozkin

Hi Benson

As far as I remember writing a map (that is fixing the code) won't make a difference, I tried it when I spotted this test was still 
ignored...



cheers, Sergey

- Original Message - 
From: Benson Margulies bimargul...@gmail.com

To: dev@cxf.apache.org
Sent: Friday, August 21, 2009 1:34 PM
Subject: Re: Handling collections with Aegis in JAX-RS



Sergey,

You have to be kidding me. The test (testReadWriteComplexMap) writes a
plain bean and then expects to read a map. Of course if fails!

--benson


On Fri, Aug 21, 2009 at 6:38 AM, Sergey
Beryozkinsergey.beryoz...@iona.com wrote:


Hi Benson

if you could look at any of these tests or at least point me in the right
direction then it would be great.
I know you're busy - so just look at it whenever you get a chance, not
urgent...

cheers, Sergey


Sergey Beryozkin-2 wrote:




Hi Benson

I can't make the Aegis tests writing/reading collections working in CXF
JAX-RS.
I've found that AegisProviderTest#testReadWriteComplexMap is still
@Ignored, it might've passed for you because it was @Ignored :-)

I've also added testWriteCollections() (which writes ListAegisTestBean)
to AegisJSONProviderTest. I also updated DataBindingJSONProviderTest, one
of its internal classes to return ListBook. AegisJSONProvider extends
AegisElementProvider, DataBindingJSONProvider extends DataBindingProvider
which actually (in this case) delegates to Aegis DataBinding.

AegisJSONProviderTest fails at the write time, it can't find the mapping
for List. DataBindingJSONProviderTest fails early at the Aegis DataBinding
initialization time for the same reason. I thought Lists were supported by
default ? I haven't found any exam[le showing how a type mapping for Lists
can be created.
Can you please, whenever you have a chance, have a look at these tests ?

thanks, Sergey




--
View this message in context: 
http://www.nabble.com/Handling-collections-with-Aegis-in-JAX-RS-tp24933144p25076146.html
Sent from the cxf-dev mailing list archive at Nabble.com.






Re: Handling collections with Aegis in JAX-RS

2009-08-21 Thread Sergey Beryozkin

Hi Benson

I'm seeing all the Aegis write tests failing at the momentOr is it only me ?

cheers, Sergey

- Original Message - 
From: Benson Margulies bimargul...@gmail.com

To: dev@cxf.apache.org
Sent: Friday, August 21, 2009 5:00 PM
Subject: Re: Handling collections with Aegis in JAX-RS



All fixed now.

I finally remembered the history of this. When you first inveigled me
into working up the Aegis provider, I got as far as this test, and
sent you email saying, 'OK, you fix the test, and I'll work out the
rest of the kinks.' And then if you even fixed up the test I missed
the email, so I never went back to it.


Re: Handling collections with Aegis in JAX-RS

2009-08-21 Thread Sergey Beryozkin

I'm confused... Hudson has apparently run the build with your changes - I'll do 
the clean build

cheers, Sergey

- Original Message - 
From: Sergey Beryozkin sbery...@progress.com

To: dev@cxf.apache.org
Sent: Friday, August 21, 2009 6:19 PM
Subject: Re: Handling collections with Aegis in JAX-RS



Hmm...

Still seeing them - Hudson has not run the build yet with the latest changes
I've done 'mvn clean install' on rt/databinding/aegis and rt/frontend/jaxrs...

By the way, I mean Aegis JAXRS tests

cheers, Sergey

- Original Message - 
From: Benson Margulies bimargul...@gmail.com

To: dev@cxf.apache.org
Sent: Friday, August 21, 2009 5:52 PM
Subject: Re: Handling collections with Aegis in JAX-RS



It appears to be you. I ran mvn in rt/databinding/aegis again, and
still no hate mail from hudson as well.

On Fri, Aug 21, 2009 at 12:39 PM, Sergey Beryozkinsbery...@progress.com wrote:

Hi Benson

I'm seeing all the Aegis write tests failing at the momentOr is it only
me ?

cheers, Sergey

- Original Message - From: Benson Margulies
bimargul...@gmail.com
To: dev@cxf.apache.org
Sent: Friday, August 21, 2009 5:00 PM
Subject: Re: Handling collections with Aegis in JAX-RS



All fixed now.

I finally remembered the history of this. When you first inveigled me
into working up the Aegis provider, I got as far as this test, and
sent you email saying, 'OK, you fix the test, and I'll work out the
rest of the kinks.' And then if you even fixed up the test I missed
the email, so I never went back to it.




Re: Interceptors and type safety

2009-08-21 Thread Daniel Kulp

The main problem with Alternative 2 is the performance impact it will have.   
The PhaseInterceptorChain (and it's iterator) is the FUNDAMENTAL loop and 
adding any processing in there would occur many many times for each invoke.  
By then end of processing a message, it's no uncommon for the chain to have 
20-30+ interceptors.   Thus, those checks would have occured that many times 
(plus another 20-30 for the response message).That would definitely have a 
least some measurable performance impact. 

In general, I've preferred:
1) If an interceptor is generic keep it generic Message.   

2) If it has to be specific (like the SoapMessage things), then make sure it's 
a soap binding it's being added to.  

One option might be to catch ClassCastException in the interceptor chain and 
only do your check if the ClassCastException was thrown to then log a more 
appropriate error/warning.  BTW:   since it would be moved to an exception 
case and not on performance critical path, we can auto detect the type it's 
supposed to be:

Class cls = currentInterceptor.getClass();
for (Method m : cls.getMethods()) {
if (!m.isSynthetic()  m.getName().equals(handleMessage)) {
Class typeTheyWant =  m.getParameters()[0];
}
}


Dan


On Fri August 21 2009 8:17:11 am Benson Margulies wrote:
 Interceptors implement a generic interface that is parameterized over
 a subclass of Message. Each interceptor class implements
 handleMessage(T), where 'T extends Message'.

 This removes one type cast from the interceptors, but it creates
 certain risks. I hit one of them, and I've been thinking about whether
 we want to change anything.

 Nothing checks to ensure that the actual message being processed is
 type-compatible with each of the interceptors. If someone puts, for
 example, an InterceptorSoapMessage into a chain, and an XMLMessage
 comes along, the result will be a ClassCastException. It will be an
 especially confusing ClassCastException, due to type erasure.

 Interceptor declares handleMessage(T), but by the time type erasure is
 done, that's just handleMessage(Message). When a mistyped message
 comes along, this mismatch is detected when code tries to assign it to
 the parameter, and the backtrace claims that the exception is being
 thrown by line one of the overall source file.

 I could think of two alternatives (other than leaving well enough alone).

 Alternative 1: get rid of the whole generic structure in interceptors.
 Everybody handles Message, and casts as they need to based on their
 assumptions or knowledge of the situation.

 Alternative 2: the chain filters out mis-types interceptors, making
 the type of the message a condition on whether the interceptor fires
 or not.

 While #1 might have something to be said for it in pure hindsight, it
 would be quite disruptive to all those user-written interceptors out
 there, so let's forget it.

 #2 has some attractive characteristics. It would work like this, I think.

 InterceptorT would gain a method:

 Class? extends Message getMessageClass();

 Each interceptor would return the message type it's prepared to handle.

 The chain would skip messages that didn't qualify.

 Does anyone think this is worth doing?

-- 
Daniel Kulp
dk...@apache.org
http://www.dankulp.com/blog


Re: Handling collections with Aegis in JAX-RS

2009-08-21 Thread D G

You are a funny man Benson - do you mind if I ask where you are located?



On Aug 21, 2009, at 2:14 PM, Benson Margulies bimargul...@gmail.com  
wrote:



I are at whole foods with iPhone - will engage when I get home.

On Aug 21, 2009, at 1:28 PM, Sergey Beryozkin  
sbery...@progress.com wrote:



This one

testWriteTo(org.apache.cxf.jaxrs.provider.AegisProviderTest)

also fails

Hudson provides some strange info
http://hudson.zones.apache.org/hudson/view/CXF/job/CXF-Trunk-JDK15/676/

shows that Benson's changes has made it into the build but

http://hudson.zones.apache.org/hudson/view/CXF/job/CXF-Trunk-JDK15/676/org.apache.cxf$cxf-rt-frontend-jaxrs/

shows that no changes has been applied

Sergey



- Original Message - From: Daniel Kulp dk...@apache.org
To: dev@cxf.apache.org
Cc: Benson Margulies bimargul...@gmail.com
Sent: Friday, August 21, 2009 6:22 PM
Subject: Re: Handling collections with Aegis in JAX-RS



On Fri August 21 2009 12:52:32 pm Benson Margulies wrote:

It appears to be you. I ran mvn in rt/databinding/aegis again, and
still no hate mail from hudson as well.
No.  He's refering to the  
org.apache.cxf.jaxrs.provider.AegisJSONProviderTest

in the jaxrs frontend.
Dan
On Fri, Aug 21, 2009 at 12:39 PM, Sergey Beryozkinsbery...@progress.com 


wrote:

 Hi Benson

 I'm seeing all the Aegis write tests failing at the  
momentOr is it

 only me ?

 cheers, Sergey

 - Original Message - From: Benson Margulies
 bimargul...@gmail.com
 To: dev@cxf.apache.org
 Sent: Friday, August 21, 2009 5:00 PM
 Subject: Re: Handling collections with Aegis in JAX-RS

 All fixed now.

 I finally remembered the history of this. When you first  
inveigled me
 into working up the Aegis provider, I got as far as this test,  
and
 sent you email saying, 'OK, you fix the test, and I'll work  
out the
 rest of the kinks.' And then if you even fixed up the test I  
missed

 the email, so I never went back to it.

--
Daniel Kulp
dk...@apache.org
http://www.dankulp.com/blog


Re: Handling collections with Aegis in JAX-RS

2009-08-21 Thread Benson Margulies
Lexington, MA, outside of Boston.

On Fri, Aug 21, 2009 at 2:26 PM, D Gdemet...@ece.neu.edu wrote:
 You are a funny man Benson - do you mind if I ask where you are located?



 On Aug 21, 2009, at 2:14 PM, Benson Margulies bimargul...@gmail.com wrote:

 I are at whole foods with iPhone - will engage when I get home.

 On Aug 21, 2009, at 1:28 PM, Sergey Beryozkin sbery...@progress.com
 wrote:

 This one

 testWriteTo(org.apache.cxf.jaxrs.provider.AegisProviderTest)

 also fails

 Hudson provides some strange info
 http://hudson.zones.apache.org/hudson/view/CXF/job/CXF-Trunk-JDK15/676/

 shows that Benson's changes has made it into the build but


 http://hudson.zones.apache.org/hudson/view/CXF/job/CXF-Trunk-JDK15/676/org.apache.cxf$cxf-rt-frontend-jaxrs/

 shows that no changes has been applied

 Sergey



 - Original Message - From: Daniel Kulp dk...@apache.org
 To: dev@cxf.apache.org
 Cc: Benson Margulies bimargul...@gmail.com
 Sent: Friday, August 21, 2009 6:22 PM
 Subject: Re: Handling collections with Aegis in JAX-RS


 On Fri August 21 2009 12:52:32 pm Benson Margulies wrote:

 It appears to be you. I ran mvn in rt/databinding/aegis again, and
 still no hate mail from hudson as well.

 No.  He's refering to the
 org.apache.cxf.jaxrs.provider.AegisJSONProviderTest
 in the jaxrs frontend.
 Dan

 On Fri, Aug 21, 2009 at 12:39 PM, Sergey
 Beryozkinsbery...@progress.com

 wrote:

  Hi Benson
 
  I'm seeing all the Aegis write tests failing at the momentOr is
  it
  only me ?
 
  cheers, Sergey
 
  - Original Message - From: Benson Margulies
  bimargul...@gmail.com
  To: dev@cxf.apache.org
  Sent: Friday, August 21, 2009 5:00 PM
  Subject: Re: Handling collections with Aegis in JAX-RS
 
  All fixed now.
 
  I finally remembered the history of this. When you first inveigled
  me
  into working up the Aegis provider, I got as far as this test, and
  sent you email saying, 'OK, you fix the test, and I'll work out the
  rest of the kinks.' And then if you even fixed up the test I missed
  the email, so I never went back to it.

 --
 Daniel Kulp
 dk...@apache.org
 http://www.dankulp.com/blog



Re: Handling collections with Aegis in JAX-RS

2009-08-21 Thread Benson Margulies
We've got canned XML being checked, I'll have to recan some of it.

On Fri, Aug 21, 2009 at 1:28 PM, Sergey Beryozkinsbery...@progress.com wrote:
 This one

 testWriteTo(org.apache.cxf.jaxrs.provider.AegisProviderTest)

 also fails

 Hudson provides some strange info
 http://hudson.zones.apache.org/hudson/view/CXF/job/CXF-Trunk-JDK15/676/

 shows that Benson's changes has made it into the build but

 http://hudson.zones.apache.org/hudson/view/CXF/job/CXF-Trunk-JDK15/676/org.apache.cxf$cxf-rt-frontend-jaxrs/

 shows that no changes has been applied

 Sergey



 - Original Message - From: Daniel Kulp dk...@apache.org
 To: dev@cxf.apache.org
 Cc: Benson Margulies bimargul...@gmail.com
 Sent: Friday, August 21, 2009 6:22 PM
 Subject: Re: Handling collections with Aegis in JAX-RS


 On Fri August 21 2009 12:52:32 pm Benson Margulies wrote:

 It appears to be you. I ran mvn in rt/databinding/aegis again, and
 still no hate mail from hudson as well.

 No.  He's refering to the
 org.apache.cxf.jaxrs.provider.AegisJSONProviderTest
 in the jaxrs frontend.

 Dan


 On Fri, Aug 21, 2009 at 12:39 PM, Sergey Beryozkinsbery...@progress.com

 wrote:

  Hi Benson
 
  I'm seeing all the Aegis write tests failing at the momentOr is it
  only me ?
 
  cheers, Sergey
 
  - Original Message - From: Benson Margulies
  bimargul...@gmail.com
  To: dev@cxf.apache.org
  Sent: Friday, August 21, 2009 5:00 PM
  Subject: Re: Handling collections with Aegis in JAX-RS
 
  All fixed now.
 
  I finally remembered the history of this. When you first inveigled me
  into working up the Aegis provider, I got as far as this test, and
  sent you email saying, 'OK, you fix the test, and I'll work out the
  rest of the kinks.' And then if you even fixed up the test I missed
  the email, so I never went back to it.

 --
 Daniel Kulp
 dk...@apache.org
 http://www.dankulp.com/blog



Re: Aegis versus JAR-RS versus XSI

2009-08-21 Thread Sergey Beryozkin

Hi Benson

AegisJSONProvider and DataBindingJSONProvider do set a namespace map which
contain a namespace for the xsi prefix.
What exactly JSON is saying ?

Sergey

bimargulies wrote:
 
 Now I've got problems. To make collections work in JAX-RS, I need to
 ensure that xsi:type gets written all the time.
 
 But JSON barfs on it.
 
 

-- 
View this message in context: 
http://www.nabble.com/Aegis-versus-JAR-RS-versus-XSI-tp25085476p25086046.html
Sent from the cxf-dev mailing list archive at Nabble.com.



Re: Integrating JAX-RS runtime into DOSGi

2009-08-21 Thread Sergey Beryozkin

Hi

Have a look here please 

http://cxf.apache.org/distributed-osgi.html

cheers, Sergey



Demetris G wrote:
 
 Hey Sergei and Josh
 
 Is the DOSGi you are referring in the essay of an email below the  
 Masters thesis I read once (and it became an open source branch of an  
 apache project) or is this a separate design?
 We worked on a design calked p2pSOA the connected distributed OSGi  
 containers over p2p technologies while exposing the endpt bundles as  
 web services. So I am fairly interested in your discussion - I just  
 want a quick clarification so I can position your work in my mind.  
 Thanks
 
 On Aug 21, 2009, at 12:28 PM, Sergey Beryozkin  
 sbery...@progress.com wrote:
 
 Hi Josh

 Can you please let me know if JAXB is being used for your JAX-RS  
 endpoints ?
 I've spotted that for HTTP Service based JAX-RS endpoints no  
 AegisProvider is being set - I'would actually like JAXB being used  
 by default for JAXRS endpoints which will be consistent with the  
 expectations of JAX-RS users in general - but I'd like to confirm  
 first that JAXB is working ok in your case...

 thanks, Sergey

 Sergey,
 Thanks again for the detailed documentation you've provided in this  
 thread.
 I was able to easily convert from JAX-WS to JAX-RS, which (I think)  
 will
 make our lives even easier.  Once we've got the ability to expose a  
 single
 service with both of these frontends, I'll make use of that as well.

 I agree that the jaxrs.resource property is no longer needed, as  
 you can
 simply register jaxrs resources as a dosgi services.

 Josh

 On Sat, Jun 20, 2009 at 11:10 AM, Sergey Beryozkin
 sbery...@progress.com 
 wrote:

 Hi,

 I've applied your patch and I've completed the initial integration  
 of
 JAX-RS into DOSGi RI. As it often happens I underestimated a bit how
 long it would take me to do it :-) but I'm quite happy now with  
 what has
 been done so far.

 I haven't got a chance to write JAX-WS system tests yet - I was a  
 bit
 constrained in time but judging from the code you did JAXWS/ 
 databindings
 should be working nicely now - please feel free to add a system  
 test, or
 either of us will do it asap.

 Now, the property names have actually changed and differ from  
 those you
 provided in the patch. As David noted, it was recommended that DOSGI
 providers would use reverse domain names as prefixes to their custom
 configuration types, such as 'pojo' in case of DOSGI RI.  
 Furthermore,
 'pojo' was a bit constraining in that it did not reflect the fact  
 that
 say SOAP or RS services were supported. Additionally, the DOSGI  
 way is
 
 

-- 
View this message in context: 
http://www.nabble.com/RE%3A-Integrating-JAX-RS-runtime-into-DOSGi-tp24127832p25086130.html
Sent from the cxf-dev mailing list archive at Nabble.com.



Re: Aegis versus JAR-RS versus XSI

2009-08-21 Thread Benson Margulies
See the JIRA I just gave you. The namespace map has to know about the
top-level collection and the internal types. You can't do that from a
Class?, you need a ParameterizedType, and then you need code to walk
it and add the types to the map.

On Fri, Aug 21, 2009 at 3:35 PM, Sergey
Beryozkinsergey.beryoz...@iona.com wrote:

 Hi Benson

 AegisJSONProvider and DataBindingJSONProvider do set a namespace map which
 contain a namespace for the xsi prefix.
 What exactly JSON is saying ?

 Sergey

 bimargulies wrote:

 Now I've got problems. To make collections work in JAX-RS, I need to
 ensure that xsi:type gets written all the time.

 But JSON barfs on it.



 --
 View this message in context: 
 http://www.nabble.com/Aegis-versus-JAR-RS-versus-XSI-tp25085476p25086046.html
 Sent from the cxf-dev mailing list archive at Nabble.com.




Re: Handling collections with Aegis in JAX-RS

2009-08-21 Thread D G
Ha - I am in Waltham on the line of Lexington and Waltham close to  
IBM. How funny is that man.




On Aug 21, 2009, at 2:36 PM, Benson Margulies bimargul...@gmail.com  
wrote:



Lexington, MA, outside of Boston.

On Fri, Aug 21, 2009 at 2:26 PM, D Gdemet...@ece.neu.edu wrote:
You are a funny man Benson - do you mind if I ask where you are  
located?




On Aug 21, 2009, at 2:14 PM, Benson Margulies  
bimargul...@gmail.com wrote:



I are at whole foods with iPhone - will engage when I get home.

On Aug 21, 2009, at 1:28 PM, Sergey Beryozkin sbery...@progress.com 


wrote:


This one

testWriteTo(org.apache.cxf.jaxrs.provider.AegisProviderTest)

also fails

Hudson provides some strange info
http://hudson.zones.apache.org/hudson/view/CXF/job/CXF-Trunk-JDK15/676/

shows that Benson's changes has made it into the build but


http://hudson.zones.apache.org/hudson/view/CXF/job/CXF-Trunk-JDK15/676/org.apache.cxf$cxf-rt-frontend-jaxrs/

shows that no changes has been applied

Sergey



- Original Message - From: Daniel Kulp dk...@apache.org
To: dev@cxf.apache.org
Cc: Benson Margulies bimargul...@gmail.com
Sent: Friday, August 21, 2009 6:22 PM
Subject: Re: Handling collections with Aegis in JAX-RS



On Fri August 21 2009 12:52:32 pm Benson Margulies wrote:


It appears to be you. I ran mvn in rt/databinding/aegis again,  
and

still no hate mail from hudson as well.


No.  He's refering to the
org.apache.cxf.jaxrs.provider.AegisJSONProviderTest
in the jaxrs frontend.
Dan


On Fri, Aug 21, 2009 at 12:39 PM, Sergey
Beryozkinsbery...@progress.com


wrote:



Hi Benson

I'm seeing all the Aegis write tests failing at the  
momentOr is

it
only me ?

cheers, Sergey

- Original Message - From: Benson Margulies
bimargul...@gmail.com
To: dev@cxf.apache.org
Sent: Friday, August 21, 2009 5:00 PM
Subject: Re: Handling collections with Aegis in JAX-RS


All fixed now.

I finally remembered the history of this. When you first  
inveigled

me
into working up the Aegis provider, I got as far as this  
test, and
sent you email saying, 'OK, you fix the test, and I'll work  
out the
rest of the kinks.' And then if you even fixed up the test I  
missed

the email, so I never went back to it.


--
Daniel Kulp
dk...@apache.org
http://www.dankulp.com/blog