Package org.apache.olingo.odata2.core.ep
Class BasicEntityProvider
- java.lang.Object
-
- org.apache.olingo.odata2.core.ep.BasicEntityProvider
-
public class BasicEntityProvider extends Object
Provider for all basic (content type independent) entity provider methods.
-
-
Constructor Summary
Constructors Constructor Description BasicEntityProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]readBinary(InputStream content)Reads binary data from an input stream.ObjectreadPropertyValue(EdmProperty edmProperty, InputStream content, Class<?> typeMapping)Reads an unformatted value of an EDM property as binary or as content typetext/plain.StringreadText(InputStream content)Reads text from an input stream.ODataResponsewriteBinary(String mimeType, byte[] data)Write binary content with content type header set to givenmime typeparameter.ODataResponsewriteMetadata(List<Schema> schemas, Map<String,String> predefinedNamespaces)Writes the metadata in XML format.ODataResponsewriteMetadata(DataServices serviceMetadata, Map<String,String> predefinedNamespaces)Writes the metadata in XML format.ODataResponsewritePropertyValue(EdmProperty edmProperty, Object value)Write property as binary or as content typetext/plain.ODataResponsewriteText(String value)Write text value as content typetext/plainwith charset parameter set to "utf-8".
-
-
-
Method Detail
-
readBinary
public byte[] readBinary(InputStream content) throws EntityProviderException
Reads binary data from an input stream.- Parameters:
content- the content input stream- Returns:
- the binary data
- Throws:
EntityProviderException
-
readText
public String readText(InputStream content) throws EntityProviderException
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
public ODataResponse writeText(String value) throws EntityProviderException
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
public ODataResponse writeBinary(String mimeType, byte[] data) throws EntityProviderException
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 EntityProviderException
Writes 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 EntityProviderException
Writes 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
-
-