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/05 10:15:36 UTC

[02/12] git commit: Removed not to merge PoC parts

Removed not to merge PoC 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/8764e11a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/8764e11a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/8764e11a

Branch: refs/heads/PocEdmAnnotationsExtension
Commit: 8764e11a6d70099a93e2da110fe47ffe06c4baaa
Parents: a73d197
Author: Michael Bolz <mi...@apache.org>
Authored: Thu Dec 5 08:46:31 2013 +0100
Committer: Michael Bolz <mi...@apache.org>
Committed: Thu Dec 5 08:46:31 2013 +0100

----------------------------------------------------------------------
 .../api/annotation/edm/ds/EntityCreate.java     |  29 -
 .../api/annotation/edm/ds/EntityDataSource.java |  31 -
 .../api/annotation/edm/ds/EntityDelete.java     |  29 -
 .../api/annotation/edm/ds/EntityRead.java       |  29 -
 .../api/annotation/edm/ds/EntitySetRead.java    |  29 -
 .../api/annotation/edm/ds/EntityUpdate.java     |  29 -
 .../annotation/data/AnnotationInMemoryDs.java   |   8 +-
 .../annotation/data/AnnotationValueAccess.java  |   2 +-
 .../core/annotation/data/DataSourceHolder.java  | 212 ------
 .../odata2/core/annotation/data/DataStore.java  |   2 +-
 .../annotation/edm/AnnotationEdmProvider.java   |   2 +
 .../core/annotation/edm/AnnotationHelper.java   | 726 -------------------
 .../odata2/core/annotation/edm/ClassHelper.java | 105 ---
 .../processor/AnnotationProcessor.java          | 309 --------
 .../processor/json/EdmAnnotationSerializer.java | 260 -------
 .../annotation/processor/json/JsonConsumer.java | 138 ----
 .../annotation/processor/json/JsonWriter.java   | 204 ------
 .../core/annotation/util/AnnotationHelper.java  | 726 +++++++++++++++++++
 .../core/annotation/util/ClassHelper.java       | 105 +++
 .../src/main/resources/log4j.xml                |  39 -
 .../data/AnnotationsInMemoryDsTest.java         |   2 +-
 .../processor/json/JsonConsumerTest.java        |  85 ---
 .../edm-annotation-webref/pom.xml               |  12 +-
 23 files changed, 845 insertions(+), 2268 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8764e11a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityCreate.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityCreate.java b/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityCreate.java
