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:35 UTC

[30/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/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
new file mode 100644
index 0000000..8c870d5
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderReadProperties.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * The {@link EntityProviderReadProperties} contains all necessary settings to read an entity with the {@link EntityProvider}.
+ * 
+ * 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>
+ * 
+ * @author SAP AG
+ */
+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 an <b>merge</b> (e.g. MERGE, PATCH) read request, 
+   * otherwise if <code>false</code> it is an <b>none 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 read 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;
+  }
+
+  public boolean getMergeSemantic() {
+    return merge;
+  }
+
+  /**
+   * @author SAP AG
+   */
+  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);
+    }
+
+    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/ff2b0a0e/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
new file mode 100644
index 0000000..55be388
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderWriteProperties.java
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * 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/ff2b0a0e/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
new file mode 100644
index 0000000..970e4d8
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/OnReadInlineContent.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * 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>
+ * 
+ * @author SAP AG
+ */
+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/ff2b0a0e/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
new file mode 100644
index 0000000..f4f3dcb
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/OnWriteEntryContent.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.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.
+ * 
+ * @author SAP AG
+ *
+ */
+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/ff2b0a0e/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
new file mode 100644
index 0000000..f702c9e
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/OnWriteFeedContent.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.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..*.
+ * 
+ * @author SAP AG
+ *
+ */
+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/ff2b0a0e/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
new file mode 100644
index 0000000..ad96cf4
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/ReadEntryResult.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.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.
+ * 
+ * @author SAP AG
+ *
+ */
+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/ff2b0a0e/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
new file mode 100644
index 0000000..c86d90d
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/ReadFeedResult.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.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.
+ * 
+ * @author SAP AG
+ */
+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();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/ReadResult.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/ReadResult.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/ReadResult.java
new file mode 100644
index 0000000..dd2d8a8
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/ReadResult.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * A {@link ReadResult} represents an inlined navigation property which points to an entry or feed.
+ * The {@link ReadResult} contains the {@link EntityProviderReadProperties} which were used for read, 
+ * the <code>navigationPropertyName</code>, the read/de-serialized inlined entity and information whether the inlined content
+ * is a <code>feed</code> (multiplicity of <code>1..m</code>) or a single <code>entry</code> (multiplicity of <code>0..1</code> or <code>1..1</code>).
+ * If inlined navigation property is <code>nullable</code> the {@link ReadResult} has the 
+ * <code>navigationPropertyName</code> and a <code>NULL</code> entry set.
+ * 
+ * @author SAP AG
+ */
+public abstract class ReadResult {
+
+  protected final EntityProviderReadProperties readProperties;
+  protected final EdmNavigationProperty navigationProperty;
+
+  /**
+   * Constructor.
+   * Parameters <b>MUST NOT BE NULL</b>.
+   * 
+   * @param readProperties read properties which are used to read enclosing parent entity
+   * @param navigationProperty emd navigation property information of found inline navigation property
+   */
+  public ReadResult(final EntityProviderReadProperties readProperties, final EdmNavigationProperty navigationProperty) {
+    this.readProperties = readProperties;
+    this.navigationProperty = navigationProperty;
+  }
+
+  /**
+   * @return read properties which were used to read enclosing parent entity
+   */
+  public EntityProviderReadProperties getReadProperties() {
+    return readProperties;
+  }
+
+  /**
+   * @return emd navigation property information of found inline navigation property
+   */
+  public EdmNavigationProperty getNavigationProperty() {
+    return navigationProperty;
+  }
+
+  /**
+   * Common access method to read result.
+   * 
+   * @return an {@link org.apache.olingo.odata2.api.ep.entry.ODataEntry ODataEntry}
+   *         for the case of an single read entry or a list of
+   *         {@link org.apache.olingo.odata2.api.ep.entry.ODataEntry ODataEntry}
+   *         in the case of an read feed.
+   */
+  public abstract Object getResult();
+
+  @Override
+  public String toString() {
+    return this.getClass().getSimpleName() + " [readProperties=" + readProperties + ", navigationProperty=" + navigationProperty + "]";
+  }
+
+  /**
+   * Return whether this entry is a <code>feed</code> (multiplicity of <code>1..m</code>) 
+   * or a single <code>entry</code> (multiplicity of <code>0..1</code> or <code>1..1</code>).
+   * 
+   * @return <code>true</code> for a feed and <code>false</code> for an entry
+   */
+  public abstract boolean isFeed();
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/TombstoneCallback.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/TombstoneCallback.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/TombstoneCallback.java
new file mode 100644
index 0000000..3021e67
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/TombstoneCallback.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.ep.callback;
+
+import org.apache.olingo.odata2.api.ODataCallback;
+
+/**
+ * <p>Interface that must be implemented in order to provide tombstone support.</p>
+ * <p>The callback implementing this interface is registered at the
+ * {@link org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties EntityProviderWriteProperties}
+ * using the callback key of this class.</p>
+ * @author SAP AG
+ */
+public interface TombstoneCallback extends ODataCallback {
+
+  /**
+   * The key to be used when registering the callback at the
+   * {@link org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties EntityProviderWriteProperties}
+   */
+  public static final String CALLBACK_KEY_TOMBSTONE = "~tombstoneCallback";
+  public static final String PREFIX_TOMBSTONE = "at";
+  public static final String NAMESPACE_TOMBSTONE = "http://purl.org/atompub/tombstones/1.0";
+
+  @Deprecated
+  public static final String REL_DELTA = "delta";
+
+  /**
+   * <p>This method is called after all entries have been serialized.</p>
+   * <p>The returned {@link TombstoneCallbackResult} must contain all deleted entries,
+   * in the form of List{@literal <}Map{@literal <}property name, property value{@literal >}{@literal >},
+   * which should be serialized.</p>
+   * <p>A map representing a deleted entry
+   * <ul><li><b>MUST</b> contain all properties which are part of the key for this entry.</li>
+   * <li><b>MAY</b> contain the property which is mapped on SyndicationUpdated.
+   * The provided value here will result in the value of the "when" attribute
+   * of the deleted entry.</li></ul></p>
+   * <p>The provided delta link will be serialized at the end of the feed document.</p>
+   */
+  TombstoneCallbackResult getTombstoneCallbackResult();
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/TombstoneCallbackResult.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/TombstoneCallbackResult.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/TombstoneCallbackResult.java
new file mode 100644
index 0000000..9836780
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/TombstoneCallbackResult.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.ep.callback;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Objects of this class are a container for the result of the {@link TombstoneCallback}.
+ * @author SAP AG
+ *
+ */
+public class TombstoneCallbackResult {
+
+  private List<Map<String, Object>> deletedEntriesData;
+  private String deltaLink;
+
+  /**
+   * A map representing a deleted entry <b>MUST</b> contain all properties which are part of the key for this entry.
+   * <br>A map representing a deleted entry <b>MAY</b> contain the property which is mapped on SyndicationUpdated. The provided value here will result in the value of the "when" attribute of the deleted entry. 
+   * @return deleted entries in the form of List{@literal <}Map{@literal <}property name, property value{@literal >}{@literal >}
+   */
+  public List<Map<String, Object>> getDeletedEntriesData() {
+    return deletedEntriesData;
+  }
+
+  /**
+   * Sets the data for all deleted entries
+   * @param deletedEntriesData
+   */
+  public void setDeletedEntriesData(final List<Map<String, Object>> deletedEntriesData) {
+    this.deletedEntriesData = deletedEntriesData;
+  }
+
+  /**
+   * @return delta link as String
+   */
+  public String getDeltaLink() {
+    return deltaLink;
+  }
+
+  /**
+   * Sets the delta link to retrieve a delta. 
+   * @param deltaLink
+   */
+  public void setDeltaLink(final String deltaLink) {
+    this.deltaLink = deltaLink;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteCallbackContext.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteCallbackContext.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteCallbackContext.java
new file mode 100644
index 0000000..4281de7
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteCallbackContext.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * 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 java.util.HashMap;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.ep.EntityProviderException;
+import org.apache.olingo.odata2.api.uri.ExpandSelectTreeNode;
+
+/**
+ * Wrapper for {@link WriteEntryCallbackContext} and {@link WriteFeedCallbackContext}.
+ * @org.apache.olingo.odata2.DoNotImplement 
+ * @author SAP AG
+ */
+public abstract class WriteCallbackContext {
+  private EdmEntitySet sourceEntitySet;
+  private EdmNavigationProperty navigationProperty;
+  private Map<String, Object> entryData;
+  private ExpandSelectTreeNode currentNode;
+
+  /**
+   * Current means the node pointing to the target entity set
+   * @return the current node of the expand select tree
+   */
+  public ExpandSelectTreeNode getCurrentExpandSelectTreeNode() {
+    return currentNode;
+  }
+
+  /**
+   * Do Not Call This Method!
+   * @param currentNode
+   */
+  public void setCurrentExpandSelectTreeNode(final ExpandSelectTreeNode currentNode) {
+    this.currentNode = currentNode;
+  }
+
+  /**
+   * Returns entity set which contains an entry that should be expanded
+   * @return source entity set
+   */
+  public EdmEntitySet getSourceEntitySet() {
+    return sourceEntitySet;
+  }
+
+  /**
+   * Do Not Call This Method!
+   * @param entitySet
+   */
+  public void setSourceEntitySet(final EdmEntitySet entitySet) {
+    sourceEntitySet = entitySet;
+  }
+
+  /**
+   * Navigation property which is contained in the expand clause.
+   * @return navigation property pointing to the entity which has to be expanded.
+   */
+  public EdmNavigationProperty getNavigationProperty() {
+    return navigationProperty;
+  }
+
+  /**
+   * Do Not Call This Method!
+   * @param navigationProperty
+   */
+  public void setNavigationProperty(final EdmNavigationProperty navigationProperty) {
+    this.navigationProperty = navigationProperty;
+  }
+
+  /**
+   * Source entry data which was just serialized.
+   * @return data of the source entry
+   */
+  public Map<String, Object> getEntryData() {
+    return entryData;
+  }
+
+  /**
+   * Do Not Call This Method!
+   * @param entryData
+   */
+  public void setEntryData(final Map<String, Object> entryData) {
+    this.entryData = entryData;
+  }
+
+  /**
+   * @return the key of the current entry as a Map<String,Object>
+   * @throws EntityProviderException in case of an {@link EdmException}
+   */
+  public Map<String, Object> extractKeyFromEntryData() throws EntityProviderException {
+    HashMap<String, Object> key = new HashMap<String, Object>();
+    try {
+      for (String keyPropertyName : sourceEntitySet.getEntityType().getKeyPropertyNames()) {
+        key.put(keyPropertyName, entryData.get(keyPropertyName));
+      }
+    } catch (EdmException e) {
+      throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+    }
+    return key;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteEntryCallbackContext.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteEntryCallbackContext.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteEntryCallbackContext.java
new file mode 100644
index 0000000..3955dab
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteEntryCallbackContext.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * Context given if the target of an expand is an entry. It contains the source entity set, the navigation property pointing to the entry which has to be expanded, the current expand select tree node and the data of the source entry.
+ * @author SAP AG
+ *
+ */
+public class WriteEntryCallbackContext extends WriteCallbackContext {}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteEntryCallbackResult.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteEntryCallbackResult.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteEntryCallbackResult.java
new file mode 100644
index 0000000..cfc5d88
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteEntryCallbackResult.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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 java.util.Map;
+
+import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
+
+/**
+ * Result of a callback. It contains the data of the entry which is to be expanded as well as the properties of this entry.
+ * @author SAP AG
+ */
+public class WriteEntryCallbackResult {
+
+  EntityProviderWriteProperties inlineProperties;
+  Map<String, Object> oneEntryData;
+
+  /**
+   * @return the inline properties
+   */
+  public EntityProviderWriteProperties getInlineProperties() {
+    return inlineProperties;
+  }
+
+  /**
+   * Sets the inline properties for this entry
+   * @param inlineProperties
+   */
+  public void setInlineProperties(final EntityProviderWriteProperties inlineProperties) {
+    this.inlineProperties = inlineProperties;
+  }
+
+  /**
+   * @return the data for the entry as a map
+   */
+  public Map<String, Object> getEntryData() {
+    return oneEntryData;
+  }
+
+  /**
+   * @param data for the entry as a map
+   */
+  public void setEntryData(final Map<String, Object> data) {
+    oneEntryData = data;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteFeedCallbackContext.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteFeedCallbackContext.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteFeedCallbackContext.java
new file mode 100644
index 0000000..ab30e4c
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteFeedCallbackContext.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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 java.net.URI;
+
+/**
+ * Context given if the target of an expand is a feed. It contains the source entity set, the navigation property pointing to the entry which has to be expanded, the current expand select tree node and the data of the source entry.
+ * @author SAP AG
+ *
+ */
+public class WriteFeedCallbackContext extends WriteCallbackContext {
+
+  private URI selfLink;
+
+  /**
+   * Sets the self Link for this feed.
+   * @param selfLink
+   */
+  public void setSelfLink(final URI selfLink) {
+    this.selfLink = selfLink;
+  }
+
+  /**
+   * This self link is the same as the link displayed for the navigation property e.g. Rooms(1)/nr_Buildings.
+   * @return the self link calculated by the library
+   */
+  public URI getSelfLink() {
+    return selfLink;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteFeedCallbackResult.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteFeedCallbackResult.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteFeedCallbackResult.java
new file mode 100644
index 0000000..8c3878e
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/WriteFeedCallbackResult.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.ep.callback;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
+
+/**
+ * Result of a callback. It contains the data of the feed which is to be expanded as well as the BaseUri of the feed. Further callbacks for this feed can also be set.
+ * @author SAP AG
+ *
+ */
+public class WriteFeedCallbackResult {
+
+  EntityProviderWriteProperties inlineProperties;
+  List<Map<String, Object>> feedData;
+
+  /**
+   * @return the inline provider properties
+   */
+  public EntityProviderWriteProperties getInlineProperties() {
+    return inlineProperties;
+  }
+
+  /**
+   * Sets the properties for the inline data. MUST NOT BE NULL.
+   * @param inlineProperties
+   */
+  public void setInlineProperties(final EntityProviderWriteProperties inlineProperties) {
+    this.inlineProperties = inlineProperties;
+  }
+
+  /**
+   * @return the feed data as a list of maps
+   */
+  public List<Map<String, Object>> getFeedData() {
+    return feedData;
+  }
+
+  /**
+   * Sets the feed data as a list of maps.
+   * @param feedData
+   */
+  public void setFeedData(final List<Map<String, Object>> feedData) {
+    this.feedData = feedData;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/package-info.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/package-info.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/package-info.java
new file mode 100644
index 0000000..b25eab4
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/callback/package-info.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+/**
+ * Entity Provider Callbacks<p>
+ * These callbacks will be used to support the $expand query option. Callbacks have to implement the {@link org.apache.olingo.odata2.api.ODataCallback} as a marker. 
+ * <br>To support an expanded entry the {@link org.apache.olingo.odata2.api.ep.callback.OnWriteEntryContent} interface has to be implemented.
+ * <br>To support an expanded feed the {@link org.apache.olingo.odata2.api.ep.callback.OnWriteFeedContent} interface has to be implemented.
+ * 
+ * <p>All callbacks are registered for a navigation property in a HashMap<String as navigation property name, callback for this navigation property> and will only be called if a matching $expand clause is found.
+ */
+package org.apache.olingo.odata2.api.ep.callback;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/EntryMetadata.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/EntryMetadata.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/EntryMetadata.java
new file mode 100644
index 0000000..39ea767
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/EntryMetadata.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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.entry;
+
+import java.util.List;
+
+/**
+ * {@link EntryMetadata} contains all metadata for an {@link ODataEntry}.
+ */
+public interface EntryMetadata {
+
+  /**
+   * Gets the URI of this entry.
+   * 
+   * @return the URI
+   */
+  public abstract String getUri();
+
+  /**
+   * Gets the association URIs for a given navigation property.
+   * 
+   * @param navigationPropertyName the name of the navigation property
+   * @return the list of URIs for the given navigation property
+   */
+  public abstract List<String> getAssociationUris(String navigationPropertyName);
+
+  /**
+   * Gets the entity tag for this entry.
+   * 
+   * @return the entity tag
+   */
+  public abstract String getEtag();
+
+  /**
+   * Gets the ID of this entry.
+   * 
+   * @return the ID
+   */
+  public abstract String getId();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/MediaMetadata.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/MediaMetadata.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/MediaMetadata.java
new file mode 100644
index 0000000..2d9da48
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/MediaMetadata.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.ep.entry;
+
+/**
+ * {@link MediaMetadata} contains all metadata for media related entries.
+ */
+public interface MediaMetadata {
+
+  /**
+   * Get <code>edit link</code>.
+   * 
+   * @return <code>edit link</code>.
+   */
+  public abstract String getEditLink();
+
+  /**
+   * Get <code>content type</code> in as specified in 
+   * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html">RFC 2616 Section 14</a>.
+   * 
+   * @return <code>content type</code>.
+   */
+  public abstract String getContentType();
+
+  /**
+   * Get <code>etag</code>.
+   * 
+   * @return <code>etag</code>.
+   */
+  public abstract String getEtag();
+
+  /**
+   * Get <code>source link</code>.
+   * 
+   * @return <code>source link</code>.
+   */
+  public abstract String getSourceLink();
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/ODataEntry.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/ODataEntry.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/ODataEntry.java
new file mode 100644
index 0000000..78401bc
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/ODataEntry.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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.entry;
+
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.uri.ExpandSelectTreeNode;
+
+/**
+ * An {@link ODataEntry} contains all <b>properties</b> (in form of a {@link Map}) and possible <b>metadata</b> 
+ * (in form of {@link MediaMetadata} and/or {@link EntryMetadata}) for an entry.
+ * 
+ */
+public interface ODataEntry {
+
+  /**
+   * Properties of this {@link ODataEntry} in form of a <b>property name</b> to <b>property value</b> map.
+   * 
+   * @return a <b>property name</b> to <b>property value</b> map.
+   */
+  public Map<String, Object> getProperties();
+
+  /**
+   * Get {@link MediaMetadata} for this {@link ODataEntry} if available.
+   * 
+   * @return {@link MediaMetadata} for this {@link ODataEntry} if available.
+   */
+  public MediaMetadata getMediaMetadata();
+
+  /**
+   * Get {@link EntryMetadata} for this {@link ODataEntry} if available.
+   * 
+   * @return {@link EntryMetadata} for this {@link ODataEntry} if available.
+   */
+  public EntryMetadata getMetadata();
+
+  /**
+   * If this {@link ODataEntry} contains properties of an inline navigation property this method
+   * returns <code>true</code>. 
+   * Otherwise if this {@link ODataEntry} only contains it own properties this method
+   * returns <code>false</code>.
+   * 
+   * @return <code>true</code> if inline navigation properties are contained, otherwise <code>false</code>.
+   */
+  public boolean containsInlineEntry();
+
+  /**
+   * Gets the expand select tree data structure which can be used for <code>$expand</code> query option.
+   * 
+   * @return parsed tree structure representing the $expand
+   */
+  public ExpandSelectTreeNode getExpandSelectTree();
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/package-info.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/package-info.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/package-info.java
new file mode 100644
index 0000000..1b99ceb
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/package-info.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+/**
+ * Entity Provider Entries<p>
+ * 
+ * The <b>org.apache.olingo.odata2.api.ep.entry</b> package contains all classes related and necessary for an {@link org.apache.olingo.odata2.api.ep.entry.ODataEntry}.
+ * <p>
+ */
+package org.apache.olingo.odata2.api.ep.entry;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/FeedMetadata.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/FeedMetadata.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/FeedMetadata.java
new file mode 100644
index 0000000..2200d5c
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/FeedMetadata.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.feed;
+
+/**
+ * {@link FeedMetadata} objects contain metadata information about one feed.
+ * @author SAP AG
+ *
+ */
+public interface FeedMetadata {
+
+  /**
+   * @return inlineCount may be null if no inlineCount is set.
+   */
+  public Integer getInlineCount();
+
+  /**
+   * @return nextLink may be null if no next link is set
+   */
+  public String getNextLink();
+
+  /**
+   * @return deltaLink may be null if no delta link is set
+   */
+  public String getDeltaLink();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java
new file mode 100644
index 0000000..0403b83
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.feed;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+
+/**
+ * An {@link ODataFeed} object contains a list of {@link ODataEntry}s and the metadata associated with this feed.
+ * @author SAP AG
+ *
+ */
+public interface ODataFeed {
+
+  /**
+   * The returned list may be empty but never null.
+   * @return list of {@link ODataEntry}s
+   */
+  public List<ODataEntry> getEntries();
+
+  /**
+   * @return {@link FeedMetadata} object
+   */
+  public FeedMetadata getFeedMetadata();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/package-info.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/package-info.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/package-info.java
new file mode 100644
index 0000000..abee895
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/package-info.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+/**
+ * Entity Provider Feed<p>
+ * 
+ * The <b>org.apache.olingo.odata2.api.ep.feed</b> package contains all classes related and necessary for an {@link org.apache.olingo.odata2.api.ep.feed.ODataFeed}.
+ * <p>
+ */
+package org.apache.olingo.odata2.api.ep.feed;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/package-info.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/package-info.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/package-info.java
new file mode 100644
index 0000000..ce381f9
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/package-info.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+/**
+ * Entity Provider<p>
+ * 
+ * The <b>org.apache.olingo.odata2.api.ep</b> package contains all classes related and necessary to provide an {@link org.apache.olingo.odata2.api.ep.EntityProvider}.
+ * <p>
+ * An {@link org.apache.olingo.odata2.api.ep.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 {@link org.apache.olingo.odata2.api.ep.EntityProvider} 
+ * for accessing entities in the <b>XML</b> and <b>JSON</b> format.
+ * <p>
+ * For support of additional formats it is recommended to handle those directly within an implementation of a 
+ * <code>ODataProcessor</code> (it is possible but <b>not recommended</b> to implement an own 
+ * {@link org.apache.olingo.odata2.api.ep.EntityProvider} for support of additional formats).
+ */
+package org.apache.olingo.odata2.api.ep;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/exception/MessageReference.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/exception/MessageReference.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/exception/MessageReference.java
new file mode 100644
index 0000000..2e8b31b
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/exception/MessageReference.java
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * 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.exception;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * APPLICATION DEVELOPERS: Please use {@link ODataApplicationException} to throw custom exceptions. This class is used inside the library only. 
+ * <p>A {@link MessageReference} references to the used message for an
+ * {@link ODataMessageException} and its sub classes. It supports
+ * internationalization and translation of exception messages.
+ * <br>Theses classes  contain a {@link MessageReference} object which
+ * can be mapped to a related key and message text in the resource bundles.
+ * @author SAP AG
+ */
+public abstract class MessageReference {
+
+  protected final String key;
+  protected List<Object> content = null;
+
+  private MessageReference(final String key) {
+    this(key, null);
+  }
+
+  private MessageReference(final String key, final List<Object> content) {
+    this.key = key;
+    this.content = content;
+  }
+
+  /**
+   * Creates a {@link MessageReference} for given <code>class</code> and <code>key</code>.
+   * This combination of <code>class</code> and <code>key</code> has to be provided
+   * by a resource bundle.
+   * @param clazz {@link ODataMessageException} for which this {@link MessageReference}
+   *              should be used
+   * @param key   unique key (in context of {@link ODataMessageException}) for reference
+   *              to message text in resource bundle
+   * @return created {@link MessageReference}
+   */
+  public static MessageReference create(final Class<? extends ODataException> clazz, final String key) {
+    return new SimpleMessageReference(clazz.getName() + "." + key);
+  }
+
+  public MessageReference create() {
+    return new SingleMessageReference(key);
+  }
+
+  /**
+   * Returns message key.
+   */
+  public String getKey() {
+    return key;
+  }
+
+  /**
+   * Adds given content to message reference.
+   */
+  public MessageReference addContent(final Object... content) {
+    if (this.content == null) {
+      return new SimpleMessageReference(key, content);
+    } else {
+      final List<Object> mergedContent = new ArrayList<Object>(this.content.size() + content.length);
+      mergedContent.addAll(this.content);
+      mergedContent.addAll(Arrays.asList(content));
+      return new SimpleMessageReference(key, mergedContent);
+    }
+  }
+
+  /**
+   * Receives content for this {@link MessageReference}.
+   * Beware that returned list is immutable.
+   */
+  public List<?> getContent() {
+    if (content == null) {
+      return Collections.emptyList();
+    } else {
+      return Collections.unmodifiableList(content);
+    }
+  }
+
+  /**
+   * Simple inner class for realization of {@link MessageReference} interface.
+   */
+  private static class SimpleMessageReference extends MessageReference {
+    public SimpleMessageReference(final String implKey) {
+      super(implKey);
+    }
+
+    public SimpleMessageReference(final String implKey, final List<Object> content) {
+      super(implKey, content);
+    }
+
+    public SimpleMessageReference(final String implKey, final Object... content) {
+      super(implKey, Arrays.asList(content));
+    }
+  }
+
+  private static class SingleMessageReference extends MessageReference {
+    public SingleMessageReference(final String implKey) {
+      super(implKey);
+    }
+
+    public SingleMessageReference(final String implKey, final List<Object> content) {
+      super(implKey, content);
+    }
+
+    public SingleMessageReference(final String implKey, final Object... content) {
+      super(implKey, Arrays.asList(content));
+    }
+
+    @Override
+    public MessageReference addContent(final Object... content) {
+
+      if (this.content == null) {
+        this.content = new ArrayList<Object>();
+      }
+
+      this.content.addAll(Arrays.asList(content));
+      return this;
+    }
+  }
+
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((key == null) ? 0 : key.hashCode());
+    return result;
+  }
+
+  /**
+   * {@link MessageReference}s are equal if their message keys have the same value.
+   * @return <code>true</code> if both instances are equal, otherwise <code>false</code>.
+   */
+  @Override
+  public boolean equals(final Object obj) {
+    if (this == obj) {
+      return true;
+    }
+    if (obj == null) {
+      return false;
+    }
+    if (getClass() != obj.getClass()) {
+      return false;
+    }
+    MessageReference other = (MessageReference) obj;
+    if (key == null) {
+      if (other.key != null) {
+        return false;
+      }
+    } else if (!key.equals(other.key)) {
+      return false;
+    }
+    return true;
+  }
+}