Package org.apache.olingo.odata2.core.ep
Class BasicEntityProvider
java.lang.Object
org.apache.olingo.odata2.core.ep.BasicEntityProvider
Provider for all basic (content type independent) entity provider methods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]readBinary(InputStream content) Reads binary data from an input stream.readPropertyValue(EdmProperty edmProperty, InputStream content, Class<?> typeMapping) Reads an unformatted value of an EDM property as binary or as content typetext/plain.readText(InputStream content) Reads text from an input stream.writeBinary(String mimeType, byte[] data) Write binary content with content type header set to givenmime typeparameter.Writes the metadata in XML format.writeMetadata(DataServices serviceMetadata, Map<String, String> predefinedNamespaces) Writes the metadata in XML format.writePropertyValue(EdmProperty edmProperty, Object value) Write property as binary or as content typetext/plain.Write text value as content typetext/plainwith charset parameter set to "utf-8".
-
Constructor Details
-
BasicEntityProvider
public BasicEntityProvider()
-
-
Method Details
-
readBinary
Reads binary data from an input stream.- Parameters:
content- the content input stream- Returns:
- the binary data
- Throws:
EntityProviderException
-
readText
Reads text from an input stream.- Parameters:
content- the content input stream- Returns:
- text as string from
InputStream - Throws:
EntityProviderException
-
readPropertyValue
public Object readPropertyValue(EdmProperty edmProperty, InputStream content, Class<?> typeMapping) throws EntityProviderException Reads an unformatted value of an EDM property as binary or as content typetext/plain.- Parameters:
edmProperty- the EDM propertycontent- the content input streamtypeMapping-- Returns:
- the value as the proper system data type
- Throws:
EntityProviderException
-
writePropertyValue
public ODataResponse writePropertyValue(EdmProperty edmProperty, Object value) throws EntityProviderException Write property as binary or as content typetext/plain.- Parameters:
edmProperty- the EDM propertyvalue- its value- Returns:
- resulting
ODataResponsewith written content - Throws:
EntityProviderException
-
writeText
Write text value as content typetext/plainwith charset parameter set to "utf-8".- Parameters:
value- the string that is written toODataResponse- Returns:
- resulting
ODataResponsewith written text content - Throws:
EntityProviderException
-
writeBinary
Write binary content with content type header set to givenmime typeparameter.- Parameters:
mimeType- MIME type which is written and used as content type header informationdata- data is written toODataResponse- Returns:
- resulting
ODataResponsewith written binary content - Throws:
EntityProviderException
-
writeMetadata
public ODataResponse writeMetadata(List<Schema> schemas, Map<String, String> predefinedNamespaces) throws EntityProviderExceptionWrites the metadata in XML format. Predefined namespaces is of type Map<prefix,namespace> and may be null or an empty Map.- Parameters:
schemas-predefinedNamespaces-- Returns:
- resulting
ODataResponsewith written metadata content - Throws:
EntityProviderException
-
writeMetadata
public ODataResponse writeMetadata(DataServices serviceMetadata, Map<String, String> predefinedNamespaces) throws EntityProviderExceptionWrites the metadata in XML format. Predefined namespaces is of type Map<prefix,namespace> and may be null or an empty Map.- Parameters:
serviceMetadata-predefinedNamespaces-- Returns:
- resulting
ODataResponsewith written metadata content - Throws:
EntityProviderException
-