You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2013/09/24 14:42:57 UTC
[30/51] [partial] Refactored project structure
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProvider.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProvider.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProvider.java
deleted file mode 100644
index c37a8bc..0000000
--- a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProvider.java
+++ /dev/null
@@ -1,834 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.api.ep;
-
-import java.io.InputStream;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.odata2.api.batch.BatchException;
-import org.apache.olingo.odata2.api.batch.BatchRequestPart;
-import org.apache.olingo.odata2.api.batch.BatchResponsePart;
-import org.apache.olingo.odata2.api.client.batch.BatchPart;
-import org.apache.olingo.odata2.api.client.batch.BatchSingleResponse;
-import org.apache.olingo.odata2.api.edm.Edm;
-import org.apache.olingo.odata2.api.edm.EdmEntitySet;
-import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
-import org.apache.olingo.odata2.api.edm.EdmProperty;
-import org.apache.olingo.odata2.api.edm.provider.Schema;
-import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
-import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
-import org.apache.olingo.odata2.api.processor.ODataErrorContext;
-import org.apache.olingo.odata2.api.processor.ODataResponse;
-import org.apache.olingo.odata2.api.rt.RuntimeDelegate;
-import org.apache.olingo.odata2.api.servicedocument.ServiceDocument;
-
-/**
- * <p>Entity Provider</p>
- * <p>An {@link EntityProvider} provides all necessary <b>read</b> and <b>write</b>
- * methods for accessing the entities defined in an <code>Entity Data Model</code>.
- * Therefore this library provides (in its <code>core</code> packages) as convenience
- * basic entity providers for accessing entities in the <b>XML</b> and <b>JSON</b>
- * formats.</p>
- *
- */
-public final class EntityProvider {
-
- /**
- * (Internal) interface for all {@link EntityProvider} necessary <b>read</b> and <b>write</b> methods for accessing
- * entities defined in an <code>Entity Data Model</code>.
- * <p>
- * This interface is declared as inner interface (class) because the {@link EntityProvider} provides a convenience
- * access (and basic implementation for <b>XML</b> and <b>JSON</b> format) to all interface methods.
- * <br/>
- * Hence, it is <b>not recommended</b> to implement this interface (it is possible to implement it and to provide an
- * own {@link EntityProvider} for support of additional formats but it is recommended to
- * handle additional formats directly within an <code>ODataProcessor</code>).
- */
- public interface EntityProviderInterface {
-
- /**
- * Write metadata document in XML format for the given schemas and the provided predefined
- * namespaces at the EDMX element. PredefinedNamespaces is of type
- * Map{@literal <}prefix,namespace{@literal >} and may be null or an empty Map.
- *
- * @param schemas all XML schemas which will be written
- * @param predefinedNamespaces type of Map{@literal <}prefix,namespace{@literal >} and may be null or an empty Map
- * @return resulting {@link ODataResponse} with written metadata content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- ODataResponse writeMetadata(List<Schema> schemas, Map<String, String> predefinedNamespaces)
- throws EntityProviderException;
-
- /**
- * Write service document based on given {@link Edm} and <code>service root</code> as
- * given content type.
- *
- * @param contentType format in which service document should be written
- * @param edm entity data model to be written
- * @param serviceRoot service root for the written service document
- * @return resulting {@link ODataResponse} with written service document content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- ODataResponse writeServiceDocument(String contentType, Edm edm, String serviceRoot) throws EntityProviderException;
-
- /**
- * Write property as content type <code>application/octet-stream</code> or <code>text/plain</code>.
- *
- * @param edmProperty entity data model for to be written property
- * @param value property which will be written
- * @return resulting {@link ODataResponse} with written property value content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- ODataResponse writePropertyValue(EdmProperty edmProperty, Object value) throws EntityProviderException;
-
- /**
- * Write text value as content type <code>text/plain</code>.
- *
- * @param value text value which will be written
- * @return resulting {@link ODataResponse} with written text/plain content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- ODataResponse writeText(String value) throws EntityProviderException;
-
- /**
- * Write binary content with content type header set to given <code>mime type</code> parameter.
- *
- * @param mimeType mime type which is written and used as content type header information.
- * @param data which is written to {@link ODataResponse}.
- * @return response object resulting {@link ODataResponse} with written binary content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- ODataResponse writeBinary(String mimeType, byte[] data) throws EntityProviderException;
-
- /**
- * Write given <code>data</code> (which is given in form of a {@link List} with a {@link Map} for each entity. Such
- * a {@link Map} contains all properties [as <code>property name</code> to <code>property value</code> mapping] for
- * the entry) in the specified
- * format (given as <code>contentType</code>) based on given <code>entity data model for an entity set</code> (given
- * as {@link EdmEntitySet})
- * and <code>properties</code> for this entity provider (given as {@link EntityProviderWriteProperties}).
- *
- * @param contentType format in which the feed should be written
- * @param entitySet entity data model for given entity data set
- * @param data set of entries in form of a {@link List} with a {@link Map} for each entity (such a {@link Map}
- * contains all properties [as <code>property name</code> to <code>property value</code> mapping).
- * @param properties additional properties necessary for writing of data
- * @return resulting {@link ODataResponse} with written feed content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- ODataResponse writeFeed(String contentType, EdmEntitySet entitySet, List<Map<String, Object>> data,
- EntityProviderWriteProperties properties) throws EntityProviderException;
-
- /**
- * Write given <code>data</code> (which is given in form of a {@link Map} for which contains all properties
- * as <code>property name</code> to <code>property value</code> mapping) for the entry in the specified
- * format (given as <code>contentType</code>) based on <code>entity data model for an entity set</code> (given as
- * {@link EdmEntitySet})
- * and <code>properties</code> for this entity provider (given as {@link EntityProviderWriteProperties}).
- *
- * @param contentType format in which the entry should be written
- * @param entitySet entity data model for given entity data set
- * @param data which contains all properties as <code>property name</code> to <code>property value</code> mapping
- * for the entry
- * @param properties additional properties necessary for writing of data
- * @return resulting {@link ODataResponse} with written entry content
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- ODataResponse writeEntry(String contentType, EdmEntitySet entitySet, Map<String, Object> data,
- EntityProviderWriteProperties properties) throws EntityProviderException;
-
- /**
- * Write given <code>value</code> (which is given in form of an {@link Object}) for the property in the specified
- * format (given as <code>contentType</code>) based on given <code>entity data model for an entity property</code>
- * (given as {@link EdmProperty}).
- *
- * @param contentType format in which the property should be written
- * @param edmProperty entity data model for given property
- * @param value data which is written
- * @return resulting {@link ODataResponse} with written property content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- ODataResponse writeProperty(String contentType, EdmProperty edmProperty, Object value)
- throws EntityProviderException;
-
- /**
- * Write <b>link</b> for key property based on <code>entity data model for an entity set</code> (given as
- * {@link EdmEntitySet})
- * in the specified format (given as <code>contentType</code>).
- * The necessary key property values must be provided within the <code>data</code> (in the form of <code>property
- * name</code>
- * to <code>property value</code> mapping) and <code>properties</code> for this entity provider must be set
- * (given as {@link EntityProviderWriteProperties}).
- *
- * @param contentType format in which the entry should be written
- * @param entitySet entity data model for given entity data set
- * @param data which contains all key properties as <code>property name</code> to <code>property value</code>
- * mapping for the entry
- * @param properties additional properties necessary for writing of data
- * @return resulting {@link ODataResponse} with written link content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- ODataResponse writeLink(String contentType, EdmEntitySet entitySet, Map<String, Object> data,
- EntityProviderWriteProperties properties) throws EntityProviderException;
-
- /**
- * Write all <b>links</b> for key property based on <code>entity data model for an entity set</code> (given as
- * {@link EdmEntitySet})
- * in the specified format (given as <code>contentType</code>) for a set of entries.
- * The necessary key property values must be provided within the <code>data</code> (in form of a {@link List} with a
- * {@link Map} for each entry. Such a {@link Map} contains all key properties [as <code>property name</code> to
- * <code>property value</code> mapping] for the entry) and <code>properties</code> for this entity provider must be
- * set
- * (given as {@link EntityProviderWriteProperties}).
- *
- * @param contentType format in which the entry should be written
- * @param entitySet entity data model for given entity data set
- * @param data set of entries in form of a {@link List} with a {@link Map} for each entry (such a {@link Map}
- * contains all key properties [as <code>property name</code> to <code>property value</code> mapping).
- * @param properties additional properties necessary for writing of data
- * @return resulting {@link ODataResponse} with written links content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- ODataResponse writeLinks(String contentType, EdmEntitySet entitySet, List<Map<String, Object>> data,
- EntityProviderWriteProperties properties) throws EntityProviderException;
-
- /**
- * Write <code>data</code> result (given as {@link Object}) of function import based on <code>return type</code>
- * of {@link EdmFunctionImport} in specified format (given as <code>contentType</code>). Additional
- * <code>properties</code>
- * for this entity provider must be set (given as {@link EntityProviderWriteProperties}).
- *
- * @param contentType format in which the entry should be written
- * @param functionImport entity data model for executed function import
- * @param data result of function import
- * @param properties additional properties necessary for writing of data
- * @return resulting {@link ODataResponse} with written function import result content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- ODataResponse writeFunctionImport(String contentType, EdmFunctionImport functionImport, Object data,
- EntityProviderWriteProperties properties) throws EntityProviderException;
-
- /**
- * Read (de-serialize) a data feed from <code>content</code> (as {@link InputStream}) in specified format (given as
- * <code>contentType</code>)
- * based on <code>entity data model</code> (given as {@link EdmEntitySet}) and provide this data as
- * {@link ODataEntry}.
- *
- * @param contentType format of content in the given input stream.
- * @param entitySet entity data model for entity set to be read
- * @param content feed data in form of an {@link InputStream} which contains the data in specified format
- * @param properties additional properties necessary for reading content from {@link InputStream} into {@link Map}.
- * @return an {@link ODataFeed} object
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- ODataFeed readFeed(String contentType, EdmEntitySet entitySet, InputStream content,
- EntityProviderReadProperties properties) throws EntityProviderException;
-
- /**
- * Reads (de-serializes) data from <code>content</code> (as {@link InputStream})
- * in specified format (given as <code>contentType</code>) based on
- * <code>entity data model</code> (given as {@link EdmEntitySet})
- * and provides this data as {@link ODataEntry}.
- * Does not return complete entry data but only data present in the
- * de-serialized content.
- * @param contentType format of content in the given input stream
- * @param entitySet entity data model for entity set to be read
- * @param content data in form of an {@link InputStream} which
- * contains the data in specified format
- * @param properties additional properties necessary for reading
- * content from {@link InputStream} into {@link Map}.
- * @return entry as {@link ODataEntry}
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- ODataEntry readEntry(String contentType, EdmEntitySet entitySet, InputStream content,
- EntityProviderReadProperties properties) throws EntityProviderException;
-
- /**
- * Read (de-serialize) properties from <code>content</code> (as {@link InputStream}) in specified format (given as
- * <code>contentType</code>)
- * based on <code>entity data model</code> (given as {@link EdmProperty}) and provide this data as {@link Map} which
- * contains
- * the read data in form of <code>property name</code> to <code>property value</code> mapping.
- *
- * @param contentType format of content in the given input stream.
- * @param edmProperty entity data model for entity property to be read
- * @param content data in form of an {@link InputStream} which contains the data in specified format
- * @param properties additional properties necessary for reading content from {@link InputStream} into {@link Map}.
- * @return property as name and value in a map
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- Map<String, Object> readProperty(String contentType, EdmProperty edmProperty, InputStream content,
- EntityProviderReadProperties properties) throws EntityProviderException;
-
- /**
- * Read (de-serialize) a property value from <code>content</code> (as {@link InputStream}) in format
- * <code>text/plain</code>
- * based on <code>entity data model</code> (given as {@link EdmProperty}) and provide this data as {@link Object}.
- *
- * @param edmProperty entity data model for entity property to be read
- * @param content data in form of an {@link InputStream} which contains the data in format <code>text/plain</code>
- * @param typeMapping defines the mapping for this <code>edm property</code> to a <code>java class</code> which
- * should be used
- * during read of the content. If according <code>edm property</code> can not be read
- * into given <code>java class</code> an {@link EntityProviderException} is thrown.
- * Supported mappings are documented in {@link org.apache.olingo.odata2.api.edm.EdmSimpleType}.
- * @return property value as object
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- Object readPropertyValue(EdmProperty edmProperty, InputStream content, Class<?> typeMapping)
- throws EntityProviderException;
-
- /**
- * Read (de-serialize) a link from <code>content</code> (as {@link InputStream}) in specified format (given as
- * <code>contentType</code>)
- * based on <code>entity data model</code> (given as {@link EdmEntitySet}) and provide the link as {@link String}.
- *
- * @param contentType format of content in the given input stream.
- * @param entitySet entity data model for entity property to be read
- * @param content data in form of an {@link InputStream} which contains the data in specified format
- * @return link as string
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- String readLink(String contentType, EdmEntitySet entitySet, InputStream content) throws EntityProviderException;
-
- /**
- * Read (de-serialize) all links from <code>content</code> (as {@link InputStream})
- * in specified format (given as <code>contentType</code>) based on <code>entity data model</code>
- * (given as {@link EdmEntitySet}) and provide the link as List of Strings.
- *
- * @param contentType format of content in the given input stream.
- * @param entitySet entity data model for entity property to be read
- * @param content data in form of an {@link InputStream} which contains the data in specified format
- * @return links as List of Strings
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- List<String> readLinks(String contentType, EdmEntitySet entitySet, InputStream content)
- throws EntityProviderException;
-
- /**
- * Read (de-serialize) data from metadata <code>inputStream</code> (as {@link InputStream}) and provide Edm as
- * {@link Edm}
- *
- * @param inputStream the given input stream
- * @param validate has to be true if metadata should be validated
- * @return Edm as {@link Edm}
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- Edm readMetadata(InputStream inputStream, boolean validate) throws EntityProviderException;
-
- /**
- * Read (de-serialize) binary data from <code>content</code> (as {@link InputStream}) and provide it as
- * <code>byte[]</code>.
- *
- * @param content data in form of an {@link InputStream} which contains the binary data
- * @return binary data as bytes
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- byte[] readBinary(InputStream content) throws EntityProviderException;
-
- /**
- * <p>Serializes an error message according to the OData standard.</p>
- * @param context contains error details see {@link ODataErrorContext}
- * @return an {@link ODataResponse} containing the serialized error message
- */
- ODataResponse writeErrorDocument(ODataErrorContext context);
-
- /**
- * Read (de-serialize) data from service document <code>inputStream</code> (as {@link InputStream}) and provide
- * ServiceDocument as {@link ServiceDocument}
- *
- * @param serviceDocument the given input stream
- * @param contentType format of content in the given input stream
- * @return ServiceDocument as {@link ServiceDocument}
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- ServiceDocument readServiceDocument(InputStream serviceDocument, String contentType) throws EntityProviderException;
-
- /**
- * Parse Batch Request body <code>inputStream</code> (as {@link InputStream}) and provide a list of Batch Parts as
- * {@link BatchPart}
- *
- * @param contentType format of content in the given input stream
- * @param content request body
- * @param properties additional properties necessary for parsing. Must not be null.
- * @return list of {@link BatchPart}
- * @throws BatchException if parsing fails
- */
- List<BatchRequestPart> parseBatchRequest(String contentType, InputStream content,
- EntityProviderBatchProperties properties) throws BatchException;
-
- /**
- * Write responses of Batch Response Parts in Batch Response as {@link ODataResponse}.
- * Batch Response body matches one-to-one with the corresponding Batch Request body
- *
- * @param batchResponseParts a list of {@link BatchResponsePart}
- * @return Batch Response as {@link ODataResponse}
- * @throws BatchException
- */
- ODataResponse writeBatchResponse(List<BatchResponsePart> batchResponseParts) throws BatchException;
-
- /**
- * Create Batch Request body as InputStream.
- *
- * @param batchParts a list of BatchPartRequests {@link BatchPart}
- * @param boundary
- * @return Batch Request as InputStream
- */
- InputStream writeBatchRequest(List<BatchPart> batchParts, String boundary);
-
- /**
- * Parse Batch Response body (as {@link InputStream}) and provide a list of single responses as
- * {@link BatchSingleResponse}
- *
- * @param content response body
- * @param contentType format of content in the given input stream (incl. boundary parameter)
- * @return list of {@link BatchSingleResponse}
- * @throws BatchException
- */
- List<BatchSingleResponse> parseBatchResponse(String contentType, InputStream content) throws BatchException;
-
- }
-
- /**
- * Create an instance for the {@link EntityProviderInterface} over the {@link RuntimeDelegate}.
- *
- * @return instance of {@link EntityProviderInterface}
- */
- private static EntityProviderInterface createEntityProvider() {
- return RuntimeDelegate.createEntityProvider();
- }
-
- /**
- * <p>Serializes an error message according to the OData standard.</p>
- * An exception is not thrown because this method is used in exception handling.</p>
- * @param context contains error details see {@link ODataErrorContext}
- * @return an {@link ODataResponse} containing the serialized error message
- */
- public static ODataResponse writeErrorDocument(final ODataErrorContext context) {
- return createEntityProvider().writeErrorDocument(context);
- }
-
- /**
- * Write metadata document in XML format for the given schemas and the provided predefined
- * namespaces at the EDMX element. PredefinedNamespaces is of type
- * Map{@literal <}prefix,namespace{@literal >} and may be null or an empty Map.
- *
- * @param schemas all XML schemas which will be written
- * @param predefinedNamespaces type of Map{@literal <}prefix,namespace{@literal >} and may be null or an empty Map
- * @return resulting {@link ODataResponse} with written metadata content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- public static ODataResponse writeMetadata(final List<Schema> schemas, final Map<String, String> predefinedNamespaces)
- throws EntityProviderException {
- return createEntityProvider().writeMetadata(schemas, predefinedNamespaces);
- }
-
- /**
- * Write service document based on given {@link Edm} and <code>service root</code> as
- * given content type.
- *
- * @param contentType format in which service document should be written
- * @param edm entity data model to be written
- * @param serviceRoot service root for the written service document
- * @return resulting {@link ODataResponse} with written service document content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- public static ODataResponse writeServiceDocument(final String contentType, final Edm edm, final String serviceRoot)
- throws EntityProviderException {
- return createEntityProvider().writeServiceDocument(contentType, edm, serviceRoot);
- }
-
- /**
- * Write property as content type <code>application/octet-stream</code> or <code>text/plain</code>.
- *
- * @param edmProperty entity data model for to be written property
- * @param value property which will be written
- * @return resulting {@link ODataResponse} with written property value content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- public static ODataResponse writePropertyValue(final EdmProperty edmProperty, final Object value)
- throws EntityProviderException {
- return createEntityProvider().writePropertyValue(edmProperty, value);
- }
-
- /**
- * Write text value as content type <code>text/plain</code>.
- *
- * @param value text value which will be written
- * @return resulting {@link ODataResponse} with written text/plain content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- public static ODataResponse writeText(final String value) throws EntityProviderException {
- return createEntityProvider().writeText(value);
- }
-
- /**
- * Write binary content with content type header set to given <code>mime type</code> parameter.
- *
- * @param mimeType mime type which is written and used as content type header information.
- * @param data which is written to {@link ODataResponse}.
- * @return response object resulting {@link ODataResponse} with written binary content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- public static ODataResponse writeBinary(final String mimeType, final byte[] data) throws EntityProviderException {
- return createEntityProvider().writeBinary(mimeType, data);
- }
-
- /**
- * Write given <code>data</code> (which is given in form of a {@link List} with a {@link Map} for each entity. Such a
- * {@link Map} contains all properties [as <code>property name</code> to <code>property value</code> mapping] for the
- * entry) in the specified
- * format (given as <code>contentType</code>) based on given <code>entity data model for an entity set</code> (given
- * as {@link EdmEntitySet})
- * and <code>properties</code> for this entity provider (given as {@link EntityProviderWriteProperties}).
- *
- * @param contentType format in which the feed should be written
- * @param entitySet entity data model for given entity data set
- * @param data set of entries in form of a {@link List} with a {@link Map} for each entity (such a {@link Map}
- * contains all properties [as <code>property name</code> to <code>property value</code> mapping).
- * @param properties additional properties necessary for writing of data
- * @return resulting {@link ODataResponse} with written feed content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- public static ODataResponse writeFeed(final String contentType, final EdmEntitySet entitySet,
- final List<Map<String, Object>> data, final EntityProviderWriteProperties properties)
- throws EntityProviderException {
- return createEntityProvider().writeFeed(contentType, entitySet, data, properties);
- }
-
- /**
- * Write given <code>data</code> (which is given in form of a {@link Map} for which contains all properties
- * as <code>property name</code> to <code>property value</code> mapping) for the entry in the specified
- * format (given as <code>contentType</code>) based on <code>entity data model for an entity set</code> (given as
- * {@link EdmEntitySet})
- * and <code>properties</code> for this entity provider (given as {@link EntityProviderWriteProperties}).
- *
- * @param contentType format in which the entry should be written
- * @param entitySet entity data model for given entity data set
- * @param data which contains all properties as <code>property name</code> to <code>property value</code> mapping for
- * the entry
- * @param properties additional properties necessary for writing of data
- * @return resulting {@link ODataResponse} with written entry content
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- public static ODataResponse writeEntry(final String contentType, final EdmEntitySet entitySet,
- final Map<String, Object> data, final EntityProviderWriteProperties properties) throws EntityProviderException {
- return createEntityProvider().writeEntry(contentType, entitySet, data, properties);
- }
-
- /**
- * Write given <code>value</code> (which is given in form of an {@link Object}) for the property in the specified
- * format (given as <code>contentType</code>) based on given <code>entity data model for an entity property</code>
- * (given as {@link EdmProperty}).
- *
- * @param contentType format in which the property should be written
- * @param edmProperty entity data model for given property
- * @param value data which is written
- * @return resulting {@link ODataResponse} with written property content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- public static ODataResponse
- writeProperty(final String contentType, final EdmProperty edmProperty, final Object value)
- throws EntityProviderException {
- return createEntityProvider().writeProperty(contentType, edmProperty, value);
- }
-
- /**
- * Write <b>link</b> for key property based on <code>entity data model for an entity set</code> (given as
- * {@link EdmEntitySet})
- * in the specified format (given as <code>contentType</code>).
- * The necessary key property values must be provided within the <code>data</code> (in the form of <code>property
- * name</code>
- * to <code>property value</code> mapping) and <code>properties</code> for this entity provider must be set
- * (given as {@link EntityProviderWriteProperties}).
- *
- * @param contentType format in which the entry should be written
- * @param entitySet entity data model for given entity data set
- * @param data which contains all key properties as <code>property name</code> to <code>property value</code> mapping
- * for the entry
- * @param properties additional properties necessary for writing of data
- * @return resulting {@link ODataResponse} with written link content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- public static ODataResponse writeLink(final String contentType, final EdmEntitySet entitySet,
- final Map<String, Object> data, final EntityProviderWriteProperties properties) throws EntityProviderException {
- return createEntityProvider().writeLink(contentType, entitySet, data, properties);
- }
-
- /**
- * Write all <b>links</b> for key property based on <code>entity data model for an entity set</code> (given as
- * {@link EdmEntitySet})
- * in the specified format (given as <code>contentType</code>) for a set of entries.
- * The necessary key property values must be provided within the <code>data</code> (in form of a {@link List} with a
- * {@link Map} for each entry. Such a {@link Map} contains all key properties [as <code>property name</code> to
- * <code>property value</code> mapping] for the entry) and <code>properties</code> for this entity provider must be
- * set
- * (given as {@link EntityProviderWriteProperties}).
- *
- * @param contentType format in which the entry should be written
- * @param entitySet entity data model for given entity data set
- * @param data set of entries in form of a {@link List} with a {@link Map} for each entry (such a {@link Map} contains
- * all key properties [as <code>property name</code> to <code>property value</code> mapping).
- * @param properties additional properties necessary for writing of data
- * @return resulting {@link ODataResponse} with written links content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- public static ODataResponse writeLinks(final String contentType, final EdmEntitySet entitySet,
- final List<Map<String, Object>> data, final EntityProviderWriteProperties properties)
- throws EntityProviderException {
- return createEntityProvider().writeLinks(contentType, entitySet, data, properties);
- }
-
- /**
- * Write <code>data</code> result (given as {@link Object}) of function import based on <code>return type</code>
- * of {@link EdmFunctionImport} in specified format (given as <code>contentType</code>). Additional
- * <code>properties</code>
- * for this entity provider must be set (given as {@link EntityProviderWriteProperties}).
- *
- * @param contentType format in which the entry should be written
- * @param functionImport entity data model for executed function import
- * @param data result of function import
- * @param properties additional properties necessary for writing of data
- * @return resulting {@link ODataResponse} with written function import result content.
- * @throws EntityProviderException if writing of data (serialization) fails
- */
- public static ODataResponse writeFunctionImport(final String contentType, final EdmFunctionImport functionImport,
- final Object data, final EntityProviderWriteProperties properties) throws EntityProviderException {
- return createEntityProvider().writeFunctionImport(contentType, functionImport, data, properties);
- }
-
- /**
- * Read (de-serialize) a data feed from <code>content</code> (as {@link InputStream}) in specified format (given as
- * <code>contentType</code>)
- * based on <code>entity data model</code> (given as {@link EdmEntitySet}) and provide this data as {@link ODataEntry}
- * .
- *
- * @param contentType format of content in the given input stream.
- * @param entitySet entity data model for entity set to be read
- * @param content feed data in form of an {@link InputStream} which contains the data in specified format
- * @param properties additional properties necessary for reading content from {@link InputStream} into {@link Map}.
- * Must not be null.
- * @return an {@link ODataFeed} object
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- public static ODataFeed readFeed(final String contentType, final EdmEntitySet entitySet, final InputStream content,
- final EntityProviderReadProperties properties) throws EntityProviderException {
- return createEntityProvider().readFeed(contentType, entitySet, content, properties);
- }
-
- /**
- * Read (de-serialize) data from <code>content</code> (as {@link InputStream}) in specified format (given as
- * <code>contentType</code>)
- * based on <code>entity data model</code> (given as {@link EdmEntitySet}) and provide this data as {@link ODataEntry}
- * .
- *
- * @param contentType format of content in the given input stream.
- * @param entitySet entity data model for entity set to be read
- * @param content data in form of an {@link InputStream} which contains the data in specified format
- * @param properties additional properties necessary for reading content from {@link InputStream} into {@link Map}.
- * Must not be null.
- * @return entry as {@link ODataEntry}
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- public static ODataEntry readEntry(final String contentType, final EdmEntitySet entitySet, final InputStream content,
- final EntityProviderReadProperties properties) throws EntityProviderException {
- return createEntityProvider().readEntry(contentType, entitySet, content, properties);
- }
-
- /**
- * Read (de-serialize) properties from <code>content</code> (as {@link InputStream}) in specified format (given as
- * <code>contentType</code>)
- * based on <code>entity data model</code> (given as {@link EdmProperty}) and provide this data as {@link Map} which
- * contains
- * the read data in form of <code>property name</code> to <code>property value</code> mapping.
- *
- * @param contentType format of content in the given input stream.
- * @param edmProperty entity data model for entity property to be read
- * @param content data in form of an {@link InputStream} which contains the data in specified format
- * @param properties additional properties necessary for reading content from {@link InputStream} into {@link Map}.
- * Must not be null.
- * @return property as name and value in a map
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- public static Map<String, Object> readProperty(final String contentType, final EdmProperty edmProperty,
- final InputStream content, final EntityProviderReadProperties properties) throws EntityProviderException {
- return createEntityProvider().readProperty(contentType, edmProperty, content, properties);
- }
-
- /**
- * Read (de-serialize) a property value from <code>content</code> (as {@link InputStream}) in format
- * <code>text/plain</code>
- * based on <code>entity data model</code> (given as {@link EdmProperty}) and provide this data as {@link Object}.
- *
- * @param edmProperty entity data model for entity property to be read
- * @param content data in form of an {@link InputStream} which contains the data in format <code>text/plain</code>
- * @return property value as object
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- public static Object readPropertyValue(final EdmProperty edmProperty, final InputStream content)
- throws EntityProviderException {
- return createEntityProvider().readPropertyValue(edmProperty, content, null);
- }
-
- /**
- * Read (de-serialize) a property value from <code>content</code> (as {@link InputStream}) in format
- * <code>text/plain</code>
- * based on <code>entity data model</code> (given as {@link EdmProperty}) and provide this data as {@link Object}.
- *
- * @param edmProperty entity data model for entity property to be read
- * @param content data in form of an {@link InputStream} which contains the data in format <code>text/plain</code>
- * @param typeMapping defines the mapping for this <code>edm property</code> to a <code>java class</code> which should
- * be used
- * during read of the content. If according <code>edm property</code> can not be read
- * into given <code>java class</code> an {@link EntityProviderException} is thrown.
- * Supported mappings are documented in {@link org.apache.olingo.odata2.api.edm.EdmSimpleType}.
- * @return property value as object
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- public static Object readPropertyValue(final EdmProperty edmProperty, final InputStream content,
- final Class<?> typeMapping) throws EntityProviderException {
- return createEntityProvider().readPropertyValue(edmProperty, content, typeMapping);
- }
-
- /**
- * Read (de-serialize) a link from <code>content</code> (as {@link InputStream}) in specified format (given as
- * <code>contentType</code>)
- * based on <code>entity data model</code> (given as {@link EdmEntitySet}) and provide the link as {@link String}.
- *
- * @param contentType format of content in the given input stream.
- * @param entitySet entity data model for entity property to be read
- * @param content data in form of an {@link InputStream} which contains the data in specified format
- * @return link as string
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- public static String readLink(final String contentType, final EdmEntitySet entitySet, final InputStream content)
- throws EntityProviderException {
- return createEntityProvider().readLink(contentType, entitySet, content);
- }
-
- /**
- * Read (de-serialize) a link collection from <code>content</code> (as {@link InputStream})
- * in specified format (given as <code>contentType</code>) based on <code>entity data model</code>
- * (given as {@link EdmEntitySet}) and provide the links as List of Strings.
- *
- * @param contentType format of content in the given input stream.
- * @param entitySet entity data model for entity property to be read
- * @param content data in form of an {@link InputStream} which contains the data in specified format
- * @return links as List of Strings
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- public static List<String> readLinks(final String contentType, final EdmEntitySet entitySet,
- final InputStream content) throws EntityProviderException {
- return createEntityProvider().readLinks(contentType, entitySet, content);
- }
-
- /**
- * Read (de-serialize) binary data from <code>content</code> (as {@link InputStream}) and provide it as
- * <code>byte[]</code>.
- *
- * @param content data in form of an {@link InputStream} which contains the binary data
- * @return binary data as bytes
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- public static byte[] readBinary(final InputStream content) throws EntityProviderException {
- return createEntityProvider().readBinary(content);
- }
-
- /**
- * Read (de-serialize) data from metadata <code>inputStream</code> (as {@link InputStream}) and provide Edm as
- * {@link Edm}
- *
- * @param metadataXml a metadata xml input stream (means the metadata document)
- * @param validate has to be true if metadata should be validated
- * @return Edm as {@link Edm}
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- public static Edm readMetadata(final InputStream metadataXml, final boolean validate) throws EntityProviderException {
- return createEntityProvider().readMetadata(metadataXml, validate);
- }
-
- /**
- * Read (de-serialize) data from service document <code>inputStream</code> (as {@link InputStream}) and provide
- * ServiceDocument as {@link ServiceDocument}
- *
- * @param serviceDocument the given input stream
- * @param contentType format of content in the given input stream
- * @return ServiceDocument as {@link ServiceDocument}
- * @throws EntityProviderException if reading of data (de-serialization) fails
- */
- public static ServiceDocument readServiceDocument(final InputStream serviceDocument, final String contentType)
- throws EntityProviderException {
- return createEntityProvider().readServiceDocument(serviceDocument, contentType);
- }
-
- /**
- * Parse Batch Request body <code>inputStream</code> (as {@link InputStream}) and provide a list of Batch Request
- * parts as {@link BatchRequestPart}
- *
- * @param contentType format of content in the given input stream
- * @param content request body
- * @param properties additional properties necessary for parsing. Must not be null.
- * @return list of {@link BatchRequestPart}
- * @throws BatchException if parsing fails
- */
- public static List<BatchRequestPart> parseBatchRequest(final String contentType, final InputStream content,
- final EntityProviderBatchProperties properties) throws BatchException {
- return createEntityProvider().parseBatchRequest(contentType, content, properties);
- }
-
- /**
- * Write responses of Batch Response Parts in Batch Response as {@link ODataResponse}.
- * Batch Response body matches one-to-one with the corresponding Batch Request body
- *
- * @param batchResponseParts a list of {@link BatchResponsePart}
- * @return Batch Response as {@link ODataResponse}
- * @throws BatchException
- */
- public static ODataResponse writeBatchResponse(final List<BatchResponsePart> batchResponseParts)
- throws BatchException {
- return createEntityProvider().writeBatchResponse(batchResponseParts);
- }
-
- /**
- * Create Batch Request body as InputStream.
- *
- * @param batchParts a list of BatchPartRequests {@link BatchPart}
- * @param boundary
- * @return Batch Request as InputStream
- */
- public static InputStream writeBatchRequest(final List<BatchPart> batchParts, final String boundary) {
- return createEntityProvider().writeBatchRequest(batchParts, boundary);
- }
-
- /**
- * Parse Batch Response body (as {@link InputStream}) and provide a list of single responses as
- * {@link BatchSingleResponse}
- *
- * @param content response body
- * @param contentType format of content in the given input stream (inclusive boundary parameter)
- * @return list of {@link BatchSingleResponse}
- * @throws BatchException
- */
- public static List<BatchSingleResponse> parseBatchResponse(final InputStream content, final String contentType)
- throws BatchException {
- return createEntityProvider().parseBatchResponse(contentType, content);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderBatchProperties.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderBatchProperties.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderBatchProperties.java
deleted file mode 100644
index 0cb47ec..0000000
--- a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderBatchProperties.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.api.ep;
-
-import org.apache.olingo.odata2.api.uri.PathInfo;
-
-/**
- * The {@link EntityProviderBatchProperties} contains necessary informations to parse a Batch Request body.
- *
- *
- */
-public class EntityProviderBatchProperties {
- /**
- * PathInfo contains service root and preceding segments which should be used for URI parsing of a single request
- */
- private PathInfo pathInfo;
-
- public static EntityProviderBatchPropertiesBuilder init() {
- return new EntityProviderBatchPropertiesBuilder();
- }
-
- public PathInfo getPathInfo() {
- return pathInfo;
- }
-
- public static class EntityProviderBatchPropertiesBuilder {
- private final EntityProviderBatchProperties properties = new EntityProviderBatchProperties();
-
- public EntityProviderBatchPropertiesBuilder() {}
-
- public EntityProviderBatchPropertiesBuilder(final EntityProviderBatchProperties propertiesFrom) {
- properties.pathInfo = propertiesFrom.pathInfo;
- }
-
- public EntityProviderBatchPropertiesBuilder pathInfo(final PathInfo pathInfo) {
- properties.pathInfo = pathInfo;
- return this;
- }
-
- public EntityProviderBatchProperties build() {
- return properties;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderException.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderException.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderException.java
deleted file mode 100644
index a2ddc91..0000000
--- a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderException.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.api.ep;
-
-import org.apache.olingo.odata2.api.exception.MessageReference;
-import org.apache.olingo.odata2.api.exception.ODataMessageException;
-
-/**
- * An {@link EntityProviderException} is the base exception for all <code>EntityProvider</code> related exceptions.
- * It extends the {@link ODataMessageException} and provides several {@link MessageReference} for specification of
- * the thrown exception.
- */
-public class EntityProviderException extends ODataMessageException {
-
- private static final long serialVersionUID = 1L;
-
- /** INVALID_STATE requires no content value */
- public static final MessageReference COMMON = createMessageReference(EntityProviderException.class, "COMMON");
- /** EXCEPTION_OCCURRED requires 1 content value ('exception name') */
- public static final MessageReference EXCEPTION_OCCURRED = createMessageReference(EntityProviderException.class,
- "EXCEPTION_OCCURRED");
- /** INVALIDMAPPING requires 1 content value ('propertyName') */
- public static final MessageReference INVALID_MAPPING = createMessageReference(EntityProviderException.class,
- "INVALID_MAPPING");
- /** INVALID_ENTITYTYPE requires 2 content values ('supplied entity type' and 'content entity type') */
- public static final MessageReference INVALID_ENTITYTYPE = createMessageReference(EntityProviderException.class,
- "INVALID_ENTITYTYPE");
- /** INVALID_COMPLEX_TYPE requires 2 content values ('supplied complex type' and 'content complex type') */
- public static final MessageReference INVALID_COMPLEX_TYPE = createMessageReference(EntityProviderException.class,
- "INVALID_COMPLEX_TYPE");
- /** INVALID_CONTENT requires 2 content values ('invalid tag' and 'parent tag') */
- public static final MessageReference INVALID_CONTENT = createMessageReference(EntityProviderException.class,
- "INVALID_CONTENT");
- /** INVALID_PROPERTY_VALUE requires 1 content value ('invalid value') */
- public static final MessageReference INVALID_PROPERTY_VALUE = createMessageReference(EntityProviderException.class,
- "INVALID_PROPERTY_VALUE");
- /** MISSING_PROPERTY requires 1 content value ('invalid value') */
- public static final MessageReference MISSING_PROPERTY = createMessageReference(EntityProviderException.class,
- "MISSING_PROPERTY");
- /** INVALID_PARENT_TAG requires 2 content values ('missing attribute name' and 'tag name') */
- public static final MessageReference MISSING_ATTRIBUTE = createMessageReference(EntityProviderException.class,
- "MISSING_ATTRIBUTE");
- public static final MessageReference UNSUPPORTED_PROPERTY_TYPE = createMessageReference(
- EntityProviderException.class, "UNSUPPORTED_PROPERTY_TYPE");
- public static final MessageReference INLINECOUNT_INVALID = createMessageReference(EntityProviderException.class,
- "INLINECOUNT_INVALID");
- /** INVALID_STATE requires 1 content value ('message') */
- public static final MessageReference INVALID_STATE = createMessageReference(EntityProviderException.class,
- "INVALID_STATE");
- /** INVALID_INLINE_CONTENT requires 1 content value ('invalid inline message') */
- public static final MessageReference INVALID_INLINE_CONTENT = createMessageReference(EntityProviderException.class,
- "INVALID_INLINE_CONTENT");
- /** INVALID_PROPERTY requires 1 content value ('invalid property name') */
- public static final MessageReference INVALID_PROPERTY = createMessageReference(EntityProviderException.class,
- "INVALID_PROPERTY");
- /** ILLEGAL_ARGUMENT requires 1 content value ('message') */
- public static final MessageReference ILLEGAL_ARGUMENT = createMessageReference(EntityProviderException.class,
- "ILLEGAL_ARGUMENT");
- /** INVALID_NAMESPACE requires 1 content value ('invalid tag/namespace') */
- public static final MessageReference INVALID_NAMESPACE = createMessageReference(EntityProviderException.class,
- "INVALID_NAMESPACE");
- /** INVALID_PARENT_TAG requires 2 content values ('expected parent tag' and 'found parent tag') */
- public static final MessageReference INVALID_PARENT_TAG = createMessageReference(EntityProviderException.class,
- "INVALID_PARENT_TAG");
- public static final MessageReference EXPANDNOTSUPPORTED = createMessageReference(EntityProviderException.class,
- "EXPANDNOTSUPPORTED");
- /** DOUBLE_PROPERTY requires 1 content value ('double tag/property') */
- public static final MessageReference DOUBLE_PROPERTY = createMessageReference(EntityProviderException.class,
- "DOUBLE_PROPERTY");
- /** NOT_SET_CHARACTER_ENCODING requires no content value */
- public static final MessageReference NOT_SET_CHARACTER_ENCODING = createMessageReference(
- EntityProviderException.class, "NOT_SET_CHARACTER_ENCODING");
- /** UNSUPPORTED_CHARACTER_ENCODING requires 1 content value ('found but unsupported character encoding') */
- public static final MessageReference UNSUPPORTED_CHARACTER_ENCODING = createMessageReference(
- EntityProviderException.class, "UNSUPPORTED_CHARACTER_ENCODING");
- /** MEDIA_DATA_NOT_INITIAL requires no content value */
- public static final MessageReference MEDIA_DATA_NOT_INITIAL = createMessageReference(EntityProviderException.class,
- "MEDIA_DATA_NOT_INITIAL");
- /** END_DOCUMENT_EXPECTED requires 1 content value ('actual token') */
- public static final MessageReference END_DOCUMENT_EXPECTED = createMessageReference(EntityProviderException.class,
- "END_DOCUMENT_EXPECTED");
- /** MISSING_RESULTS_ARRAY requires no content value */
- public static final MessageReference MISSING_RESULTS_ARRAY = createMessageReference(EntityProviderException.class,
- "MISSING_RESULTS_ARRAY");
-
- public EntityProviderException(final MessageReference messageReference) {
- super(messageReference);
- }
-
- public EntityProviderException(final MessageReference messageReference, final Throwable cause) {
- super(messageReference, cause);
- }
-
- public EntityProviderException(final MessageReference messageReference, final String errorCode) {
- super(messageReference, errorCode);
- }
-
- public EntityProviderException(final MessageReference messageReference, final Throwable cause,
- final String errorCode) {
- super(messageReference, cause, errorCode);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderReadProperties.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderReadProperties.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderReadProperties.java
deleted file mode 100644
index a012487..0000000
--- a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderReadProperties.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.api.ep;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.olingo.odata2.api.ep.callback.OnReadInlineContent;
-
-/**
- * <p>The {@link EntityProviderReadProperties} contains all necessary settings
- * to read an entity with the {@link EntityProvider}.</p>
- * <p>The main settings are
- * <ul>
- * <li>the <code>mergeSemantic</code></li>
- * <li>the <code>callback for inlined navigation properties</code></li>
- * <li>and the <code>type mappings</code></li>
- * </ul>
- * </p>
- *
- */
-public class EntityProviderReadProperties {
- /** Callback which is necessary if entity contains inlined navigation properties. */
- private OnReadInlineContent callback;
- /**
- * if merge is <code>true</code> the input content is in context of a <b>merge</b> (e.g. MERGE, PATCH) read request,
- * otherwise if <code>false</code> it is a <b>non-merge</b> (e.g. CREATE) read request
- */
- private boolean merge;
- /**
- * typeMappings contains mappings from <code>edm property name</code> to <code>java class</code> which should be used
- * for a type mapping during reading of content. If according <code>edm property</code> can not be read
- * into given <code>java class</code> an {@link EntityProviderException} is thrown.
- * Supported mappings are documented in {@link org.apache.olingo.odata2.api.edm.EdmSimpleType}.
- */
- final private Map<String, Object> typeMappings;
- final private Map<String, String> validatedPrefix2NamespaceUri;
-
- private EntityProviderReadProperties() {
- typeMappings = new HashMap<String, Object>();
- validatedPrefix2NamespaceUri = new HashMap<String, String>();
- }
-
- public static EntityProviderReadPropertiesBuilder init() {
- return new EntityProviderReadPropertiesBuilder();
- }
-
- public static EntityProviderReadPropertiesBuilder initFrom(final EntityProviderReadProperties properties) {
- return new EntityProviderReadPropertiesBuilder(properties);
- }
-
- public Map<String, String> getValidatedPrefixNamespaceUris() {
- return Collections.unmodifiableMap(validatedPrefix2NamespaceUri);
- }
-
- public Map<String, Object> getTypeMappings() {
- return Collections.unmodifiableMap(typeMappings);
- }
-
- public OnReadInlineContent getCallback() {
- return callback;
- }
-
- /**
- * <p>Gets the merge semantics.</p>
- * <p>Merge semantics is set if the input content has to be treated in the context
- * of a request to merge incoming data with existing data (e.g., indicated by the
- * HTTP verbs <code>MERGE</code> or <code>PATCH</code> in a server application).
- * Otherwise the request, even if not all data are supplied, is supposed to
- * overwrite the existing entity completely.</p>
- */
- public boolean getMergeSemantic() {
- return merge;
- }
-
- /**
- *
- */
- public static class EntityProviderReadPropertiesBuilder {
- private final EntityProviderReadProperties properties = new EntityProviderReadProperties();
-
- public EntityProviderReadPropertiesBuilder() {}
-
- public EntityProviderReadPropertiesBuilder(final EntityProviderReadProperties propertiesFrom) {
- properties.merge = propertiesFrom.merge;
- properties.callback = propertiesFrom.callback;
- addValidatedPrefixes(propertiesFrom.validatedPrefix2NamespaceUri);
- addTypeMappings(propertiesFrom.typeMappings);
- }
-
- /**
- * Sets the merge semantics.
- * @param mergeSemantic whether merge semantics is requested
- * @see EntityProviderReadProperties#getMergeSemantic()
- */
- public EntityProviderReadPropertiesBuilder mergeSemantic(final boolean mergeSemantic) {
- properties.merge = mergeSemantic;
- return this;
- }
-
- public EntityProviderReadPropertiesBuilder callback(final OnReadInlineContent callback) {
- properties.callback = callback;
- return this;
- }
-
- public EntityProviderReadPropertiesBuilder addValidatedPrefixes(final Map<String, String> prefix2NamespaceUri) {
- if (prefix2NamespaceUri != null) {
- properties.validatedPrefix2NamespaceUri.putAll(prefix2NamespaceUri);
- }
- return this;
- }
-
- public EntityProviderReadPropertiesBuilder addTypeMappings(final Map<String, Object> typeMappings) {
- if (typeMappings != null) {
- properties.typeMappings.putAll(typeMappings);
- }
- return this;
- }
-
- public EntityProviderReadProperties build() {
- return properties;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderWriteProperties.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderWriteProperties.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderWriteProperties.java
deleted file mode 100644
index 1b5a25c..0000000
--- a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderWriteProperties.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.api.ep;
-
-import java.net.URI;
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.olingo.odata2.api.ODataCallback;
-import org.apache.olingo.odata2.api.commons.InlineCount;
-import org.apache.olingo.odata2.api.uri.ExpandSelectTreeNode;
-
-/**
- * {@link EntityProviderWriteProperties} contains all additional properties which are necessary to <b>write
- * (serialize)</b> an {@link org.apache.olingo.odata2.api.ep.entry.ODataEntry} into an specific format (e.g.
- * <code>XML</code> or <code>JSON</code> or ...).
- */
-public class EntityProviderWriteProperties {
-
- private URI serviceRoot;
- private String mediaResourceMimeType;
- private InlineCount inlineCountType;
- private Integer inlineCount;
- private String nextLink;
- private ExpandSelectTreeNode expandSelectTree;
- private Map<String, ODataCallback> callbacks = Collections.emptyMap();
- private URI selfLink;
-
- private EntityProviderWriteProperties() {}
-
- /**
- * Gets the self link from an application. May be null.
- * @return the self link
- */
- public final URI getSelfLink() {
- return selfLink;
- }
-
- /**
- * Gets the service root.
- * @return the service root
- */
- public final URI getServiceRoot() {
- return serviceRoot;
- }
-
- /**
- * Gets the MIME type of the media resource.
- * @return the MIME type of the media resource
- */
- public final String getMediaResourceMimeType() {
- return mediaResourceMimeType;
- }
-
- /**
- * Gets the type of the inlinecount request from the system query option.
- * @return the type of the inlinecount request from the system query option
- */
- public final InlineCount getInlineCountType() {
- return inlineCountType;
- }
-
- public final Map<String, ODataCallback> getCallbacks() {
- return callbacks;
- }
-
- /**
- * Gets the expand select tree data structure resulting from $expand and $select query options.
- * @return a paresed tree structure representing the $expand and $select
- */
- public final ExpandSelectTreeNode getExpandSelectTree() {
- return expandSelectTree;
- }
-
- /**
- * Gets the inlinecount.
- * @return the inlinecount as Integer
- * @see #getInlineCountType
- */
- public final Integer getInlineCount() {
- return inlineCount;
- }
-
- /**
- * Gets the next link used for server-side paging of feeds.
- * @return the next link
- */
- public final String getNextLink() {
- return nextLink;
- }
-
- public static ODataEntityProviderPropertiesBuilder serviceRoot(final URI serviceRoot) {
- return new ODataEntityProviderPropertiesBuilder().serviceRoot(serviceRoot);
- }
-
- public static class ODataEntityProviderPropertiesBuilder {
- private final EntityProviderWriteProperties properties = new EntityProviderWriteProperties();
-
- /**
- * @param mediaResourceMimeType the mediaResourceMimeType to set
- */
- public final ODataEntityProviderPropertiesBuilder mediaResourceMimeType(final String mediaResourceMimeType) {
- properties.mediaResourceMimeType = mediaResourceMimeType;
- return this;
- }
-
- /**
- * @param inlineCountType the inlineCountType to set
- */
- public final ODataEntityProviderPropertiesBuilder inlineCountType(final InlineCount inlineCountType) {
- properties.inlineCountType = inlineCountType;
- return this;
- }
-
- /**
- * @param inlineCount the inlineCount to set
- */
- public final ODataEntityProviderPropertiesBuilder inlineCount(final Integer inlineCount) {
- properties.inlineCount = inlineCount;
- return this;
- }
-
- /**
- * @param serviceRoot
- */
- public final ODataEntityProviderPropertiesBuilder serviceRoot(final URI serviceRoot) {
- properties.serviceRoot = serviceRoot;
- return this;
- }
-
- /**
- * @param nextLink Next link to render feeds with server side paging. Should usually contain a skiptoken.
- */
- public ODataEntityProviderPropertiesBuilder nextLink(final String nextLink) {
- properties.nextLink = nextLink;
- return this;
- }
-
- /**
- * Build properties object.
- * @return assembled properties object
- */
- public final EntityProviderWriteProperties build() {
- return properties;
- }
-
- /**
- * Set a expand select tree which results from $expand and $select query parameter. Usually the data structure is
- * constructed
- * by the uri parser.
- * @param expandSelectTree data structure
- * @return properties builder
- */
- public ODataEntityProviderPropertiesBuilder expandSelectTree(final ExpandSelectTreeNode expandSelectTree) {
- properties.expandSelectTree = expandSelectTree;
- return this;
- }
-
- public ODataEntityProviderPropertiesBuilder callbacks(final Map<String, ODataCallback> callbacks) {
- properties.callbacks = callbacks;
- return this;
- }
-
- public ODataEntityProviderPropertiesBuilder selfLink(final URI selfLink) {
- properties.selfLink = selfLink;
- return this;
- }
-
- public ODataEntityProviderPropertiesBuilder fromProperties(final EntityProviderWriteProperties properties) {
- this.properties.mediaResourceMimeType = properties.getMediaResourceMimeType();
- this.properties.inlineCountType = properties.getInlineCountType();
- this.properties.inlineCount = properties.getInlineCount();
- this.properties.nextLink = properties.getNextLink();
- this.properties.expandSelectTree = properties.getExpandSelectTree();
- this.properties.callbacks = properties.getCallbacks();
- this.properties.selfLink = properties.getSelfLink();
- return this;
- }
-
- }
-
- public static ODataEntityProviderPropertiesBuilder fromProperties(final EntityProviderWriteProperties properties) {
- final ODataEntityProviderPropertiesBuilder b = EntityProviderWriteProperties.serviceRoot(properties
- .getServiceRoot());
- b.fromProperties(properties);
- return b;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/OnReadInlineContent.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/OnReadInlineContent.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/OnReadInlineContent.java
deleted file mode 100644
index 2b6afe8..0000000
--- a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/OnReadInlineContent.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.api.ep.callback;
-
-import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
-import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
-import org.apache.olingo.odata2.api.exception.ODataApplicationException;
-
-/**
- * <p>
- * Callback interface for the deep insert read calls (read of <code><m:inline></code> content).
- * Typically the {@link #receiveReadProperties(EntityProviderReadProperties, EdmNavigationProperty)} method is called
- * when an inline navigation property is found and will be read.
- * </p>
- * <p>
- * The {@link #handleReadEntry(ReadEntryResult)} and {@link #handleReadFeed(ReadFeedResult)} methods are called
- * after the inline navigation property was read and deliver the read (de-serialized) entity or list of entities.
- * If inlined navigation property is <code>nullable</code> and not set a {@link ReadEntryResult} is given with the
- * <code>navigationPropertyName</code> and a <code>NULL</code> entry set.
- * </p>
- *
- *
- */
-public interface OnReadInlineContent {
-
- /**
- * Receive (request) to be used {@link EntityProviderReadProperties} to read the found inline navigation property
- * (<code>><m:inline>...</m:inline></code>).
- *
- * @param readProperties read properties which are used to read enclosing parent entity
- * @param navigationProperty emd navigation property information of found inline navigation property
- * @return read properties which are used to read (de-serialize) found inline navigation property
- * @throws ODataApplicationException
- */
- EntityProviderReadProperties receiveReadProperties(EntityProviderReadProperties readProperties,
- EdmNavigationProperty navigationProperty) throws ODataApplicationException;
-
- /**
- * Handles reading (de-serialization) entry result.
- * The given {@link ReadEntryResult} object contains all contextual information
- * about the de-serialized inline navigation property and the entry as
- * {@link org.apache.olingo.odata2.api.ep.entry.ODataEntry ODataEntry}.
- *
- * @param readEntryResult with contextual information about and de-serialized
- * inlined navigation property as {@link org.apache.olingo.odata2.api.ep.entry.ODataEntry ODataEntry}
- * @throws ODataApplicationException
- */
- void handleReadEntry(ReadEntryResult readEntryResult) throws ODataApplicationException;
-
- /**
- * Handles reading (de-serialization) entry result.
- * The given {@link ReadFeedResult} object contains all contextual information
- * about the de-serialized inline navigation property and the entry as
- * a list of {@link org.apache.olingo.odata2.api.ep.entry.ODataEntry ODataEntry}.
- *
- * @param readFeedResult with contextual information about and de-serialized
- * inlined navigation property as a list of {@link org.apache.olingo.odata2.api.ep.entry.ODataEntry ODataEntry}
- * @throws ODataApplicationException
- */
- void handleReadFeed(ReadFeedResult readFeedResult) throws ODataApplicationException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/OnWriteEntryContent.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/OnWriteEntryContent.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/OnWriteEntryContent.java
deleted file mode 100644
index 1c4f74b..0000000
--- a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/OnWriteEntryContent.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.api.ep.callback;
-
-import org.apache.olingo.odata2.api.ODataCallback;
-import org.apache.olingo.odata2.api.exception.ODataApplicationException;
-
-/**
- * Callback interface for the $expand query option.
- * <p>If an expand clause for a navigation property which points to an entry is found this callback will be called.
- * <br>Pointing to an entry means the navigation property has a multiplicity of 0..1 or 1..1.
- *
- *
- *
- */
-public interface OnWriteEntryContent extends ODataCallback {
-
- /**
- * Retrieves the data for an entry. See {@link WriteEntryCallbackContext} for details on the context and
- * {@link WriteEntryCallbackResult} for details on the result of this method.
- * @param context of this entry
- * @return result - must not be null.
- * @throws ODataApplicationException
- */
- WriteEntryCallbackResult retrieveEntryResult(WriteEntryCallbackContext context) throws ODataApplicationException;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/OnWriteFeedContent.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/OnWriteFeedContent.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/OnWriteFeedContent.java
deleted file mode 100644
index 3f7e88a..0000000
--- a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/OnWriteFeedContent.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.api.ep.callback;
-
-import org.apache.olingo.odata2.api.ODataCallback;
-import org.apache.olingo.odata2.api.exception.ODataApplicationException;
-
-/**
- * Callback interface for the $expand query option.
- * <p>If an expand clause for a navigation property which points to a feed is found this callback will be called.
- * <br>Pointing to an feed means the navigation property has a multiplicity of 0..* or 1..*.
- *
- *
- *
- */
-public interface OnWriteFeedContent extends ODataCallback {
-
- /**
- * Retrieves the data for a feed. See {@link WriteFeedCallbackContext} for details on the context and
- * {@link WriteFeedCallbackResult} for details on the result of this method.
- * @param context of this entry
- * @return result - must not be null.
- * @throws ODataApplicationException
- */
- WriteFeedCallbackResult retrieveFeedResult(WriteFeedCallbackContext context) throws ODataApplicationException;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/ReadEntryResult.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/ReadEntryResult.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/ReadEntryResult.java
deleted file mode 100644
index e6b8d8c..0000000
--- a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/ReadEntryResult.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.api.ep.callback;
-
-import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
-import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
-import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
-
-/**
- * A {@link ReadEntryResult} represents an inlined navigation property which points to an entry.
- * The {@link ReadEntryResult} contains the {@link EntityProviderReadProperties} which were used for read,
- * the <code>navigationPropertyName</code> and the read/de-serialized inlined entity.
- * If inlined navigation property is <code>nullable</code> the {@link ReadEntryResult} has the
- * <code>navigationPropertyName</code> and a <code>NULL</code> entry set.
- *
- *
- *
- */
-public class ReadEntryResult extends ReadResult {
-
- private final ODataEntry entry;
-
- /**
- * Constructor.
- * Parameters <b>MUST NOT BE NULL</b>.
- *
- * @param properties read properties which are used to read enclosing parent entity
- * @param navigationProperty emd navigation property information of found inline navigation property
- * @param entry read entity as {@link ODataEntry}
- */
- public ReadEntryResult(final EntityProviderReadProperties properties, final EdmNavigationProperty navigationProperty,
- final ODataEntry entry) {
- super(properties, navigationProperty);
- this.entry = entry;
- }
-
- @Override
- public ODataEntry getResult() {
- return entry;
- }
-
- @Override
- public boolean isFeed() {
- return false;
- }
-
- @Override
- public String toString() {
- return super.toString() + "\n\t" + entry.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/ReadFeedResult.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/ReadFeedResult.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/ReadFeedResult.java
deleted file mode 100644
index 3e58609..0000000
--- a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/ReadFeedResult.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.api.ep.callback;
-
-import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
-import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
-import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
-
-/**
- * A {@link ReadFeedResult} represents an inlined navigation property which points to a feed (in the form of a list of
- * {@link org.apache.olingo.odata2.api.ep.entry.ODataEntry ODataEntry} instances).
- * The {@link ReadFeedResult} contains the {@link EntityProviderReadProperties} which were used for read,
- * the <code>navigationPropertyName</code> and the read/de-serialized inlined entities.
- * If inlined navigation property is <code>nullable</code> the {@link ReadFeedResult} has the
- * <code>navigationPropertyName</code> and a <code>NULL</code> entry set.
- *
- *
- */
-public class ReadFeedResult extends ReadResult {
-
- private final ODataFeed feed;
-
- /**
- * Constructor.
- * Parameters <b>MUST NOT BE NULL</b>.
- *
- * @param properties read properties which are used to read enclosing parent entity
- * @param navigationProperty emd navigation property information of found inline navigation property
- * @param entry read entities as list of {@link org.apache.olingo.odata2.api.ep.entry.ODataEntry ODataEntry}
- */
- public ReadFeedResult(final EntityProviderReadProperties properties, final EdmNavigationProperty navigationProperty,
- final ODataFeed entry) {
- super(properties, navigationProperty);
- feed = entry;
- }
-
- @Override
- public ODataFeed getResult() {
- return feed;
- }
-
- @Override
- public boolean isFeed() {
- return true;
- }
-
- @Override
- public String toString() {
- return super.toString() + "\n\t" + feed.toString();
- }
-}