You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by tb...@apache.org on 2013/12/10 14:50:28 UTC

[33/50] [abbrv] git commit: Extract abstract, rename and refactore processor parts

Extract abstract, rename and refactore processor parts


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/28b35fff
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/28b35fff
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/28b35fff

Branch: refs/heads/ODataServlet
Commit: 28b35fff8c68aec2fbdac3f2f4f127cba62641b6
Parents: 8764e11
Author: Michael Bolz <mi...@apache.org>
Authored: Thu Dec 5 09:44:11 2013 +0100
Committer: Michael Bolz <mi...@apache.org>
Committed: Thu Dec 5 09:44:11 2013 +0100

----------------------------------------------------------------------
 .../olingo/odata2/api/data/DataSource.java      | 200 +++++++++++++++++++
 .../odata2/api/data/DataSourceProcessor.java    |  47 +++++
 .../olingo/odata2/api/data/ListsDataSource.java | 200 -------------------
 .../annotation/data/AnnotationInMemoryDs.java   |   4 +-
 .../annotation/processor/ListsProcessor.java    |  18 +-
 .../odata2/fit/ref/EntryXmlReadOnlyTest.java    |  15 +-
 .../ref/processor/ScenarioDataSource.java       |   4 +-
 7 files changed, 271 insertions(+), 217 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/28b35fff/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/data/DataSource.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/data/DataSource.java b/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/data/DataSource.java
