Migration from Apache Abdera to Apache Wink
TBD
This section contains the following topics:
- Consuming Atom Documents
- Producing Atom Documents
- Producing Atom Documents Using Apache Wink
- Consuming RSS Documents
- Creating RSS Documents
- Writing Atom Publishing Protocol (APP) Server
- Writing Atom Publishing Protocol (APP) Client
- Object Models Comparison for Atom Syndication Format (ASF)
- Object Models Comparison for Atom Publishing Protocol (APP)
- Object Models Comparison for RSS (Really Simple Syndication)
Consuming Atom Documents
TBD ConsumeAtomUsingAbdera.java
Apache Wink is the perfect solution for consuming and producing Atom, APP and RSS documents. The following section describes how to migrate from Apache Abdera to Apache Wink by providing a set of examples that cover most use cases.
Advantages of Apache Wink over Apache Abdera
- Standardized APIs (using JAX-RS and JAXB)
- Support for handling XML and JSON more easily
- Support for handling RSS and ATOM more easily
This section contains the following topics:
- 1) Consuming Atom Documents
- 2) a) Producing Atom Documents
- 2) b) Producing Atom Documents - the JAX-RS way
- 3) Consuming RSS Documents
- 4) Producing RSS Documents
- 5) Writing Atom Publishing Protocol (APP) Server
- 6) Writing Atom Publishing Protocol (APP) Client
...
1) Consuming Atom Documents
The following code example demonstrates the consumption of Atom documents using Apache Abdera.
Apache Abdera - Click on link to Download - ConsumeAtomUsingAbdera.java | ||
---|---|---|
| ||
Apache Abdera | ||
|
TBD ConsumeAtomUsingWink.javaThe following code example demonstrates the consumption of Atom documents using Apache Wink.
Apache Wink - Click on link to Download - ConsumeAtomUsingWink.java | ||
---|---|---|
|
...
2) a) Producing Atom Documents
...
The following code example demonstrates the production of Atom documents using Apache Abdera.
Apache Abdera - Click on links to Download - ProduceAtomUsingAbdera.java ProduceAtomUsingAbdera_web.xml |
---|
...
Apache Abdera | ||
---|---|---|
|
...
The following code example demonstrates the production of Atom documents using Apache Wink.
Apache Wink - Click on links to Download - ProduceAtomUsingWink.java ProduceAtomUsingWink_web.xml | ||
---|---|---|
Apache Wink | ||
|
2) b) Producing Atom Documents
...
- the JAX-RS
...
way
A more elegant way of producing Atom documents using Apache Wink is In order to produce an Atom document according to the JAX-RS specification using Apache Wink perform the following stepsway as described below:
- Open the Eclipse developement envirnment development environment and then create a "Dynamic Web Project".
- Add Apache Wink & its dependent JARs into under Java Build Path and Java EE Module Dependencies.
- Create a POJO class and a method that creates Atom feed document. Annotate the class & its methods with the required JAX-RS annotations as below:
ProduceAtom.java - Add org.apache.wink.server.internal.servlet.RestServlet into web.xml and specify the path of above Resource class in it's init-param.
See ProduceAtomWinkElegant_web.xml and application - Deploy the web-application and access it using the url http://localhost:8080/ProduceAtom_Wink_Elegant/rest/getAtom
- Final WAR -> ProduceAtom_Wink_Elegant.zip (add Wink & its dependent JARs under ProduceAtom_Wink_Elegant\WEB-INF\lib and re-zip it as WAR).
...
3) Consuming RSS Documents
TBD
The following code example demonstrates the consuming of RSS documents using Apache Abdera.
Apache Wink Abdera - Click on link to Download - ConsumeRssUsingAbdera.java | ||
---|---|---|
|
The following code example demonstrates the consuming of RSS documents using Apache Wink.
Apache Wink - Click on link to Download - ConsumeRssUsingWink.java | |||
---|---|---|---|
|
...
4) Producing RSS Documents
Apache Abdera
Apache Abdera version 0.4 does not support RSS write.
Apache Wink
Same as in 2) b) Producing Atom Documents - the JAX-RS way. However the resource method now returns an RssFeed object instead of AtomFeed object.
Apache Wink - Click on link to Download - ProduceRss_Wink_Elegant.zip | ||
---|---|---|
|
...
5) Writing Atom Publishing Protocol (APP) Server
The following steps explain how to implement an APP server as described in the following beautiful article by James Snell: http://www.ibm.com/developerworks/library/x-atompp1/
Apache Abdera
- Open the Eclipse development environment and create a "Dynamic Web Project".
- Add Apache Abdera & its dependent JARs under Java EE Module Dependencies.
- Add the following CollectionAdapter and Provider classes under src/myPackage directory: APP_CollectionAdapter.java APP_ContentProvider.java
- Add org.apache.abdera.protocol.server.servlet.AbderaServlet into web.xml and point the following init paramters to the classes added above.
org.apache.abdera.protocol.server.Provider
org.apache.abdera.protocol.server.CollectionAdapter
APP_Server_Abdera_web.xml - Add the following index.jsp which has help on how to perform the APP operations: APP_Server_Abdera_index.jsp
- Deploy and run the application.
Final WAR -> APP_Server_Abdera.zip (add Apache Abdera & its dependent JARs under APP_Server_Abdera\WEB-INF\lib and re-zip it as WAR).
Apache Wink
- Open the Eclipse development environment and create a "Dynamic Web Project".
- Add Apache Wink & its dependent JARs under Java EE Module Dependencies.
- Add the following Resource class under src/myPackage directory: EntriesCollection.java
- Add org.apache.wink.server.internal.servlet.RestServlet into web.xml and specify the path of above Resource class in it's init-param. APP_Server_Wink_web.xml APP_Server_Wink_application
- Add the following index.jsp which has help on how to perform the APP operations: APP_Server_Wink_index.jsp
- Deploy and run the application.
Final WAR -> APP_Server_Wink.zip (add Apache Wink & its dependent JARs under APP_Server_Wink\WEB-INF\lib and re-zip it as WAR)
References
- Apache Wink's "SimpleDefects" example: http://svn.apache.org/repos/asf/incubator/wink/tags/wink-0.1-incubating/wink-examples/apps/SimpleDefects/src/main/java/org/apache/wink/example/simpledefects/resources/DefectsResource.java
- Abdera Feed Sample shipped with IBM WebSphere Feature Pack for Web 2.0 http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.ajax.feed.samples.help/docs/GettingStarted_useage.html
- Abdera Server Implementation Guide -> http://cwiki.apache.org/ABDERA/server-implementation-guide.html
- Abdera Collection Adapter Implementation Guide -> http://cwiki.apache.org/ABDERA/collection-adapter-implementation-guide.html
...
6) Writing Atom Publishing Protocol (APP) Client
In order to write an Atom Publishing Protocol client refer to the following examples.
Info | ||
---|---|---|
| ||
Make sure that the APP_Server_Abdera.war and the APP_Server_Wink.war provided in the previous example are deployed before running these examples. |
Apache Abdera - Click on link to Download - APP_Client_Abdera.java | ||
---|---|---|
1. Acessing Service Document:
| ||
Creating RSS Documents
TBD
| ||
2. Getting a Feed
| ||
3. Posting an entry to a Feed
| ||
4. Putting a change to an Entry
| ||
5. Getting an Entry
| ||
6. Deleting an Entry
|
Apache Wink - Click on link to Download - APP_Client_Wink.java | |||
---|---|---|---|
1. Acessing Service Document:
| |||
Apache Abdera | Apache Wink | ||
As of v0.4 Abdera has no support for RSS write. | Same as in 2)a) or 2)b). The resource method now returns an RssFeed object instead of AtomFeed object.
| ||
|
Writing Atom Publishing Protocol (APP) Server
TBD
Writing Atom Publishing Protocol (APP) Client
TBD
Object Models Comparison for Atom Syndication Format (ASF)
TBD
Object Models Comparison for Atom Publishing Protocol (APP)
TBD
Object Models Comparison for RSS (Really Simple Syndication)
| ||
2. Getting a Feed
| ||
3. Posting an entry to a Feed
| ||
4. Putting a change to an Entry
| ||
5. Getting an Entry
| ||
6. Deleting an Entry
|
...
...