org.apache.olingo.odata2.api.ep
Interface EntityProvider.EntityProviderInterface

Enclosing class:
EntityProvider

public static interface EntityProvider.EntityProviderInterface

(Internal) interface for all EntityProvider necessary read and write methods for accessing entities defined in an Entity Data Model.

This interface is declared as inner interface (class) because the EntityProvider provides a convenience access (and basic implementation for XML and JSON format) to all interface methods.
Hence, it is not recommended to implement this interface (it is possible to implement it and to provide an own EntityProvider for support of additional formats but it is recommended to handle additional formats directly within an ODataProcessor).


Method Summary
 List<BatchRequestPart> parseBatchRequest(String contentType, InputStream content, EntityProviderBatchProperties properties)
          Parse Batch Request body inputStream (as InputStream) and provide a list of Batch Parts as BatchPart
 List<BatchSingleResponse> parseBatchResponse(String contentType, InputStream content)
          Parse Batch Response body (as InputStream) and provide a list of single responses as BatchSingleResponse
 byte[] readBinary(InputStream content)
          Read (de-serialize) binary data from content (as InputStream) and provide it as byte[].
 ODataDeltaFeed readDeltaFeed(String contentType, EdmEntitySet entitySet, InputStream content, EntityProviderReadProperties properties)
          Read (de-serialize) a delta data feed from content (as InputStream) in specified format (given as contentType) based on entity data model (given as EdmEntitySet) and provide this data as ODataDeltaFeed.
 ODataEntry readEntry(String contentType, EdmEntitySet entitySet, InputStream content, EntityProviderReadProperties properties)
          Reads (de-serializes) data from content (as InputStream) in specified format (given as contentType) based on entity data model (given as EdmEntitySet) and provides this data as ODataEntry.
 ODataErrorContext readErrorDocument(InputStream errorDocument, String contentType)
          Read (de-serialize) data from error document as InputStream and provide according ODataErrorContext.
 ODataFeed readFeed(String contentType, EdmEntitySet entitySet, InputStream content, EntityProviderReadProperties properties)
          Read (de-serialize) a data feed from content (as InputStream) in specified format (given as contentType) based on entity data model (given as EdmEntitySet) and provide this data as ODataFeed.
 Object readFunctionImport(String contentType, EdmFunctionImport functionImport, InputStream content, EntityProviderReadProperties properties)
          Reads (de-serializes) function-import data from content (as InputStream) in specified format (given as contentType) based on entity data model (given as EdmFunctionImport) and provide this data as Object.
 String readLink(String contentType, EdmEntitySet entitySet, InputStream content)
          Read (de-serialize) a link from content (as InputStream) in specified format (given as contentType) based on entity data model (given as EdmEntitySet) and provide the link as String.
 List<String> readLinks(String contentType, EdmEntitySet entitySet, InputStream content)
          Read (de-serialize) all links from content (as InputStream) in specified format (given as contentType) based on entity data model (given as EdmEntitySet) and provide the link as List of Strings.
 Edm readMetadata(InputStream inputStream, boolean validate)
          Read (de-serialize) data from metadata inputStream (as InputStream) and provide Edm as Edm
 Map<String,Object> readProperty(String contentType, EdmProperty edmProperty, InputStream content, EntityProviderReadProperties properties)
          Read (de-serialize) properties from content (as InputStream) in specified format (given as contentType) based on entity data model (given as EdmProperty) and provide this data as Map which contains the read data in form of property name to property value mapping.
 Object readPropertyValue(EdmProperty edmProperty, InputStream content, Class<?> typeMapping)
          Read (de-serialize) a property value from content (as InputStream) in format text/plain based on entity data model (given as EdmProperty) and provide this data as Object.
 ServiceDocument readServiceDocument(InputStream serviceDocument, String contentType)
          Read (de-serialize) data from service document inputStream (as InputStream) and provide ServiceDocument as ServiceDocument
 InputStream writeBatchRequest(List<BatchPart> batchParts, String boundary)
          Create Batch Request body as InputStream.
 ODataResponse writeBatchResponse(List<BatchResponsePart> batchResponseParts)
          Write responses of Batch Response Parts in Batch Response as ODataResponse.
 ODataResponse writeBinary(String mimeType, byte[] data)
          Write binary content with content type header set to given mime type parameter.
 ODataResponse writeEntry(String contentType, EdmEntitySet entitySet, Map<String,Object> data, EntityProviderWriteProperties properties)
          Write given data (which is given in form of a Map for which contains all properties as property name to property value mapping) for the entry in the specified format (given as contentType) based on entity data model for an entity set (given as EdmEntitySet) and properties for this entity provider (given as EntityProviderWriteProperties).
 ODataResponse writeErrorDocument(ODataErrorContext context)
          Serializes an error message according to the OData standard.
 ODataResponse writeFeed(String contentType, EdmEntitySet entitySet, List<Map<String,Object>> data, EntityProviderWriteProperties properties)
          Write given data (which is given in form of a List with a Map for each entity.
 ODataResponse writeFunctionImport(String contentType, EdmFunctionImport functionImport, Object data, EntityProviderWriteProperties properties)
          Write data result (given as Object) of function import based on return type of EdmFunctionImport in specified format (given as contentType).
 ODataResponse writeLink(String contentType, EdmEntitySet entitySet, Map<String,Object> data, EntityProviderWriteProperties properties)
          Write link for key property based on entity data model for an entity set (given as EdmEntitySet) in the specified format (given as contentType).
 ODataResponse writeLinks(String contentType, EdmEntitySet entitySet, List<Map<String,Object>> data, EntityProviderWriteProperties properties)
          Write all links for key property based on entity data model for an entity set (given as EdmEntitySet) in the specified format (given as contentType) for a set of entries.
 ODataResponse writeMetadata(List<Schema> schemas, Map<String,String> predefinedNamespaces)
          Write metadata document in XML format for the given schemas and the provided predefined namespaces at the EDMX element.
 ODataResponse writeProperty(String contentType, EdmProperty edmProperty, Object value)
          Write given value (which is given in form of an Object) for the property in the specified format (given as contentType) based on given entity data model for an entity property (given as EdmProperty).
 ODataResponse writePropertyValue(EdmProperty edmProperty, Object value)
          Write property as content type application/octet-stream or text/plain.
 ODataResponse writeServiceDocument(String contentType, Edm edm, String serviceRoot)
          Write service document based on given Edm and service root as given content type.
 ODataResponse writeText(String value)
          Write text value as content type text/plain.
 

Method Detail

writeMetadata

ODataResponse writeMetadata(List<Schema> schemas,
                            Map<String,String> predefinedNamespaces)
                            throws EntityProviderException
Write metadata document in XML format for the given schemas and the provided predefined namespaces at the EDMX element. PredefinedNamespaces is of type Map<prefix,namespace> and may be null or an empty Map.

Parameters:
schemas - all XML schemas which will be written
predefinedNamespaces - type of Map<prefix,namespace> and may be null or an empty Map
Returns:
resulting ODataResponse with written metadata content.
Throws:
EntityProviderException - if writing of data (serialization) fails

writeServiceDocument

ODataResponse writeServiceDocument(String contentType,
                                   Edm edm,
                                   String serviceRoot)
                                   throws EntityProviderException
Write service document based on given Edm and service root as given content type.

Parameters:
contentType - format in which service document should be written
edm - entity data model to be written
serviceRoot - service root for the written service document
Returns:
resulting ODataResponse with written service document content.
Throws:
EntityProviderException - if writing of data (serialization) fails

writePropertyValue

ODataResponse writePropertyValue(EdmProperty edmProperty,
                                 Object value)
                                 throws EntityProviderException
Write property as content type application/octet-stream or text/plain.

Parameters:
edmProperty - entity data model for to be written property
value - property which will be written
Returns:
resulting ODataResponse with written property value content.
Throws:
EntityProviderException - if writing of data (serialization) fails

writeText

ODataResponse writeText(String value)
                        throws EntityProviderException
Write text value as content type text/plain.

Parameters:
value - text value which will be written
Returns:
resulting ODataResponse with written text/plain content.
Throws:
EntityProviderException - if writing of data (serialization) fails

writeBinary

ODataResponse writeBinary(String mimeType,
                          byte[] data)
                          throws EntityProviderException
Write binary content with content type header set to given mime type parameter.

Parameters:
mimeType - mime type which is written and used as content type header information.
data - which is written to ODataResponse.
Returns:
response object resulting ODataResponse with written binary content.
Throws:
EntityProviderException - if writing of data (serialization) fails

writeFeed

ODataResponse writeFeed(String contentType,
                        EdmEntitySet entitySet,
                        List<Map<String,Object>> data,
                        EntityProviderWriteProperties properties)
                        throws EntityProviderException
Write given data (which is given in form of a List with a Map for each entity. Such a Map contains all properties [as property name to property value mapping] for the entry) in the specified format (given as contentType) based on given entity data model for an entity set (given as EdmEntitySet) and properties for this entity provider (given as EntityProviderWriteProperties).

Parameters:
contentType - format in which the feed should be written
entitySet - entity data model for given entity data set
data - set of entries in form of a List with a Map for each entity (such a Map contains all properties [as property name to property value mapping).
properties - additional properties necessary for writing of data
Returns:
resulting ODataResponse with written feed content.
Throws:
EntityProviderException - if writing of data (serialization) fails

writeEntry

ODataResponse writeEntry(String contentType,
                         EdmEntitySet entitySet,
                         Map<String,Object> data,
                         EntityProviderWriteProperties properties)
                         throws EntityProviderException
Write given data (which is given in form of a Map for which contains all properties as property name to property value mapping) for the entry in the specified format (given as contentType) based on entity data model for an entity set (given as EdmEntitySet) and properties for this entity provider (given as EntityProviderWriteProperties).

Parameters:
contentType - format in which the entry should be written
entitySet - entity data model for given entity data set
data - which contains all properties as property name to property value mapping for the entry
properties - additional properties necessary for writing of data
Returns:
resulting ODataResponse with written entry content
Throws:
EntityProviderException - if writing of data (serialization) fails

writeProperty

ODataResponse writeProperty(String contentType,
                            EdmProperty edmProperty,
                            Object value)
                            throws EntityProviderException
Write given value (which is given in form of an Object) for the property in the specified format (given as contentType) based on given entity data model for an entity property (given as EdmProperty).

Parameters:
contentType - format in which the property should be written
edmProperty - entity data model for given property
value - data which is written
Returns:
resulting ODataResponse with written property content.
Throws:
EntityProviderException - if writing of data (serialization) fails

writeLink

ODataResponse writeLink(String contentType,
                        EdmEntitySet entitySet,
                        Map<String,Object> data,
                        EntityProviderWriteProperties properties)
                        throws EntityProviderException
Write link for key property based on entity data model for an entity set (given as EdmEntitySet) in the specified format (given as contentType). The necessary key property values must be provided within the data (in the form of property name to property value mapping) and properties for this entity provider must be set (given as EntityProviderWriteProperties).

Parameters:
contentType - format in which the entry should be written
entitySet - entity data model for given entity data set
data - which contains all key properties as property name to property value mapping for the entry
properties - additional properties necessary for writing of data
Returns:
resulting ODataResponse with written link content.
Throws:
EntityProviderException - if writing of data (serialization) fails

writeLinks

ODataResponse writeLinks(String contentType,
                         EdmEntitySet entitySet,
                         List<Map<String,Object>> data,
                         EntityProviderWriteProperties properties)
                         throws EntityProviderException
Write all links for key property based on entity data model for an entity set (given as EdmEntitySet) in the specified format (given as contentType) for a set of entries. The necessary key property values must be provided within the data (in form of a List with a Map for each entry. Such a Map contains all key properties [as property name to property value mapping] for the entry) and properties for this entity provider must be set (given as EntityProviderWriteProperties).

Parameters:
contentType - format in which the entry should be written
entitySet - entity data model for given entity data set
data - set of entries in form of a List with a Map for each entry (such a Map contains all key properties [as property name to property value mapping).
properties - additional properties necessary for writing of data
Returns:
resulting ODataResponse with written links content.
Throws:
EntityProviderException - if writing of data (serialization) fails

writeFunctionImport

ODataResponse writeFunctionImport(String contentType,
                                  EdmFunctionImport functionImport,
                                  Object data,
                                  EntityProviderWriteProperties properties)
                                  throws EntityProviderException
Write data result (given as Object) of function import based on return type of EdmFunctionImport in specified format (given as contentType). Additional properties for this entity provider must be set (given as EntityProviderWriteProperties).

Parameters:
contentType - format in which the entry should be written
functionImport - entity data model for executed function import
data - result of function import
properties - additional properties necessary for writing of data
Returns:
resulting ODataResponse with written function import result content.
Throws:
EntityProviderException - if writing of data (serialization) fails

readFeed

ODataFeed readFeed(String contentType,
                   EdmEntitySet entitySet,
                   InputStream content,
                   EntityProviderReadProperties properties)
                   throws EntityProviderException
Read (de-serialize) a data feed from content (as InputStream) in specified format (given as contentType) based on entity data model (given as EdmEntitySet) and provide this data as ODataFeed.

Parameters:
contentType - format of content in the given input stream.
entitySet - entity data model for entity set to be read
content - feed data in form of an InputStream which contains the data in specified format
properties - additional properties necessary for reading content from InputStream into Map.
Returns:
an ODataFeed object
Throws:
EntityProviderException - if reading of data (de-serialization) fails

readDeltaFeed

ODataDeltaFeed readDeltaFeed(String contentType,
                             EdmEntitySet entitySet,
                             InputStream content,
                             EntityProviderReadProperties properties)
                             throws EntityProviderException
Read (de-serialize) a delta data feed from content (as InputStream) in specified format (given as contentType) based on entity data model (given as EdmEntitySet) and provide this data as ODataDeltaFeed.

Parameters:
contentType - format of content in the given input stream.
entitySet - entity data model for entity set to be read
content - delta feed data in form of an InputStream which contains the data in specified format
properties - additional properties necessary for reading content from InputStream into Map.
Returns:
an ODataDeltaFeed object
Throws:
EntityProviderException - if reading of data (de-serialization) fails

readEntry

ODataEntry readEntry(String contentType,
                     EdmEntitySet entitySet,
                     InputStream content,
                     EntityProviderReadProperties properties)
                     throws EntityProviderException
Reads (de-serializes) data from content (as InputStream) in specified format (given as contentType) based on entity data model (given as EdmEntitySet) and provides this data as ODataEntry. Does not return complete entry data but only data present in the de-serialized content.

Parameters:
contentType - format of content in the given input stream
entitySet - entity data model for entity set to be read
content - data in form of an InputStream which contains the data in specified format
properties - additional properties necessary for reading content from InputStream into Map.
Returns:
entry as ODataEntry
Throws:
EntityProviderException - if reading of data (de-serialization) fails

readProperty

Map<String,Object> readProperty(String contentType,
                                EdmProperty edmProperty,
                                InputStream content,
                                EntityProviderReadProperties properties)
                                throws EntityProviderException
Read (de-serialize) properties from content (as InputStream) in specified format (given as contentType) based on entity data model (given as EdmProperty) and provide this data as Map which contains the read data in form of property name to property value mapping.

Parameters:
contentType - format of content in the given input stream.
edmProperty - entity data model for entity property to be read
content - data in form of an InputStream which contains the data in specified format
properties - additional properties necessary for reading content from InputStream into Map.
Returns:
property as name and value in a map
Throws:
EntityProviderException - if reading of data (de-serialization) fails

readPropertyValue

Object readPropertyValue(EdmProperty edmProperty,
                         InputStream content,
                         Class<?> typeMapping)
                         throws EntityProviderException
Read (de-serialize) a property value from content (as InputStream) in format text/plain based on entity data model (given as EdmProperty) and provide this data as Object.

Parameters:
edmProperty - entity data model for entity property to be read
content - data in form of an InputStream which contains the data in format text/plain
typeMapping - defines the mapping for this edm property to a java class which should be used during read of the content. If according edm property can not be read into given java class an EntityProviderException is thrown. Supported mappings are documented in EdmSimpleType.
Returns:
property value as object
Throws:
EntityProviderException - if reading of data (de-serialization) fails

readFunctionImport

Object readFunctionImport(String contentType,
                          EdmFunctionImport functionImport,
                          InputStream content,
                          EntityProviderReadProperties properties)
                          throws EntityProviderException
Reads (de-serializes) function-import data from content (as InputStream) in specified format (given as contentType) based on entity data model (given as EdmFunctionImport) and provide this data as Object.

Parameters:
contentType - format of content in the given input stream.
functionImport - entity data model for Function Import to be read
content - data in form of an InputStream which contains the data in specified format
properties - additional properties necessary for reading content from InputStream into Map. Must not be null.
Returns:
data as Object
Throws:
EntityProviderException - if reading of data (de-serialization) fails

readLink

String readLink(String contentType,
                EdmEntitySet entitySet,
                InputStream content)
                throws EntityProviderException
Read (de-serialize) a link from content (as InputStream) in specified format (given as contentType) based on entity data model (given as EdmEntitySet) and provide the link as String.

Parameters:
contentType - format of content in the given input stream.
entitySet - entity data model for entity property to be read
content - data in form of an InputStream which contains the data in specified format
Returns:
link as string
Throws:
EntityProviderException - if reading of data (de-serialization) fails

readLinks

List<String> readLinks(String contentType,
                       EdmEntitySet entitySet,
                       InputStream content)
                       throws EntityProviderException
Read (de-serialize) all links from content (as InputStream) in specified format (given as contentType) based on entity data model (given as EdmEntitySet) and provide the link as List of Strings.

Parameters:
contentType - format of content in the given input stream.
entitySet - entity data model for entity property to be read
content - data in form of an InputStream which contains the data in specified format
Returns:
links as List of Strings
Throws:
EntityProviderException - if reading of data (de-serialization) fails

readMetadata

Edm readMetadata(InputStream inputStream,
                 boolean validate)
                 throws EntityProviderException
Read (de-serialize) data from metadata inputStream (as InputStream) and provide Edm as Edm

Parameters:
inputStream - the given input stream
validate - has to be true if metadata should be validated
Returns:
Edm as Edm
Throws:
EntityProviderException - if reading of data (de-serialization) fails

readBinary

byte[] readBinary(InputStream content)
                  throws EntityProviderException
Read (de-serialize) binary data from content (as InputStream) and provide it as byte[].

Parameters:
content - data in form of an InputStream which contains the binary data
Returns:
binary data as bytes
Throws:
EntityProviderException - if reading of data (de-serialization) fails

writeErrorDocument

ODataResponse writeErrorDocument(ODataErrorContext context)

Serializes an error message according to the OData standard.

Parameters:
context - contains error details see ODataErrorContext
Returns:
an ODataResponse containing the serialized error message

readServiceDocument

ServiceDocument readServiceDocument(InputStream serviceDocument,
                                    String contentType)
                                    throws EntityProviderException
Read (de-serialize) data from service document inputStream (as InputStream) and provide ServiceDocument as ServiceDocument

Parameters:
serviceDocument - the given input stream
contentType - format of content in the given input stream
Returns:
ServiceDocument as ServiceDocument
Throws:
EntityProviderException - if reading of data (de-serialization) fails

parseBatchRequest

List<BatchRequestPart> parseBatchRequest(String contentType,
                                         InputStream content,
                                         EntityProviderBatchProperties properties)
                                         throws BatchException
Parse Batch Request body inputStream (as InputStream) and provide a list of Batch Parts as BatchPart

Parameters:
contentType - format of content in the given input stream
content - request body
properties - additional properties necessary for parsing. Must not be null.
Returns:
list of BatchPart
Throws:
BatchException - if parsing fails

writeBatchResponse

ODataResponse writeBatchResponse(List<BatchResponsePart> batchResponseParts)
                                 throws BatchException
Write responses of Batch Response Parts in Batch Response as ODataResponse. Batch Response body matches one-to-one with the corresponding Batch Request body

Parameters:
batchResponseParts - a list of BatchResponsePart
Returns:
Batch Response as ODataResponse
Throws:
BatchException

writeBatchRequest

InputStream writeBatchRequest(List<BatchPart> batchParts,
                              String boundary)
Create Batch Request body as InputStream.

Parameters:
batchParts - a list of BatchPartRequests BatchPart
boundary -
Returns:
Batch Request as InputStream

parseBatchResponse

List<BatchSingleResponse> parseBatchResponse(String contentType,
                                             InputStream content)
                                             throws BatchException
Parse Batch Response body (as InputStream) and provide a list of single responses as BatchSingleResponse

Parameters:
content - response body
contentType - format of content in the given input stream (incl. boundary parameter)
Returns:
list of BatchSingleResponse
Throws:
BatchException

readErrorDocument

ODataErrorContext readErrorDocument(InputStream errorDocument,
                                    String contentType)
                                    throws EntityProviderException
Read (de-serialize) data from error document as InputStream and provide according ODataErrorContext.

Parameters:
errorDocument - error document which is read
contentType - format of content in the given input stream
Returns:
read error document
Throws:
EntityProviderException - if reading of data (de-serialization) fails


Copyright © 2013-2015 The Apache Software Foundation. All Rights Reserved.