You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Douglas Leite <do...@gmail.com> on 2008/06/18 04:02:38 UTC

[GSOC] Issues with JAXB at GData binding

I have started to implement the invokers at binding-gdata module. Maybe, the
simplest operation is retrieve a feed from an specific URI. So, I have
chosen the getFeed() method as the first one to be implemented.

Trying to think as simple as possible, and using the gdata java client, the
method follow these steps:

1) Set the user credentials;
2) Get the feed at an URI as a com.google.gdata.data.Feed object;
3) Pass the feed object to the body of the message object
(org.apache.tuscany.sca.invocation.Message);

The following piece of code demonstrate it:
*
     //FIXME - Get credentials automatically
     myService.setUserCredentials("gsocstudent2008@gmail.com", "gsoc2008");

     Feed feed = (Feed) myService.getFeed(new URL(uri), Feed.class);

     msg.setBody(feed);*

However, I am having some issues with marshalling/unmarshalling the Feed
object while passing it to the message body. I got these output:

Exception in thread "main" java.lang.IllegalArgumentException:
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 3 counts of
IllegalAnnotationExceptions
com.google.gdata.data.BaseFeed does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.google.gdata.data.BaseFeed
        at com.google.gdata.data.Feed
com.google.gdata.client.Service$GDataRequestFactory is an interface, and
JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.google.gdata.client.Service$GDataRequestFactory
        at public com.google.gdata.client.Service$GDataRequestFactory
com.google.gdata.client.Service.getRequestFactory()
        at com.google.gdata.client.Service
        at public com.google.gdata.client.Service
com.google.gdata.data.BaseEntry.getService()
        at com.google.gdata.data.BaseEntry
        at public java.util.List com.google.gdata.data.BaseFeed.getEntries()
        at com.google.gdata.data.BaseFeed
        at com.google.gdata.data.Feed
com.google.gdata.client.Service$GDataRequestFactory does not have a no-arg
default constructor.
    this problem is related to the following location:
        at com.google.gdata.client.Service$GDataRequestFactory
        at public com.google.gdata.client.Service$GDataRequestFactory
com.google.gdata.client.Service.getRequestFactory()
        at com.google.gdata.client.Service
        at public com.google.gdata.client.Service
com.google.gdata.data.BaseEntry.getService()
        at com.google.gdata.data.BaseEntry
        at public java.util.List com.google.gdata.data.BaseFeed.getEntries()
        at com.google.gdata.data.BaseFeed
        at com.google.gdata.data.Feed
        . . .

BaseFeed is a super type of Feed, and although it does not have a no-arg
default constructor, the Feed has one.

Thoughts?

-- 
Douglas Siqueira Leite
Computer Science Master's degree student of University of Campinas (Unicamp)

Re: [GSOC] Issues with JAXB at GData binding

Posted by Douglas Leite <do...@gmail.com>.
Here is a patch to solve the above problem:

https://issues.apache.org/jira/browse/TUSCANY-2412

On Wed, Jun 18, 2008 at 9:44 AM, Douglas Leite <do...@gmail.com> wrote:

