You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2015/03/18 14:04:47 UTC

[3/6] olingo-odata4 git commit: [OLINGO-575] Merge EdmImpl classes

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityContainerImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityContainerImpl.java
new file mode 100644
index 0000000..6c768ce
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityContainerImpl.java
@@ -0,0 +1,216 @@
+/*
+ * 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.commons.core.edm.provider;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmActionImport;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.commons.api.edm.EdmSingleton;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.ActionImport;
+import org.apache.olingo.commons.api.edm.provider.EdmProvider;
+import org.apache.olingo.commons.api.edm.provider.EntityContainer;
+import org.apache.olingo.commons.api.edm.provider.EntityContainerInfo;
+import org.apache.olingo.commons.api.edm.provider.EntitySet;
+import org.apache.olingo.commons.api.edm.provider.FunctionImport;
+import org.apache.olingo.commons.api.edm.provider.Singleton;
+import org.apache.olingo.commons.core.edm.AbstractEdmEntityContainer;
+import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
+
+public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
+
+  private final EdmProvider provider;
+  private EntityContainer container;
+  private EdmAnnotationHelper helper;
+
+  public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider,
+      final EntityContainerInfo entityContainerInfo) {
+    super(edm, entityContainerInfo.getContainerName(), entityContainerInfo.getExtendsContainer());
+    this.provider = provider;
+  }
+
+  public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider, final FullQualifiedName containerFQN,
+      final EntityContainer entityContainer) {
+    super(edm, containerFQN, entityContainer.getExtendsContainerFQN());
+    this.provider = provider;
+    container = entityContainer;
+    this.helper = new EdmAnnotationHelperImpl(edm, entityContainer);
+  }
+
+  @Override
+  protected EdmSingleton createSingleton(final String singletonName) {
+    EdmSingleton singleton = null;
+
+    try {
+      final Singleton providerSingleton = provider.getSingleton(entityContainerName, singletonName);
+      if (providerSingleton != null) {
+        singleton = new EdmSingletonImpl(edm, this, providerSingleton);
+      }
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+
+    return singleton;
+  }
+
+  @Override
+  protected EdmEntitySet createEntitySet(final String entitySetName) {
+    EdmEntitySet entitySet = null;
+
+    try {
+      final EntitySet providerEntitySet = provider.getEntitySet(entityContainerName, entitySetName);
+      if (providerEntitySet != null) {
+        entitySet = new EdmEntitySetImpl(edm, this, providerEntitySet);
+      }
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+
+    return entitySet;
+  }
+
+  @Override
+  protected EdmActionImport createActionImport(final String actionImportName) {
+    EdmActionImport actionImport = null;
+
+    try {
+      final ActionImport providerImport = provider.getActionImport(entityContainerName, actionImportName);
+      if (providerImport != null) {
+        actionImport = new EdmActionImportImpl(edm, this, providerImport);
+      }
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+
+    return actionImport;
+  }
+
+  @Override
+  protected EdmFunctionImport createFunctionImport(final String functionImportName) {
+    EdmFunctionImport functionImport = null;
+
+    try {
+      final FunctionImport providerImport = provider.getFunctionImport(entityContainerName, functionImportName);
+      if (providerImport != null) {
+        functionImport = new EdmFunctionImportImpl(edm, this, providerImport);
+      }
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+
+    return functionImport;
+  }
+
+  @Override
+  protected void loadAllEntitySets() {
+    loadContainer();
+    List<EntitySet> providerEntitySets = container.getEntitySets();
+    if (providerEntitySets != null) {
+      for (EntitySet entitySet : providerEntitySets) {
+        if (!entitySets.containsKey(entitySet.getName())) {
+          EdmEntitySetImpl impl = new EdmEntitySetImpl(edm, this, entitySet);
+          entitySets.put(impl.getName(), impl);
+        }
+      }
+    }
+  }
+
+  @Override
+  protected void loadAllFunctionImports() {
+    loadContainer();
+    List<FunctionImport> providerFunctionImports = container.getFunctionImports();
+    if (providerFunctionImports != null) {
+      for (FunctionImport functionImport : providerFunctionImports) {
+        String functionName = functionImport.getName();
+        if (!functionImports.containsKey(functionName)) {
+          functionImports.put(functionName,
+              new EdmFunctionImportImpl(edm, this, functionImport));
+        }
+      }
+    }
+
+  }
+
+  @Override
+  protected void loadAllSingletons() {
+    loadContainer();
+    List<Singleton> providerSingletons = container.getSingletons();
+    if (providerSingletons != null) {
+      for (Singleton singleton : providerSingletons) {
+        if (!singletons.containsKey(singleton.getName())) {
+          EdmSingletonImpl impl = new EdmSingletonImpl(edm, this, singleton);
+          singletons.put(singleton.getName(), impl);
+        }
+      }
+    }
+
+  }
+
+  @Override
+  protected void loadAllActionImports() {
+    loadContainer();
+    List<ActionImport> providerActionImports = container.getActionImports();
+    if (providerActionImports != null) {
+      for (ActionImport actionImport : providerActionImports) {
+        if (!actionImports.containsKey(actionImport.getName())) {
+          EdmActionImportImpl impl = new EdmActionImportImpl(edm, this, actionImport);
+          actionImports.put(actionImport.getName(), impl);
+        }
+      }
+    }
+
+  }
+
+  private void loadContainer() {
+    if (container == null) {
+      try {
+        container = provider.getEntityContainer();
+        if (container == null) {
+          // TODO: Should we throw an exception here?
+          container = new EntityContainer().setName(getName());
+        }
+      } catch (ODataException e) {
+        throw new EdmException(e);
+      }
+    }
+  }
+
+  @Override
+  public TargetType getAnnotationsTargetType() {
+    return TargetType.EntityContainer;
+  }
+
+  @Override
+  public EdmAnnotation getAnnotation(final EdmTerm term) {
+    return helper == null ? null : helper.getAnnotation(term);
+  }
+
+  @Override
+  public List<EdmAnnotation> getAnnotations() {
+    return helper == null ? Collections.<EdmAnnotation> emptyList() : helper.getAnnotations();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntitySetImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntitySetImpl.java
new file mode 100644
index 0000000..d69f6fe
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntitySetImpl.java
@@ -0,0 +1,44 @@
+/*
+ * 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.commons.core.edm.provider;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.provider.EntitySet;
+
+public class EdmEntitySetImpl extends EdmBindingTargetImpl implements EdmEntitySet {
+
+  private EntitySet entitySet;
+
+  public EdmEntitySetImpl(final Edm edm, final EdmEntityContainer container, final EntitySet entitySet) {
+    super(edm, container, entitySet);
+    this.entitySet = entitySet;
+  }
+
+  @Override
+  public boolean isIncludeInServiceDocument() {
+    return entitySet.isIncludeInServiceDocument();
+  }
+
+  @Override
+  public TargetType getAnnotationsTargetType() {
+    return TargetType.EntitySet;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityTypeImpl.java
new file mode 100644
index 0000000..b6cbec6
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityTypeImpl.java
@@ -0,0 +1,112 @@
+/*
+ * 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.commons.core.edm.provider;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
+import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.EntityType;
+import org.apache.olingo.commons.api.edm.provider.PropertyRef;
+import org.apache.olingo.commons.core.edm.AbstractEdmEntityType;
+import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
+import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class EdmEntityTypeImpl extends AbstractEdmEntityType {
+
+  private final EdmStructuredTypeHelper helper;
+
+  private EntityType entityType;
+
+  private boolean baseTypeChecked = false;
+  
+  private EdmAnnotationHelper annotationHelper;
+
+  public static EdmEntityTypeImpl getInstance(final Edm edm, final FullQualifiedName name,
+      final EntityType entityType) {
+
+    return new EdmEntityTypeImpl(edm, name, entityType);
+  }
+
+  private EdmEntityTypeImpl(final Edm edm, final FullQualifiedName name, final EntityType entityType) {
+    super(edm, name, entityType.getBaseTypeFQN(), entityType.hasStream());
+    this.entityType = entityType;
+    helper = new EdmStructuredTypeHelperImpl(edm, name, entityType);
+  }
+
+  @Override
+  protected Map<String, EdmProperty> getProperties() {
+    return helper.getProperties();
+  }
+
+  @Override
+  protected Map<String, EdmNavigationProperty> getNavigationProperties() {
+    return helper.getNavigationProperties();
+  }
+
+  @Override
+  protected void checkBaseType() {
+    if (!baseTypeChecked) {
+      if (baseTypeName != null) {
+        baseType = buildBaseType(baseTypeName);
+        entityBaseType = (EdmEntityType) baseType;
+      }
+      if (baseType == null
+          || (baseType.isAbstract() && ((AbstractEdmEntityType) baseType).getKeyPropertyRefs().size() == 0)) {
+        final List<PropertyRef> key = entityType.getKey();
+        if (key != null) {
+          final List<EdmKeyPropertyRef> edmKey = new ArrayList<EdmKeyPropertyRef>();
+          for (PropertyRef ref : key) {
+            edmKey.add(new EdmKeyPropertyRefImpl(this, ref));
+          }
+          setEdmKeyPropertyRef(edmKey);
+        }
+      }
+      baseTypeChecked = true;
+    }
+  }
+
+  @Override
+  public boolean isOpenType() {
+    return helper.isOpenType();
+  }
+
+  @Override
+  public boolean isAbstract() {
+    return helper.isAbstract();
+  }
+
+  @Override
+  public EdmAnnotation getAnnotation(final EdmTerm term) {
+    return annotationHelper.getAnnotation(term);
+  }
+
+  @Override
+  public List<EdmAnnotation> getAnnotations() {
+    return annotationHelper.getAnnotations();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEnumTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEnumTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEnumTypeImpl.java
new file mode 100644
index 0000000..9b4ca6a
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEnumTypeImpl.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.provider;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmMember;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.EnumMember;
+import org.apache.olingo.commons.api.edm.provider.EnumType;
+import org.apache.olingo.commons.core.edm.AbstractEdmEnumType;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+
+public class EdmEnumTypeImpl extends AbstractEdmEnumType {
+
+  private static final Set<EdmPrimitiveTypeKind> VALID_UNDERLYING_TYPES = new HashSet<EdmPrimitiveTypeKind>();
+  {
+    VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Byte);
+    VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.SByte);
+    VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Int16);
+    VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Int32);
+    VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Int64);
+  };
+
+  private final EdmPrimitiveType underlyingType;
+
+  private final EnumType enumType;
+
+  private List<EdmMember> members;
+
+  public EdmEnumTypeImpl(final Edm edm, final FullQualifiedName enumName, final EnumType enumType) {
+    super(edm, enumName, enumType.isFlags());
+
+    if (enumType.getUnderlyingType() == null) {
+      underlyingType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32);
+    } else {
+      EdmPrimitiveTypeKind underlyingTypeKind = EdmPrimitiveTypeKind.valueOfFQN(enumType.getUnderlyingType());
+
+      if (!VALID_UNDERLYING_TYPES.contains(underlyingTypeKind)) {
+        throw new EdmException("Not allowed as underlying type: " + underlyingTypeKind);
+      }
+      underlyingType = EdmPrimitiveTypeFactory.getInstance(underlyingTypeKind);
+    }
+
+    this.enumType = enumType;
+  }
+
+  @Override
+  public EdmPrimitiveType getUnderlyingType() {
+    return underlyingType;
+  }
+
+  @Override
+  protected List<EdmMember> getMembers() {
+    if (members == null) {
+      members = new ArrayList<EdmMember>(enumType.getMembers().size());
+      for (EnumMember member : enumType.getMembers()) {
+        members.add(new EdmMemberImpl(edm, getFullQualifiedName(), member));
+      }
+    }
+    return members;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImpl.java
new file mode 100644
index 0000000..4a29d83
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImpl.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.provider;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmFunction;
+import org.apache.olingo.commons.api.edm.EdmReturnType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.provider.Function;
+
+public class EdmFunctionImpl extends EdmOperationImpl implements EdmFunction {
+
+  private final Function function;
+
+  public static EdmFunctionImpl getInstance(final Edm edm, final FullQualifiedName name, final Function function) {
+    return EdmOperationImpl.getInstance(new EdmFunctionImpl(edm, name, function));
+  }
+
+  private EdmFunctionImpl(final Edm edm, final FullQualifiedName name, final Function function) {
+    super(edm, name, function, EdmTypeKind.FUNCTION);
+    this.function = function;
+  }
+
+  @Override
+  public boolean isComposable() {
+    return function.isComposable();
+  }
+
+  @Override
+  public EdmReturnType getReturnType() {
+    final EdmReturnType returnType = super.getReturnType();
+    if (returnType == null) {
+      throw new EdmException("ReturnType for a function must not be null");
+    }
+    return returnType;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImportImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImportImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImportImpl.java
new file mode 100644
index 0000000..ead3116
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImportImpl.java
@@ -0,0 +1,63 @@
+/*
+ * 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.commons.core.edm.provider;
+
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmFunction;
+import org.apache.olingo.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.FunctionImport;
+
+public class EdmFunctionImportImpl extends EdmOperationImportImpl implements EdmFunctionImport {
+
+  private final FunctionImport functionImport;
+
+  public EdmFunctionImportImpl(final Edm edm, final EdmEntityContainer container, final FunctionImport functionImport) {
+    super(edm, container, functionImport);
+    this.functionImport = functionImport;
+  }
+
+  @Override
+  public FullQualifiedName getFunctionFqn() {
+    return functionImport.getFunctionFQN();
+  }
+
+  @Override
+  public EdmFunction getUnboundFunction(final List<String> parameterNames) {
+    return edm.getUnboundFunction(getFunctionFqn(), parameterNames);
+  }
+
+  @Override
+  public List<EdmFunction> getUnboundFunctions() {
+    return edm.getUnboundFunctions(getFunctionFqn());
+  }
+
+  @Override
+  public boolean isIncludeInServiceDocument() {
+    return functionImport.isIncludeInServiceDocument();
+  }
+
+  @Override
+  public TargetType getAnnotationsTargetType() {
+    return TargetType.FunctionImport;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmKeyPropertyRefImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmKeyPropertyRefImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmKeyPropertyRefImpl.java
new file mode 100644
index 0000000..a7f291d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmKeyPropertyRefImpl.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.provider;
+
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.provider.PropertyRef;
+import org.apache.olingo.commons.core.edm.AbstractEdmKeyPropertyRef;
+
+public class EdmKeyPropertyRefImpl extends AbstractEdmKeyPropertyRef {
+
+  private final PropertyRef ref;
+
+  public EdmKeyPropertyRefImpl(final EdmEntityType edmEntityType, final PropertyRef ref) {
+    super(edmEntityType);
+    this.ref = ref;
+  }
+
+  @Override
+  public String getName() {
+    return ref.getName();
+  }
+
+  @Override
+  public String getAlias() {
+    return ref.getAlias();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmMemberImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmMemberImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmMemberImpl.java
new file mode 100644
index 0000000..6c840fd
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmMemberImpl.java
@@ -0,0 +1,50 @@
+/*
+ * 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.commons.core.edm.provider;
+
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.EnumMember;
+import org.apache.olingo.commons.core.edm.AbstractEdmMember;
+import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
+
+public class EdmMemberImpl extends AbstractEdmMember {
+
+  private final EdmAnnotationHelper helper;
+
+  public EdmMemberImpl(final Edm edm, final FullQualifiedName enumFQN, final EnumMember member) {
+    super(edm, enumFQN, member.getName(), member.getValue());
+    this.helper = new EdmAnnotationHelperImpl(edm, member);
+  }
+
+  @Override
+  public EdmAnnotation getAnnotation(final EdmTerm term) {
+    return helper.getAnnotation(term);
+  }
+
+  @Override
+  public List<EdmAnnotation> getAnnotations() {
+    return helper.getAnnotations();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNavigationPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNavigationPropertyImpl.java
new file mode 100644
index 0000000..5c9e2c1
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNavigationPropertyImpl.java
@@ -0,0 +1,116 @@
+/*
+ * 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.commons.core.edm.provider;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmReferentialConstraint;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
+import org.apache.olingo.commons.api.edm.provider.ReferentialConstraint;
+import org.apache.olingo.commons.core.edm.AbstractEdmNavigationProperty;
+import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty {
+
+  private final FullQualifiedName structuredTypeName;
+  private final NavigationProperty navigationProperty;
+  private List<EdmReferentialConstraint> referentialConstraints;
+  private final EdmAnnotationHelper helper;
+
+  public EdmNavigationPropertyImpl(
+      final Edm edm, final FullQualifiedName structuredTypeName, final NavigationProperty navigationProperty) {
+    super(edm, navigationProperty.getName());
+    this.structuredTypeName = structuredTypeName;
+    this.navigationProperty = navigationProperty;
+    this.helper = new EdmAnnotationHelperImpl(edm, navigationProperty);
+  }
+
+  @Override
+  protected FullQualifiedName getTypeFQN() {
+    return navigationProperty.getTypeFQN();
+  }
+
+  @Override
+  public boolean isCollection() {
+    return navigationProperty.isCollection();
+  }
+
+  @Override
+  public boolean isNullable() {
+    return navigationProperty.isNullable();
+  }
+
+  @Override
+  public Boolean containsTarget() {
+    return navigationProperty.isContainsTarget();
+  }
+
+  @Override
+  protected String internatGetPartner() {
+    return navigationProperty.getPartner();
+  }
+
+  @Override
+  public String getReferencingPropertyName(final String referencedPropertyName) {
+    final List<ReferentialConstraint> referentialConstraints = navigationProperty.getReferentialConstraints();
+    if (referentialConstraints != null) {
+      for (ReferentialConstraint constraint : referentialConstraints) {
+        if (constraint.getReferencedProperty().equals(referencedPropertyName)) {
+          return constraint.getProperty();
+        }
+      }
+    }
+    return null;
+  }
+
+  @Override
+  public List<EdmReferentialConstraint> getReferentialConstraints() {
+    if (referentialConstraints == null) {
+      final List<ReferentialConstraint> providerConstraints = navigationProperty.getReferentialConstraints();
+      referentialConstraints = new ArrayList<EdmReferentialConstraint>();
+      if (providerConstraints != null) {
+        for (ReferentialConstraint constraint : providerConstraints) {
+          referentialConstraints.add(
+              new EdmReferentialConstraintImpl(edm, constraint));
+        }
+      }
+    }
+    return referentialConstraints;
+  }
+
+  @Override
+  public FullQualifiedName getAnnotationsTargetFQN() {
+    return structuredTypeName;
+  }
+
+  @Override
+  public EdmAnnotation getAnnotation(final EdmTerm term) {
+    return helper.getAnnotation(term);
+  }
+
+  @Override
+  public List<EdmAnnotation> getAnnotations() {
+    return helper.getAnnotations();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmOperationImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmOperationImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmOperationImpl.java
new file mode 100644
index 0000000..6b451c3
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmOperationImpl.java
@@ -0,0 +1,99 @@
+/*
+ * 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.commons.core.edm.provider;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmParameter;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.provider.Operation;
+import org.apache.olingo.commons.api.edm.provider.Parameter;
+import org.apache.olingo.commons.core.edm.AbstractEdmOperation;
+import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
+
+public abstract class EdmOperationImpl extends AbstractEdmOperation {
+
+  protected final Operation operation;
+  protected final EdmAnnotationHelper helper;
+
+  protected static <T extends EdmOperationImpl> T getInstance(final T instance) {
+    final List<Parameter> providerParameters = instance.operation.getParameters();
+    if (providerParameters != null) {
+      final List<EdmParameter> _parameters = new ArrayList<EdmParameter>(providerParameters.size());
+      for (Parameter parameter : providerParameters) {
+        _parameters.add(new EdmParameterImpl(instance.edm, parameter));
+      }
+      instance.setParameters(_parameters);
+    }
+
+    final String entitySetPath = instance.operation.getEntitySetPath();
+    if (entitySetPath != null) {
+      instance.setEntitySetPath(entitySetPath);
+    }
+
+    instance.setIsBound(instance.operation.isBound());
+
+    if (instance.operation.getReturnType() != null) {
+      instance.setReturnType(new EdmReturnTypeImpl(instance.edm, instance.operation.getReturnType()));
+    }
+
+    return instance;
+  }
+
+  protected EdmOperationImpl(final Edm edm, final FullQualifiedName name, final Operation operation,
+      final EdmTypeKind kind) {
+
+    super(edm, name, kind);
+    this.operation = operation;
+    this.helper = new EdmAnnotationHelperImpl(edm, operation);
+  }
+
+  @Override
+  public FullQualifiedName getBindingParameterTypeFqn() {
+    if (isBound()) {
+      Parameter bindingParameter = operation.getParameters().get(0);
+      return bindingParameter.getTypeFQN();
+    }
+    return null;
+  }
+
+  @Override
+  public Boolean isBindingParameterTypeCollection() {
+    if (isBound()) {
+      Parameter bindingParameter = operation.getParameters().get(0);
+      return bindingParameter.isCollection();
+    }
+    return null;
+  }
+
+  @Override
+  public EdmAnnotation getAnnotation(final EdmTerm term) {
+    return helper.getAnnotation(term);
+  }
+
+  @Override
+  public List<EdmAnnotation> getAnnotations() {
+    return helper.getAnnotations();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmOperationImportImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmOperationImportImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmOperationImportImpl.java
new file mode 100644
index 0000000..c55d525
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmOperationImportImpl.java
@@ -0,0 +1,52 @@
+/*
+ * 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.commons.core.edm.provider;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.Target;
+import org.apache.olingo.commons.api.edm.provider.OperationImport;
+import org.apache.olingo.commons.core.edm.AbstractEdmOperationImport;
+import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
+
+import java.util.List;
+
+public abstract class EdmOperationImportImpl extends AbstractEdmOperationImport {
+
+  private final EdmAnnotationHelper helper;
+  
+  public EdmOperationImportImpl(final Edm edm, final EdmEntityContainer container,
+      final OperationImport operationImport) {
+    super(edm, container, operationImport.getName(), new Target.Builder(operationImport.getEntitySet(), container
+        ).build());
+    this.helper = new EdmAnnotationHelperImpl(edm, operationImport);
+  }
+
+  @Override
+  public EdmAnnotation getAnnotation(final EdmTerm term) {
+    return helper.getAnnotation(term);
+  }
+
+  @Override
+  public List<EdmAnnotation> getAnnotations() {
+    return helper.getAnnotations();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmParameterImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmParameterImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmParameterImpl.java
new file mode 100644
index 0000000..e1d3229
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmParameterImpl.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.provider;
+
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmMapping;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+import org.apache.olingo.commons.api.edm.provider.Parameter;
+import org.apache.olingo.commons.core.edm.AbstractEdmParameter;
+import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
+
+public class EdmParameterImpl extends AbstractEdmParameter {
+
+  private final Parameter parameter;
+  private final EdmAnnotationHelper helper;
+
+  public EdmParameterImpl(final Edm edm, final Parameter parameter) {
+    super(edm, parameter.getName(), parameter.getTypeFQN());
+    this.parameter = parameter;
+    this.helper = new EdmAnnotationHelperImpl(edm, parameter);
+  }
+
+  @Override
+  public boolean isCollection() {
+    return parameter.isCollection();
+  }
+
+  @Override
+  public EdmMapping getMapping() {
+    return parameter.getMapping();
+  }
+
+  @Override
+  public boolean isNullable() {
+    return parameter.isNullable();
+  }
+
+  @Override
+  public Integer getMaxLength() {
+    return parameter.getMaxLength();
+  }
+
+  @Override
+  public Integer getPrecision() {
+    return parameter.getPrecision();
+  }
+
+  @Override
+  public Integer getScale() {
+    return parameter.getScale();
+  }
+
+  @Override
+  public SRID getSrid() {
+    return parameter.getSrid();
+  }
+
+  @Override
+  public EdmAnnotation getAnnotation(final EdmTerm term) {
+    return helper.getAnnotation(term);
+  }
+
+  @Override
+  public List<EdmAnnotation> getAnnotations() {
+    return helper.getAnnotations();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmPropertyImpl.java
new file mode 100644
index 0000000..9f14925
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmPropertyImpl.java
@@ -0,0 +1,119 @@
+/*
+ * 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.commons.core.edm.provider;
+
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmMapping;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+import org.apache.olingo.commons.api.edm.provider.Property;
+import org.apache.olingo.commons.core.edm.AbstractEdmProperty;
+import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+
+public class EdmPropertyImpl extends AbstractEdmProperty {
+
+  private final FullQualifiedName structuredTypeName;
+  private final Property property;
+  private final EdmTypeInfo typeInfo;
+  private EdmAnnotationHelper helper;
+
+  public EdmPropertyImpl(final Edm edm, final FullQualifiedName structuredTypeName, final Property property) {
+    super(edm, property.getName());
+
+    this.structuredTypeName = structuredTypeName;
+    this.property = property;
+    typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(property.getType().toString()).build();
+    this.helper = new EdmAnnotationHelperImpl(edm, property);
+  }
+
+  @Override
+  public EdmTypeInfo getTypeInfo() {
+    return typeInfo;
+  }
+
+  @Override
+  public boolean isCollection() {
+    return property.isCollection();
+  }
+
+  @Override
+  public EdmMapping getMapping() {
+    return property.getMapping();
+  }
+
+  @Override
+  public String getMimeType() {
+    return property.getMimeType();
+  }
+
+  @Override
+  public boolean isNullable() {
+    return property.isNullable();
+  }
+
+  @Override
+  public Integer getMaxLength() {
+    return property.getMaxLength();
+  }
+
+  @Override
+  public Integer getPrecision() {
+    return property.getPrecision();
+  }
+
+  @Override
+  public Integer getScale() {
+    return property.getScale();
+  }
+
+  @Override
+  public SRID getSrid() {
+    return property.getSrid();
+  }
+
+  @Override
+  public boolean isUnicode() {
+    return property.isUnicode();
+  }
+
+  @Override
+  public String getDefaultValue() {
+    return property.getDefaultValue();
+  }
+
+  @Override
+  public FullQualifiedName getAnnotationsTargetFQN() {
+    return structuredTypeName;
+  }
+
+  @Override
+  public EdmAnnotation getAnnotation(final EdmTerm term) {
+    return helper.getAnnotation(term);
+  }
+
+  @Override
+  public List<EdmAnnotation> getAnnotations() {
+    return helper.getAnnotations();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmProviderImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmProviderImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmProviderImpl.java
new file mode 100644
index 0000000..1468e81
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmProviderImpl.java
@@ -0,0 +1,376 @@
+/*
+ * 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.commons.core.edm.provider;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.edm.EdmAction;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmAnnotations;
+import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmFunction;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.Action;
+import org.apache.olingo.commons.api.edm.provider.AliasInfo;
+import org.apache.olingo.commons.api.edm.provider.Annotatable;
+import org.apache.olingo.commons.api.edm.provider.Annotation;
+import org.apache.olingo.commons.api.edm.provider.Annotations;
+import org.apache.olingo.commons.api.edm.provider.ComplexType;
+import org.apache.olingo.commons.api.edm.provider.EdmProvider;
+import org.apache.olingo.commons.api.edm.provider.EntityContainerInfo;
+import org.apache.olingo.commons.api.edm.provider.EntityType;
+import org.apache.olingo.commons.api.edm.provider.EnumType;
+import org.apache.olingo.commons.api.edm.provider.Function;
+import org.apache.olingo.commons.api.edm.provider.Parameter;
+import org.apache.olingo.commons.api.edm.provider.Schema;
+import org.apache.olingo.commons.api.edm.provider.Term;
+import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
+import org.apache.olingo.commons.core.edm.AbstractEdm;
+
+public class EdmProviderImpl extends AbstractEdm {
+
+  private final EdmProvider provider;
+  private final Map<FullQualifiedName, List<Action>> actionsMap = new HashMap<FullQualifiedName, List<Action>>();
+  private final Map<FullQualifiedName, List<Function>> functionsMap = new HashMap<FullQualifiedName, List<Function>>();
+
+  public EdmProviderImpl(final EdmProvider provider) {
+    this.provider = provider;
+  }
+
+  @Override
+  public EdmEntityContainer createEntityContainer(final FullQualifiedName containerName) {
+    try {
+      EntityContainerInfo entityContainerInfo = provider.getEntityContainerInfo(containerName);
+      if (entityContainerInfo != null) {
+        return new EdmEntityContainerImpl(this, provider, entityContainerInfo);
+      }
+      return null;
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+  }
+
+  @Override
+  public EdmEnumType createEnumType(final FullQualifiedName enumName) {
+    try {
+      EnumType enumType = provider.getEnumType(enumName);
+      if (enumType != null) {
+        return new EdmEnumTypeImpl(this, enumName, enumType);
+      }
+      return null;
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+  }
+
+  @Override
+  public EdmTypeDefinition createTypeDefinition(final FullQualifiedName typeDefinitionName) {
+    try {
+      TypeDefinition typeDefinition = provider.getTypeDefinition(typeDefinitionName);
+      if (typeDefinition != null) {
+        return new EdmTypeDefinitionImpl(this, typeDefinitionName, typeDefinition);
+      }
+      return null;
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+  }
+
+  @Override
+  public EdmEntityType createEntityType(final FullQualifiedName entityTypeName) {
+    try {
+      EntityType entityType = provider.getEntityType(entityTypeName);
+      if (entityType != null) {
+        return EdmEntityTypeImpl.getInstance(this, entityTypeName, entityType);
+      }
+      return null;
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+  }
+
+  @Override
+  public EdmComplexType createComplexType(final FullQualifiedName complexTypeName) {
+    try {
+      final ComplexType complexType = provider.getComplexType(complexTypeName);
+      if (complexType != null) {
+        return EdmComplexTypeImpl.getInstance(this, complexTypeName, complexType);
+      }
+      return null;
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+  }
+
+  @Override
+  public EdmAction createBoundAction(final FullQualifiedName actionName,
+      final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection) {
+
+    try {
+      List<Action> actions = actionsMap.get(actionName);
+      if (actions == null) {
+        actions = provider.getActions(actionName);
+        if (actions == null) {
+          return null;
+        } else {
+          actionsMap.put(actionName, actions);
+        }
+      }
+      // Search for bound action where binding parameter matches
+      for (Action action : actions) {
+        if (action.isBound()) {
+          final List<Parameter> parameters = action.getParameters();
+          final Parameter parameter = parameters.get(0);
+          if (bindingParameterTypeName.equals(parameter.getTypeFQN())
+              && isBindingParameterCollection.booleanValue() == parameter.isCollection()) {
+
+            return EdmActionImpl.getInstance(this, actionName, action);
+          }
+
+        }
+      }
+      return null;
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+  }
+
+  @Override
+  public EdmFunction createBoundFunction(final FullQualifiedName functionName,
+      final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection,
+      final List<String> parameterNames) {
+
+    try {
+      List<Function> functions = functionsMap.get(functionName);
+      if (functions == null) {
+        functions = provider.getFunctions(functionName);
+        if (functions == null) {
+          return null;
+        } else {
+          functionsMap.put(functionName, functions);
+        }
+      }
+      final List<String> parameterNamesCopy =
+          parameterNames == null ? Collections.<String> emptyList() : parameterNames;
+      for (Function function : functions) {
+        if (function.isBound()) {
+          List<Parameter> providerParameters = function.getParameters();
+          if (providerParameters == null || providerParameters.size() == 0) {
+            throw new EdmException("No parameter specified for bound function: " + functionName);
+          }
+          final Parameter bindingParameter = providerParameters.get(0);
+          if (bindingParameterTypeName.equals(bindingParameter.getTypeFQN())
+              && isBindingParameterCollection.booleanValue() == bindingParameter.isCollection()) {
+
+            if (parameterNamesCopy.size() == providerParameters.size() - 1) {
+              final List<String> providerParameterNames = new ArrayList<String>();
+              for (int i = 1; i < providerParameters.size(); i++) {
+                providerParameterNames.add(providerParameters.get(i).getName());
+              }
+              if (parameterNamesCopy.containsAll(providerParameterNames)) {
+                return EdmFunctionImpl.getInstance(this, functionName, function);
+              }
+            }
+          }
+        }
+      }
+      return null;
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+  }
+
+  @Override
+  protected Map<String, String> createAliasToNamespaceInfo() {
+    final Map<String, String> aliasToNamespaceInfos = new HashMap<String, String>();
+    try {
+      final List<AliasInfo> aliasInfos = provider.getAliasInfos();
+      if (aliasInfos != null) {
+        for (AliasInfo info : aliasInfos) {
+          aliasToNamespaceInfos.put(info.getAlias(), info.getNamespace());
+        }
+      }
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+    return aliasToNamespaceInfos;
+  }
+
+  @Override
+  protected EdmAction createUnboundAction(final FullQualifiedName actionName) {
+    try {
+      List<Action> actions = actionsMap.get(actionName);
+      if (actions == null) {
+        actions = provider.getActions(actionName);
+        if (actions == null) {
+          return null;
+        } else {
+          actionsMap.put(actionName, actions);
+        }
+      }
+      // Search for first unbound action
+      for (Action action : actions) {
+        if (!action.isBound()) {
+          return EdmActionImpl.getInstance(this, actionName, action);
+        }
+      }
+      return null;
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+  }
+
+  @Override
+  protected List<EdmFunction> createUnboundFunctions(final FullQualifiedName functionName) {
+    List<EdmFunction> result = new ArrayList<EdmFunction>();
+
+    try {
+      List<Function> functions = functionsMap.get(functionName);
+      if (functions == null) {
+        functions = provider.getFunctions(functionName);
+        if (functions != null) {
+          functionsMap.put(functionName, functions);
+        }
+      }
+      if (functions != null) {
+        for (Function function : functions) {
+          if (!function.isBound()) {
+            result.add(EdmFunctionImpl.getInstance(this, functionName, function));
+          }
+        }
+      }
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+
+    return result;
+  }
+
+  @Override
+  protected EdmFunction createUnboundFunction(final FullQualifiedName functionName, final List<String> parameterNames) {
+    try {
+      List<Function> functions = functionsMap.get(functionName);
+      if (functions == null) {
+        functions = provider.getFunctions(functionName);
+        if (functions == null) {
+          return null;
+        } else {
+          functionsMap.put(functionName, functions);
+        }
+      }
+
+      final List<String> parameterNamesCopy =
+          parameterNames == null ? Collections.<String> emptyList() : parameterNames;
+      for (Function function : functions) {
+        if (!function.isBound()) {
+          List<Parameter> providerParameters = function.getParameters();
+          if (providerParameters == null) {
+            providerParameters = Collections.emptyList();
+          }
+          if (parameterNamesCopy.size() == providerParameters.size()) {
+            final List<String> functionParameterNames = new ArrayList<String>();
+            for (Parameter parameter : providerParameters) {
+              functionParameterNames.add(parameter.getName());
+            }
+
+            if (parameterNamesCopy.containsAll(functionParameterNames)) {
+              return EdmFunctionImpl.getInstance(this, functionName, function);
+            }
+          }
+        }
+      }
+      return null;
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+  }
+
+  @Override
+  protected Map<String, EdmSchema> createSchemas() {
+    try {
+      final Map<String, EdmSchema> _schemas = new LinkedHashMap<String, EdmSchema>();
+      for (Schema schema : provider.getSchemas()) {
+        _schemas.put(schema.getNamespace(), new EdmSchemaImpl(this, provider, schema));
+      }
+      return _schemas;
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+  }
+
+  @Override
+  protected EdmTerm createTerm(final FullQualifiedName termName) {
+    try {
+      Term providerTerm = provider.getTerm(termName);
+      if (providerTerm != null) {
+        return new EdmTermImpl(this, termName.getNamespace(), providerTerm);
+      }
+      return null;
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+  }
+
+  //TODO: Check implementation
+  @Override
+  protected EdmAnnotations createAnnotationGroup(final FullQualifiedName targetName) {
+    try {
+      EdmSchema schema = getSchema(targetName.getNamespace());
+      Annotations providerGroup = provider.getAnnotationsGroup(targetName);
+      if (providerGroup != null) {
+        return new EdmAnnotationsImpl(this, schema, providerGroup);
+      }
+      return null;
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+  }
+
+  @Override
+  protected List<EdmAnnotation> createAnnotations(final FullQualifiedName annotatedName) {
+    try {
+      Annotatable providerAnnotatable = provider.getAnnoatatable(annotatedName);
+      if (providerAnnotatable != null && providerAnnotatable.getAnnotations() != null) {
+        List<EdmAnnotation> result = new ArrayList<EdmAnnotation>();
+        for(Annotation annotation : providerAnnotatable.getAnnotations()){
+          //Load Term
+          getTerm(new FullQualifiedName(annotation.getTerm()));
+          result.add(new EdmAnnotationImpl(this, annotation));
+        }
+        return result;
+      }
+      return null;
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReferentialConstraintImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReferentialConstraintImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReferentialConstraintImpl.java
new file mode 100644
index 0000000..9cf07ab
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReferentialConstraintImpl.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.provider;
+
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.provider.ReferentialConstraint;
+import org.apache.olingo.commons.core.edm.AbstractEdmReferentialConstraint;
+import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
+
+public class EdmReferentialConstraintImpl extends AbstractEdmReferentialConstraint {
+
+  private final EdmAnnotationHelper helper;
+  
+  public EdmReferentialConstraintImpl(final Edm edm, final ReferentialConstraint constraint) {
+    super(constraint.getProperty(), constraint.getReferencedProperty());
+    this.helper = new EdmAnnotationHelperImpl(edm, constraint);
+  }
+
+  @Override
+  public EdmAnnotation getAnnotation(final EdmTerm term) {
+    return helper.getAnnotation(term);
+  }
+
+  @Override
+  public List<EdmAnnotation> getAnnotations() {
+    return helper.getAnnotations();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReturnTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReturnTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReturnTypeImpl.java
new file mode 100644
index 0000000..80eef43
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReturnTypeImpl.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.provider;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+import org.apache.olingo.commons.api.edm.provider.ReturnType;
+import org.apache.olingo.commons.core.edm.AbstractEdmReturnType;
+
+public class EdmReturnTypeImpl extends AbstractEdmReturnType {
+
+  private final ReturnType returnType;
+
+  public EdmReturnTypeImpl(final Edm edm, final ReturnType returnType) {
+    super(edm, returnType.getTypeFQN());
+    this.returnType = returnType;
+  }
+
+  @Override
+  public boolean isCollection() {
+    return returnType.isCollection();
+  }
+
+  @Override
+  public boolean isNullable() {
+    return returnType.isNullable();
+  }
+
+  @Override
+  public Integer getMaxLength() {
+    return returnType.getMaxLength();
+  }
+
+  @Override
+  public Integer getPrecision() {
+    return returnType.getPrecision();
+  }
+
+  @Override
+  public Integer getScale() {
+    return returnType.getScale();
+  }
+
+  @Override
+  public SRID getSrid() {
+    return returnType.getSrid();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSchemaImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSchemaImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSchemaImpl.java
new file mode 100644
index 0000000..2ef1c27
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSchemaImpl.java
@@ -0,0 +1,194 @@
+/*
+ * 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.commons.core.edm.provider;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAction;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmAnnotations;
+import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmFunction;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.Action;
+import org.apache.olingo.commons.api.edm.provider.Annotation;
+import org.apache.olingo.commons.api.edm.provider.Annotations;
+import org.apache.olingo.commons.api.edm.provider.ComplexType;
+import org.apache.olingo.commons.api.edm.provider.EdmProvider;
+import org.apache.olingo.commons.api.edm.provider.EntityType;
+import org.apache.olingo.commons.api.edm.provider.EnumType;
+import org.apache.olingo.commons.api.edm.provider.Function;
+import org.apache.olingo.commons.api.edm.provider.Schema;
+import org.apache.olingo.commons.api.edm.provider.Term;
+import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
+import org.apache.olingo.commons.core.edm.AbstractEdmSchema;
+
+public class EdmSchemaImpl extends AbstractEdmSchema {
+
+  private final Schema schema;
+  private final Edm edm;
+  private final EdmProvider provider;
+
+  public EdmSchemaImpl(final Edm edm, final EdmProvider provider, final Schema schema) {
+    super(schema.getNamespace(), schema.getAlias());
+    this.edm = edm;
+    this.provider = provider;
+    this.schema = schema;
+  }
+
+  @Override
+  protected EdmEntityContainer createEntityContainer() {
+    if (schema.getEntityContainer() != null) {
+      FullQualifiedName containerFQN = new FullQualifiedName(namespace, schema.getEntityContainer().getName());
+      return new EdmEntityContainerImpl(edm, provider, containerFQN, schema.getEntityContainer());
+    }
+    return null;
+  }
+
+  @Override
+  protected List<EdmTypeDefinition> createTypeDefinitions() {
+    final List<EdmTypeDefinition> typeDefinitions = new ArrayList<EdmTypeDefinition>();
+    final List<TypeDefinition> providerTypeDefinitions = schema.getTypeDefinitions();
+    if (providerTypeDefinitions != null) {
+      for (TypeDefinition def : providerTypeDefinitions) {
+        typeDefinitions.add(new EdmTypeDefinitionImpl(edm, new FullQualifiedName(namespace, def.getName()), def));
+      }
+    }
+    return typeDefinitions;
+  }
+
+  @Override
+  protected List<EdmEnumType> createEnumTypes() {
+    final List<EdmEnumType> enumTypes = new ArrayList<EdmEnumType>();
+    final List<EnumType> providerEnumTypes = schema.getEnumTypes();
+    if (providerEnumTypes != null) {
+      for (EnumType enumType : providerEnumTypes) {
+        enumTypes.add(new EdmEnumTypeImpl(edm, new FullQualifiedName(namespace, enumType.getName()), enumType));
+      }
+    }
+    return enumTypes;
+  }
+
+  @Override
+  protected List<EdmEntityType> createEntityTypes() {
+    final List<EdmEntityType> entityTypes = new ArrayList<EdmEntityType>();
+    final List<EntityType> providerEntityTypes = schema.getEntityTypes();
+    if (providerEntityTypes != null) {
+      for (EntityType entityType : providerEntityTypes) {
+        entityTypes.add(EdmEntityTypeImpl.getInstance(edm, new FullQualifiedName(namespace, entityType.getName()),
+            entityType));
+      }
+    }
+    return entityTypes;
+  }
+
+  @Override
+  protected List<EdmComplexType> createComplexTypes() {
+    final List<EdmComplexType> complexTypes = new ArrayList<EdmComplexType>();
+    final List<ComplexType> providerComplexTypes = schema.getComplexTypes();
+    if (providerComplexTypes != null) {
+      for (ComplexType complexType : providerComplexTypes) {
+        complexTypes.add(EdmComplexTypeImpl.getInstance(edm, new FullQualifiedName(namespace, complexType.getName()),
+            complexType));
+      }
+    }
+    return complexTypes;
+  }
+
+  @Override
+  protected List<EdmAction> createActions() {
+    final List<EdmAction> actions = new ArrayList<EdmAction>();
+    final List<Action> providerActions = schema.getActions();
+    if (providerActions != null) {
+      for (Action action : providerActions) {
+        actions.add(EdmActionImpl.getInstance(edm, new FullQualifiedName(namespace, action.getName()), action));
+      }
+    }
+    return actions;
+  }
+
+  @Override
+  protected List<EdmFunction> createFunctions() {
+    final List<EdmFunction> functions = new ArrayList<EdmFunction>();
+    final List<Function> providerFunctions = schema.getFunctions();
+    if (providerFunctions != null) {
+      for (Function function : providerFunctions) {
+        functions.add(EdmFunctionImpl.getInstance(edm, new FullQualifiedName(namespace, function.getName()), function));
+      }
+    }
+    return functions;
+  }
+
+  @Override
+  protected List<EdmTerm> createTerms() {
+    final List<EdmTerm> terms = new ArrayList<EdmTerm>();
+    final List<Term> providerTerms = schema.getTerms();
+    if (providerTerms != null) {
+      for (Term term : providerTerms) {
+        terms.add(new EdmTermImpl(edm, getNamespace(), term));
+      }
+    }
+    return terms;
+  }
+
+  @Override
+  protected List<EdmAnnotations> createAnnotationGroups() {
+    final List<EdmAnnotations> annotationGroups = new ArrayList<EdmAnnotations>();
+    final List<Annotations> providerAnnotations =
+        schema.getAnnotationGroups();
+    if (providerAnnotations != null) {
+      for (Annotations annotationGroup : providerAnnotations) {
+        annotationGroups.add(new EdmAnnotationsImpl(edm, this, annotationGroup));
+      }
+    }
+    return annotationGroups;
+  }
+
+  @Override
+  protected List<EdmAnnotation> createAnnotations() {
+    final List<EdmAnnotation> annotations = new ArrayList<EdmAnnotation>();
+    final List<Annotation> providerAnnotations =
+        schema.getAnnotations();
+    if (providerAnnotations != null) {
+      for (Annotation annotation : providerAnnotations) {
+        annotations.add(new EdmAnnotationImpl(edm, annotation));
+      }
+    }
+    return annotations;
+  }
+
+  @Override
+  public EdmAnnotation getAnnotation(final EdmTerm term) {
+    EdmAnnotation result = null;
+    for (EdmAnnotation annotation : getAnnotations()) {
+      if (term.getFullQualifiedName().equals(annotation.getTerm().getFullQualifiedName())) {
+        result = annotation;
+      }
+    }
+
+    return result;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSingletonImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSingletonImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSingletonImpl.java
new file mode 100644
index 0000000..ca953dc
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSingletonImpl.java
@@ -0,0 +1,36 @@
+/*
+ * 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.commons.core.edm.provider;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmSingleton;
+import org.apache.olingo.commons.api.edm.provider.Singleton;
+
+public class EdmSingletonImpl extends EdmBindingTargetImpl implements EdmSingleton {
+
+  public EdmSingletonImpl(final Edm edm, final EdmEntityContainer container, final Singleton singleton) {
+    super(edm, container, singleton);
+  }
+
+  @Override
+  public TargetType getAnnotationsTargetType() {
+    return TargetType.Singleton;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuredTypeHelperImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuredTypeHelperImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuredTypeHelperImpl.java
new file mode 100644
index 0000000..1ec265d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuredTypeHelperImpl.java
@@ -0,0 +1,84 @@
+/*
+ * 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.commons.core.edm.provider;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
+import org.apache.olingo.commons.api.edm.provider.Property;
+import org.apache.olingo.commons.api.edm.provider.StructuralType;
+import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
+
+  private final Edm edm;
+  private final FullQualifiedName structuredTypeName;
+  private final StructuralType structuredType;
+  private Map<String, EdmProperty> properties;
+  private Map<String, EdmNavigationProperty> navigationProperties;
+
+  public EdmStructuredTypeHelperImpl(
+      final Edm edm, final FullQualifiedName structuredTypeName, final StructuralType structuredType) {
+    this.edm = edm;
+    this.structuredTypeName = structuredTypeName;
+    this.structuredType = structuredType;
+  }
+
+  @Override
+  public Map<String, EdmProperty> getProperties() {
+    if (properties == null) {
+      properties = new LinkedHashMap<String, EdmProperty>();
+      if (structuredType.getProperties() != null) {
+        for (Property property : structuredType.getProperties()) {
+          properties.put(property.getName(), new EdmPropertyImpl(edm, structuredTypeName, property));
+        }
+      }
+    }
+    return properties;
+  }
+
+  @Override
+  public Map<String, EdmNavigationProperty> getNavigationProperties() {
+    if (navigationProperties == null) {
+      navigationProperties = new LinkedHashMap<String, EdmNavigationProperty>();
+      if (structuredType.getNavigationProperties() != null) {
+        for (NavigationProperty navigationProperty : structuredType.getNavigationProperties()) {
+          navigationProperties.put(navigationProperty.getName(),
+              new EdmNavigationPropertyImpl(edm, structuredTypeName, navigationProperty));
+        }
+      }
+    }
+    return navigationProperties;
+  }
+
+  @Override
+  public boolean isOpenType() {
+    return structuredType.isOpenType();
+  }
+
+  @Override
+  public boolean isAbstract() {
+    return structuredType.isAbstract();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTermImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTermImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTermImpl.java
new file mode 100644
index 0000000..e2b34a5
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTermImpl.java
@@ -0,0 +1,170 @@
+/*
+ * 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.commons.core.edm.provider;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.ClassUtils;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+import org.apache.olingo.commons.api.edm.provider.Term;
+import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
+import org.apache.olingo.commons.core.edm.EdmNamedImpl;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class EdmTermImpl extends EdmNamedImpl implements EdmTerm {
+
+  private static final Logger LOG = LoggerFactory.getLogger(EdmTermImpl.class);
+
+  private final Term term;
+
+  private final FullQualifiedName fqn;
+
+  private final EdmTypeInfo typeInfo;
+
+  private final EdmAnnotationHelper helper;
+
+  private EdmType termType;
+
+  private EdmTerm baseTerm;
+
+  private List<Class<?>> appliesTo;
+
+  public EdmTermImpl(final Edm edm, final String namespace, final Term term) {
+    super(edm, term.getName());
+
+    this.term = term;
+    this.fqn = new FullQualifiedName(namespace, term.getName());
+    this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(term.getType()).build();
+    this.helper = new EdmAnnotationHelperImpl(edm, term);
+  }
+
+  @Override
+  public FullQualifiedName getFullQualifiedName() {
+    return fqn;
+  }
+
+  @Override
+  public EdmType getType() {
+    if (termType == null) {
+      termType = typeInfo.isPrimitiveType()
+              ? EdmPrimitiveTypeFactory.getInstance(typeInfo.getPrimitiveTypeKind())
+              : typeInfo.isTypeDefinition()
+              ? typeInfo.getTypeDefinition()
+              : typeInfo.isEnumType()
+              ? typeInfo.getEnumType()
+              : typeInfo.isComplexType()
+              ? typeInfo.getComplexType()
+              : null;
+      if (termType == null) {
+        throw new EdmException("Cannot find type with name: " + typeInfo.getFullQualifiedName());
+      }
+    }
+
+    return termType;
+  }
+
+  @Override
+  public EdmTerm getBaseTerm() {
+    if (baseTerm == null && term.getBaseTerm() != null) {
+      baseTerm = edm.getTerm(new FullQualifiedName(term.getBaseTerm()));
+    }
+    return baseTerm;
+  }
+
+  @Override
+  public List<Class<?>> getAppliesTo() {
+    if (appliesTo == null) {
+      appliesTo = new ArrayList<Class<?>>();
+      for (String element : term.getAppliesTo()) {
+        try {
+          appliesTo.add(ClassUtils.getClass(EdmTerm.class.getPackage().getName() + ".Edm" + element));
+        } catch (ClassNotFoundException e) {
+          LOG.error("Could not load Edm class for {}", element, e);
+        }
+      }
+    }
+    return appliesTo;
+  }
+
+  @Override
+  public Boolean isNullable() {
+    return term.isNullable();
+  }
+
+  @Override
+  public Integer getMaxLength() {
+    return term.getMaxLength();
+  }
+
+  @Override
+  public Integer getPrecision() {
+    return term.getPrecision();
+  }
+
+  @Override
+  public Integer getScale() {
+    return term.getScale();
+  }
+
+  @Override
+  public SRID getSrid() {
+    return term.getSrid();
+  }
+
+  @Override
+  public String getDefaultValue() {
+    return term.getDefaultValue();
+  }
+
+  @Override
+  public TargetType getAnnotationsTargetType() {
+    return TargetType.Term;
+  }
+
+  @Override
+  public FullQualifiedName getAnnotationsTargetFQN() {
+    return getFullQualifiedName();
+  }
+
+  @Override
+  public String getAnnotationsTargetPath() {
+    return null;
+  }
+
+  @Override
+  public EdmAnnotation getAnnotation(final EdmTerm term) {
+    return helper.getAnnotation(term);
+  }
+
+  @Override
+  public List<EdmAnnotation> getAnnotations() {
+    return helper.getAnnotations();
+  }
+
+}