deleted file mode 100644
index 529ee63..0000000
--- a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityCreate.java
+++ /dev/null
@@ -1,29 +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.annotation.edm.ds;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface EntityCreate {
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8764e11a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityDataSource.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityDataSource.java b/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityDataSource.java
deleted file mode 100644
index e21c81f..0000000
--- a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityDataSource.java
+++ /dev/null
@@ -1,31 +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.annotation.edm.ds;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface EntityDataSource {
-  String name() default "";
-  Class<?> entityType();
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8764e11a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityDelete.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityDelete.java b/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityDelete.java
deleted file mode 100644
index f852307..0000000
--- a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityDelete.java
+++ /dev/null
@@ -1,29 +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.annotation.edm.ds;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface EntityDelete {
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8764e11a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityRead.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityRead.java b/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityRead.java
deleted file mode 100644
index 76333ca..0000000
--- a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityRead.java
+++ /dev/null
@@ -1,29 +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.annotation.edm.ds;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface EntityRead {
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8764e11a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntitySetRead.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntitySetRead.java b/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntitySetRead.java
deleted file mode 100644
index 79cb80c..0000000
--- a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntitySetRead.java
+++ /dev/null
@@ -1,29 +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.annotation.edm.ds;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface EntitySetRead {
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8764e11a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityUpdate.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityUpdate.java b/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityUpdate.java
deleted file mode 100644
index 6aea1eb..0000000
--- a/odata2-edm-annotation/edm-annotation-api/src/main/java/org/apache/olingo/odata2/api/annotation/edm/ds/EntityUpdate.java
+++ /dev/null
@@ -1,29 +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.annotation.edm.ds;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface EntityUpdate {
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8764e11a/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 7c41945..030cc93 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
@@ -32,10 +32,10 @@ import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
 import org.apache.olingo.odata2.api.exception.ODataApplicationException;
 import org.apache.olingo.odata2.api.exception.ODataNotFoundException;
 import org.apache.olingo.odata2.api.exception.ODataNotImplementedException;
-import org.apache.olingo.odata2.core.annotation.edm.AnnotationHelper;
-import org.apache.olingo.odata2.core.annotation.edm.AnnotationHelper.AnnotatedNavInfo;
-import org.apache.olingo.odata2.core.annotation.edm.AnnotationHelper.ODataAnnotationException;
-import org.apache.olingo.odata2.core.annotation.edm.ClassHelper;
+import org.apache.olingo.odata2.core.annotation.util.AnnotationHelper;
+import org.apache.olingo.odata2.core.annotation.util.ClassHelper;
+import org.apache.olingo.odata2.core.annotation.util.AnnotationHelper.AnnotatedNavInfo;
+import org.apache.olingo.odata2.core.annotation.util.AnnotationHelper.ODataAnnotationException;
 import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
 
 public class AnnotationInMemoryDs implements ListsDataSource {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8764e11a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/AnnotationValueAccess.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/AnnotationValueAccess.java b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/AnnotationValueAccess.java
index c29ac39..14183bf 100644
--- a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/AnnotationValueAccess.java
+++ b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/AnnotationValueAccess.java
@@ -23,7 +23,7 @@ import org.apache.olingo.odata2.api.edm.EdmMapping;
 import org.apache.olingo.odata2.api.edm.EdmProperty;
 import org.apache.olingo.odata2.api.exception.ODataException;
 import org.apache.olingo.odata2.api.exception.ODataNotImplementedException;
-import org.apache.olingo.odata2.core.annotation.edm.AnnotationHelper;
+import org.apache.olingo.odata2.core.annotation.util.AnnotationHelper;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8764e11a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/DataSourceHolder.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/DataSourceHolder.java b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/DataSourceHolder.java
deleted file mode 100644
index d4c6f98..0000000
--- a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/DataSourceHolder.java
+++ /dev/null
@@ -1,212 +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.core.annotation.data;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityCreate;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityDataSource;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityDelete;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityRead;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntitySetRead;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityUpdate;
-import org.apache.olingo.odata2.api.uri.KeyPredicate;
-import org.apache.olingo.odata2.core.annotation.edm.AnnotationHelper;
-
-/**
- *
- */
-public final class DataSourceHolder {
-
-  private static final AnnotationHelper ANNOTATION_HELPER = new AnnotationHelper();
-  private static final Object[] EMPTY_ARRAY = new Object[0];
-  
-  private final String name;
-  private final Object dataSourceInstance;
-  private final Class<?> entityTypeClass;
-  private Method readMethod;
-  private Method createMethod;
-  private Method updateMethod;
-  private Method deleteMethod;
-  private Method readSetMethod;
-
-  public DataSourceHolder(Class<?> clz) {
-    EntityDataSource eds = clz.getAnnotation(EntityDataSource.class);
-    entityTypeClass = eds.entityType();
-    EdmEntityType entityType = entityTypeClass.getAnnotation(EdmEntityType.class);
-    if (entityType == null) {
-      throw new IllegalArgumentException("Missing EdmEntityType Annotation at class " + clz);
-    }
-
-    if (entityType.name().isEmpty()) {
-      name = ANNOTATION_HELPER.getCanonicalName(entityTypeClass);
-    } else {
-      name = entityType.name();
-    }
-    dataSourceInstance = createInstance(clz);
-    initMethods(clz);
-  }
-
-  private void initMethods(Class<?> clz) throws IllegalArgumentException, SecurityException {
-    Method[] methods = clz.getDeclaredMethods();
-    for (Method method : methods) {
-      EntityRead ec = method.getAnnotation(EntityRead.class);
-      if (ec != null) {
-        readMethod = method;
-      }
-      EntityCreate ep = method.getAnnotation(EntityCreate.class);
-      if (ep != null) {
-        createMethod = method;
-      }
-      EntityUpdate update = method.getAnnotation(EntityUpdate.class);
-      if (update != null) {
-        updateMethod = method;
-      }
-      EntityDelete delete = method.getAnnotation(EntityDelete.class);
-      if (delete != null) {
-        deleteMethod = method;
-      }
-      EntitySetRead readSet = method.getAnnotation(EntitySetRead.class);
-      if (readSet != null) {
-        readSetMethod = method;
-      }
-    }
-
-    validateMethods(clz);
-  }
-
-  private void validateMethods(Class<?> clz) throws IllegalArgumentException {
-    //
-    if (readMethod == null) {
-      throw new IllegalArgumentException("Missing " + EntityRead.class
-              + " annotation at " + EntityDataSource.class + " annotated class " + clz);
-    }
-    if (updateMethod == null) {
-      throw new IllegalArgumentException("Missing " + EntityUpdate.class
-              + " annotation at " + EntityDataSource.class + " annotated class " + clz);
-    }
-    if (createMethod == null) {
-      throw new IllegalArgumentException("Missing " + EntityCreate.class
-              + " annotation at " + EntityDataSource.class + " annotated class " + clz);
-    }
-    
-    if(readSetMethod != null) {
-      if(!Collection.class.isAssignableFrom(readSetMethod.getReturnType())) {
-        throw new IllegalArgumentException("Read set method must have a return type which is assignable to " 
-            + Collection.class + " but return type for annotated method " + readSetMethod + " is " 
-            + readSetMethod.getReturnType());
-      }
-    }
-  }
-
-  public Object readEntity(Object[] keyValues) {
-    if (readMethod.getParameterTypes().length != keyValues.length) {
-      throw new IllegalStateException("Wrong amount of key properties. Expected read keys = "
-              + Arrays.toString(readMethod.getParameterTypes()) + " given key predicates = " 
-              + Arrays.toString(keyValues));
-    }
-
-    return invoke(readMethod, keyValues);
-  }
-
-  public Object readEntity(List<KeyPredicate> keys) {
-    Object[] parameterKeys = mapParameterKeys(readMethod, keys);
-    return invoke(readMethod, parameterKeys);
-  }
-
-  private Object[] mapParameterKeys(Method method, List<KeyPredicate> keys) throws IllegalStateException {
-    if(method == null) {
-      return EMPTY_ARRAY;
-    }
-    Class<?>[] pTypes = method.getParameterTypes();
-    if (pTypes.length != keys.size()) {
-      throw new IllegalStateException("Wrong amount of key properties. Expected read keys = "
-              + Arrays.toString(pTypes) + " given key predicates = " + keys);
-    }
-    Object[] parameterKeys = new Object[pTypes.length];
-    int i = 0;
-    for (KeyPredicate keyPredicate : keys) {
-      if (matches(pTypes[i], keyPredicate)) {
-        parameterKeys[i] = keyPredicate.getLiteral();
-      }
-      i++;
-    }
-    return parameterKeys;
-  }
-
-  public Object createEntity(Object key) {
-    return invoke(createMethod, new Object[]{key});
-  }
-
-  public Object updateEntity(Object key) {
-    return invoke(updateMethod, new Object[]{key});
-  }
-
-  public Object deleteEntity(List<KeyPredicate> keys) {
-    Object[] parameterKeys = mapParameterKeys(deleteMethod, keys);
-    return invoke(deleteMethod, parameterKeys);
-  }
-
-  public Collection<?> readEntitySet() {
-    return (Collection<?>) invoke(readSetMethod, new Object[0]);
-  }
-
-  private Object invoke(Method m, Object[] objs) {
-    try {
-      return m.invoke(dataSourceInstance, objs);
-    } catch (Exception ex) {
-      return null;
-    }
-  }
-
-  public Object createEntityInstance() {
-    return createInstance(this.entityTypeClass);
-  }
-
-  private static Object createInstance(Class<?> clz) {
-    try {
-      return clz.newInstance();
-    } catch (Exception ex) {
-      return null;
-    }
-  }
-
-  public String getEntityName() {
-    return this.name;
-  }
-
-  public Class<?> getEntityTypeClass() {
-    return entityTypeClass;
-  }
-
-  @Override
-  public String toString() {
-    return "DataSourceHolder{" + "name=" + name + ", dataSourceInstance=" + dataSourceInstance + 
-            ", entityTypeClass=" + entityTypeClass + ", consumerMethod=" + readMethod + 
-            ", createMethod=" + createMethod + ", updateMethod=" + updateMethod + '}';
-  }
-
-  private boolean matches(Class<?> aClass, KeyPredicate type) {
-    return true;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8764e11a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/DataStore.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/DataStore.java b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/DataStore.java
index 834e33a..696ab9a 100644
--- a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/DataStore.java
+++ b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/data/DataStore.java
@@ -29,7 +29,7 @@ import java.util.Map;
 
 import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
 import org.apache.olingo.odata2.api.exception.ODataApplicationException;
-import org.apache.olingo.odata2.core.annotation.edm.AnnotationHelper;
+import org.apache.olingo.odata2.core.annotation.util.AnnotationHelper;
 import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8764e11a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationEdmProvider.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationEdmProvider.java b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationEdmProvider.java
index 1b53d58..97f5b53 100644
--- a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationEdmProvider.java
+++ b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationEdmProvider.java
@@ -64,6 +64,8 @@ import org.apache.olingo.odata2.api.edm.provider.Schema;
 import org.apache.olingo.odata2.api.edm.provider.SimpleProperty;
 import org.apache.olingo.odata2.api.edm.provider.Using;
 import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.core.annotation.util.AnnotationHelper;
+import org.apache.olingo.odata2.core.annotation.util.ClassHelper;
 import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8764e11a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationHelper.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationHelper.java b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationHelper.java
deleted file mode 100644
index 2b6675f..0000000
--- a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationHelper.java
+++ /dev/null
@@ -1,726 +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.core.annotation.edm;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.lang.reflect.ParameterizedType;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.olingo.odata2.api.annotation.edm.EdmComplexType;
-import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
-import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
-import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
-import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
-import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty.Multiplicity;
-import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
-import org.apache.olingo.odata2.api.edm.EdmLiteralKind;
-import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeException;
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
-import org.apache.olingo.odata2.api.edm.FullQualifiedName;
-import org.apache.olingo.odata2.api.exception.ODataException;
-import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
-
-/**
- *
- */
-public class AnnotationHelper {
-
-  public static final String DEFAULT_CONTAINER_NAME = "DefaultContainer";
-
-  /**
-   * Compare keys of both instances.
-   * 
-   * @param firstInstance
-   * @param secondInstance
-   * @return 
-   */
-  public boolean keyMatch(Object firstInstance, Object secondInstance) {
-    if (firstInstance == null || secondInstance == null) {
-      return false;
-    } else if (firstInstance.getClass() != secondInstance.getClass()) {
-      return false;
-    }
-
-    Map<String, Object> firstKeyFields = getValueForAnnotatedFields(firstInstance, EdmKey.class);
-    Map<String, Object> secondKeyFields = getValueForAnnotatedFields(secondInstance, EdmKey.class);
-
-    return keyValuesMatch(firstKeyFields, secondKeyFields);
-  }
-
-  /**
-   * Compare keys of instance with key values in map.
-   * 
-   * @param instance
-   * @param keyName2Value
-   * @return 
-   */
-  public boolean keyMatch(Object instance, Map<String, Object> keyName2Value) {
-    Map<String, Object> instanceKeyFields = getValueForAnnotatedFields(instance, EdmKey.class);
-    return keyValuesMatch(instanceKeyFields, keyName2Value);
-  }
-
-  private boolean keyValuesMatch(Map<String, Object> firstKeyValues, Map<String, Object> secondKeyValues) {
-    if (firstKeyValues.size() != secondKeyValues.size()) {
-      return false;
-    } else {
-      Set<Map.Entry<String, Object>> entries = firstKeyValues.entrySet();
-      for (Map.Entry<String, Object> entry : entries) {
-        Object firstKey = entry.getValue();
-        Object secondKey = secondKeyValues.get(entry.getKey());
-        if (!isEqual(firstKey, secondKey)) {
-          return false;
-        }
-      }
-      return true;
-    }
-  }
-  
-  private boolean isEqual(Object firstKey, Object secondKey) {
-    if (firstKey == null) {
-      if (secondKey == null) {
-        return true;
-      } else {
-        return secondKey.equals(firstKey);
-      }
-    } else {
-      return firstKey.equals(secondKey);
-    }
-  }
-
-  public String extractEntitTypeName(EdmNavigationProperty enp, Class<?> fallbackClass) {
-    Class<?> entityTypeClass = enp.toType();
-    return extractEntityTypeName(entityTypeClass == Object.class ? fallbackClass : entityTypeClass);
-  }
-
-  public String extractEntitTypeName(EdmNavigationProperty enp, Field field) {
-    Class<?> entityTypeClass = enp.toType();
-    if (entityTypeClass == Object.class) {
-      Class<?> toClass = field.getType();
-      return extractEntityTypeName((toClass.isArray() || Collection.class.isAssignableFrom(toClass) ?
-          (Class<?>) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0] : toClass));
-    } else {
-      return extractEntityTypeName(entityTypeClass);
-    }
-  }
-
-  /**
-   * Returns <code>NULL</code> if given class is not annotated. If annotated the set entity type name is returned and if
-   * no name is set the default name is generated from the simple class name.
-   *
-   * @param annotatedClass
-   * @return
-   */
-  public String extractEntityTypeName(Class<?> annotatedClass) {
-    return extractTypeName(annotatedClass, EdmEntityType.class);
-  }
-
-  public FullQualifiedName extractEntityTypeFqn(EdmEntityType type, Class<?> annotatedClass) {
-    if(type.namespace().isEmpty()) {
-      return new FullQualifiedName(generateNamespace(annotatedClass), extractEntityTypeName(annotatedClass));
-    }
-    return new FullQualifiedName(type.namespace(), extractEntityTypeName(annotatedClass));
-  }
-  
-  public FullQualifiedName extractEntityTypeFqn(Class<?> annotatedClass) {
-    EdmEntityType type = annotatedClass.getAnnotation(EdmEntityType.class);
-    if(type == null) {
-      return null;
-    }
-    return extractEntityTypeFqn(type, annotatedClass);
-  }
-
-  public FullQualifiedName extractComplexTypeFqn(Class<?> annotatedClass) {
-    EdmComplexType type = annotatedClass.getAnnotation(EdmComplexType.class);
-    if(type == null) {
-      return null;
-    }
-    return extractComplexTypeFqn(type, annotatedClass);
-  }
-
-  public FullQualifiedName extractComplexTypeFqn(EdmComplexType type, Class<?> annotatedClass) {
-    if(type.namespace().isEmpty()) {
-      return new FullQualifiedName(generateNamespace(annotatedClass), extractComplexTypeName(annotatedClass));
-    }
-    return new FullQualifiedName(type.namespace(), extractComplexTypeName(annotatedClass));
-  }
-
-  public String extractComplexTypeName(Class<?> annotatedClass) {
-    return extractTypeName(annotatedClass, EdmComplexType.class);
-  }
-  
-  public String generateNamespace(Class<?> annotatedClass) {
-    String packageName = annotatedClass.getPackage().getName();
-    return packageName;
-  }
-
-  /**
-   *
-   *
-   * @param <T> must be EdmEntityType or EdmComplexType annotation
-   * @param annotatedClass
-   * @param typeAnnotation
-   * @return null if annotatedClass is not annotated or name set via annotation or generated via
-   * {@link #getCanonicalName(java.lang.Class)}
-   */
-  private <T extends Annotation> String extractTypeName(Class<?> annotatedClass, Class<T> typeAnnotation) {
-    if (annotatedClass == Object.class) {
-      return null;
-    }
-    T type = annotatedClass.getAnnotation(typeAnnotation);
-    if (type == null) {
-      return null;
-    }
-
-    String name;
-    if (typeAnnotation == EdmEntityType.class) {
-      name = ((EdmEntityType) type).name();
-    } else if (typeAnnotation == EdmComplexType.class) {
-      name = ((EdmComplexType) type).name();
-    } else {
-      return null;
-    }
-
-    if (name.isEmpty()) {
-      return getCanonicalName(annotatedClass);
-    }
-    return name;
-  }
-
-  /**
-   * Get the set property name from an EdmProperty or EdmNavigationProperty annotation.
-   *
-   * @param field
-   * @return
-   */
-  public String getPropertyNameFromAnnotation(Field field) {
-    EdmProperty property = field.getAnnotation(EdmProperty.class);
-    if (property == null) {
-      EdmNavigationProperty navProperty = field.getAnnotation(EdmNavigationProperty.class);
-      if (navProperty == null) {
-        throw new EdmAnnotationException("Given field '" + field
-            + "' has no EdmProperty or EdmNavigationProperty annotation.");
-      }
-      return navProperty.name();
-    }
-    return property.name();
-  }
-
-  public String getPropertyName(Field field) {
-    String propertyName = getPropertyNameFromAnnotation(field);
-    if (propertyName.isEmpty()) {
-      propertyName = getCanonicalName(field);
-    }
-    return propertyName;
-  }
-
-  public String extractFromRoleName(EdmNavigationProperty enp, Field field) {
-    return getCanonicalRole(field.getDeclaringClass());
-  }
-
-  public String extractToRoleName(EdmNavigationProperty enp, Field field) {
-    String role = enp.toRole();
-    if (role.isEmpty()) {
-      role = getCanonicalRole(
-          field.getType().isArray() || Collection.class.isAssignableFrom(field.getType()) ?
-              (Class<?>) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0] : field.getType());
-    }
-    return role;
-  }
-
-  public String getCanonicalRole(Class<?> fallbackClass) {
-    String toRole = extractEntityTypeName(fallbackClass);
-    return "r_" + toRole;
-  }
-
-  public String extractRelationshipName(EdmNavigationProperty enp, Field field) {
-    String relationshipName = enp.association();
-    if (relationshipName.isEmpty()) {
-      final String fromRole = extractFromRoleName(enp, field);
-      final String toRole = extractToRoleName(enp, field);
-      if (fromRole.compareTo(toRole) > 0) {
-        relationshipName = toRole + "-" + fromRole;
-      } else {
-        relationshipName = fromRole + "-" + toRole;
-      }
-    }
-    return relationshipName;
-  }
-
-  public EdmMultiplicity getMultiplicity(EdmNavigationProperty enp, Field field) {
-    EdmMultiplicity multiplicity = mapMultiplicity(enp.toMultiplicity());
-    final boolean isCollectionType = field.getType().isArray() || Collection.class.isAssignableFrom(field.getType());
-
-    if (multiplicity == EdmMultiplicity.ONE && isCollectionType) {
-      return EdmMultiplicity.MANY;
-    }
-    return multiplicity;
-  }
-
-
-  /**
-   * Set key fields based on values in map.
-   * If an key field is not available or <code>NULL</code> in the map 
-   * it will be not set as <code>NULL</code> at the instance object.
-   * 
-   * @param instance
-   * @param keys
-   * @return
-   */
-  public <T> T setKeyFields(T instance, Map<String, Object> keys) {
-    List<Field> fields = getAnnotatedFields(instance, EdmKey.class);
-
-    for (Field field : fields) {
-      String propertyName = getPropertyName(field);
-      Object keyValue = keys.get(propertyName);
-      setValueForProperty(instance, propertyName, keyValue);
-    }
-
-    return instance;
-  }
-
-  public static final class ODataAnnotationException extends ODataException {
-    private static final long serialVersionUID = 1L;
-
-    public ODataAnnotationException(String message) {
-      super(message);
-    }
-  }
-
-  
-  public class AnnotatedNavInfo {
-    private final Field fromField;
-    private final Field toField;
-    private final EdmNavigationProperty fromNavigation;
-    private final EdmNavigationProperty toNavigation;
-
-    public AnnotatedNavInfo(Field fromField, Field toField, EdmNavigationProperty fromNavigation,
-        EdmNavigationProperty toNavigation) {
-      this.fromField = fromField;
-      this.toField = toField;
-      this.fromNavigation = fromNavigation;
-      this.toNavigation = toNavigation;
-    }
-
-    public Field getFromField() {
-      return fromField;
-    }
-
-    public Field getToField() {
-      return toField;
-    }
-
-    public EdmMultiplicity getFromMultiplicity() {
-      return getMultiplicity(toNavigation, toField);
-    }
-
-    public EdmMultiplicity getToMultiplicity() {
-      return getMultiplicity(fromNavigation, fromField);
-    }
-    
-    public boolean isBiDirectional() {
-      return toNavigation != null;
-    }
-  }
-
-  public AnnotatedNavInfo getCommonNavigationInfo(Class<?> sourceClass, Class<?> targetClass) {
-    List<Field> sourceFields = getAnnotatedFields(sourceClass, EdmNavigationProperty.class);
-    List<Field> targetFields = getAnnotatedFields(targetClass, EdmNavigationProperty.class);
-
-    // first try via association name to get full navigation information
-    for (Field sourceField : sourceFields) {
-      final EdmNavigationProperty sourceNav = sourceField.getAnnotation(EdmNavigationProperty.class);
-      final String sourceAssociation = extractRelationshipName(sourceNav, sourceField);
-      for (Field targetField : targetFields) {
-        final EdmNavigationProperty targetNav = targetField.getAnnotation(EdmNavigationProperty.class);
-        final String targetAssociation = extractRelationshipName(targetNav, targetField);
-        if (sourceAssociation.equals(targetAssociation)) {
-          return new AnnotatedNavInfo(sourceField, targetField, sourceNav, targetNav);
-        }
-      }
-    }
-    
-    // if nothing was found assume none bi-directinal navigation
-    String targetEntityTypeName = extractEntityTypeName(targetClass);
-    for (Field sourceField : sourceFields) {
-      final EdmNavigationProperty sourceNav = sourceField.getAnnotation(EdmNavigationProperty.class);
-      final String navTargetEntityName = extractEntitTypeName(sourceNav, sourceField);
-      
-      if (navTargetEntityName.equals(targetEntityTypeName)) {
-        return new AnnotatedNavInfo(sourceField, null, sourceNav, null);
-      }
-    }
-    
-    return null;
-  }
-
-  public Class<?> getFieldTypeForProperty(Object instance, String propertyName) throws ODataAnnotationException {
-    if (instance == null) {
-      return null;
-    }
-
-    Field field = getFieldForPropertyName(instance, propertyName, instance.getClass(), true);
-    if (field == null) {
-      throw new ODataAnnotationException("No field for property '" + propertyName
-          + "' found at class '" + instance.getClass() + "'.");
-    }
-    return field.getType();
-  }
-
-  public Object getValueForProperty(Object instance, String propertyName) throws ODataAnnotationException {
-    if (instance == null) {
-      return null;
-    }
-
-    Field field = getFieldForPropertyName(instance, propertyName, instance.getClass(), true);
-    if (field == null) {
-      throw new ODataAnnotationException("No field for property '" + propertyName
-          + "' found at class '" + instance.getClass() + "'.");
-    }
-    return getFieldValue(instance, field);
-  }
-
-  public void setValueForProperty(Object instance, String propertyName, Object propertyValue) {
-    if (instance != null) {
-      Field field = getFieldForPropertyName(instance, propertyName, instance.getClass(), true);
-      if (field != null) {
-        setFieldValue(instance, field, propertyValue);
-      }
-    }
-  }
-
-  private Field getFieldForPropertyName(Object instance, String propertyName,
-      Class<?> resultClass, boolean inherited) {
-    if (instance == null) {
-      return null;
-    }
-
-    Field[] fields = resultClass.getDeclaredFields();
-    for (Field field : fields) {
-      EdmProperty property = field.getAnnotation(EdmProperty.class);
-      if (property != null) {
-        if (property.name().isEmpty() && getCanonicalName(field).equals(propertyName)) {
-          return field;
-        } else if (property.name().equals(propertyName)) {
-          return field;
-        }
-      }
-    }
-
-    Class<?> superClass = resultClass.getSuperclass();
-    if (inherited && superClass != Object.class) {
-      return getFieldForPropertyName(instance, propertyName, superClass, true);
-    }
-
-    return null;
-  }
-
-  public Object getValueForField(Object instance, String fieldName, Class<? extends Annotation> annotation) {
-    if (instance == null) {
-      return null;
-    }
-    return getValueForField(instance, fieldName, instance.getClass(), annotation, true);
-  }
-
-  public Object getValueForField(Object instance, Class<? extends Annotation> annotation) {
-    if (instance == null) {
-      return null;
-    }
-    return getValueForField(instance, instance.getClass(), annotation, true);
-  }
-
-  private Object getValueForField(Object instance, Class<?> resultClass,
-      Class<? extends Annotation> annotation, boolean inherited) {
-    return getValueForField(instance, null, resultClass, annotation, inherited);
-  }
-
-  public Map<String, Object> getValueForAnnotatedFields(Object instance,
-      Class<? extends Annotation> annotation) {
-    return getValueForAnnotatedFields(instance, instance.getClass(), annotation, true);
-  }
-
-  private Map<String, Object> getValueForAnnotatedFields(Object instance, Class<?> resultClass,
-      Class<? extends Annotation> annotation, boolean inherited) {
-    if (instance == null) {
-      return null;
-    }
-
-    Field[] fields = resultClass.getDeclaredFields();
-    Map<String, Object> fieldName2Value = new HashMap<String, Object>();
-
-    for (Field field : fields) {
-      if (field.getAnnotation(annotation) != null) {
-        Object value = getFieldValue(instance, field);
-        final EdmProperty property = field.getAnnotation(EdmProperty.class);
-        final String name = property == null || property.name().isEmpty() ? field.getName() : property.name();
-        fieldName2Value.put(name, value);
-      }
-    }
-
-    Class<?> superClass = resultClass.getSuperclass();
-    if (inherited && superClass != Object.class) {
-      Map<String, Object> tmp = getValueForAnnotatedFields(instance, superClass, annotation, true);
-      fieldName2Value.putAll(tmp);
-    }
-
-    return fieldName2Value;
-  }
-
-  public void setValueForAnnotatedField(Object instance, Class<? extends Annotation> annotation, Object value) 
-      throws ODataAnnotationException {
-    List<Field> fields = getAnnotatedFields(instance, annotation);
-
-    if(fields.isEmpty()) {
-      throw new ODataAnnotationException("No field found for annotation '" + annotation
-          + "' on instance '" + instance + "'.");
-    } else if(fields.size() > 1) {
-      throw new ODataAnnotationException("More then one field found for annotation '" + annotation
-          + "' on instance '" + instance + "'.");
-    }
-
-    setFieldValue(instance, fields.get(0), value);
-  }
-
-  public void setValuesToAnnotatedFields(Object instance,
-      Class<? extends Annotation> annotation, Map<String, Object> fieldName2Value) {
-    List<Field> fields = getAnnotatedFields(instance, annotation);
-
-    // XXX: refactore
-    for (Field field : fields) {
-      final String canonicalName = getCanonicalName(field);
-      if (fieldName2Value.containsKey(canonicalName)) {
-        Object value = fieldName2Value.get(canonicalName);
-        setFieldValue(instance, field, value);
-      }
-    }
-  }
-
-  public List<Field> getAnnotatedFields(Object instance, Class<? extends Annotation> annotation) {
-    if (instance == null) {
-      return null;
-    }
-    return getAnnotatedFields(instance.getClass(), annotation, true);
-  }
-
-  public List<Field> getAnnotatedFields(Class<?> fieldClass, Class<? extends Annotation> annotation) {
-    return getAnnotatedFields(fieldClass, annotation, true);
-  }
-
-  /**
-   *
-   * @param instance
-   * @param resultClass
-   * @param annotation
-   * @param inherited
-   * @return
-   */
-  private List<Field> getAnnotatedFields(Class<?> resultClass,
-      Class<? extends Annotation> annotation, boolean inherited) {
-    if (resultClass == null) {
-      return null;
-    }
-
-    Field[] fields = resultClass.getDeclaredFields();
-    List<Field> annotatedFields = new ArrayList<Field>();
-
-    for (Field field : fields) {
-      if (field.getAnnotation(annotation) != null) {
-        annotatedFields.add(field);
-      }
-    }
-
-    Class<?> superClass = resultClass.getSuperclass();
-    if (inherited && superClass != Object.class) {
-      List<Field> tmp = getAnnotatedFields(superClass, annotation, true);
-      annotatedFields.addAll(tmp);
-    }
-
-    return annotatedFields;
-  }
-
-  private Object getValueForField(Object instance, String fieldName, Class<?> resultClass,
-      Class<? extends Annotation> annotation, boolean inherited) {
-    if (instance == null) {
-      return null;
-    }
-
-    Field[] fields = resultClass.getDeclaredFields();
-    for (Field field : fields) {
-      if (field.getAnnotation(annotation) != null
-          && (fieldName == null || field.getName().equals(fieldName))) {
-        return getFieldValue(instance, field);
-      }
-    }
-
-    Class<?> superClass = resultClass.getSuperclass();
-    if (inherited && superClass != Object.class) {
-      return getValueForField(instance, fieldName, superClass, annotation, true);
-    }
-
-    return null;
-  }
-
-  private Object getFieldValue(Object instance, Field field) {
-    try {
-      boolean access = field.isAccessible();
-      field.setAccessible(true);
-      Object value = field.get(instance);
-      field.setAccessible(access);
-      return value;
-    } catch (IllegalArgumentException ex) { // should never happen
-      throw new ODataRuntimeException(ex);
-    } catch (IllegalAccessException ex) { // should never happen
-      throw new ODataRuntimeException(ex);
-    }
-  }
-
-  private void setFieldValue(Object instance, Field field, Object value) {
-    try {
-      Object usedValue = value;
-      if (value != null
-          && field.getType() != value.getClass()
-          && value.getClass() == String.class) {
-        usedValue = convert(field, (String) value);
-      }
-      boolean access = field.isAccessible();
-      field.setAccessible(true);
-      field.set(instance, usedValue);
-      field.setAccessible(access);
-    } catch (IllegalArgumentException ex) { // should never happen
-      throw new ODataRuntimeException(ex);
-    } catch (IllegalAccessException ex) { // should never happen
-      throw new ODataRuntimeException(ex);
-    }
-  }
-
-  public Object convert(Field field, String propertyValue) {
-    Class<?> fieldClass = field.getType();
-    try {
-      EdmProperty property = field.getAnnotation(EdmProperty.class);
-      EdmSimpleTypeKind type = mapTypeKind(property.type());
-      return type.getEdmSimpleTypeInstance().valueOfString(propertyValue,
-          EdmLiteralKind.DEFAULT, null, fieldClass);
-    } catch (EdmSimpleTypeException ex) {
-      throw new ODataRuntimeException("Conversion failed for string property with error: "
-          + ex.getMessage(), ex);
-    }
-  }
-
-  public boolean isEdmAnnotated(Object object) {
-    if (object == null) {
-      return false;
-    }
-    return isEdmAnnotated(object.getClass());
-  }
-
-  public boolean isEdmTypeAnnotated(Class<?> clazz) {
-    boolean isComplexEntity = clazz.getAnnotation(EdmComplexType.class) != null;
-    boolean isEntity = clazz.getAnnotation(EdmEntityType.class) != null;
-    return isComplexEntity || isEntity;
-  }
-
-  public boolean isEdmAnnotated(Class<?> clazz) {
-    if (clazz == null) {
-      return false;
-    } else {
-      final boolean isEntity = null != clazz.getAnnotation(EdmEntityType.class);
-      final boolean isEntitySet = null != clazz.getAnnotation(EdmEntitySet.class);
-      final boolean isComplexEntity = null != clazz.getAnnotation(EdmComplexType.class);
-      return isEntity || isComplexEntity || isEntitySet;
-    }
-  }
-
-  public String getCanonicalName(Field field) {
-    return firstCharToUpperCase(field.getName());
-  }
-
-  public String getCanonicalName(Class<?> clazz) {
-    return firstCharToUpperCase(clazz.getSimpleName());
-  }
-
-  private String firstCharToUpperCase(String content) {
-    if (content == null || content.isEmpty()) {
-      return content;
-    }
-    return content.substring(0, 1).toUpperCase(Locale.ENGLISH) + content.substring(1);
-  }
-
-  public EdmSimpleTypeKind mapTypeKind(org.apache.olingo.odata2.api.annotation.edm.EdmType type) {
-    switch (type) {
-      case BINARY: return EdmSimpleTypeKind.Binary;
-      case BOOLEAN: return EdmSimpleTypeKind.Boolean;
-      case BYTE: return EdmSimpleTypeKind.Byte;
-      case COMPLEX: return EdmSimpleTypeKind.Null;
-      case DATE_TIME: return EdmSimpleTypeKind.DateTime;
-      case DATE_TIME_OFFSET: return EdmSimpleTypeKind.DateTimeOffset;
-      case DECIMAL: return EdmSimpleTypeKind.Decimal;
-      case DOUBLE: return EdmSimpleTypeKind.Double;
-      case GUID: return EdmSimpleTypeKind.Guid;
-      case INT16: return EdmSimpleTypeKind.Int16;
-      case INT32: return EdmSimpleTypeKind.Int32;
-      case INT64: return EdmSimpleTypeKind.Int64;
-      case NULL: return EdmSimpleTypeKind.Null;
-      case SBYTE: return EdmSimpleTypeKind.SByte;
-      case SINGLE: return EdmSimpleTypeKind.Single;
-      case STRING: return EdmSimpleTypeKind.String;
-      case TIME: return EdmSimpleTypeKind.Time;
-      default: throw new ODataRuntimeException("Unknown type '" + type
-        + "' for mapping to EdmSimpleTypeKind.");
-    }
-  }
-
-  public EdmMultiplicity mapMultiplicity(Multiplicity multiplicity) {
-    switch (multiplicity) {
-    case ZERO_OR_ONE: return EdmMultiplicity.ZERO_TO_ONE;
-    case ONE: return EdmMultiplicity.ONE;
-    case MANY: return EdmMultiplicity.MANY;
-    default: throw new ODataRuntimeException("Unknown type '" + multiplicity + "' for mapping to EdmMultiplicity.");
-    }
-  }
-  
-  /**
-   * 
-   */
-  private static class EdmAnnotationException extends RuntimeException {
-
-    private static final long serialVersionUID = 42L;
-
-    public EdmAnnotationException(String message) {
-      super(message);
-    }
-  }
-
-  public String getCanonicalNamespace(Class<?> aClass) {
-    return generateNamespace(aClass);
-  }
-
-  public String extractContainerName(Class<?> aClass) {
-    EdmEntitySet entitySet = aClass.getAnnotation(EdmEntitySet.class);
-    if(entitySet != null) {
-      String containerName = entitySet.container();
-      if(!containerName.isEmpty()) {
-        return containerName;
-      }
-    }
-    return DEFAULT_CONTAINER_NAME;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8764e11a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/ClassHelper.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/ClassHelper.java b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/ClassHelper.java
deleted file mode 100644
index 2a4c706..0000000
--- a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/ClassHelper.java
+++ /dev/null
@@ -1,105 +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.core.annotation.edm;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FilenameFilter;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- */
-public class ClassHelper {
-  
-  private static final File[] EMPTY_FILE_ARRAY = new File[0];
-  
-  private static final FilenameFilter CLASSFILE_FILTER = new FilenameFilter() {
-    @Override
-    public boolean accept(File dir, String name) {
-      return name.endsWith(CLASSFILE_ENDING);
-    }
-    public static final String CLASSFILE_ENDING = ".class";
-  };
-  
-  private static final FileFilter FOLDER_FILTER = new FileFilter() {
-    @Override
-    public boolean accept(File pathname) {
-      return pathname.isDirectory();
-    }
-  };
-  
-  public static final List<Class<?>> loadClasses(String packageToScan, ClassValidator cv) {
-    return loadClasses(packageToScan, CLASSFILE_FILTER, cv);
-  }
-
-  
-  public static final List<Class<?>> loadClasses(String packageToScan, FilenameFilter ff, ClassValidator cv) {
-    final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-    String folderToScan = packageToScan.replace(".", "/");
-    URL url = classLoader.getResource(folderToScan);
-    if(url == null) {
-      throw new IllegalArgumentException("No folder to scan found for package '" + packageToScan + "'.");
-    }
-    File folder = new File(url.getFile());
-    File[] classFiles = folder.listFiles(ff);
-    if(classFiles == null) {
-      classFiles = EMPTY_FILE_ARRAY;
-    }
-
-    List<Class<?>> annotatedClasses = new ArrayList<Class<?>>(classFiles.length);
-    for (File file : classFiles) {
-      String name = file.getName();
-      String fqn = packageToScan + "." + name.substring(0, name.length() - 6);
-      try {
-        Class<?> c = classLoader.loadClass(fqn);
-        if (cv.isClassValid(c)) {
-          annotatedClasses.add(c);
-        }
-      } catch (ClassNotFoundException ex) {
-        throw new IllegalArgumentException("Exception during class loading of class '" + fqn + 
-                "' with message '" + ex.getMessage() + "'.");
-      }
-    }
-    
-    // recursive search
-    File[] subfolders = listSubFolder(folder);
-    for (File file : subfolders) {
-      List<Class<?>> subFolderClazzes = loadClasses(packageToScan + "." + file.getName(), ff, cv);
-      annotatedClasses.addAll(subFolderClazzes);
-    }
-    //
-    
-    return annotatedClasses;
-  }
-
-  private static File[] listSubFolder(File folder) {
-    File[] subfolders = folder.listFiles(FOLDER_FILTER);
-    if(subfolders == null) {
-      return EMPTY_FILE_ARRAY;
-    }
-    return subfolders;
-  }
-  
-  public interface ClassValidator {
-    boolean isClassValid(Class<?> c);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8764e11a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/AnnotationProcessor.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/AnnotationProcessor.java b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/AnnotationProcessor.java
deleted file mode 100644
index b1b8730..0000000
--- a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/AnnotationProcessor.java
+++ /dev/null
@@ -1,309 +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.core.annotation.processor;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Field;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
-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.EdmProperty;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityDataSource;
-import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
-import org.apache.olingo.odata2.api.exception.ODataException;
-import org.apache.olingo.odata2.api.processor.ODataContext;
-import org.apache.olingo.odata2.api.processor.ODataResponse;
-import org.apache.olingo.odata2.api.processor.ODataSingleProcessor;
-import org.apache.olingo.odata2.api.uri.KeyPredicate;
-import org.apache.olingo.odata2.api.uri.info.DeleteUriInfo;
-import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
-import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo;
-import org.apache.olingo.odata2.api.uri.info.GetMediaResourceUriInfo;
-import org.apache.olingo.odata2.api.uri.info.PostUriInfo;
-import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo;
-import org.apache.olingo.odata2.core.annotation.data.DataSourceHolder;
-import org.apache.olingo.odata2.core.annotation.edm.AnnotationHelper;
-import org.apache.olingo.odata2.core.annotation.edm.ClassHelper;
-import org.apache.olingo.odata2.core.annotation.processor.json.EdmAnnotationSerializer;
-import org.apache.olingo.odata2.core.annotation.processor.json.JsonConsumer;
-import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
-
-/**
- *
- */
-public class AnnotationProcessor extends ODataSingleProcessor {
-
-  private static final AnnotationHelper ANNOTATION_HELPER = new AnnotationHelper();
-
-  private final Map<String, DataSourceHolder> dataSources = new HashMap<String, DataSourceHolder>();
-  private ODataContext odataContext;
-
-  public AnnotationProcessor(ODataContext context, String packageToScan) {
-    odataContext = context;
-
-    List<Class<?>> foundClasses = ClassHelper.loadClasses(packageToScan, new ClassHelper.ClassValidator() {
-      @Override
-      public boolean isClassValid(Class<?> c) {
-        return null != c.getAnnotation(EntityDataSource.class);
-      }
-    });
-
-    init(foundClasses);
-  }
-
-  private void init(List<Class<?>> foundClasses) {
-    for (Class<?> clz : foundClasses) {
-      DataSourceHolder dhs = new DataSourceHolder(clz);
-      dataSources.put(dhs.getEntityName(), dhs);
-    }
-  }
-
-  @Override
-  public ODataResponse readEntity(GetEntityUriInfo uriInfo, String contentType) throws ODataException {
-    final String name = uriInfo.getTargetType().getName();
-
-    List<KeyPredicate> keys = uriInfo.getKeyPredicates();
-    DataSourceHolder holder = dataSources.get(name);
-    if (holder != null) {
-      Object result = holder.readEntity(keys);
-      if (result != null) {
-        return createODataResponse(result, HttpStatusCodes.OK);
-      }
-    }
-
-    return ODataResponse.status(HttpStatusCodes.NOT_FOUND).build();
-  }
-
-  @Override
-  public ODataResponse readEntitySet(GetEntitySetUriInfo uriInfo, String contentType) throws ODataException {
-    final String name = uriInfo.getTargetType().getName();
-
-    DataSourceHolder holder = dataSources.get(name);
-    if (holder != null) {
-      Object result = holder.readEntitySet();
-      if (result != null) {
-        return createODataResponse(result, HttpStatusCodes.OK);
-      }
-    }
-
-    return ODataResponse.status(HttpStatusCodes.NOT_FOUND).build();
-  }
-
-  @Override
-  public ODataResponse createEntity(PostUriInfo uriInfo, InputStream content,
-          String requestContentType, String contentType) throws ODataException {
-    final String name = uriInfo.getTargetType().getName();
-
-    DataSourceHolder dataSource = dataSources.get(name);
-    if (dataSource != null) {
-      Object instance = createInstanceFromContent(dataSource, content);
-
-      Object result = dataSource.createEntity(instance);
-      return createODataResponse(result, HttpStatusCodes.CREATED);
-    }
-
-    return ODataResponse.status(HttpStatusCodes.BAD_REQUEST).build();
-  }
-
-  @Override
-  public ODataResponse deleteEntity(DeleteUriInfo uriInfo, String contentType) throws ODataException {
-    final String name = uriInfo.getTargetType().getName();
-
-    DataSourceHolder holder = dataSources.get(name);
-    if (holder != null) {
-      List<KeyPredicate> keys = uriInfo.getKeyPredicates();
-      Object result = holder.deleteEntity(keys);
-      if (result != null) {
-        return ODataResponse.status(HttpStatusCodes.NO_CONTENT).build();
-      }
-    }
-
-    return ODataResponse.status(HttpStatusCodes.NOT_FOUND).build();
-  }
-
-  @Override
-  public ODataResponse readEntityMedia(GetMediaResourceUriInfo uriInfo, String contentType) throws ODataException {
-    final String name = uriInfo.getTargetType().getName();
-
-    List<KeyPredicate> keys = uriInfo.getKeyPredicates();
-    Object result = readEntity(name, keys);
-    if (result != null) {
-      Object content = new AnnotationHelper().getValueForField(result, EdmMediaResourceContent.class);
-      Object mimeType = new AnnotationHelper().getValueForField(result, EdmMediaResourceMimeType.class);
-    return ODataResponse.status(HttpStatusCodes.OK).entity(content).contentHeader(String.valueOf(mimeType)).build();
-    }
-
-    return ODataResponse.status(HttpStatusCodes.NOT_FOUND).build();
-  }
-  
-  private Object readEntity(String entityName, List<KeyPredicate> keys) {
-    DataSourceHolder holder = dataSources.get(entityName);
-    if (holder != null) {
-      return holder.readEntity(keys);
-    }
-    return null;
-  }
-  
-  
-  private ODataResponse createODataResponse(Object result, HttpStatusCodes statusCode) throws ODataException {
-//    StringBuilder resultAsString = new StringBuilder("{\"d\":");
-//    if (result != null) {
-//      resultAsString.append(result.toString());
-//    } else {
-//      resultAsString.append("NULL");
-//    }
-//    resultAsString.append("}");
-    EdmAnnotationSerializer jsonSerializer = 
-            new EdmAnnotationSerializer(odataContext.getPathInfo().getServiceRoot().toASCIIString());
-    InputStream resultAsString = jsonSerializer.serialize(result);
-    return ODataResponse.status(statusCode)
-            .contentHeader("application/json")
-            .entity(resultAsString).build();
-  }
-
-  private Object createInstanceFromContent(DataSourceHolder dataSource, InputStream content) 
-          throws ODataException {
-    try {
-      Object instance = dataSource.createEntityInstance();
-      Map<String, FieldHolder> propName2Field = extractPropertyFields(dataSource.getEntityTypeClass());
-      Map<String, String> contentAsMap = JsonConsumer.readContent(content);
-      Set<Map.Entry<String, String>> contentEntries = contentAsMap.entrySet();
-      for (Map.Entry<String, String> entry : contentEntries) {
-        FieldHolder fh = propName2Field.get(entry.getKey());
-        if (fh != null) {
-          fh.set(instance, entry.getValue());
-        }
-      }
-      return instance;      
-    } catch (IOException e) {
-      throw new ODataRuntimeException("Unexpected IOException with message: " + e.getMessage());
-    }
-  }
-
-  @Override
-  public ODataResponse updateEntity(PutMergePatchUriInfo uriInfo, InputStream content, 
-          String requestContentType, boolean merge, String contentType) throws ODataException {
-    final String name = uriInfo.getTargetType().getName();
-
-    DataSourceHolder dataSource = dataSources.get(name);
-    if (dataSource != null) {
-      Object instance = createInstanceFromContent(dataSource, content);
-
-      Object result = dataSource.updateEntity(instance);
-      return createODataResponse(result, HttpStatusCodes.OK);
-    }
-
-    return ODataResponse.status(HttpStatusCodes.BAD_REQUEST).build();
-  }
-
-  private Map<String, FieldHolder> extractPropertyFields(Class<?> typeClass) {
-    if (typeClass == null) {
-      return Collections.emptyMap();
-    }
-    EdmEntityType type = typeClass.getAnnotation(EdmEntityType.class);
-    if (type == null) {
-      return Collections.emptyMap();
-    }
-
-    //
-    Map<String, FieldHolder> name2Fields = new HashMap<String, FieldHolder>();
-    Field[] fields = typeClass.getDeclaredFields();
-    for (Field field : fields) {
-      FieldHolder fh = FieldHolder.create(field);
-      name2Fields.put(fh.propertyName, fh);
-    }
-
-    //
-    Class<?> superClass = typeClass.getSuperclass();
-    if (superClass != null && superClass.getAnnotation(EdmEntityType.class) != null) {
-      name2Fields.putAll(extractPropertyFields(superClass));
-    }
-    //
-
-    return name2Fields;
-  }
-
-  /**
-   *
-   */
-  static final class FieldHolder {
-
-    final String propertyName;
-    final Field propertyField;
-
-    public FieldHolder(String propertyName, Field propertyField) {
-      this.propertyName = propertyName;
-      this.propertyField = propertyField;
-    }
-
-    public static FieldHolder create(Field field) {
-      EdmProperty ep = field.getAnnotation(EdmProperty.class);
-      String name;
-      if (ep != null && !ep.name().isEmpty()) {
-        name = ep.name();
-      } else {
-        name = ANNOTATION_HELPER.getCanonicalName(field);
-      }
-      return new FieldHolder(name, field);
-    }
-
-    public void set(Object instance, Object value) {
-      set(instance, String.valueOf(value));
-    }
-
-    public void set(Object instance, String value) {
-      try {
-        boolean accessible = propertyField.isAccessible();
-        if (!accessible) {
-          propertyField.setAccessible(true);
-        }
-
-        //
-        Class<?> type = propertyField.getType();
-        if (type == Boolean.class || type == boolean.class) {
-          propertyField.set(instance, Boolean.valueOf(value));
-        } else if (type == Integer.class || type == int.class) {
-          propertyField.set(instance, Integer.valueOf(value));
-        } else if (type == Long.class || type == long.class) {
-          propertyField.set(instance, Integer.valueOf(value));
-        } else {
-          propertyField.set(instance, value);
-        }
-        //
-
-        if (!accessible) {
-          propertyField.setAccessible(false);
-        }
-      } catch (Exception ex) {
-      }
-    }
-
-    @Override
-    public String toString() {
-      return "FieldHolder{" + "propertyName=" + propertyName + ", propertyField=" + propertyField + '}';
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8764e11a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/json/EdmAnnotationSerializer.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/json/EdmAnnotationSerializer.java b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/json/EdmAnnotationSerializer.java
deleted file mode 100644
index 7ae9971..0000000
--- a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/json/EdmAnnotationSerializer.java
+++ /dev/null
@@ -1,260 +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.core.annotation.processor.json;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
-import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
-import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
-import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
-import org.apache.olingo.odata2.api.annotation.edm.EdmType;
-import org.apache.olingo.odata2.api.edm.EdmLiteralKind;
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeException;
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
-import org.apache.olingo.odata2.core.annotation.edm.AnnotationHelper;
-import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
-
-public class EdmAnnotationSerializer {
-
-  private final String baseUri;
-  private static final AnnotationHelper ANNOTATION_HELPER = new AnnotationHelper();
-
-  public EdmAnnotationSerializer(String baseUri) {
-    this.baseUri = baseUri;
-  }
-
-  public InputStream serialize(Object obj) {
-    byte[] buf = getContent(obj).getBytes();
-    InputStream stream = new ByteArrayInputStream(buf);
-    return stream;
-  }
-
-  private String getContent(Object entity) {
-    if (entity == null) {
-      return "NULL";
-    } else if (isConsumable(entity)) {
-      try {
-        return handleEdmAnnotations(entity);
-      } catch (Exception e) {
-        throw new ODataRuntimeException("Exception with following message occured: " + e.getMessage(), e);
-      }
-    } else {
-      return entity.toString();
-    }
-  }
-
-  private String handleEdmAnnotations(Object entity)
-          throws IllegalArgumentException, IllegalAccessException, IOException {
-    //
-    Writer writer = new StringWriter();
-    JsonWriter json = new JsonWriter(writer);
-    json.start();
-    writeObject(entity, json);
-    json.finish();
-    writer.close();
-    //
-    return writer.toString();
-  }
-
-  private void writeObject(Object entity, JsonWriter json) throws IllegalAccessException {
-    if (entity.getClass().isArray()) {
-      List<Object> entities = Arrays.asList(entity);
-      writeCollection(entities, json);
-    } else if (Collection.class.isAssignableFrom(entity.getClass())) {
-      Collection<Object> entities = (Collection<Object>) entity;
-      writeCollection(entities, json);
-    } else {
-      writeSingleObject(entity, json);
-    }
-  }
-
-  private void writeCollection(Collection<Object> entities, JsonWriter json) throws IllegalAccessException {
-    json.startObject();
-    json.writeName("results");
-    json.startArray();
-    boolean writeSeperator = false;
-    for (Object object : entities) {
-      if (writeSeperator) {
-        json.writeSeparator();
-      } else {
-        writeSeperator = true;
-      }
-      writeSingleObject(object, json);
-    }
-    json.endArray();
-    json.endObject();
-  }
-
-  private void writeSingleObject(Object entity, JsonWriter json) throws IllegalAccessException {
-    List<Field> fields = getAllFields(entity.getClass());
-    json.startObject();
-    for (Field field : fields) {
-      boolean written = writeEdmProperty(entity, json, field);
-      if (!written) {
-        writeEdmNavigationProperty(entity, json, field);
-      }
-    }
-    json.endObject();
-  }
-
-  private boolean writeEdmNavigationProperty(Object entity, JsonWriter json, Field field)
-          throws IllegalArgumentException, IllegalAccessException {
-    EdmNavigationProperty navProperty = field.getAnnotation(EdmNavigationProperty.class);
-    EdmEntitySet entitySet = entity.getClass().getAnnotation(EdmEntitySet.class);
-    if (navProperty != null) {
-      field.setAccessible(true);
-      Object keyValue = extractEdmKey(entity);
-      json.writeStringProperty("uri", baseUri + entitySet.name() + "('" + keyValue.toString() + "')"
-              + "/" + navProperty.association());
-      return true;
-    }
-    return false;
-  }
-
-  private boolean writeEdmProperty(Object entity, JsonWriter json, Field field) throws IllegalAccessException {
-    EdmProperty property = field.getAnnotation(EdmProperty.class);
-    if (property != null) {
-      field.setAccessible(true);
-      Object fieldValue = field.get(entity);
-      String name = getName(property, field);
-      EdmSimpleTypeKind defaultType = getDefaultSimpleTypeKind(field, property);
-      try {
-        String value = defaultType.getEdmSimpleTypeInstance().valueToString(fieldValue, EdmLiteralKind.JSON, null);
-        write(defaultType, name, value, json);
-      } catch (EdmSimpleTypeException e) {
-        throw new IllegalArgumentException("Illegal argument for valueToString for EdmSimpleType = '"
-                + property.type() + "' with message = '" + e.getMessage() + "'.");
-      }
-      return true;
-    }
-    return false;
-  }
-
-  public void write(EdmSimpleTypeKind kind, String name, String value, JsonWriter jsonStreamWriter) {
-    switch (kind) {
-      case String:
-        jsonStreamWriter.writeStringProperty(name, value);
-        break;
-      case Boolean:
-      case Byte:
-      case SByte:
-      case Int16:
-      case Int32:
-        jsonStreamWriter.writeRawProperty(name, value);
-        break;
-      case DateTime:
-      case DateTimeOffset:
-        // Although JSON escaping is (and should be) done in the JSON
-        // serializer, we backslash-escape the forward slash here explicitly
-        // because it is not required to escape it in JSON but in OData.
-        jsonStreamWriter.writeRawStringProperty(name, value == null ? null : value.replace("/", "\\/"));
-        break;
-      default:
-        jsonStreamWriter.writeRawStringProperty(name, value);
-        break;
-    }
-  }
-
-  private EdmSimpleTypeKind getDefaultSimpleTypeKind(Field field, EdmProperty property) {
-    final EdmType type = property.type();
-    if (type == EdmType.NULL) {
-      Class<?> fieldType = field.getType();
-      if (fieldType == String.class) {
-        return EdmSimpleTypeKind.String;
-      } else if (fieldType == Long.class) {
-        return EdmSimpleTypeKind.Int64;
-      } else if (fieldType == Integer.class) {
-        return EdmSimpleTypeKind.Int32;
-      }
-    }
-    return ANNOTATION_HELPER.mapTypeKind(type);
-  }
-
-  private Class<?> getType(EdmProperty property) {
-    EdmSimpleTypeKind type = ANNOTATION_HELPER.mapTypeKind(property.type());
-    Class<?> defaultType = type.getEdmSimpleTypeInstance().getDefaultType();
-    return defaultType;
-  }
-
-  private Object extractEdmKey(Object value) throws IllegalArgumentException, IllegalAccessException {
-    Field idField = getFieldWithAnnotation(value.getClass(), EdmKey.class);
-    if (idField == null) {
-      return "NULL";
-    }
-    idField.setAccessible(true);
-    return idField.get(value);
-  }
-
-  private Field getFieldWithAnnotation(Class<?> clazz, Class<? extends Annotation> annotationClazz) {
-
-    Field[] fields = clazz.getDeclaredFields();
-    for (Field field : fields) {
-      if (field.getAnnotation(annotationClazz) != null) {
-        return field;
-      }
-    }
-
-    Class<?> superclass = clazz.getSuperclass();
-    if (superclass != Object.class) {
-      return getFieldWithAnnotation(superclass, annotationClazz);
-    }
-
-    return null;
-  }
-
-  private List<Field> getAllFields(Class<?> clazz) {
-    Field[] fields = clazz.getDeclaredFields();
-    List<Field> allFields = new ArrayList<Field>(Arrays.asList(fields));
-
-    final Class<?> superclass = clazz.getSuperclass();
-    if (superclass != Object.class) {
-      allFields.addAll(getAllFields(superclass));
-    }
-
-    return allFields;
-  }
-
-  private boolean isConsumable(Object entity) {
-    if (entity == null) {
-      return false;
-    } else if (ANNOTATION_HELPER.isEdmAnnotated(entity)) {
-      return true;
-    } else if (entity.getClass().isArray() || entity.getClass().isAssignableFrom(Collection.class)) {
-      return true;
-    } else if (Collection.class.isAssignableFrom(entity.getClass())) {
-      return true;
-    }
-    return false;
-  }
-
-  private String getName(EdmProperty property, Field field) {
-    String name = property.name();
-    if (name.isEmpty()) {
-      name = ANNOTATION_HELPER.getCanonicalName(field);
-    }
-    return name;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8764e11a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/json/JsonConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/json/JsonConsumer.java b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/json/JsonConsumer.java
deleted file mode 100644
index 265484d..0000000
--- a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/json/JsonConsumer.java
+++ /dev/null
@@ -1,138 +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.core.annotation.processor.json;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.olingo.odata2.core.ep.util.FormatJson;
-
-import com.google.gson.stream.JsonReader;
-import com.google.gson.stream.JsonToken;
-
-/**
- *
- */
-public class JsonConsumer {
-
-  private final JsonReader reader;
-  private final Map<String, String> properties;
-
-  public JsonConsumer(InputStream content) {
-    reader = new JsonReader(new InputStreamReader(content));
-    properties = new HashMap<String, String>();
-  }
-
-  public static Map<String, String> readContent(InputStream content) throws IOException {
-    JsonConsumer jc = new JsonConsumer(content);
-    return jc.read();
-  }
-
-  public Map<String, String> read() throws IOException {
-
-    reader.beginObject();
-    String nextName = reader.nextName();
-    if (FormatJson.D.equals(nextName)) {
-      reader.beginObject();
-      readEntryContent();
-      reader.endObject();
-    } else {
-      handleName(nextName);
-      readEntryContent();
-    }
-    reader.endObject();
-
-    return properties;
-  }
-
-  private void readEntryContent() throws IOException {
-    while (reader.hasNext()) {
-      final String name = reader.nextName();
-      handleName(name);
-    }
-  }
-
-  private void handleName(final String name) throws IOException {
-    if (FormatJson.METADATA.equals(name)) {
-      readMetadata();
-    } else {
-      readPropertyValue(name);
-    }
-  }
-
-  private void readPropertyValue(final String name) throws IOException {
-    final JsonToken tokenType = reader.peek();
-    final String value;
-
-    switch (tokenType) {
-      case STRING:
-        value = reader.nextString();
-        break;
-      case BOOLEAN:
-        value = String.valueOf(reader.nextBoolean());
-        break;
-      case NULL:
-        reader.nextNull();
-      default:
-        value = null;
-    }
-
-    properties.put(name, value);
-  }
-
-  private void readMetadata() throws IOException {
-    reader.beginObject();
-
-    while (reader.hasNext()) {
-      String name = reader.nextName();
-
-      if (FormatJson.PROPERTIES.equals(name)) {
-        reader.skipValue();
-        continue;
-      }
-
-      String value = reader.nextString();
-      if (FormatJson.ID.equals(name)) {
-        properties.put("md_" + name, value);
-      } else if (FormatJson.URI.equals(name)) {
-        properties.put("md_" + name, value);
-      } else if (FormatJson.TYPE.equals(name)) {
-        properties.put("md_" + name, value);
-      } else if (FormatJson.ETAG.equals(name)) {
-        properties.put("md_" + name, value);
-      } else if (FormatJson.EDIT_MEDIA.equals(name)) {
-        properties.put("md_" + name, value);
-      } else if (FormatJson.MEDIA_SRC.equals(name)) {
-        properties.put("md_" + name, value);
-      } else if (FormatJson.MEDIA_ETAG.equals(name)) {
-        properties.put("md_" + name, value);
-      } else if (FormatJson.CONTENT_TYPE.equals(name)) {
-        properties.put("md_" + name, value);
-      } else {
-        throw new IllegalStateException("Unknown metadata");
-      }
-    }
-
-    reader.endObject();
-  }
-
-}