Hi Anthony
On 25/04/12 12:56, Muller, Anthony wrote:
Thanks Sergey.
Yes, I wish to not be high-coupled with Abdera (a dead project ?).
It appears it has been revived during the last couple of years, see for
example
http://mail-archives.apache.org/mod_mbox/abdera-dev/
It's not super-active, but I guess the future for the project is about
supporting Atom-based extensions, etc, so the level of the activity is
not high. As far as the the bare Atom support (populating Feeds &
Entries) is concerned, Abdera is good
But maybe I can write a new provider from source of AtomPojoProvider to be able
to make more customization if needed (no author name for instance)...
Sure, it's a viable option, much depends on the complexity of the feeds
and in principle one can manually build feeds & entries using DOM for
example :-)
About OData, I will ask to Stephan Klevenz. I looked at FIQL, it looks like
OData search features indeed, but it is a CXF specific feature?
FIQL support is one specific 'realization' of the CXF Search extension,
the FIQL query is parsed and captured in a neutral representation which
can be used against the populated application beans to select the
matching ones or can be transformed into SQL, hopefully JPA soon thanks
to the effort led by Jeff Wang, etc, via custom visitors.
The Search extension has to be capable of accepting other query
expressions encoded directly in the URI path or queries. The SQL, JPA
visitors will work as usual. So seems like supporting OData path
expressions would be a good enhancement
Cheers, Sergey
Regards,
Anthony
-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]]
Sent: mardi 24 avril 2012 18:18
To: [email protected]
Subject: Re: [JAX-RS] CXF - Atom support - samples?
Hi
On 24/04/12 15:30, Muller, Anthony wrote:
Hello,
I'm trying to evaluate what it can be done using CXF + Atom but it is quite
difficult to find information about this topic...
Do you have sample somewhere?
We have some documentation here:
http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-Atom
I'm starting to write a atom provider... Is it the good way to proceed?
Oh, sorry, see you already starting to extend AtomPojoProvider...
This strategy works well if the actual application code does not 'want'
to get Apache Abdera (or other 3rd party Atom library) classes such as
Feed or Entry visible. Thta can be handy when say open XML or JSON or
Atom-enveloped payload needs to be returned, we'd just do
@Produces({"application/atom+xml", "application/xml"}) or similar.
Dealing directly with Abdera Feed& Entry is more flexible and I guess
even simpler as you have the direct access to Feed& Entry. The only
downside is that you bind the code to Abdera, so switching to Rome or
similar would be more difficult. May be not a big issue...
We do no have any specific demos but have some code on the trunk&
tests. By default it's really all about registering Atom providers and
working with Feed& Entry. Here is the one:
http://svn.apache.org/repos/asf/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AtomBookStore.java
or this one (for Atom-based logging):
http://svn.apache.org/repos/asf/cxf/branches/2.3.x-fixes/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/AtomPullServer.java
The Abdera Feed& Entry are used there
Moreover, it is some documentation about OData support in CXF?
There's no specific OAuth support in CXF but I believe Stephan Klevenz
integrated CXF with the Google OData project.
I guess having a custom provider is also reasonable. I wonder may be we
should update CXF Search extensions to support the OData URI syntax in
addition to the FIQL one, need to think about it...
Cheers, Sergey
Regards,
Anthony
public class MyODataProvider extends AtomPojoProvider {
public MyODataProvider() {
final Map<String, AbstractAtomElementBuilder<?>> builders = new
HashMap<String, AbstractAtomElementBuilder<?>>();
builders.put(Documents.class.getName(), new
DocumentsFeedBuilder());
builders.put(Document.class.getName(), new
DocumentEntryBuilder());
setAtomBuilders(builders);
}
}
class DocumentsFeedBuilder extends AbstractFeedBuilder<Documents> {
@Override
public String getIcon(Documents pojo) {
return "DocumentsFeedBuilder.getIcon(pojo)";
}
@Override
public String getLogo(Documents pojo) {
return "DocumentsFeedBuilder.getLogo(pojo)";
}
@Override
public String getTitle(Documents pojo) {
return "DocumentsFeedBuilder.getTitle(pojo)";
}
@Override
public String getAuthor(Documents pojo) {
return "DocumentsFeedBuilder.getAuthor(pojo)";
}
@Override
public String getId(Documents pojo) {
return "DocumentsFeedBuilder.getId(pojo)";
}
@Override
public String getBaseUri(Documents pojo) {
return "DocumentsFeedBuilder.getBaseUri(pojo)";
}
@Override
public String getUpdated(Documents pojo) {
return "2012-04-18T17:54:42.155+02:00";
}
@Override
public List<String> getCategories(Documents pojo) {
return Collections.emptyList();
}
@Override
public Map<String, String> getLinks(Documents pojo) {
return Collections.emptyMap();
}
}
class DocumentEntryBuilder extends AbstractEntryBuilder<Document> {
@Override
public String getPublished(Document pojo) {
if(pojo.getUpdated() != null) {
return pojo.getUpdated().toGregorianCalendar().toString(); //
"2012-04-18T17:54:42.155+02:00"
}
return null;
}
@Override
public String getSummary(Document pojo) {
return "DocumentEntryBuilder.getSummary(pojo)";
}
@Override
public String getTitle(Document pojo) {
return pojo.getName();
}
@Override
public String getAuthor(Document pojo) {
return "DocumentEntryBuilder.getAuthor(pojo)";
}
@Override
public String getId(Document pojo) {
return String.valueOf(pojo.getId());
}
@Override
public String getBaseUri(Document pojo) {
return "DocumentEntryBuilder.getBaseUri(pojo)";
}
@Override
public String getUpdated(Document pojo) {
if(pojo.getUpdated() != null) {
return pojo.getUpdated().toGregorianCalendar().toString(); //
"2012-04-18T17:54:42.155+02:00"
}
return null;
}
@Override
public List<String> getCategories(Document pojo) {
return Collections.emptyList();
}
@Override
public Map<String, String> getLinks(Document pojo) {
return Collections.emptyMap();
}
}
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com