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

[8/8] git commit: [OLINGO-83] Refactoring of 'annotation-processor-*' modules

[OLINGO-83] Refactoring of 'annotation-processor-*' modules


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/3bd59050
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/3bd59050
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/3bd59050

Branch: refs/heads/master
Commit: 3bd59050f2697c8d67a7e104e4791bb91406d762
Parents: bb73dad
Author: Michael Bolz <mi...@apache.org>
Authored: Fri Dec 20 10:42:08 2013 +0100
Committer: Michael Bolz <mi...@apache.org>
Committed: Fri Dec 20 14:10:03 2013 +0100

----------------------------------------------------------------------
 .../processor/api/AnnotationServiceFactory.java |  118 ++
 .../olingo/odata2/api/data/DataSource.java      |  200 ---
 .../odata2/api/data/DataSourceProcessor.java    |   47 -
 .../olingo/odata2/api/data/ValueAccess.java     |   69 -
 .../core/AnnotationServiceFactoryImpl.java      |   73 +
 .../processor/core/DataSourceProcessor.java     |   49 +
 .../processor/core/ListsProcessor.java          | 1640 +++++++++++++++++
 .../core/datasource/AnnotationInMemoryDs.java   |  384 ++++
 .../core/datasource/AnnotationValueAccess.java  |  108 ++
 .../core/datasource/BeanPropertyAccess.java     |  185 ++
 .../processor/core/datasource/DataSource.java   |  200 +++
 .../processor/core/datasource/DataStore.java    |  294 ++++
 .../processor/core/datasource/ValueAccess.java  |   69 +
 .../core/edm/AnnotationEdmProvider.java         |  769 ++++++++
 .../processor/core/util/AnnotationHelper.java   |  777 +++++++++
 .../processor/core/util/ClassHelper.java        |  140 ++
 .../annotation/data/AnnotationInMemoryDs.java   |  376 ----
 .../annotation/data/AnnotationValueAccess.java  |  109 --
 .../annotation/data/BeanPropertyAccess.java     |  186 --
 .../odata2/core/annotation/data/DataStore.java  |  294 ----
 .../annotation/edm/AnnotationEdmProvider.java   |  769 --------
 .../annotation/processor/ListsProcessor.java    | 1641 ------------------
 .../core/annotation/util/AnnotationHelper.java  |  777 ---------
 .../core/annotation/util/ClassHelper.java       |  140 --
 .../data/AnnotationsInMemoryDsTest.java         |   10 +-
 .../edm/AnnotationEdmProviderTest.java          |    1 +
 .../ref/AnnotationRefServiceFactory.java        |  215 +++
 .../processor/ref/model/Building.java           |   97 ++
 .../annotation/processor/ref/model/City.java    |   61 +
 .../processor/ref/model/Employee.java           |  192 ++
 .../processor/ref/model/Location.java           |   60 +
 .../annotation/processor/ref/model/Manager.java |   43 +
 .../ref/model/ModelSharedConstants.java         |   25 +
 .../annotation/processor/ref/model/Photo.java   |  128 ++
 .../annotation/processor/ref/model/RefBase.java |   78 +
 .../processor/ref/model/ResourceHelper.java     |   96 +
 .../annotation/processor/ref/model/Room.java    |   88 +
 .../annotation/processor/ref/model/Team.java    |   73 +
 .../odata2/ref/annotation/model/Building.java   |   97 --
 .../odata2/ref/annotation/model/City.java       |   61 -
 .../odata2/ref/annotation/model/Employee.java   |  192 --
 .../odata2/ref/annotation/model/Location.java   |   60 -
 .../odata2/ref/annotation/model/Manager.java    |   43 -
 .../annotation/model/ModelSharedConstants.java  |   25 -
 .../odata2/ref/annotation/model/Photo.java      |  128 --
 .../odata2/ref/annotation/model/RefBase.java    |   78 -
 .../ref/annotation/model/ResourceHelper.java    |   96 -
 .../odata2/ref/annotation/model/Room.java       |   88 -
 .../odata2/ref/annotation/model/Team.java       |   73 -
 .../processor/AnnotationServiceFactory.java     |  215 ---
 .../src/main/webapp/WEB-INF/web.xml             |    2 +-
 .../olingo/odata2/fit/ref/AbstractRefTest.java  |    4 +-
 .../odata2/fit/ref/EntryXmlReadOnlyTest.java    |    2 +-
 .../AbstractContentNegotiationTest.java         |    4 +-
 .../ref/processor/ScenarioDataSource.java       |    2 +-
 .../ref/processor/ScenarioServiceFactory.java   |    4 +-
 .../olingo/odata2/ref/read/EntitySetTest.java   |    4 +-
 .../olingo/odata2/ref/read/EntityTest.java      |    4 +-
 58 files changed, 5982 insertions(+), 5781 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/3bd59050/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/AnnotationServiceFactory.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/AnnotationServiceFactory.java b/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/AnnotationServiceFactory.java