> I have tried the first idea gave by Raymond, and now the getFeed() is
> working without the mentioned marshal/umarshal problem.
>
> Thanks
>
>
> On Wed, Jun 18, 2008 at 2:17 AM, Luciano Resende <lu...@gmail.com>
> wrote:
>
>> I guess the Invoker is not available yet, but I committed Douglas last
>> patch in java/modules/binding-gdata. I'll try to take a look at this
>> tomorrow as well, this should be similar to what we had to do for
>> binding-atom-abdera.
>>
>> On Tue, Jun 17, 2008 at 8:16 PM, Raymond Feng <en...@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > The main issue here is that we don't know how to handle the databinding
>> for
>> > the GData. My wide guess is that the pass-by-value interceptor is
>> triggered
>> > to copy the data to enforce the PBV semantics for the remotable
>> interface.
>> >
>> > Here are a few things you can do to avoid this:
>> >
>> > 1) Have the GDataBinding invoker to implement DataExchangeSemantics SPI
>> and
>> > return true for the allowsPassByReference() method.
>> > 2) Add a new databinding for GData so that Tuscany knows about GData and
>> > handles the copy, marshal/unmarshal of the data correctly.
>> >
>> > Please point me to the code so that I can give you more suggestions.
>> >
>> > Thanks,
>> > Raymond
>> >
>> > --------------------------------------------------
>> > From: "Douglas Leite" <do...@gmail.com>
>> > Sent: Tuesday, June 17, 2008 7:02 PM
>> > To: "Tuscany-Developers" <de...@tuscany.apache.org>
>> > Subject: [GSOC] Issues with JAXB at GData binding
>> >
>> >> I have started to implement the invokers at binding-gdata module.
>> Maybe,
>> >> the
>> >> simplest operation is retrieve a feed from an specific URI. So, I have
>> >> chosen the getFeed() method as the first one to be implemented.
>> >>
>> >> Trying to think as simple as possible, and using the gdata java client,
>> >> the
>> >> method follow these steps:
>> >>
>> >> 1) Set the user credentials;
>> >> 2) Get the feed at an URI as a com.google.gdata.data.Feed object;
>> >> 3) Pass the feed object to the body of the message object
>> >> (org.apache.tuscany.sca.invocation.Message);
>> >>
>> >> The following piece of code demonstrate it:
>> >> *
>> >>    //FIXME - Get credentials automatically
>> >>    myService.setUserCredentials("gsocstudent2008@gmail.com",
>> "gsoc2008");
>> >>
>> >>    Feed feed = (Feed) myService.getFeed(new URL(uri), Feed.class);
>> >>
>> >>    msg.setBody(feed);*
>> >>
>> >> However, I am having some issues with marshalling/unmarshalling the
>> Feed
>> >> object while passing it to the message body. I got these output:
>> >>
>> >> Exception in thread "main" java.lang.IllegalArgumentException:
>> >> com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 3 counts of
>> >> IllegalAnnotationExceptions
>> >> com.google.gdata.data.BaseFeed does not have a no-arg default
>> constructor.
>> >>   this problem is related to the following location:
>> >>       at com.google.gdata.data.BaseFeed
>> >>       at com.google.gdata.data.Feed
>> >> com.google.gdata.client.Service$GDataRequestFactory is an interface,
>> and
>> >> JAXB can't handle interfaces.
>> >>   this problem is related to the following location:
>> >>       at com.google.gdata.client.Service$GDataRequestFactory
>> >>       at public com.google.gdata.client.Service$GDataRequestFactory
>> >> com.google.gdata.client.Service.getRequestFactory()
>> >>       at com.google.gdata.client.Service
>> >>       at public com.google.gdata.client.Service
>> >> com.google.gdata.data.BaseEntry.getService()
>> >>       at com.google.gdata.data.BaseEntry
>> >>       at public java.util.List
>> com.google.gdata.data.BaseFeed.getEntries()
>> >>       at com.google.gdata.data.BaseFeed
>> >>       at com.google.gdata.data.Feed
>> >> com.google.gdata.client.Service$GDataRequestFactory does not have a
>> no-arg
>> >> default constructor.
>> >>   this problem is related to the following location:
>> >>       at com.google.gdata.client.Service$GDataRequestFactory
>> >>       at public com.google.gdata.client.Service$GDataRequestFactory
>> >> com.google.gdata.client.Service.getRequestFactory()
>> >>       at com.google.gdata.client.Service
>> >>       at public com.google.gdata.client.Service
>> >> com.google.gdata.data.BaseEntry.getService()
>> >>       at com.google.gdata.data.BaseEntry
>> >>       at public java.util.List
>> com.google.gdata.data.BaseFeed.getEntries()
>> >>       at com.google.gdata.data.BaseFeed
>> >>       at com.google.gdata.data.Feed
>> >>       . . .
>> >>
>> >> BaseFeed is a super type of Feed, and although it does not have a
>> no-arg
>> >> default constructor, the Feed has one.
>> >>
>> >> Thoughts?
>> >>
>> >> --
>> >> Douglas Siqueira Leite
>> >> Computer Science Master's degree student of University of Campinas
>> >> (Unicamp)
>> >>
>> >
>>
>>
>>
>> --
>> Luciano Resende
>> Apache Tuscany Committer
>> http://people.apache.org/~lresende <http://people.apache.org/%7Elresende>
>> http://lresende.blogspot.com/
>>
>
>
>
> --
> Douglas Siqueira Leite
> Computer Science Master's degree student of University of Campinas
> (Unicamp)
>



-- 
Douglas Siqueira Leite
Computer Science Master's degree student of University of Campinas (Unicamp)

Re: [GSOC] Issues with JAXB at GData binding

Posted by Douglas Leite <do...@gmail.com>.
I have tried the first idea gave by Raymond, and now the getFeed() is
working without the mentioned marshal/umarshal problem.

Thanks

On Wed, Jun 18, 2008 at 2:17 AM, Luciano Resende <lu...@gmail.com>
wrote:

