org.odata4j.producer
Interface ODataProducer

All Known Implementing Classes:
InMemoryProducer, JPAProducer

public interface ODataProducer

Implement ODataProducer on the server-side to create a new java-based OData producer.

The interface contains methods for clients to retrieve/query entities and to introspect service metadata (for read-only services); as well as methods to create/modify/delete entities (for read-write services).

Note that all client requests/responses are normalized - all details involving the OData http protocol, query expression model, EDM structure are handled by odata4j at a higher level.


Method Summary
 void close()
          Releases any resources managed by this producer.
 EntityResponse createEntity(String entitySetName, OEntity entity)
          Creates a new OData entity.
 EntityResponse createEntity(String entitySetName, OEntityKey entityKey, String navProp, OEntity entity)
          Creates a new OData entity as a reference of an existing entity, implicitly linked to the existing entity by a navigation property.
 void deleteEntity(String entitySetName, OEntityKey entityKey)
          Deletes an existing entity.
 EntitiesResponse getEntities(String entitySetName, QueryInfo queryInfo)
          Gets all the entities for a given set matching the query information.
 EntityResponse getEntity(String entitySetName, OEntityKey entityKey)
          Obtains a single entity based on its type and key.
 EdmDataServices getMetadata()
          Obtains the service metadata for this producer.
 BaseResponse getNavProperty(String entitySetName, OEntityKey entityKey, String navProp, QueryInfo queryInfo)
          Given a specific entity, follow one of its navigation properties, applying constraints as appropriate.
 void mergeEntity(String entitySetName, OEntity entity)
          Modifies an existing entity using merge semantics.
 void updateEntity(String entitySetName, OEntity entity)
          Modifies an existing entity using update semantics.
 

Method Detail

close

void close()
Releases any resources managed by this producer.


createEntity

EntityResponse createEntity(String entitySetName,
                            OEntity entity)
Creates a new OData entity.

Parameters:
entitySetName - the entity-set name
entity - the request entity sent from the client
Returns:
the newly-created entity, fully populated with the key and default properties
See Also:
[odata.org] Creating new Entries

createEntity

EntityResponse createEntity(String entitySetName,
                            OEntityKey entityKey,
                            String navProp,
                            OEntity entity)
Creates a new OData entity as a reference of an existing entity, implicitly linked to the existing entity by a navigation property.

Parameters:
entitySetName - the entity-set name of the existing entity
entityKey - the entity-key of the existing entity
navProp - the navigation property off of the existing entity
entity - the request entity sent from the client
Returns:
the newly-created entity, fully populated with the key and default properties, and linked to the existing entity
See Also:
[odata.org] Creating new Entries

deleteEntity

void deleteEntity(String entitySetName,
                  OEntityKey entityKey)
Deletes an existing entity.

Parameters:
entitySetName - the entity-set name of the entity
entityKey - the entity-key of the entity
See Also:
[odata.org] Deleting Entries

getEntities

EntitiesResponse getEntities(String entitySetName,
                             QueryInfo queryInfo)
Gets all the entities for a given set matching the query information.

Parameters:
entitySetName - the entity-set name for entities to return
queryInfo - the additional constraints to apply to the entities
Returns:
a packaged collection of entities to pass back to the client

getEntity

EntityResponse getEntity(String entitySetName,
                         OEntityKey entityKey)
Obtains a single entity based on its type and key.

Parameters:
entitySetName - the entity-set name for the entity to return
entityKey - the unique entity-key within the set
Returns:
the matching entity

getMetadata

EdmDataServices getMetadata()
Obtains the service metadata for this producer.

Returns:
a fully-constructed metadata object

getNavProperty

BaseResponse getNavProperty(String entitySetName,
                            OEntityKey entityKey,
                            String navProp,
                            QueryInfo queryInfo)
Given a specific entity, follow one of its navigation properties, applying constraints as appropriate. Return the resulting entity, entities, or property value.

Parameters:
entitySetName - the entity-set of the entity to start with
entityKey - the unique entity-key of the entity to start with
navProp - the navigation property to follow
queryInfo - additional constraints to apply to the result
Returns:
the resulting entity, entities, or property value

mergeEntity

void mergeEntity(String entitySetName,
                 OEntity entity)
Modifies an existing entity using merge semantics.

Parameters:
entitySetName - the entity-set name
entity - the entity modifications sent from the client
See Also:
[odata.org] Updating Entries

updateEntity

void updateEntity(String entitySetName,
                  OEntity entity)
Modifies an existing entity using update semantics.

Parameters:
entitySetName - the entity-set name
entity - the entity modifications sent from the client
See Also:
[odata.org] Updating Entries


http://odata4j.org