Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

The Olingo2 component utilizes Apache Olingo version 2.0 APIs to interact with OData 2.0 and 3.0 compliant services. A number of popular commercial and enterprise vendors and products support the OData protocol. A sample list of supporting products can be found on the OData website.

The Olingo2 component It supports reading feeds, delta feeds, entities, simple and complex properties, links, counts, using custom and OData system query parameters. It supports updating entities, properties, and association links. It also supports submitting queries and change requests as a single OData batch operation. 

...

Note that the resourcePath option can either in specified in the URI as a part of the URI path, as an endpoint option ?resourcePath=<resource-path> or as a header value CamelOlingo2.resourcePath. The OData entity key predicate can either be a part of the resource path, e.g. Manufacturers('1'), where '1' is the key predicate, or be specified separately with resource path Manufacturers and keyPredicate option '1'

EndpointOptionsHTTP MethodResult Body Type
batchdata
POST with multipart/mixed batch request
java.util.List<org.apache.camel.component.olingo2.api.batch.Olingo2BatchResponse>
createdata, resourcePath
POST
org.apache.olingo.odata2.api.ep.entry.ODataEntry for new entries
org.apache.olingo.odata2.api.commons.HttpStatusCodes for other OData resources
deleteresourcePath
DELETE
org.apache.olingo.odata2.api.commons.HttpStatusCodes
mergedata, resourcePath
MERGE
org.apache.olingo.odata2.api.commons.HttpStatusCodes
patchdata, resourcePath
PATCH
org.apache.olingo.odata2.api.commons.HttpStatusCodes
readqueryParams, resourcePath
GET
Depends on OData resource being queried as described next
updatedata, resourcePath
PUT
org.apache.olingo.odata2.api.commons.HttpStatusCodes

...

OData Resource TypeResource URI from resourcePath and keyPredicateIn or Out Body Type
Entity data model$metadata
org.apache.olingo.odata2.api.edm.Edm
Service document/
org.apache.olingo.odata2.api.servicedocument.ServiceDocument
OData feed<entity-set>
org.apache.olingo.odata2.api.ep.feed.ODataFeed
OData entry<entity-set>(<key-predicate>)
org.apache.olingo.odata2.api.ep.entry.ODataEntry for Out body (response)
java.util.Map<String, Object> for In body (request)
Simple property<entity-set>(<key-predicate>)/<simple-property>
Appropriate Java data type as described by Olingo EdmProperty
Simple property value<entity-set>(<key-predicate>)/<simple-property>/$value
Appropriate Java data type as described by Olingo EdmProperty
Complex property<entity-set>(<key-predicate>)/<complex-property>
java.util.Map<String, Object>
Zero or one association link<entity-set>(<key-predicate>/$link/<one-to-one-entity-set-property>
String for response
java.util.Map<String, Object> with key property names and values for request
Zero or many association links<entity-set>(<key-predicate>/$link/<one-to-many-entity-set-property>
java.util.List<String> for response
java.util.List<java.util.Map<String, Object>> containing list of key property names and values for request
Count<resource-uri>/$count
java.lang.Long

...

NameTypeDescription
data
Object
Data with appropriate type used to create or modify the OData resource
keyPredicate
String
Key predicate to create a parameterized OData resource endpoint. Useful for create/update operations where the key predicate value is dynamically provided in a header
queryParams
java.util.Map<String, String>
OData system options and custom query options. For more information see OData 2.0 URI Conventions
resourcePath
String
OData resource path, may or may not contain key predicate
*
String
Any other URI option is treated as a query parameter and added to query parameter map, overwriting an existing specified entries in a queryParams option, if also specified

Consumer Endpoints

Only the read endpoint can be used as a consumer endpoint. Consumer endpoints can use Scheduled Poll Consumer Options with a consumer. prefix to schedule endpoint invocation. By default consumer endpoints that return an array or collection will generate one exchange per element, and their routes will be executed once for each exchange. This behavior can be disabled by setting the endpoint property consumer.splitResult=false

...

The following route reads top 5 entries from the Manufacturer feed ordered by ascending Name property. 

 

from("direct:...")
    .setHeader("CamelOlingo2.$top", "5");
    .to("olingo2://read/Manufacturers?orderBy=Name%20asc");

 

The following route reads Manufacturer entry using the key property value in incoming id header. 

 

from("direct:...")
    .setHeader("CamelOlingo2.keyPredicate", header("id"))
    .to("olingo2://read/Manufacturers");

 

The following route creates Manufacturer entry using the java.util.Map<String, Object> in body message. 

 

from("direct:...")
    .to("olingo2://create/Manufacturers");

 

The following route polls Manufacturer delta feed every 30 seconds. The bean blah updates the bean paramsBean to add an updated !deltatoken property with the value returned in the ODataDeltaFeed result. Since the initial delta token is not known, the consumer endpoint will produce an ODataFeed value the first time, and ODataDeltaFeed on subsequent polls.