> I guess the Invoker is not available yet, but I committed Douglas last
> patch in java/modules/binding-gdata. I'll try to take a look at this
> tomorrow as well, this should be similar to what we had to do for
> binding-atom-abdera.
>
> On Tue, Jun 17, 2008 at 8:16 PM, Raymond Feng <en...@gmail.com> wrote:
> > Hi,
> >
> > The main issue here is that we don't know how to handle the databinding
> for
> > the GData. My wide guess is that the pass-by-value interceptor is
> triggered
> > to copy the data to enforce the PBV semantics for the remotable
> interface.
> >
> > Here are a few things you can do to avoid this:
> >
> > 1) Have the GDataBinding invoker to implement DataExchangeSemantics SPI
> and
> > return true for the allowsPassByReference() method.
> > 2) Add a new databinding for GData so that Tuscany knows about GData and
> > handles the copy, marshal/unmarshal of the data correctly.
> >
> > Please point me to the code so that I can give you more suggestions.
> >
> > Thanks,
> > Raymond
> >
> > --------------------------------------------------
> > From: "Douglas Leite" <do...@gmail.com>
> > Sent: Tuesday, June 17, 2008 7:02 PM
> > To: "Tuscany-Developers" <de...@tuscany.apache.org>
> > Subject: [GSOC] Issues with JAXB at GData binding
> >
> >> I have started to implement the invokers at binding-gdata module. Maybe,
> >> the
> >> simplest operation is retrieve a feed from an specific URI. So, I have
> >> chosen the getFeed() method as the first one to be implemented.
> >>
> >> Trying to think as simple as possible, and using the gdata java client,
> >> the
> >> method follow these steps:
> >>
> >> 1) Set the user credentials;
> >> 2) Get the feed at an URI as a com.google.gdata.data.Feed object;
> >> 3) Pass the feed object to the body of the message object
> >> (org.apache.tuscany.sca.invocation.Message);
> >>
> >> The following piece of code demonstrate it:
> >> *
> >>    //FIXME - Get credentials automatically
> >>    myService.setUserCredentials("gsocstudent2008@gmail.com",
> "gsoc2008");
> >>
> >>    Feed feed = (Feed) myService.getFeed(new URL(uri), Feed.class);
> >>
> >>    msg.setBody(feed);*
> >>
> >> However, I am having some issues with marshalling/unmarshalling the Feed
> >> object while passing it to the message body. I got these output:
> >>
> >> Exception in thread "main" java.lang.IllegalArgumentException:
> >> com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 3 counts of
> >> IllegalAnnotationExceptions
> >> com.google.gdata.data.BaseFeed does not have a no-arg default
> constructor.
> >>   this problem is related to the following location:
> >>       at com.google.gdata.data.BaseFeed
> >>       at com.google.gdata.data.Feed
> >> com.google.gdata.client.Service$GDataRequestFactory is an interface, and
> >> JAXB can't handle interfaces.
> >>   this problem is related to the following location:
> >>       at com.google.gdata.client.Service$GDataRequestFactory
> >>       at public com.google.gdata.client.Service$GDataRequestFactory
> >> com.google.gdata.client.Service.getRequestFactory()
> >>       at com.google.gdata.client.Service
> >>       at public com.google.gdata.client.Service
> >> com.google.gdata.data.BaseEntry.getService()
> >>       at com.google.gdata.data.BaseEntry
> >>       at public java.util.List
> com.google.gdata.data.BaseFeed.getEntries()
> >>       at com.google.gdata.data.BaseFeed
> >>       at com.google.gdata.data.Feed
> >> com.google.gdata.client.Service$GDataRequestFactory does not have a
> no-arg
> >> default constructor.
> >>   this problem is related to the following location:
> >>       at com.google.gdata.client.Service$GDataRequestFactory
> >>       at public com.google.gdata.client.Service$GDataRequestFactory
> >> com.google.gdata.client.Service.getRequestFactory()
> >>       at com.google.gdata.client.Service
> >>       at public com.google.gdata.client.Service
> >> com.google.gdata.data.BaseEntry.getService()
> >>       at com.google.gdata.data.BaseEntry
> >>       at public java.util.List
> com.google.gdata.data.BaseFeed.getEntries()
> >>       at com.google.gdata.data.BaseFeed
> >>       at com.google.gdata.data.Feed
> >>       . . .
> >>
> >> BaseFeed is a super type of Feed, and although it does not have a no-arg
> >> default constructor, the Feed has one.
> >>
> >> Thoughts?
> >>
> >> --
> >> Douglas Siqueira Leite
> >> Computer Science Master's degree student of University of Campinas
> >> (Unicamp)
> >>
> >
>
>
>
> --
> Luciano Resende
> Apache Tuscany Committer
> http://people.apache.org/~lresende <http://people.apache.org/%7Elresende>
> http://lresende.blogspot.com/
>



