You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by fm...@apache.org on 2013/07/26 13:22:33 UTC

[28/51] [partial] initial commit

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/ODataResponse.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/ODataResponse.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/ODataResponse.java
new file mode 100644
index 0000000..f84e272
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/ODataResponse.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * 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.processor;
+
+import java.io.IOException;
+import java.util.Set;
+
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+import org.apache.olingo.odata2.api.rt.RuntimeDelegate;
+
+/**
+ * <p>An <code>ODataResponse</code> is usually created by an {@link ODataProcessor}
+ * during request handling.</p>
+ * <p>The handler can use a serializer to create an 
+ * OData body (== response entity) and can set various response headers.
+ * A response can be created using the builder pattern:
+ * <pre>
+ * {@code
+ * ODataResponse response = ODataResponse.entity("hello world").setStatus(HttpStatusCodes.OK).build();
+ * }
+ * </pre>
+ * @author SAP AG
+ */
+public abstract class ODataResponse {
+
+  /**
+   * Do not subclass ODataResponse!
+   */
+  protected ODataResponse() {}
+
+  /**
+   * @return HTTP status code of this response
+   */
+  public abstract HttpStatusCodes getStatus();
+
+  /**
+   * @return a response entity which becomes the body part of a response message
+   */
+  public abstract Object getEntity();
+
+  /**
+   * Close the underlying entity input stream (if such a stream is available) and release all with this repsonse associated resources.
+   * 
+   * @throws IOException if something goes wrong during close of {@link ODataResponse}
+   */
+  public abstract void close() throws IOException;
+
+  /**
+   * @param name HTTP response header name
+   * @return a header value or null if not set
+   */
+  public abstract String getHeader(String name);
+
+  /**
+   * @return Content-Type header value or null if not set
+   */
+  public abstract String getContentHeader();
+
+  /**
+   * @return Location header value or null if not set
+   */
+  public abstract String getIdLiteral();
+
+  /**
+   * @return ETag header value or null if not available
+   */
+  public abstract String getETag();
+
+  /**
+   * @return a set of all available header names
+   */
+  public abstract Set<String> getHeaderNames();
+
+  /**
+   * Case insensitive check if the header is available in this ODataResponse
+   * @param header header name
+   * @return true/false
+   */
+  public abstract boolean containsHeader(String header);
+
+  /**
+   * @param status HTTP status code
+   * @return a builder object
+   */
+  public static ODataResponseBuilder status(final HttpStatusCodes status) {
+    return newBuilder().status(status);
+  }
+
+  /**
+   * @param response
+   * @return a new builder object
+   */
+  public static ODataResponseBuilder fromResponse(final ODataResponse response) {
+    return newBuilder().fromResponse(response);
+  }
+
+  /**
+   * @param entity
+   * @return a builder object
+   */
+  public static ODataResponseBuilder entity(final Object entity) {
+    return newBuilder().entity(entity);
+  }
+
+  /**
+   * @param name  HTTP header name
+   * @param value associated value
+   * @return a builder object
+   */
+  public static ODataResponseBuilder header(final String name, final String value) {
+    return newBuilder().header(name, value);
+  }
+
+  /**
+   * @param value content header value
+   * @return a builder object
+   */
+  public static ODataResponseBuilder contentHeader(final String value) {
+    return newBuilder().contentHeader(value);
+  }
+
+  /**
+   * @return returns a new builder object
+   */
+  public static ODataResponseBuilder newBuilder() {
+    return ODataResponseBuilder.newInstance();
+  }
+
+  /**
+   * Implementation of the builder pattern to create instances of this type of object. 
+   * @author SAP AG
+   */
+  public static abstract class ODataResponseBuilder {
+
+    protected ODataResponseBuilder() {}
+
+    private static ODataResponseBuilder newInstance() {
+      return RuntimeDelegate.createODataResponseBuilder();
+    }
+
+    public abstract ODataResponse build();
+
+    public abstract ODataResponseBuilder status(HttpStatusCodes status);
+
+    public abstract ODataResponseBuilder entity(Object entity);
+
+    public abstract ODataResponseBuilder header(String name, String value);
+
+    public abstract ODataResponseBuilder idLiteral(String idLiteral);
+
+    public abstract ODataResponseBuilder eTag(String eTag);
+
+    public abstract ODataResponseBuilder contentHeader(String contentHeader);
+
+    protected abstract ODataResponseBuilder fromResponse(ODataResponse response);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/ODataSingleProcessor.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/ODataSingleProcessor.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/ODataSingleProcessor.java
new file mode 100644
index 0000000..6932ecc
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/ODataSingleProcessor.java
@@ -0,0 +1,375 @@
+/*******************************************************************************
+ * 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.processor;
+
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.ODataServiceVersion;
+import org.apache.olingo.odata2.api.batch.BatchHandler;
+import org.apache.olingo.odata2.api.batch.BatchResponsePart;
+import org.apache.olingo.odata2.api.commons.HttpHeaders;
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+import org.apache.olingo.odata2.api.commons.ODataHttpHeaders;
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmServiceMetadata;
+import org.apache.olingo.odata2.api.ep.EntityProvider;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.exception.ODataNotImplementedException;
+import org.apache.olingo.odata2.api.processor.ODataResponse.ODataResponseBuilder;
+import org.apache.olingo.odata2.api.processor.feature.CustomContentType;
+import org.apache.olingo.odata2.api.processor.part.BatchProcessor;
+import org.apache.olingo.odata2.api.processor.part.EntityComplexPropertyProcessor;
+import org.apache.olingo.odata2.api.processor.part.EntityLinkProcessor;
+import org.apache.olingo.odata2.api.processor.part.EntityLinksProcessor;
+import org.apache.olingo.odata2.api.processor.part.EntityMediaProcessor;
+import org.apache.olingo.odata2.api.processor.part.EntityProcessor;
+import org.apache.olingo.odata2.api.processor.part.EntitySetProcessor;
+import org.apache.olingo.odata2.api.processor.part.EntitySimplePropertyProcessor;
+import org.apache.olingo.odata2.api.processor.part.EntitySimplePropertyValueProcessor;
+import org.apache.olingo.odata2.api.processor.part.FunctionImportProcessor;
+import org.apache.olingo.odata2.api.processor.part.FunctionImportValueProcessor;
+import org.apache.olingo.odata2.api.processor.part.MetadataProcessor;
+import org.apache.olingo.odata2.api.processor.part.ServiceDocumentProcessor;
+import org.apache.olingo.odata2.api.uri.info.DeleteUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetComplexPropertyUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntityCountUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntityLinkCountUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntityLinkUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetCountUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetLinksCountUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetLinksUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetFunctionImportUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetMediaResourceUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetMetadataUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetServiceDocumentUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo;
+import org.apache.olingo.odata2.api.uri.info.PostUriInfo;
+import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo;
+
+/**
+ * <p>A default {@link ODataProcessor} that implements all processor features in a single class.</p>
+ * <p>It is recommended to derive from this class and it is required by the
+ * {@link org.apache.olingo.odata2.api.ODataServiceFactory} to build an {@link org.apache.olingo.odata2.api.ODataService}.</p>
+ * <p>This abstract class provides a default behavior, returning the correct response
+ * for requests for the service or the metadata document, respectively, and throwing an
+ * {@link ODataNotImplementedException} for all other requests.
+ * Sub classes have to override only methods they want to support.</p> 
+ * 
+ * @author SAP AG
+ */
+public abstract class ODataSingleProcessor implements MetadataProcessor, ServiceDocumentProcessor, EntityProcessor, EntitySetProcessor, EntityComplexPropertyProcessor, EntityLinkProcessor, EntityLinksProcessor, EntityMediaProcessor, EntitySimplePropertyProcessor, EntitySimplePropertyValueProcessor, FunctionImportProcessor, FunctionImportValueProcessor, BatchProcessor, CustomContentType {
+
+  /**
+   * A request context object usually injected by the OData library.
+   */
+  private ODataContext context;
+
+  /**
+   * @see ODataProcessor
+   */
+  @Override
+  public void setContext(final ODataContext context) {
+    this.context = context;
+  }
+
+  /**
+   * @see ODataProcessor
+   */
+  @Override
+  public ODataContext getContext() {
+    return context;
+  }
+
+  /**
+   * @see BatchProcessor
+   */
+  @Override
+  public ODataResponse executeBatch(final BatchHandler handler, final String contentType, final InputStream content) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @throws ODataNotImplementedException 
+   * @see BatchProcessor
+   */
+  @Override
+  public BatchResponsePart executeChangeSet(final BatchHandler handler, final List<ODataRequest> requests) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see FunctionImportProcessor
+   */
+  @Override
+  public ODataResponse executeFunctionImport(final GetFunctionImportUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see FunctionImportValueProcessor
+   */
+  @Override
+  public ODataResponse executeFunctionImportValue(final GetFunctionImportUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntitySimplePropertyValueProcessor
+   */
+  @Override
+  public ODataResponse readEntitySimplePropertyValue(final GetSimplePropertyUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntitySimplePropertyValueProcessor
+   */
+  @Override
+  public ODataResponse updateEntitySimplePropertyValue(final PutMergePatchUriInfo uriInfo, final InputStream content, final String requestContentType, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntitySimplePropertyValueProcessor
+   */
+  @Override
+  public ODataResponse deleteEntitySimplePropertyValue(final DeleteUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntitySimplePropertyProcessor
+   */
+  @Override
+  public ODataResponse readEntitySimpleProperty(final GetSimplePropertyUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntitySimplePropertyProcessor
+   */
+  @Override
+  public ODataResponse updateEntitySimpleProperty(final PutMergePatchUriInfo uriInfo, final InputStream content, final String requestContentType, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntityMediaProcessor
+   */
+  @Override
+  public ODataResponse readEntityMedia(final GetMediaResourceUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntityMediaProcessor
+   */
+  @Override
+  public ODataResponse updateEntityMedia(final PutMergePatchUriInfo uriInfo, final InputStream content, final String requestContentType, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntityMediaProcessor
+   */
+  @Override
+  public ODataResponse deleteEntityMedia(final DeleteUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntityLinksProcessor
+   */
+  @Override
+  public ODataResponse readEntityLinks(final GetEntitySetLinksUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntityLinksProcessor
+   */
+  @Override
+  public ODataResponse countEntityLinks(final GetEntitySetLinksCountUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntityLinkProcessor
+   */
+  @Override
+  public ODataResponse createEntityLink(final PostUriInfo uriInfo, final InputStream content, final String requestContentType, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntityLinkProcessor
+   */
+  @Override
+  public ODataResponse readEntityLink(final GetEntityLinkUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntityLinkProcessor
+   */
+  @Override
+  public ODataResponse existsEntityLink(final GetEntityLinkCountUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntityLinkProcessor
+   */
+  @Override
+  public ODataResponse updateEntityLink(final PutMergePatchUriInfo uriInfo, final InputStream content, final String requestContentType, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntityLinkProcessor
+   */
+  @Override
+  public ODataResponse deleteEntityLink(final DeleteUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntityComplexPropertyProcessor
+   */
+  @Override
+  public ODataResponse readEntityComplexProperty(final GetComplexPropertyUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntityComplexPropertyProcessor
+   */
+  @Override
+  public ODataResponse updateEntityComplexProperty(final PutMergePatchUriInfo uriInfo, final InputStream content, final String requestContentType, final boolean merge, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntitySetProcessor
+   */
+  @Override
+  public ODataResponse readEntitySet(final GetEntitySetUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntitySetProcessor
+   */
+  @Override
+  public ODataResponse countEntitySet(final GetEntitySetCountUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntitySetProcessor
+   */
+  @Override
+  public ODataResponse createEntity(final PostUriInfo uriInfo, final InputStream content, final String requestContentType, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntityProcessor
+   */
+  @Override
+  public ODataResponse readEntity(final GetEntityUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntityProcessor
+   */
+  @Override
+  public ODataResponse existsEntity(final GetEntityCountUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntityProcessor
+   */
+  @Override
+  public ODataResponse updateEntity(final PutMergePatchUriInfo uriInfo, final InputStream content, final String requestContentType, final boolean merge, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see EntityProcessor
+   */
+  @Override
+  public ODataResponse deleteEntity(final DeleteUriInfo uriInfo, final String contentType) throws ODataException {
+    throw new ODataNotImplementedException();
+  }
+
+  /**
+   * @see ServiceDocumentProcessor
+   */
+  @Override
+  public ODataResponse readServiceDocument(final GetServiceDocumentUriInfo uriInfo, final String contentType) throws ODataException {
+    final Edm entityDataModel = getContext().getService().getEntityDataModel();
+    final String serviceRoot = getContext().getPathInfo().getServiceRoot().toASCIIString();
+
+    final ODataResponse response = EntityProvider.writeServiceDocument(contentType, entityDataModel, serviceRoot);
+    final ODataResponseBuilder odataResponseBuilder = ODataResponse.fromResponse(response).header(ODataHttpHeaders.DATASERVICEVERSION, ODataServiceVersion.V10);
+    if (isContentTypeUpdateNecessary(contentType, response)) {
+      odataResponseBuilder.contentHeader(contentType);
+    }
+    return odataResponseBuilder.build();
+  }
+
+  /**
+   * Simple check whether the content type for the {@link ODataResponse} needs adapted or not (based on requested content type).
+   * 
+   * @param contentType
+   * @param response
+   * @return true if an update is necessary
+   */
+  private boolean isContentTypeUpdateNecessary(final String contentType, final ODataResponse response) {
+    boolean contentTypeAlreadySet = contentType.equals(response.getContentHeader());
+    boolean requestedAtomAndRespondAtomSvc = contentType.contains("atom") && response.getContentHeader().contains("atomsvc");
+
+    return !(contentTypeAlreadySet || requestedAtomAndRespondAtomSvc);
+  }
+
+  /**
+   * @see MetadataProcessor
+   */
+  @Override
+  public ODataResponse readMetadata(final GetMetadataUriInfo uriInfo, final String contentType) throws ODataException {
+    final EdmServiceMetadata edmServiceMetadata = getContext().getService().getEntityDataModel().getServiceMetadata();
+
+    return ODataResponse.status(HttpStatusCodes.OK).header(HttpHeaders.CONTENT_TYPE, contentType).header(ODataHttpHeaders.DATASERVICEVERSION, edmServiceMetadata.getDataServiceVersion()).entity(edmServiceMetadata.getMetadata()).build();
+  }
+
+  /**
+   * @see CustomContentType
+   */
+  @Override
+  public List<String> getCustomContentTypes(final Class<? extends ODataProcessor> processorFeature) throws ODataException {
+    return Collections.emptyList();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/feature/CustomContentType.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/feature/CustomContentType.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/feature/CustomContentType.java
new file mode 100644
index 0000000..813bd00
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/feature/CustomContentType.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.processor.feature;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataProcessor;
+
+/**
+ * Data processor feature if processor supports custom content types. By default the OData library supports
+ * various types like Json (application/json), Atom (application/xml+atom) and XML (application/xml). But
+ * the OData specification allows also other types like e.g. CSV or plain text.  
+ * 
+ * @author SAP AG
+ */
+public interface CustomContentType extends ODataProcessorFeature {
+
+  /**
+   * The OData library will consider these additional content types during negotiation of http content type header.
+   * @param processorFeature
+   * @return a list of additional supported content types in the format "type/sub type"
+   * @throws ODataException
+   */
+  public List<String> getCustomContentTypes(Class<? extends ODataProcessor> processorFeature) throws ODataException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/feature/ODataProcessorFeature.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/feature/ODataProcessorFeature.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/feature/ODataProcessorFeature.java
new file mode 100644
index 0000000..3692737
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/feature/ODataProcessorFeature.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.processor.feature;
+
+/**
+ * Marker interface for data processor features. A feature is like a call back where 
+ * the OData library can request additional information from the processor to change
+ * control over request handling. 
+ * 
+ * @author SAP AG
+ */
+public interface ODataProcessorFeature {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/feature/package-info.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/feature/package-info.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/feature/package-info.java
new file mode 100644
index 0000000..15d4eda
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/feature/package-info.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+/**
+ * Processor Features<p>
+ * 
+ * Optional feature interfaces. Can be implemented by custom data processors. 
+ */
+package org.apache.olingo.odata2.api.processor.feature;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/package-info.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/package-info.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/package-info.java
new file mode 100644
index 0000000..484abd1
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/package-info.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+/**
+ * Data Processor<p>
+ * 
+ * A data processor implements all create, read, update and delete (CRUD) methods of an OData service. A processor as 
+ * part of a OData service implementation is created by the service factory and then called during request handling. 
+ * In dependency of the http context (http method, requestheaders ...) and the parsed uri semantic the OData Library 
+ * will call an appropriate processor method. Within this method a service can perform operations on data. In a final
+ * step the data result can be transformed using a {@link org.apache.olingo.odata2.api.ep.EntityProvider} (for Json, Atom and XML) and is returned as 
+ * a {@link org.apache.olingo.odata2.api.processor.ODataResponse}.
+ * <p>
+ * A processor gets access to context information either via method parameters or a {@link org.apache.olingo.odata2.api.processor.ODataContext} which is attached 
+ * to the processor object.
+ * <p>
+ * A processor can support optional features {@link org.apache.olingo.odata2.api.processor.feature} and implement 
+ * parts {@link org.apache.olingo.odata2.api.processor.part} which is more or less a grouping for different OData CRUD operations.
+ * <p>
+ * {@link org.apache.olingo.odata2.api.processor.ODataSingleProcessor} is a convenience abstract class that implements all interface parts and has default implementations 
+ * for handling OData service document and metadata. Usually the {@link org.apache.olingo.odata2.api.processor.ODataSingleProcessor} is used together with a 
+ * <code>ODataSingleService</code> default implementation.
+ *  
+ */
+package org.apache.olingo.odata2.api.processor;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/BatchProcessor.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/BatchProcessor.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/BatchProcessor.java
new file mode 100644
index 0000000..427a549
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/BatchProcessor.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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.processor.part;
+
+import java.io.InputStream;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.batch.BatchHandler;
+import org.apache.olingo.odata2.api.batch.BatchResponsePart;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataProcessor;
+import org.apache.olingo.odata2.api.processor.ODataRequest;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+
+/**
+ * Execute a OData batch request. 
+ * 
+ * @author SAP AG
+ *
+ */
+public interface BatchProcessor extends ODataProcessor {
+
+  /**
+   * Executes a OData batch request and provide Batch Response as {@link ODataResponse} 
+   * @param handler batch handler
+   * @param contentType the content type of the request
+   * @param content Batch Request body
+   * @return a {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse executeBatch(BatchHandler handler, String contentType, InputStream content) throws ODataException;
+
+  /**
+   * Executes a Change Set and provide BatchResponsePart as {@link BatchResponsePart} that contains the responses to change requests.
+   * The method has to define a rollback semantic that may be applied when a request within a Change Set fails (all-or-nothing requirement).
+   * If a request within a Change Set fails, instead of Change Set Response should be returned the error response 
+   * @param handler batch handler
+   * @param requests list of single change requests
+   * @return a {@link BatchResponsePart} object
+   * @throws ODataException 
+   */
+  BatchResponsePart executeChangeSet(BatchHandler handler, List<ODataRequest> requests) throws ODataException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityComplexPropertyProcessor.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityComplexPropertyProcessor.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityComplexPropertyProcessor.java
new file mode 100644
index 0000000..a27766a
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityComplexPropertyProcessor.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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.processor.part;
+
+import java.io.InputStream;
+
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataProcessor;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.api.uri.info.GetComplexPropertyUriInfo;
+import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo;
+
+/**
+ * Execute a OData complex property request. 
+ * 
+ * @author SAP AG
+ */
+public interface EntityComplexPropertyProcessor extends ODataProcessor {
+  /**
+   * Reads a complex property of an entity.
+   * @param uriInfo information about the request URI
+   * @param contentType the content type of the response
+   * @return a {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse readEntityComplexProperty(GetComplexPropertyUriInfo uriInfo, String contentType) throws ODataException;
+
+  /**
+   * Updates a complex property of an entity.
+   * @param uriInfo information about the request URI
+   * @param content the content of the request, containing the updated property data
+   * @param requestContentType the content type of the request body
+   * @param merge if <code>true</code>, properties not present in the data are left unchanged;
+   *              if <code>false</code>, they are reset
+   * @param contentType the content type of the response
+   * @return a {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse updateEntityComplexProperty(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, boolean merge, String contentType) throws ODataException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityLinkProcessor.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityLinkProcessor.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityLinkProcessor.java
new file mode 100644
index 0000000..b9c36db
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityLinkProcessor.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * 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.processor.part;
+
+import java.io.InputStream;
+
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataProcessor;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.api.uri.info.DeleteUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntityLinkCountUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntityLinkUriInfo;
+import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo;
+
+/**
+ * Execute an OData entity link request. 
+ * 
+ * @author SAP AG
+ */
+public interface EntityLinkProcessor extends ODataProcessor {
+  /**
+   * Reads the URI of the target entity of a navigation property.
+   * @param uriInfo information about the request URI
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse readEntityLink(GetEntityLinkUriInfo uriInfo, String contentType) throws ODataException;
+
+  /**
+   * Returns whether the target entity of a navigation property exists.
+   * @param uriInfo information about the request URI
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse existsEntityLink(GetEntityLinkCountUriInfo uriInfo, String contentType) throws ODataException;
+
+  /**
+   * Updates the link to the target entity of a navigation property.
+   * @param uriInfo information about the request URI
+   * @param content the content of the request, containing the new URI
+   * @param requestContentType the content type of the request body
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse updateEntityLink(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException;
+
+  /**
+   * Deletes the link to the target entity of a navigation property.
+   * @param uriInfo information about the request URI
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse deleteEntityLink(DeleteUriInfo uriInfo, String contentType) throws ODataException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityLinksProcessor.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityLinksProcessor.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityLinksProcessor.java
new file mode 100644
index 0000000..9aaad4a
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityLinksProcessor.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * 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.processor.part;
+
+import java.io.InputStream;
+
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataProcessor;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetLinksCountUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetLinksUriInfo;
+import org.apache.olingo.odata2.api.uri.info.PostUriInfo;
+
+/**
+ * Execute a OData entity links request. 
+ * 
+ * @author SAP AG
+ */
+public interface EntityLinksProcessor extends ODataProcessor {
+  /**
+   * Reads the URIs of the target entities of a navigation property.
+   * @param uriInfo information about the request URI
+   * @param contentType the content type of the response
+   * @return an OData response object
+   * @throws ODataException
+   */
+  ODataResponse readEntityLinks(GetEntitySetLinksUriInfo uriInfo, String contentType) throws ODataException;
+
+  /**
+   * Counts the number of target entities of a navigation property.
+   * @param uriInfo information about the request URI
+   * @param contentType the content type of the response
+   * @return an OData response object
+   * @throws ODataException
+   */
+  ODataResponse countEntityLinks(GetEntitySetLinksCountUriInfo uriInfo, String contentType) throws ODataException;
+
+  /**
+   * Creates a new link to a target entity of a navigation property.
+   * @param uriInfo information about the request URI
+   * @param content the content of the request, containing the link data
+   * @param requestContentType the content type of the request body
+   * @param contentType the content type of the response
+   * @return an OData response object
+   * @throws ODataException
+   */
+  ODataResponse createEntityLink(PostUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityMediaProcessor.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityMediaProcessor.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityMediaProcessor.java
new file mode 100644
index 0000000..b9e7c3e
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityMediaProcessor.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * 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.processor.part;
+
+import java.io.InputStream;
+
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataProcessor;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.api.uri.info.DeleteUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetMediaResourceUriInfo;
+import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo;
+
+/**
+ * Execute an OData entity media request
+ * @author SAP AG
+ */
+public interface EntityMediaProcessor extends ODataProcessor {
+
+  /**
+   * Reads the media resource of an entity.
+   * @param uriInfo information about the request URI
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse readEntityMedia(GetMediaResourceUriInfo uriInfo, String contentType) throws ODataException;
+
+  /**
+   * Updates the media resource of an entity.
+   * @param uriInfo information about the request URI
+   * @param content the content of the request
+   * @param requestContentType the content type of the request body
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse updateEntityMedia(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException;
+
+  /**
+   * Deletes the media resource of an entity.
+   * @param uriInfo information about the request URI
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse deleteEntityMedia(DeleteUriInfo uriInfo, String contentType) throws ODataException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityProcessor.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityProcessor.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityProcessor.java
new file mode 100644
index 0000000..c1a69a3
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntityProcessor.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * 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.processor.part;
+
+import java.io.InputStream;
+
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataProcessor;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.api.uri.info.DeleteUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntityCountUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo;
+import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo;
+
+/**
+ * Execute a OData entity request. 
+ * 
+ * @author SAP AG
+ */
+public interface EntityProcessor extends ODataProcessor {
+
+  /**
+   * Reads an entity.
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse readEntity(GetEntityUriInfo uriInfo, String contentType) throws ODataException;
+
+  /**
+   * Checks whether an entity exists.
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse existsEntity(GetEntityCountUriInfo uriInfo, String contentType) throws ODataException;
+
+  /**
+   * Updates an entity.
+   * @param uriInfo information about the request URI
+   * @param content the content of the request, containing the updated entity data
+   * @param requestContentType the content type of the request body
+   * @param merge if <code>true</code>, properties not present in the data are left unchanged;
+   *              if <code>false</code>, they are reset
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse updateEntity(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, boolean merge, String contentType) throws ODataException;
+
+  /**
+   * Deletes an entity.
+   * @param uriInfo  a {@link DeleteUriInfo} object with information from the URI parser
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse deleteEntity(DeleteUriInfo uriInfo, String contentType) throws ODataException;
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntitySetProcessor.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntitySetProcessor.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntitySetProcessor.java
new file mode 100644
index 0000000..b42a940
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntitySetProcessor.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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.processor.part;
+
+import java.io.InputStream;
+
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataProcessor;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetCountUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
+import org.apache.olingo.odata2.api.uri.info.PostUriInfo;
+
+/**
+ * Execute a OData entity set request. 
+ * 
+ * @author SAP AG
+ *
+ */
+public interface EntitySetProcessor extends ODataProcessor {
+
+  /**
+   * Reads entities.
+   * @param uriInfo information about the request URI
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse readEntitySet(GetEntitySetUriInfo uriInfo, String contentType) throws ODataException;
+
+  /**
+   * Counts the number of requested entities.
+   * @param uriInfo information about the request URI
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse countEntitySet(GetEntitySetCountUriInfo uriInfo, String contentType) throws ODataException;
+
+  /**
+   * Creates an entity.
+   * @param uriInfo information about the request URI
+   * @param content the content of the request, containing the data of the new entity
+   * @param requestContentType the content type of the request body
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse createEntity(PostUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntitySimplePropertyProcessor.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntitySimplePropertyProcessor.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntitySimplePropertyProcessor.java
new file mode 100644
index 0000000..20a0b0d
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntitySimplePropertyProcessor.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.processor.part;
+
+import java.io.InputStream;
+
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataProcessor;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo;
+import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo;
+
+/**
+ * Execute a OData entity simple property request. 
+ * 
+ * @author SAP AG
+ */
+public interface EntitySimplePropertyProcessor extends ODataProcessor {
+
+  /**
+   * Reads a simple property of an entity.
+   * @param contentType the content type of the response
+   * @return a {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse readEntitySimpleProperty(GetSimplePropertyUriInfo uriInfo, String contentType) throws ODataException;
+
+  /**
+   * Updates a simple property of an entity.
+   * @param uriInfo information about the request URI
+   * @param content the content of the request, containing the updated property data
+   * @param requestContentType the content type of the request body
+   * @param contentType the content type of the response
+   * @return a {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse updateEntitySimpleProperty(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntitySimplePropertyValueProcessor.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntitySimplePropertyValueProcessor.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntitySimplePropertyValueProcessor.java
new file mode 100644
index 0000000..b641fcf
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/EntitySimplePropertyValueProcessor.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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.processor.part;
+
+import java.io.InputStream;
+
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataProcessor;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.api.uri.info.DeleteUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo;
+import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo;
+
+/**
+ * Execute a OData entity simple property value request. 
+ * 
+ * @author SAP AG
+ */
+public interface EntitySimplePropertyValueProcessor extends ODataProcessor {
+
+  /**
+   * Reads the unformatted value of a simple property of an entity.
+   * @param uriInfo information about the request URI
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse readEntitySimplePropertyValue(GetSimplePropertyUriInfo uriInfo, String contentType) throws ODataException;
+
+  /**
+   * Updates a simple property of an entity with an unformatted value.
+   * @param uriInfo information about the request URI
+   * @param content the content of the request, containing the new value
+   * @param requestContentType the content type of the request body
+   *                           (important for a binary property)
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse updateEntitySimplePropertyValue(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException;
+
+  /**
+   * Deletes the value of a simple property of an entity.
+   * @param uriInfo information about the request URI
+   * @param contentType the content type of the response
+   * @return a {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse deleteEntitySimplePropertyValue(DeleteUriInfo uriInfo, String contentType) throws ODataException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/FunctionImportProcessor.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/FunctionImportProcessor.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/FunctionImportProcessor.java
new file mode 100644
index 0000000..7e50553
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/FunctionImportProcessor.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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.processor.part;
+
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataProcessor;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.api.uri.info.GetFunctionImportUriInfo;
+
+/**
+ * Execute an OData function import request. 
+ * @author SAP AG
+ */
+public interface FunctionImportProcessor extends ODataProcessor {
+  /**
+   * Executes a function import and returns the result.
+   * @param uriInfo information about the request URI
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse executeFunctionImport(GetFunctionImportUriInfo uriInfo, String contentType) throws ODataException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/FunctionImportValueProcessor.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/FunctionImportValueProcessor.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/FunctionImportValueProcessor.java
new file mode 100644
index 0000000..3d2fbbc
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/FunctionImportValueProcessor.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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.processor.part;
+
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataProcessor;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.api.uri.info.GetFunctionImportUriInfo;
+
+/**
+ * Execute an OData function import value request.
+ * @author SAP AG
+ */
+public interface FunctionImportValueProcessor extends ODataProcessor {
+  /**
+   * Returns the unformatted value of a function import.
+   * @param uriInfo information about the request URI
+   * @param contentType the content type of the response
+   * @return an {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse executeFunctionImportValue(GetFunctionImportUriInfo uriInfo, String contentType) throws ODataException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/MetadataProcessor.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/MetadataProcessor.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/MetadataProcessor.java
new file mode 100644
index 0000000..307d202
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/MetadataProcessor.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * 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.processor.part;
+
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataProcessor;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.api.uri.info.GetMetadataUriInfo;
+
+/**
+ * Execute a OData metadata request. 
+ * 
+ * @author SAP AG
+ */
+public interface MetadataProcessor extends ODataProcessor {
+
+  /**
+   * @param contentType 
+   * @return a {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse readMetadata(GetMetadataUriInfo uriInfo, String contentType) throws ODataException;
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/ServiceDocumentProcessor.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/ServiceDocumentProcessor.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/ServiceDocumentProcessor.java
new file mode 100644
index 0000000..94db07b
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/ServiceDocumentProcessor.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * 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.processor.part;
+
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataProcessor;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.api.uri.info.GetServiceDocumentUriInfo;
+
+/**
+ * Execute a OData service document request. 
+ * 
+ * @author SAP AG
+ */
+public interface ServiceDocumentProcessor extends ODataProcessor {
+
+  /**
+   * @param contentType 
+   * @return a {@link ODataResponse} object
+   * @throws ODataException
+   */
+  ODataResponse readServiceDocument(GetServiceDocumentUriInfo uriInfo, String contentType) throws ODataException;
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/package-info.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/package-info.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/package-info.java
new file mode 100644
index 0000000..16ca1c0
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/processor/part/package-info.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+/**
+ * Processor Parts<p>
+ */
+package org.apache.olingo.odata2.api.processor.part;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/rt/RuntimeDelegate.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/rt/RuntimeDelegate.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/rt/RuntimeDelegate.java
new file mode 100644
index 0000000..af0f74f
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/rt/RuntimeDelegate.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * 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.rt;
+
+import java.io.InputStream;
+
+import org.apache.olingo.odata2.api.ODataService;
+import org.apache.olingo.odata2.api.batch.BatchResponsePart.BatchResponsePartBuilder;
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmSimpleType;
+import org.apache.olingo.odata2.api.edm.EdmSimpleTypeFacade;
+import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
+import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
+import org.apache.olingo.odata2.api.ep.EntityProvider.EntityProviderInterface;
+import org.apache.olingo.odata2.api.ep.EntityProviderException;
+import org.apache.olingo.odata2.api.processor.ODataRequest.ODataRequestBuilder;
+import org.apache.olingo.odata2.api.processor.ODataResponse.ODataResponseBuilder;
+import org.apache.olingo.odata2.api.processor.ODataSingleProcessor;
+import org.apache.olingo.odata2.api.uri.UriParser;
+
+/**
+ * Provides access to core implementation classes for interfaces. This class is used 
+ * by internal abstract API implementations and it is not intended to be used by others. 
+ * 
+ * @org.apache.olingo.odata2.DoNotImplement
+ * @author SAP AG
+ */
+public abstract class RuntimeDelegate {
+
+  private static final String IMPLEMENTATION = "org.apache.olingo.odata2.core.rt.RuntimeDelegateImpl";
+
+  /**
+   * Create a runtime delegate instance from the core library. The core 
+   * library (org.apache.olingo.odata2.core.jar) needs to be included into the classpath
+   * of the using application.
+   * @return an implementation object
+   */
+  private static RuntimeDelegateInstance getInstance() {
+    RuntimeDelegateInstance delegate;
+
+    try {
+      final Class<?> clazz = Class.forName(RuntimeDelegate.IMPLEMENTATION);
+
+      /*
+       * We explicitly do not use the singleton pattern to keep the server state free
+       * and avoid class loading issues also during hot deployment. 
+       */
+      final Object object = clazz.newInstance();
+      delegate = (RuntimeDelegateInstance) object;
+
+    } catch (final Exception e) {
+      throw new RuntimeDelegateException(e);
+    }
+    return delegate;
+  }
+
+  /**
+   * An implementation is available in the core library.
+   * @org.apache.olingo.odata2.DoNotImplement
+   */
+  public static abstract class RuntimeDelegateInstance {
+
+    protected abstract ODataResponseBuilder createODataResponseBuilder();
+
+    protected abstract EdmSimpleType getEdmSimpleType(EdmSimpleTypeKind edmSimpleTypeKind);
+
+    protected abstract UriParser getUriParser(Edm edm);
+
+    protected abstract EdmSimpleTypeFacade getSimpleTypeFacade();
+
+    protected abstract Edm createEdm(EdmProvider provider);
+
+    protected abstract EntityProviderInterface createEntityProvider();
+
+    protected abstract ODataService createODataSingleProcessorService(EdmProvider provider, ODataSingleProcessor processor);
+
+    protected abstract EdmProvider createEdmProvider(InputStream metadataXml, boolean validate) throws EntityProviderException;
+
+    protected abstract BatchResponsePartBuilder createBatchResponsePartBuilder();
+
+    protected abstract ODataRequestBuilder createODataRequestBuilder();
+
+  }
+
+  /**
+   * Returns a simple type object for given type kind.
+   * @param edmSimpleTypeKind type kind
+   * @return an implementation object
+   */
+  public static EdmSimpleType getEdmSimpleType(final EdmSimpleTypeKind edmSimpleTypeKind) {
+    return RuntimeDelegate.getInstance().getEdmSimpleType(edmSimpleTypeKind);
+  }
+
+  /**
+   * Returns an implementation of the EDM simple-type facade.
+   * @return an implementation object
+   */
+  public static EdmSimpleTypeFacade getSimpleTypeFacade() {
+    return RuntimeDelegate.getInstance().getSimpleTypeFacade();
+  }
+
+  /**
+   * Returns a builder for creating response objects with variable parameter sets.
+   * @return an implementation object
+   */
+  public static ODataResponseBuilder createODataResponseBuilder() {
+    return RuntimeDelegate.getInstance().createODataResponseBuilder();
+  }
+
+  /**
+   * Creates and returns an entity data model.
+   * @param provider a provider implemented by the OData service
+   * @return an implementation object
+   */
+  public static Edm createEdm(final EdmProvider provider) {
+    return RuntimeDelegate.getInstance().createEdm(provider);
+  }
+
+  /**
+   * Returns an parser which can parse OData uris based on metadata.
+   * @param edm metadata of the implemented service
+   * @return an implementation object
+   */
+  public static UriParser getUriParser(final Edm edm) {
+    return RuntimeDelegate.getInstance().getUriParser(edm);
+  }
+
+  /**
+   * Creates and returns a http entity provider. 
+   * @return an implementation object
+   */
+  public static EntityProviderInterface createEntityProvider() {
+    return RuntimeDelegate.getInstance().createEntityProvider();
+  }
+
+  /**
+   * Creates and returns a single processor service. 
+   * @param provider a provider implementation for the metadata of the OData service
+   * @param processor a single data processor implementation of the OData service
+   * @return a implementation object
+   */
+  public static ODataService createODataSingleProcessorService(final EdmProvider provider, final ODataSingleProcessor processor) {
+    return RuntimeDelegate.getInstance().createODataSingleProcessorService(provider, processor);
+  }
+
+  /**
+   * Creates and returns an edm provider. 
+   * @param metadataXml a metadata xml input stream (means the metadata document)
+   * @param validate true if semantic checks for metadata input stream shall be done
+   * @return an instance of EdmProvider
+   */
+  public static EdmProvider createEdmProvider(final InputStream metadataXml, final boolean validate) throws EntityProviderException {
+    return RuntimeDelegate.getInstance().createEdmProvider(metadataXml, validate);
+  }
+
+  private static class RuntimeDelegateException extends RuntimeException {
+
+    private static final long serialVersionUID = 1L;
+
+    public RuntimeDelegateException(final Exception e) {
+      super(e);
+    }
+  }
+
+  public static BatchResponsePartBuilder createBatchResponsePartBuilder() {
+    return RuntimeDelegate.getInstance().createBatchResponsePartBuilder();
+  }
+
+  public static ODataRequestBuilder createODataRequestBuilder() {
+    return RuntimeDelegate.getInstance().createODataRequestBuilder();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/rt/package-info.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/rt/package-info.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/rt/package-info.java
new file mode 100644
index 0000000..51c14c0
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/rt/package-info.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+/**
+ * Runtime Support<p> 
+ * 
+ * Provides a mechanism for loading of implementation classes for interfaces. 
+ */
+package org.apache.olingo.odata2.api.rt;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Accept.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Accept.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Accept.java
new file mode 100644
index 0000000..187212f
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Accept.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * 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.servicedocument;
+
+/**
+ * An Accept element
+ * <p>Accept element indicates the types of representation accepted by the Collection
+ * @author SAP AG
+ */
+public interface Accept {
+
+  /**
+   * Get the media range
+   * 
+   * @return value as String
+   */
+  public String getValue();
+
+  /**
+   * Get common attributes
+   * 
+   * @return {@link CommonAttributes}
+   */
+  public CommonAttributes getCommonAttributes();
+}