new file mode 100644
index 0000000..694f199
--- /dev/null
+++ b/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/data/DataSource.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * 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.data;
+
+import java.util.Arrays;
+import java.util.List;
+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.EdmFunctionImport;
+import org.apache.olingo.odata2.api.exception.ODataApplicationException;
+import org.apache.olingo.odata2.api.exception.ODataNotFoundException;
+import org.apache.olingo.odata2.api.exception.ODataNotImplementedException;
+
+/**
+ * <p>This interface is intended to make it easier to implement an OData
+ * service in cases where all data for each entity set can be provided as a {@link List} of objects from which all
+ * properties described in the
+ * Entity Data Model can be retrieved and set.</p>
+ * <p>By obeying these restrictions, data-source implementations get the
+ * following advantages:
+ * <ul>
+ * <li>All system query options can be handled centrally.</li>
+ * <li>Following navigation paths must only be done step by step.</li>
+ * </ul>
+ * </p>
+ * 
+ */
+public interface DataSource {
+
+  /**
+   * Retrieves the whole data list for the specified entity set.
+   * @param entitySet the requested {@link EdmEntitySet}
+   * @return the requested data list
+   */
+  List<?> readData(EdmEntitySet entitySet) throws ODataNotImplementedException, ODataNotFoundException, EdmException,
+      ODataApplicationException;
+
+  /**
+   * Retrieves a single data object for the specified entity set and key.
+   * @param entitySet the requested {@link EdmEntitySet}
+   * @param keys the entity key as map of key names to key values
+   * @return the requested data object
+   */
+  Object readData(EdmEntitySet entitySet, Map<String, Object> keys) throws ODataNotImplementedException,
+      ODataNotFoundException, EdmException, ODataApplicationException;
+
+  /**
+   * <p>Retrieves data for the specified function import and key.</p>
+   * <p>This method is called also for function imports that have defined in
+   * their metadata an other HTTP method than <code>GET</code>.</p>
+   * @param function the requested {@link EdmFunctionImport}
+   * @param parameters the parameters of the function import
+   * as map of parameter names to parameter values
+   * @param keys the key of the returned entity set, as map of key names to key values,
+   * if the return type of the function import is a collection of entities
+   * (optional)
+   * @return the requested data object, either a list or a single object;
+   * if the function import's return type is of type <code>Binary</code>,
+   * the returned object(s) must be of type {@link BinaryData}
+   */
+  Object readData(EdmFunctionImport function, Map<String, Object> parameters, Map<String, Object> keys)
+      throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException;
+
+  /**
+   * <p>Retrieves related data for the specified source data, entity set, and key.</p>
+   * <p>If the underlying association of the EDM is specified to have target
+   * multiplicity '*' and no target key is given, this method returns a list of
+   * related data, otherwise it returns a single data object.</p>
+   * @param sourceEntitySet the {@link EdmEntitySet} of the source entity
+   * @param sourceData the data object of the source entity
+   * @param targetEntitySet the requested target {@link EdmEntitySet}
+   * @param targetKeys the key of the target entity as map of key names to key values
+   * (optional)
+   * @return the requested releated data object, either a list or a single object
+   */
+  Object readRelatedData(EdmEntitySet sourceEntitySet, Object sourceData, EdmEntitySet targetEntitySet,
+      Map<String, Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException,
+      ODataApplicationException;
+
+  /**
+   * Retrieves the binary data and the MIME type for the media resource
+   * associated to the specified media-link entry.
+   * @param entitySet the {@link EdmEntitySet} of the media-link entry
+   * @param mediaLinkEntryData the data object of the media-link entry
+   * @return the binary data and the MIME type of the media resource
+   */
+  BinaryData readBinaryData(EdmEntitySet entitySet, Object mediaLinkEntryData) throws ODataNotImplementedException,
+      ODataNotFoundException, EdmException, ODataApplicationException;
+
+  /**
+   * <p>Creates and returns a new instance of the requested data-object type.</p>
+   * <p>This instance must not be part of the corresponding list and should
+   * have empty content, apart from the key and other mandatory properties.
+   * However, intermediate objects to access complex properties must not be
+   * <code>null</code>.</p>
+   * @param entitySet the {@link EdmEntitySet} the object must correspond to
+   * @return the new data object
+   */
+  Object newDataObject(EdmEntitySet entitySet) throws ODataNotImplementedException, EdmException,
+      ODataApplicationException;
+
+  /**
+   * Writes the binary data for the media resource associated to the
+   * specified media-link entry.
+   * @param entitySet the {@link EdmEntitySet} of the media-link entry
+   * @param mediaLinkEntryData the data object of the media-link entry
+   * @param binaryData the binary data of the media resource along with
+   * the MIME type of the binary data
+   */
+  void writeBinaryData(EdmEntitySet entitySet, Object mediaLinkEntryData, BinaryData binaryData)
+      throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException;
+
+  /**
+   * Deletes a single data object identified by the specified entity set and key.
+   * @param entitySet the {@link EdmEntitySet} of the entity to be deleted
+   * @param keys the entity key as map of key names to key values
+   */
+  void deleteData(EdmEntitySet entitySet, Map<String, Object> keys) throws ODataNotImplementedException,
+      ODataNotFoundException, EdmException, ODataApplicationException;
+
+  /**
+   * <p>Inserts an instance into the entity list of the specified entity set.</p>
+   * <p>If {@link #newDataObject} has not set the key and other mandatory
+   * properties already, this method must set them before inserting the
+   * instance into the list.</p>
+   * @param entitySet the {@link EdmEntitySet} the object must correspond to
+   * @param data the data object of the new entity
+   */
+  void createData(EdmEntitySet entitySet, Object data) throws ODataNotImplementedException, EdmException,
+      ODataApplicationException;
+
+  /**
+   * Deletes the relation from the specified source data to a target entity
+   * specified by entity set and key.
+   * @param sourceEntitySet the {@link EdmEntitySet} of the source entity
+   * @param sourceData the data object of the source entity
+   * @param targetEntitySet the {@link EdmEntitySet} of the target entity
+   * @param targetKeys the key of the target entity as map of key names to key values
+   * (optional)
+   */
+  void deleteRelation(EdmEntitySet sourceEntitySet, Object sourceData, EdmEntitySet targetEntitySet,
+      Map<String, Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException,
+      ODataApplicationException;
+
+  /**
+   * Writes a relation from the specified source data to a target entity
+   * specified by entity set and key.
+   * @param sourceEntitySet the {@link EdmEntitySet} of the source entity
+   * @param sourceData the data object of the source entity
+   * @param targetEntitySet the {@link EdmEntitySet} of the relation target
+   * @param targetKeys the key of the target entity as map of key names to key values
+   */
+  void writeRelation(EdmEntitySet sourceEntitySet, Object sourceData, EdmEntitySet targetEntitySet,
+      Map<String, Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException,
+      ODataApplicationException;
+
+  /**
+   * Container to store binary data (as byte array) and the associated MIME type.
+   */
+  public class BinaryData {
+    private final byte[] data;
+    private final String mimeType;
+
+    public BinaryData(final byte[] data, final String mimeType) {
+      this.data = data;
+      this.mimeType = mimeType;
+    }
+
+    public byte[] getData() {
+      return data;
+    }
+
+    public String getMimeType() {
+      return mimeType;
+    }
+
+    @Override
+    public String toString() {
+      return "data=" + Arrays.toString(data) + ", mimeType=" + mimeType;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/28b35fff/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/data/DataSourceProcessor.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/data/DataSourceProcessor.java b/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/data/DataSourceProcessor.java
new file mode 100644
index 0000000..2be5663
--- /dev/null
+++ b/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/data/DataSourceProcessor.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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.data;
+
+import org.apache.olingo.odata2.api.processor.ODataSingleProcessor;
+
+/**
+ * Abstract class for implementation of the centralized parts of OData processing,
+ * allowing to use the simplified {@link DataSource} and {@link ValueAccess} for the
+ * actual data handling.
+ * <br/>
+ * Extend this class and implement a DataSourceProcessor if the default implementation
+ * (<code>ListProcessor</code> found in <code>annotation-processor-core module</code>) has to be overwritten.
+ */
+public abstract class DataSourceProcessor extends ODataSingleProcessor {
+
+  protected final DataSource dataSource;
+  protected final ValueAccess valueAccess;
+  
+  /**
+   * Initialize a {@link DataSourceProcessor} in combination with given {@link DataSource} (providing data objects)
+   * and {@link ValueAccess} (accessing values of data objects).
+   * 
+   * @param dataSource used for accessing the data objects
+   * @param valueAccess for accessing the values provided by the data objects
+   */
+  public DataSourceProcessor(final DataSource dataSource, final ValueAccess valueAccess) {
+    this.dataSource = dataSource;
+    this.valueAccess = valueAccess;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/28b35fff/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/data/ListsDataSource.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/data/ListsDataSource.java b/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/data/ListsDataSource.java
deleted file mode 100644
index e9229e3..0000000
--- a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/data/ListsDataSource.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.api.data;
-
-import java.util.Arrays;
-import java.util.List;
-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.EdmFunctionImport;
-import org.apache.olingo.odata2.api.exception.ODataApplicationException;
-import org.apache.olingo.odata2.api.exception.ODataNotFoundException;
-import org.apache.olingo.odata2.api.exception.ODataNotImplementedException;
-
-/**
- * <p>This interface is intended to make it easier to implement an OData
- * service in cases where all data for each entity set can be provided as a {@link List} of objects from which all
- * properties described in the
- * Entity Data Model can be retrieved and set.</p>
- * <p>By obeying these restrictions, data-source implementations get the
- * following advantages:
- * <ul>
- * <li>All system query options can be handled centrally.</li>
- * <li>Following navigation paths must only be done step by step.</li>
- * </ul>
- * </p>
- * 
- */
-public interface ListsDataSource {
-
-  /**
-   * Retrieves the whole data list for the specified entity set.
-   * @param entitySet the requested {@link EdmEntitySet}
-   * @return the requested data list
-   */
-  List<?> readData(EdmEntitySet entitySet) throws ODataNotImplementedException, ODataNotFoundException, EdmException,
-      ODataApplicationException;
-
-  /**
-   * Retrieves a single data object for the specified entity set and key.
-   * @param entitySet the requested {@link EdmEntitySet}
-   * @param keys the entity key as map of key names to key values
-   * @return the requested data object
-   */
-  Object readData(EdmEntitySet entitySet, Map<String, Object> keys) throws ODataNotImplementedException,
-      ODataNotFoundException, EdmException, ODataApplicationException;
-
-  /**
-   * <p>Retrieves data for the specified function import and key.</p>
-   * <p>This method is called also for function imports that have defined in
-   * their metadata an other HTTP method than <code>GET</code>.</p>
-   * @param function the requested {@link EdmFunctionImport}
-   * @param parameters the parameters of the function import
-   * as map of parameter names to parameter values
-   * @param keys the key of the returned entity set, as map of key names to key values,
-   * if the return type of the function import is a collection of entities
-   * (optional)
-   * @return the requested data object, either a list or a single object;
-   * if the function import's return type is of type <code>Binary</code>,
-   * the returned object(s) must be of type {@link BinaryData}
-   */
-  Object readData(EdmFunctionImport function, Map<String, Object> parameters, Map<String, Object> keys)
-      throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException;
-
-  /**
-   * <p>Retrieves related data for the specified source data, entity set, and key.</p>
-   * <p>If the underlying association of the EDM is specified to have target
-   * multiplicity '*' and no target key is given, this method returns a list of
-   * related data, otherwise it returns a single data object.</p>
-   * @param sourceEntitySet the {@link EdmEntitySet} of the source entity
-   * @param sourceData the data object of the source entity
-   * @param targetEntitySet the requested target {@link EdmEntitySet}
-   * @param targetKeys the key of the target entity as map of key names to key values
-   * (optional)
-   * @return the requested releated data object, either a list or a single object
-   */
-  Object readRelatedData(EdmEntitySet sourceEntitySet, Object sourceData, EdmEntitySet targetEntitySet,
-      Map<String, Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException,
-      ODataApplicationException;
-
-  /**
-   * Retrieves the binary data and the MIME type for the media resource
-   * associated to the specified media-link entry.
-   * @param entitySet the {@link EdmEntitySet} of the media-link entry
-   * @param mediaLinkEntryData the data object of the media-link entry
-   * @return the binary data and the MIME type of the media resource
-   */
-  BinaryData readBinaryData(EdmEntitySet entitySet, Object mediaLinkEntryData) throws ODataNotImplementedException,
-      ODataNotFoundException, EdmException, ODataApplicationException;
-
-  /**
-   * <p>Creates and returns a new instance of the requested data-object type.</p>
-   * <p>This instance must not be part of the corresponding list and should
-   * have empty content, apart from the key and other mandatory properties.
-   * However, intermediate objects to access complex properties must not be
-   * <code>null</code>.</p>
-   * @param entitySet the {@link EdmEntitySet} the object must correspond to
-   * @return the new data object
-   */
-  Object newDataObject(EdmEntitySet entitySet) throws ODataNotImplementedException, EdmException,
-      ODataApplicationException;
-
-  /**
-   * Writes the binary data for the media resource associated to the
-   * specified media-link entry.
-   * @param entitySet the {@link EdmEntitySet} of the media-link entry
-   * @param mediaLinkEntryData the data object of the media-link entry
-   * @param binaryData the binary data of the media resource along with
-   * the MIME type of the binary data
-   */
-  void writeBinaryData(EdmEntitySet entitySet, Object mediaLinkEntryData, BinaryData binaryData)
-      throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException;
-
-  /**
-   * Deletes a single data object identified by the specified entity set and key.
-   * @param entitySet the {@link EdmEntitySet} of the entity to be deleted
-   * @param keys the entity key as map of key names to key values
-   */
-  void deleteData(EdmEntitySet entitySet, Map<String, Object> keys) throws ODataNotImplementedException,
-      ODataNotFoundException, EdmException, ODataApplicationException;
-
-  /**
-   * <p>Inserts an instance into the entity list of the specified entity set.</p>
-   * <p>If {@link #newDataObject} has not set the key and other mandatory
-   * properties already, this method must set them before inserting the
-   * instance into the list.</p>
-   * @param entitySet the {@link EdmEntitySet} the object must correspond to
-   * @param data the data object of the new entity
-   */
-  void createData(EdmEntitySet entitySet, Object data) throws ODataNotImplementedException, EdmException,
-      ODataApplicationException;
-
-  /**
-   * Deletes the relation from the specified source data to a target entity
-   * specified by entity set and key.
-   * @param sourceEntitySet the {@link EdmEntitySet} of the source entity
-   * @param sourceData the data object of the source entity
-   * @param targetEntitySet the {@link EdmEntitySet} of the target entity
-   * @param targetKeys the key of the target entity as map of key names to key values
-   * (optional)
-   */
-  void deleteRelation(EdmEntitySet sourceEntitySet, Object sourceData, EdmEntitySet targetEntitySet,
-      Map<String, Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException,
-      ODataApplicationException;
-
-  /**
-   * Writes a relation from the specified source data to a target entity
-   * specified by entity set and key.
-   * @param sourceEntitySet the {@link EdmEntitySet} of the source entity
-   * @param sourceData the data object of the source entity
-   * @param targetEntitySet the {@link EdmEntitySet} of the relation target
-   * @param targetKeys the key of the target entity as map of key names to key values
-   */
-  void writeRelation(EdmEntitySet sourceEntitySet, Object sourceData, EdmEntitySet targetEntitySet,
-      Map<String, Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException,
-      ODataApplicationException;
-
-  /**
-   * Container to store binary data (as byte array) and the associated MIME type.
-   */
-  public class BinaryData {
-    private final byte[] data;
-    private final String mimeType;
-
-    public BinaryData(final byte[] data, final String mimeType) {
-      this.data = data;
-      this.mimeType = mimeType;
-    }
-
-    public byte[] getData() {
-      return data;
-    }
-
-    public String getMimeType() {
-      return mimeType;
-    }
-
-    @Override
-    public String toString() {
-      return "data=" + Arrays.toString(data) + ", mimeType=" + mimeType;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/28b35fff/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/AnnotationInMemoryDs.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/AnnotationInMemoryDs.java b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/AnnotationInMemoryDs.java
index 030cc93..db03a4c 100644
--- a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/AnnotationInMemoryDs.java
+++ b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/AnnotationInMemoryDs.java
@@ -24,7 +24,7 @@ import java.util.Map;
 import org.apache.olingo.odata2.api.annotation.edm.EdmMediaResourceContent;
 import org.apache.olingo.odata2.api.annotation.edm.EdmMediaResourceMimeType;
 import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
-import org.apache.olingo.odata2.api.data.ListsDataSource;
+import org.apache.olingo.odata2.api.data.DataSource;
 import org.apache.olingo.odata2.api.edm.EdmEntitySet;
 import org.apache.olingo.odata2.api.edm.EdmException;
 import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
@@ -38,7 +38,7 @@ import org.apache.olingo.odata2.core.annotation.util.AnnotationHelper.AnnotatedN
 import org.apache.olingo.odata2.core.annotation.util.AnnotationHelper.ODataAnnotationException;
 import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
 
-public class AnnotationInMemoryDs implements ListsDataSource {
+public class AnnotationInMemoryDs implements DataSource {
 
   private static final AnnotationHelper ANNOTATION_HELPER = new AnnotationHelper();
   private final Map<String, DataStore<Object>> dataStores = new HashMap<String, DataStore<Object>>();

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/28b35fff/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/ListsProcessor.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/ListsProcessor.java b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/ListsProcessor.java
index 16e1eab..19218d7 100644
--- a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/ListsProcessor.java
+++ b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/ListsProcessor.java
@@ -36,8 +36,9 @@ import org.apache.olingo.odata2.api.batch.BatchResponsePart;
 import org.apache.olingo.odata2.api.commons.HttpContentType;
 import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
 import org.apache.olingo.odata2.api.commons.InlineCount;
-import org.apache.olingo.odata2.api.data.ListsDataSource;
-import org.apache.olingo.odata2.api.data.ListsDataSource.BinaryData;
+import org.apache.olingo.odata2.api.data.DataSource;
+import org.apache.olingo.odata2.api.data.DataSource.BinaryData;
+import org.apache.olingo.odata2.api.data.DataSourceProcessor;
 import org.apache.olingo.odata2.api.data.ValueAccess;
 import org.apache.olingo.odata2.api.edm.Edm;
 import org.apache.olingo.odata2.api.edm.EdmConcurrencyMode;
@@ -81,7 +82,6 @@ import org.apache.olingo.odata2.api.exception.ODataNotImplementedException;
 import org.apache.olingo.odata2.api.processor.ODataContext;
 import org.apache.olingo.odata2.api.processor.ODataRequest;
 import org.apache.olingo.odata2.api.processor.ODataResponse;
-import org.apache.olingo.odata2.api.processor.ODataSingleProcessor;
 import org.apache.olingo.odata2.api.uri.ExpandSelectTreeNode;
 import org.apache.olingo.odata2.api.uri.KeyPredicate;
 import org.apache.olingo.odata2.api.uri.NavigationSegment;
@@ -117,21 +117,17 @@ import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo;
 
 /**
  * Implementation of the centralized parts of OData processing,
- * allowing to use the simplified {@link ListsDataSource} for the
+ * allowing to use the simplified {@link DataSource} for the
  * actual data handling.
  * 
  */
-public class ListsProcessor extends ODataSingleProcessor {
+public class ListsProcessor extends DataSourceProcessor {
 
   // TODO: Paging size should be configurable.
   private static final int SERVER_PAGING_SIZE = 100;
 
-  private final ListsDataSource dataSource;
-  private final ValueAccess valueAccess;
-
-  public ListsProcessor(final ListsDataSource dataSource, final ValueAccess valueAccess) {
-    this.dataSource = dataSource;
-    this.valueAccess = valueAccess;
+  public ListsProcessor(final DataSource dataSource, final ValueAccess valueAccess) {
+    super(dataSource, valueAccess);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/28b35fff/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java
index eec1f42..6e319c6 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java
@@ -96,10 +96,10 @@ public class EntryXmlReadOnlyTest extends AbstractRefXmlTest {
   public void entryWithSpecialKey() throws Exception {
     // Ugly hack to create an entity with a key containing special characters just for this test.
     ListsProcessor processor = (ListsProcessor) getService().getEntityProcessor();
-    Field field = processor.getClass().getDeclaredField("dataSource");
+    Field field = getField(processor.getClass(), "dataSource");
     field.setAccessible(true);
     ScenarioDataSource dataSource = (ScenarioDataSource) field.get(processor);
-    field = dataSource.getClass().getDeclaredField("dataContainer");
+    field = getField(dataSource.getClass(), "dataContainer");
     field.setAccessible(true);
     DataContainer dataContainer = (DataContainer) field.get(dataSource);
     // Add a new Photo where the "Type" property is set to, space-separated,
@@ -118,6 +118,17 @@ public class EntryXmlReadOnlyTest extends AbstractRefXmlTest {
     assertXpathEvaluatesTo(expected + "/$value", "/atom:entry/atom:link[@rel=\"edit-media\"]/@href", body);
   }
 
+  private Field getField(Class<?> clazz, String string) throws Exception {
+    try {
+      return clazz.getDeclaredField(string);
+    } catch (NoSuchFieldException e) {
+      if(clazz == Object.class) {
+        throw e;
+      }
+      return getField(clazz.getSuperclass(), string);
+    }
+  }
+
   @Test
   public void expand() throws Exception {
     HttpResponse response = callUri("Employees('5')?$expand=ne_Manager");

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/28b35fff/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ScenarioDataSource.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ScenarioDataSource.java b/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ScenarioDataSource.java
index 0047226..cc70639 100644
--- a/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ScenarioDataSource.java
+++ b/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ScenarioDataSource.java
@@ -28,7 +28,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.olingo.odata2.api.commons.HttpContentType;
-import org.apache.olingo.odata2.api.data.ListsDataSource;
+import org.apache.olingo.odata2.api.data.DataSource;
 import org.apache.olingo.odata2.api.edm.EdmEntitySet;
 import org.apache.olingo.odata2.api.edm.EdmException;
 import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
@@ -48,7 +48,7 @@ import org.apache.olingo.odata2.ref.model.Team;
  * Data for the reference scenario
  * 
  */
-public class ScenarioDataSource implements ListsDataSource {
+public class ScenarioDataSource implements DataSource {
 
   private static final String ENTITYSET_1_1 = "Employees";
   private static final String ENTITYSET_1_2 = "Teams";