-- 
Douglas Siqueira Leite
Computer Science Master's degree student of University of Campinas (Unicamp)

Re: [GSOC] Issues with JAXB at GData binding

Posted by Luciano Resende <lu...@gmail.com>.
I guess the Invoker is not available yet, but I committed Douglas last
patch in java/modules/binding-gdata. I'll try to take a look at this
tomorrow as well, this should be similar to what we had to do for
binding-atom-abdera.

On Tue, Jun 17, 2008 at 8:16 PM, Raymond Feng <en...@gmail.com> wrote:
> Hi,
>
> The main issue here is that we don't know how to handle the databinding for
> the GData. My wide guess is that the pass-by-value interceptor is triggered
> to copy the data to enforce the PBV semantics for the remotable interface.
>
> Here are a few things you can do to avoid this:
>
> 1) Have the GDataBinding invoker to implement DataExchangeSemantics SPI and
> return true for the allowsPassByReference() method.
> 2) Add a new databinding for GData so that Tuscany knows about GData and
> handles the copy, marshal/unmarshal of the data correctly.
>
> Please point me to the code so that I can give you more suggestions.
>
> Thanks,
> Raymond
>
> --------------------------------------------------
> From: "Douglas Leite" <do...@gmail.com>
> Sent: Tuesday, June 17, 2008 7:02 PM
> To: "Tuscany-Developers" <de...@tuscany.apache.org>
> Subject: [GSOC] Issues with JAXB at GData binding
>
>> I have started to implement the invokers at binding-gdata module. Maybe,
>> the
>> simplest operation is retrieve a feed from an specific URI. So, I have
>> chosen the getFeed() method as the first one to be implemented.
>>
>> Trying to think as simple as possible, and using the gdata java client,
>> the
>> method follow these steps:
>>
>> 1) Set the user credentials;
>> 2) Get the feed at an URI as a com.google.gdata.data.Feed object;
>> 3) Pass the feed object to the body of the message object
>> (org.apache.tuscany.sca.invocation.Message);
>>
>> The following piece of code demonstrate it:
>> *
>>    //FIXME - Get credentials automatically
>>    myService.setUserCredentials("gsocstudent2008@gmail.com", "gsoc2008");
>>
>>    Feed feed = (Feed) myService.getFeed(new URL(uri), Feed.class);
>>
>>    msg.setBody(feed);*
>>
>> However, I am having some issues with marshalling/unmarshalling the Feed
>> object while passing it to the message body. I got these output:
>>
>> Exception in thread "main" java.lang.IllegalArgumentException:
>> com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 3 counts of
>> IllegalAnnotationExceptions
>> com.google.gdata.data.BaseFeed does not have a no-arg default constructor.
>>   this problem is related to the following location:
>>       at com.google.gdata.data.BaseFeed
>>       at com.google.gdata.data.Feed
>> com.google.gdata.client.Service$GDataRequestFactory is an interface, and
>> JAXB can't handle interfaces.
>>   this problem is related to the following location:
>>       at com.google.gdata.client.Service$GDataRequestFactory
>>       at public com.google.gdata.client.Service$GDataRequestFactory
>> com.google.gdata.client.Service.getRequestFactory()
>>       at com.google.gdata.client.Service
>>       at public com.google.gdata.client.Service
>> com.google.gdata.data.BaseEntry.getService()
>>       at com.google.gdata.data.BaseEntry
>>       at public java.util.List com.google.gdata.data.BaseFeed.getEntries()
>>       at com.google.gdata.data.BaseFeed
>>       at com.google.gdata.data.Feed
>> com.google.gdata.client.Service$GDataRequestFactory does not have a no-arg
>> default constructor.
>>   this problem is related to the following location:
>>       at com.google.gdata.client.Service$GDataRequestFactory
>>       at public com.google.gdata.client.Service$GDataRequestFactory
>> com.google.gdata.client.Service.getRequestFactory()
>>       at com.google.gdata.client.Service
>>       at public com.google.gdata.client.Service
>> com.google.gdata.data.BaseEntry.getService()
>>       at com.google.gdata.data.BaseEntry
>>       at public java.util.List com.google.gdata.data.BaseFeed.getEntries()
>>       at com.google.gdata.data.BaseFeed
>>       at com.google.gdata.data.Feed
>>       . . .
>>
>> BaseFeed is a super type of Feed, and although it does not have a no-arg
>> default constructor, the Feed has one.
>>
>> Thoughts?
>>
>> --
>> Douglas Siqueira Leite
>> Computer Science Master's degree student of University of Campinas
>> (Unicamp)
>>
>