new file mode 100644
index 0000000..38fe73a
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/AnnotationServiceFactory.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * 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.annotation.processor.api;
+
+import java.util.Collection;
+
+import org.apache.olingo.odata2.api.ODataService;
+import org.apache.olingo.odata2.api.exception.ODataException;
+
+/**
+ * AnnotationServiceFactory which provides an AnnotationService which handles java beans (classes)
+ * annotated with annotation from <code>org.apache.olingo.olingo-odata2-api-annotation</code> module
+ * (see package <code>org.apache.olingo.odata2.api.annotation.edm</code>).
+ */
+public abstract class AnnotationServiceFactory {
+
+  private static final String IMPLEMENTATION = 
+      "org.apache.olingo.odata2.annotation.processor.core.AnnotationServiceFactoryImpl";
+
+  /**
+   * Create a runtime delegate instance from the core library. The core
+   * library (org.apache.olingo.odata2.annotation.processor.core) needs to be included into the classpath
+   * of the using application.
+   * @return implementation instance
+   */
+  private static AnnotationServiceFactoryInstance getInstance() {
+    AnnotationServiceFactoryInstance delegate;
+
+    try {
+      final Class<?> clazz = Class.forName(IMPLEMENTATION);
+      /*
+       * We explicitly do not use the singleton pattern to keep the server state free
+       * and avoid class loading issues also during hot deployment.
+       */
+      final Object object = clazz.newInstance();
+      delegate = (AnnotationServiceFactoryInstance) object;
+
+    } catch (final Exception e) {
+      throw new RuntimeException(e);
+    }
+    return delegate;
+  }
+
+  /**
+   * Interface to be implemented for an instance of a {@link AnnotationServiceFactoryInstance} which
+   * provides an {@link ODataService} based on annotation from 
+   * <code>org.apache.olingo.olingo-odata2-api-annotation</code> module
+   * (see package <code>org.apache.olingo.odata2.api.annotation.edm</code>).
+   */
+  public interface AnnotationServiceFactoryInstance {
+    /**
+     * Create an {@link ODataService} which is based on an EDM and Processor which are using the annotations from 
+     * <code>org.apache.olingo.olingo-odata2-api-annotation</code> module
+     * (see package <code>org.apache.olingo.odata2.api.annotation.edm</code>) to define the model and access the data.
+     * 
+     * @param modelPackage package name which is scanned for annotated classes
+     * @return service an {@link ODataService} based on on an EDM and Processor which are using annotations 
+     *            for model definition and data access.
+     * @throws ODataException if an error during initialization occurs
+     */
+    public ODataService createAnnotationService(String modelPackage) throws ODataException;
+    /**
+     * Create an {@link ODataService} which is based on an EDM and Processor which are using the annotations from 
+     * <code>org.apache.olingo.olingo-odata2-api-annotation</code> module
+     * (see package <code>org.apache.olingo.odata2.api.annotation.edm</code>) to define the model and access the data.
+     * 
+     * @param modelPackage classes (which are annotated) which will be used for EDM definition and data access.
+     * @return service an {@link ODataService} based on on an EDM and Processor which are using annotations 
+     *            for model definition and data access.
+     * @throws ODataException if an error during initialization occurs
+     */
+    public ODataService createAnnotationService(Collection<Class<?>> annotatedClasses) throws ODataException;
+  }
+
+  /**
+   * Create an {@link ODataService} which is based on an EDM and Processor which are using the annotations from 
+   * <code>org.apache.olingo.olingo-odata2-api-annotation</code> module
+   * (see package <code>org.apache.olingo.odata2.api.annotation.edm</code>) to define the model and access the data.
+   * 
+   * @param modelPackage package name which is scanned for annotated classes
+   * @return service an {@link ODataService} based on on an EDM and Processor which are using annotations 
+   *            for model definition and data access.
+   * @throws ODataException if an error during initialization occurs
+   */
+  public static ODataService createAnnotationService(String modelPackage) throws ODataException {
+    return getInstance().createAnnotationService(modelPackage);
+  }
+  
+  /**
+   * Create an {@link ODataService} which is based on an EDM and Processor which are using the annotations from 
+   * <code>org.apache.olingo.olingo-odata2-api-annotation</code> module
+   * (see package <code>org.apache.olingo.odata2.api.annotation.edm</code>) to define the model and access the data.
+   * 
+   * @param modelPackage classes (which are annotated) which will be used for EDM definition and data access.
+   * @return service an {@link ODataService} based on on an EDM and Processor which are using annotations 
+   *            for model definition and data access.
+   * @throws ODataException if an error during initialization occurs
+   */
+  public static ODataService createAnnotationService(Collection<Class<?>> annotatedClasses) throws ODataException {
+    return getInstance().createAnnotationService(annotatedClasses);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/3bd59050/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/api/data/DataSource.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/api/data/DataSource.java b/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/api/data/DataSource.java
deleted file mode 100644
index 694f199..0000000
--- a/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/api/data/DataSource.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 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/3bd59050/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/api/data/DataSourceProcessor.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/api/data/DataSourceProcessor.java b/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/api/data/DataSourceProcessor.java
deleted file mode 100644
index dc89970..0000000
--- a/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/api/data/DataSourceProcessor.java
+++ /dev/null
@@ -1,47 +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 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/3bd59050/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/api/data/ValueAccess.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/api/data/ValueAccess.java b/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/api/data/ValueAccess.java
deleted file mode 100644
index 633ca37..0000000
--- a/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/api/data/ValueAccess.java
+++ /dev/null
@@ -1,69 +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 org.apache.olingo.odata2.api.edm.EdmMapping;
-import org.apache.olingo.odata2.api.edm.EdmProperty;
-import org.apache.olingo.odata2.api.exception.ODataException;
-
-/**
- * This interface is intended to access values in a Java object.
- */
-public interface ValueAccess {
-
-  /**
-   * Retrieves the value of an EDM property for the given data object.
-   * @param data the Java data object
-   * @param property the requested {@link EdmProperty}
-   * @return the requested property value
-   */
-  public <T> Object getPropertyValue(final T data, final EdmProperty property) throws ODataException;
-
-  /**
-   * Sets the value of an EDM property for the given data object.
-   * @param data the Java data object
-   * @param property the {@link EdmProperty}
-   * @param value the new value of the property
-   */
-  public <T, V> void setPropertyValue(T data, final EdmProperty property, final V value) throws ODataException;
-
-  /**
-   * Retrieves the Java type of an EDM property for the given data object.
-   * @param data the Java data object
-   * @param property the requested {@link EdmProperty}
-   * @return the requested Java type
-   */
-  public <T> Class<?> getPropertyType(final T data, final EdmProperty property) throws ODataException;
-
-  /**
-   * Retrieves the value defined by a mapping object for the given data object.
-   * @param data the Java data object
-   * @param mapping the requested {@link EdmMapping}
-   * @return the requested value
-   */
-  public <T> Object getMappingValue(final T data, final EdmMapping mapping) throws ODataException;
-
-  /**
-   * Sets the value defined by a mapping object for the given data object.
-   * @param data the Java data object
-   * @param mapping the {@link EdmMapping}
-   * @param value the new value
-   */
-  public <T, V> void setMappingValue(T data, final EdmMapping mapping, final V value) throws ODataException;
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/3bd59050/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/AnnotationServiceFactoryImpl.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/AnnotationServiceFactoryImpl.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/AnnotationServiceFactoryImpl.java
new file mode 100644
index 0000000..9c673a3
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/AnnotationServiceFactoryImpl.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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.annotation.processor.core;
+
+import java.util.Collection;
+
+import org.apache.olingo.odata2.annotation.processor.api.AnnotationServiceFactory.AnnotationServiceFactoryInstance;
+import org.apache.olingo.odata2.annotation.processor.core.datasource.AnnotationInMemoryDs;
+import org.apache.olingo.odata2.annotation.processor.core.datasource.AnnotationValueAccess;
+import org.apache.olingo.odata2.annotation.processor.core.edm.AnnotationEdmProvider;
+import org.apache.olingo.odata2.api.ODataService;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.rt.RuntimeDelegate;
+
+/**
+ * ODataServiceFactory implementation based on ListProcessor
+ * in combination with Annotation-Support-Classes for EdmProvider, DataSource and ValueAccess.
+ */
+public class AnnotationServiceFactoryImpl implements AnnotationServiceFactoryInstance {
+
+  /**
+   * Create an instance which further can create an {@link ODataService}.
+   * 
+   * @return instance which further can create an {@link ODataService}.
+   */
+  public AnnotationServiceFactoryInstance createInstance() {
+    return new AnnotationServiceFactoryImpl();
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public ODataService createAnnotationService(String modelPackage) throws ODataException {
+    AnnotationEdmProvider edmProvider = new AnnotationEdmProvider(modelPackage);
+    AnnotationInMemoryDs dataSource = new AnnotationInMemoryDs(modelPackage);
+    AnnotationValueAccess valueAccess = new AnnotationValueAccess();
+
+    // Edm via Annotations and ListProcessor via AnnotationDS with AnnotationsValueAccess
+    return RuntimeDelegate.createODataSingleProcessorService(edmProvider,
+        new ListsProcessor(dataSource, valueAccess));
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public ODataService createAnnotationService(Collection<Class<?>> annotatedClasses) throws ODataException {
+    AnnotationEdmProvider edmProvider = new AnnotationEdmProvider(annotatedClasses);
+    AnnotationInMemoryDs dataSource = new AnnotationInMemoryDs(annotatedClasses);
+    AnnotationValueAccess valueAccess = new AnnotationValueAccess();
+
+    // Edm via Annotations and ListProcessor via AnnotationDS with AnnotationsValueAccess
+    return RuntimeDelegate.createODataSingleProcessorService(edmProvider,
+        new ListsProcessor(dataSource, valueAccess));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/3bd59050/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/DataSourceProcessor.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/DataSourceProcessor.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/DataSourceProcessor.java
new file mode 100644
index 0000000..b08bfea
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/DataSourceProcessor.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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.annotation.processor.core;
+
+import org.apache.olingo.odata2.annotation.processor.core.datasource.DataSource;
+import org.apache.olingo.odata2.annotation.processor.core.datasource.ValueAccess;
+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;
+  }
+}