
odata4j
Overview
There is a vast amount of data available today and data is now being collected and stored at a rate never seen before. Much of this data is managed by Java server applications and difficult to access or integrate into new uses.
The Open Data Protocol (OData) is a Web protocol for querying and updating data that provides a way to unlock this data and free it from silos that exist in applications today. OData does this by applying and building upon Web technologies such as HTTP, Atom Publishing Protocol (AtomPub) and JSON to provide access to information from a variety of applications, services, and stores.
Project Info
odata4j is a new open-source toolkit for building first-class OData producers and first-class OData consumers in Java.
Goals and Guidelines
- Build on top of existing Java standards (e.g. JAX-RS, JPA, StAX) and use top shelf Java open-source components (jersey, Joda Time)
- OData consumers should run equally well under constrained Java client environments, specifically Android
- OData producers should run equally well under constrained Java server environments, specifically Google AppEngine
Consumers - Getting Started
- Download the latest archive zip
- Add odata4j-bundle-x.x.jar to your build path (or odata4j-clientbundle-x.x.jar for a smaller client-only bundle)
- Create an new consumer using
ODataConsumer.create("http://pathto/service.svc/")
and use the consumer for client scenarios
Consumers - Examples
(All of these examples work on Android as well) * Basic consumer query & modification example using the OData Read/Write Test service: ODataTestServiceReadWriteExample.java * Simple Netflix example: NetflixConsumerExample.java * List all entities for a given service: ServiceListingConsumerExample.java * Use the Dallas data service to query AP news stories (requires Dallas credentials): DallasConsumerExampleAP.java * Use the Dallas data service to query UNESCO data (requires Dallas credentials): DallasConsumerExampleUnescoUIS.java * Basic Azure table-service table/entity manipulation example (requires Azure storage credentials): AzureTableStorageConsumerExample.java * Test against the sample odata4j service hosted on Google AppEngine: AppEngineConsumerExample.java
Producers - Getting Started
- Download the latest archive zip
- Add odata4j-bundle-x.x.jar to your build path (or odata4j-nojpabundle-x.x.jar for a smaller bundle with no JPA support)
- Choose or implement an ODataProducer
- Use InMemoryProducer to expose POJOs as OData entities using bean properties. Example: InMemoryProducerExample.java
- Use JPAProducer to expose an existing JPA 2.0 entity model: JPAProducerExample.java
- Implement ODataProducer directly
- Take a look at odata4j-appengine for an example of how to expose AppEngine's Datastore as an OData endpoint
- Hosting in Tomcat: http://code.google.com/p/odata4j/wiki/Tomcat
Status
odata4j is still early days, a quick summary of what's implemented * Fairly complete expression parser (pretty much everything except complex navigation property literals) * URI parser for producers * Complete EDM metadata parser (and model) * Dynamic entity/property model (OEntity/OProperty) * Consumer api: ODataConsumer * Producer api: ODataProducer * ATOM and JSON transports * Non standard behavior (e.g. Azure authentication, Dallas paging) via client extension api * Transparent server-driven paging * Cross domain policy files for silverlight clients * Free WADL for your OData producer thanks to jersey. e.g. odata4j-sample application.wadl * Tested with current OData client set (.NET ,Silverlight, LinqPad, PowerPivot)
Roadmap and Changelog
Roadmap