-- 
Luciano Resende
Apache Tuscany Committer
http://people.apache.org/~lresende
http://lresende.blogspot.com/

Re: [GSOC] Issues with JAXB at GData binding

Posted by Raymond Feng <en...@gmail.com>.
Hi,

The main issue here is that we don't know how to handle the databinding for 
the GData. My wide guess is that the pass-by-value interceptor is triggered 
to copy the data to enforce the PBV semantics for the remotable interface.

Here are a few things you can do to avoid this:

1) Have the GDataBinding invoker to implement DataExchangeSemantics SPI and 
return true for the allowsPassByReference() method.
2) Add a new databinding for GData so that Tuscany knows about GData and 
handles the copy, marshal/unmarshal of the data correctly.

Please point me to the code so that I can give you more suggestions.

Thanks,
Raymond

--------------------------------------------------
From: "Douglas Leite" <do...@gmail.com>
Sent: Tuesday, June 17, 2008 7:02 PM
To: "Tuscany-Developers" <de...@tuscany.apache.org>
Subject: [GSOC] Issues with JAXB at GData binding

> I have started to implement the invokers at binding-gdata module. Maybe, 
> the
> simplest operation is retrieve a feed from an specific URI. So, I have
> chosen the getFeed() method as the first one to be implemented.
>
> Trying to think as simple as possible, and using the gdata java client, 
> the
> method follow these steps:
>
> 1) Set the user credentials;
> 2) Get the feed at an URI as a com.google.gdata.data.Feed object;
> 3) Pass the feed object to the body of the message object
> (org.apache.tuscany.sca.invocation.Message);
>
> The following piece of code demonstrate it:
> *
>     //FIXME - Get credentials automatically
>     myService.setUserCredentials("gsocstudent2008@gmail.com", "gsoc2008");
>
>     Feed feed = (Feed) myService.getFeed(new URL(uri), Feed.class);
>
>     msg.setBody(feed);*
>
> However, I am having some issues with marshalling/unmarshalling the Feed
> object while passing it to the message body. I got these output:
>
> Exception in thread "main" java.lang.IllegalArgumentException:
> com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 3 counts of
> IllegalAnnotationExceptions
> com.google.gdata.data.BaseFeed does not have a no-arg default constructor.
>    this problem is related to the following location:
>        at com.google.gdata.data.BaseFeed
>        at com.google.gdata.data.Feed
> com.google.gdata.client.Service$GDataRequestFactory is an interface, and
> JAXB can't handle interfaces.
>    this problem is related to the following location:
>        at com.google.gdata.client.Service$GDataRequestFactory
>        at public com.google.gdata.client.Service$GDataRequestFactory
> com.google.gdata.client.Service.getRequestFactory()
>        at com.google.gdata.client.Service
>        at public com.google.gdata.client.Service
> com.google.gdata.data.BaseEntry.getService()
>        at com.google.gdata.data.BaseEntry
>        at public java.util.List 
> com.google.gdata.data.BaseFeed.getEntries()
>        at com.google.gdata.data.BaseFeed
>        at com.google.gdata.data.Feed
> com.google.gdata.client.Service$GDataRequestFactory does not have a no-arg
> default constructor.
>    this problem is related to the following location:
>        at com.google.gdata.client.Service$GDataRequestFactory
>        at public com.google.gdata.client.Service$GDataRequestFactory
> com.google.gdata.client.Service.getRequestFactory()
>        at com.google.gdata.client.Service
>        at public com.google.gdata.client.Service
> com.google.gdata.data.BaseEntry.getService()
>        at com.google.gdata.data.BaseEntry
>        at public java.util.List 
> com.google.gdata.data.BaseFeed.getEntries()
>        at com.google.gdata.data.BaseFeed
>        at com.google.gdata.data.Feed
>        . . .
>
> BaseFeed is a super type of Feed, and although it does not have a no-arg
> default constructor, the Feed has one.
>
> Thoughts?
>
> -- 
> Douglas Siqueira Leite
> Computer Science Master's degree student of University of Campinas 
> (Unicamp)
>