You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/04/03 11:12:31 UTC

git commit: [OLINGO-209] open type is both for complex and entity types

Repository: olingo-odata4
Updated Branches:
  refs/heads/master a6817f32f -> 251742312


[OLINGO-209] open type is both for complex and entity types


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/25174231
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/25174231
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/25174231

Branch: refs/heads/master
Commit: 251742312ac73f23b675e07cb7bf34a8cbbb87eb
Parents: a6817f3
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Apr 3 11:12:22 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Apr 3 11:12:22 2014 +0200

----------------------------------------------------------------------
 .../olingo/client/core/edm/EdmClientImpl.java   |   4 +-
 .../client/core/edm/EdmComplexTypeImpl.java     |   5 +
 .../client/core/edm/EdmEntityTypeImpl.java      |   5 +-
 .../olingo/client/core/edm/EdmSchemaImpl.java   |   4 +-
 .../core/edm/EdmStructuredTypeHelperImpl.java   |  11 +
 .../olingo/commons/api/edm/EdmEntityType.java   |   7 -
 .../commons/api/edm/EdmStructuredType.java      |   7 +
 .../olingo/commons/core/edm/AbstractEdm.java    | 333 +++++++++++++++++++
 .../commons/core/edm/AbstractEdmImpl.java       | 333 -------------------
 .../commons/core/edm/AbstractEdmSchema.java     | 154 +++++++++
 .../commons/core/edm/AbstractEdmSchemaImpl.java | 154 ---------
 .../core/edm/AbstractEdmStructuredType.java     |  16 +-
 .../core/edm/EdmStructuredTypeHelper.java       |   3 +
 .../commons/core/edm/EdmImplCachingTest.java    |   4 +-
 .../commons/core/edm/EdmImplCallCreateTest.java |   4 +-
 .../core/edm/provider/EdmComplexTypeImpl.java   |   7 +-
 .../core/edm/provider/EdmEntityTypeImpl.java    |   2 +-
 .../core/edm/provider/EdmProviderImpl.java      |   4 +-
 .../server/core/edm/provider/EdmSchemaImpl.java |   4 +-
 .../provider/EdmStructuredTypeHelperImpl.java   |   8 +-
 20 files changed, 550 insertions(+), 519 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
index c2c832d..0fe9ce6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
@@ -57,9 +57,9 @@ import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.edm.AbstractEdmImpl;
+import org.apache.olingo.commons.core.edm.AbstractEdm;
 
-public class EdmClientImpl extends AbstractEdmImpl {
+public class EdmClientImpl extends AbstractEdm {
 
   private final ODataServiceVersion version;
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java
index 9ecc511..caaf7c0 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java
@@ -64,4 +64,9 @@ public class EdmComplexTypeImpl extends AbstractEdmComplexType {
     return helper.getNavigationProperties();
   }
 
+  @Override
+  public boolean isOpenType() {
+    return helper.isOpenType();
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
index 0f9d0e6..994e42c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
@@ -61,14 +61,11 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
     return instance;
   }
 
-  private final EntityType entityType;
-
   private EdmEntityTypeImpl(final Edm edm, final FullQualifiedName fqn, final FullQualifiedName baseTypeName,
           final EntityType entityType) {
 
     super(edm, fqn, baseTypeName, entityType.isHasStream());
     this.helper = new EdmStructuredTypeHelperImpl(edm, entityType);
-    this.entityType = entityType;
   }
 
   @Override
@@ -83,7 +80,7 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
 
   @Override
   public boolean isOpenType() {
-    return entityType.isOpenType();
+    return helper.isOpenType();
   }
 
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
index 7d8e1ae..0d5a936 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
@@ -43,9 +43,9 @@ import org.apache.olingo.commons.api.edm.EdmFunction;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.edm.AbstractEdmSchemaImpl;
+import org.apache.olingo.commons.core.edm.AbstractEdmSchema;
 
-public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
+public class EdmSchemaImpl extends AbstractEdmSchema {
 
   private final ODataServiceVersion version;
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmStructuredTypeHelperImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmStructuredTypeHelperImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmStructuredTypeHelperImpl.java
index 140fe89..f3b8946 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmStructuredTypeHelperImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmStructuredTypeHelperImpl.java
@@ -24,6 +24,7 @@ import java.util.Map;
 import org.apache.olingo.client.api.edm.xml.CommonNavigationProperty;
 import org.apache.olingo.client.api.edm.xml.CommonProperty;
 import org.apache.olingo.client.api.edm.xml.ComplexType;
+import org.apache.olingo.client.api.edm.xml.EntityType;
 import org.apache.olingo.client.api.edm.xml.v4.NavigationProperty;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
@@ -69,4 +70,14 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
     }
     return navigationProperties;
   }
+
+  @Override
+  public boolean isOpenType() {
+    return complexType instanceof org.apache.olingo.client.api.edm.xml.v4.ComplexType
+            ? ((org.apache.olingo.client.api.edm.xml.v4.ComplexType) complexType).isOpenType()
+            : complexType instanceof EntityType
+            ? ((EntityType) complexType).isOpenType()
+            : false;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityType.java
index fe698c4..9eb0dd5 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityType.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityType.java
@@ -54,13 +54,6 @@ public interface EdmEntityType extends EdmStructuredType {
    */
   boolean hasStream();
 
-  /**
-   * Indicates if the entity type is an open type.
-   *
-   * @return <code>true</code> if the entity type is open
-   */
-  boolean isOpenType();
-
   /*
    * (non-Javadoc)
    *

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java
index 3c823dc..6990091 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java
@@ -79,4 +79,11 @@ public interface EdmStructuredType extends EdmType {
    * @return true if this type is compatible to the testType ( i.e. this type is a subtype of targetType )
    */
   boolean compatibleTo(EdmType targetType);
+
+  /**
+   * Indicates if the entity type is an open type.
+   *
+   * @return <code>true</code> if the entity type is open
+   */
+  boolean isOpenType();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java
new file mode 100644
index 0000000..5047192
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java
@@ -0,0 +1,333 @@
+/*
+ * 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;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAction;
+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.EdmSchema;
+import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
+import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+
+public abstract class AbstractEdm implements Edm {
+
+  private final Map<FullQualifiedName, EdmEntityContainer> entityContainers =
+      new HashMap<FullQualifiedName, EdmEntityContainer>();
+
+  private final Map<FullQualifiedName, EdmEnumType> enumTypes = new HashMap<FullQualifiedName, EdmEnumType>();
+
+  private final Map<FullQualifiedName, EdmTypeDefinition> typeDefinitions =
+      new HashMap<FullQualifiedName, EdmTypeDefinition>();
+
+  private final Map<FullQualifiedName, EdmEntityType> entityTypes = new HashMap<FullQualifiedName, EdmEntityType>();
+
+  private final Map<FullQualifiedName, EdmComplexType> complexTypes = new HashMap<FullQualifiedName, EdmComplexType>();
+
+  private final Map<FullQualifiedName, EdmAction> unboundActions = new HashMap<FullQualifiedName, EdmAction>();
+
+  private final Map<FunctionMapKey, EdmFunction> unboundFunctions = new HashMap<FunctionMapKey, EdmFunction>();
+
+  private final Map<ActionMapKey, EdmAction> boundActions = new HashMap<ActionMapKey, EdmAction>();
+
+  private final Map<FunctionMapKey, EdmFunction> boundFunctions = new HashMap<FunctionMapKey, EdmFunction>();
+
+  private EdmServiceMetadata serviceMetadata;
+
+  private Map<String, String> aliasToNamespaceInfo;
+
+  private List<EdmSchema> schemas;
+
+  @Override
+  public List<EdmSchema> getSchemas() {
+    if (schemas == null) {
+      schemas = createSchemas();
+      if (schemas != null) {
+        aliasToNamespaceInfo = new HashMap<String, String>();
+        for (EdmSchema schema : schemas) {
+          String namespace = schema.getNamespace();
+          if (schema.getAlias() != null) {
+            aliasToNamespaceInfo.put(schema.getAlias(), namespace);
+          }
+
+          List<EdmEnumType> localEnumTypes = schema.getEnumTypes();
+          if (localEnumTypes != null) {
+            for (EdmEnumType enumType : localEnumTypes) {
+              enumTypes.put(new FullQualifiedName(namespace, enumType.getName()), enumType);
+            }
+          }
+
+          List<EdmTypeDefinition> localTypeDefinitions = schema.getTypeDefinitions();
+          if (localTypeDefinitions != null) {
+            for (EdmTypeDefinition typeDef : localTypeDefinitions) {
+              typeDefinitions.put(new FullQualifiedName(namespace, typeDef.getName()), typeDef);
+            }
+          }
+
+          List<EdmComplexType> localComplexTypes = schema.getComplexTypes();
+          if (localComplexTypes != null) {
+            for (EdmComplexType complexType : localComplexTypes) {
+              complexTypes.put(new FullQualifiedName(namespace, complexType.getName()), complexType);
+            }
+          }
+
+          List<EdmEntityType> localEntityTypes = schema.getEntityTypes();
+          if (localEntityTypes != null) {
+            for (EdmEntityType entityType : localEntityTypes) {
+              entityTypes.put(new FullQualifiedName(namespace, entityType.getName()), entityType);
+            }
+          }
+
+          List<EdmAction> localActions = schema.getActions();
+          if (localActions != null) {
+            for (EdmAction action : localActions) {
+              if (action.isBound()) {
+                ActionMapKey key = new ActionMapKey(new FullQualifiedName(namespace, action.getName()),
+                    action.getBindingParameterTypeFqn(), action.isBindingParameterTypeCollection());
+                boundActions.put(key, action);
+              } else {
+                unboundActions.put(new FullQualifiedName(namespace, action.getName()), action);
+              }
+            }
+          }
+
+          List<EdmFunction> localFunctions = schema.getFunctions();
+          if (localFunctions != null) {
+            for (EdmFunction function : localFunctions) {
+              FunctionMapKey key =
+                  new FunctionMapKey(new FullQualifiedName(namespace, function.getName()), function
+                      .getBindingParameterTypeFqn(), function.isBindingParameterTypeCollection(), function
+                      .getParameterNames());
+
+              if (function.isBound()) {
+                boundFunctions.put(key, function);
+              } else {
+                unboundFunctions.put(key, function);
+              }
+            }
+          }
+          
+          EdmEntityContainer entityContainer = schema.getEntityContainer();
+          if(entityContainer != null){
+            entityContainers.put(new FullQualifiedName(namespace, entityContainer.getName()), entityContainer);
+            if(!entityContainers.containsKey(null)){
+              entityContainers.put(null, entityContainer);
+            }
+          }
+        }
+      }
+    }
+    return schemas;
+  }
+
+  @Override
+  public EdmEntityContainer getEntityContainer(final FullQualifiedName namespaceOrAliasFQN) {
+    final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
+    EdmEntityContainer container = entityContainers.get(fqn);
+    if (container == null) {
+      container = createEntityContainer(fqn);
+      if (container != null) {
+        entityContainers.put(fqn, container);
+        if (fqn == null) {
+          entityContainers.put(new FullQualifiedName(container.getNamespace(), container.getName()), container);
+        }
+      }
+    }
+    return container;
+  }
+
+  @Override
+  public EdmEnumType getEnumType(final FullQualifiedName namespaceOrAliasFQN) {
+    final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
+    EdmEnumType enumType = enumTypes.get(fqn);
+    if (enumType == null) {
+      enumType = createEnumType(fqn);
+      if (enumType != null) {
+        enumTypes.put(fqn, enumType);
+      }
+    }
+    return enumType;
+  }
+
+  @Override
+  public EdmTypeDefinition getTypeDefinition(final FullQualifiedName namespaceOrAliasFQN) {
+    final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
+    EdmTypeDefinition typeDefinition = typeDefinitions.get(fqn);
+    if (typeDefinition == null) {
+      typeDefinition = createTypeDefinition(fqn);
+      if (typeDefinition != null) {
+        typeDefinitions.put(fqn, typeDefinition);
+      }
+    }
+    return typeDefinition;
+  }
+
+  @Override
+  public EdmEntityType getEntityType(final FullQualifiedName namespaceOrAliasFQN) {
+    final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
+    EdmEntityType entityType = entityTypes.get(fqn);
+    if (entityType == null) {
+      entityType = createEntityType(fqn);
+      if (entityType != null) {
+        entityTypes.put(fqn, entityType);
+      }
+    }
+    return entityType;
+  }
+
+  @Override
+  public EdmComplexType getComplexType(final FullQualifiedName namespaceOrAliasFQN) {
+    final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
+    EdmComplexType complexType = complexTypes.get(fqn);
+    if (complexType == null) {
+      complexType = createComplexType(fqn);
+      if (complexType != null) {
+        complexTypes.put(fqn, complexType);
+      }
+    }
+    return complexType;
+  }
+
+  @Override
+  public EdmAction getAction(final FullQualifiedName actionName, final FullQualifiedName bindingParameterTypeName,
+      final Boolean isBindingParameterCollection) {
+
+    EdmAction action = null;
+
+    final FullQualifiedName actionFqn = resolvePossibleAlias(actionName);
+    if (bindingParameterTypeName == null) {
+      action = unboundActions.get(actionName);
+      if (action == null) {
+        action = createUnboundAction(actionFqn);
+        if (action != null) {
+          unboundActions.put(actionName, action);
+        }
+      }
+    } else {
+      final FullQualifiedName bindingParameterTypeFqn = resolvePossibleAlias(bindingParameterTypeName);
+      final ActionMapKey key = new ActionMapKey(actionFqn, bindingParameterTypeFqn, isBindingParameterCollection);
+      action = boundActions.get(key);
+      if (action == null) {
+        action = createBoundAction(actionFqn, bindingParameterTypeFqn, isBindingParameterCollection);
+        if (action != null) {
+          boundActions.put(key, action);
+        }
+      }
+    }
+
+    return action;
+  }
+
+  @Override
+  public EdmFunction getFunction(final FullQualifiedName functionName,
+      final FullQualifiedName bindingParameterTypeName,
+      final Boolean isBindingParameterCollection, final List<String> parameterNames) {
+
+    EdmFunction function = null;
+
+    final FullQualifiedName functionFqn = resolvePossibleAlias(functionName);
+    if (bindingParameterTypeName == null) {
+      final FunctionMapKey key = new FunctionMapKey(
+          functionFqn, bindingParameterTypeName, isBindingParameterCollection, parameterNames);
+      function = unboundFunctions.get(key);
+      if (function == null) {
+        function = createUnboundFunction(functionFqn, parameterNames);
+        if (function != null) {
+          unboundFunctions.put(key, function);
+        }
+      }
+    } else {
+      final FullQualifiedName bindingParameterTypeFqn = resolvePossibleAlias(bindingParameterTypeName);
+      final FunctionMapKey key =
+          new FunctionMapKey(functionFqn, bindingParameterTypeFqn, isBindingParameterCollection, parameterNames);
+      function = boundFunctions.get(key);
+      if (function == null) {
+        function = createBoundFunction(functionFqn, bindingParameterTypeFqn, isBindingParameterCollection,
+            parameterNames);
+        if (function != null) {
+          boundFunctions.put(key, function);
+        }
+      }
+    }
+
+    return function;
+  }
+
+  @Override
+  public EdmServiceMetadata getServiceMetadata() {
+    if (serviceMetadata == null) {
+      serviceMetadata = createServiceMetadata();
+    }
+    return serviceMetadata;
+  }
+
+  private FullQualifiedName resolvePossibleAlias(final FullQualifiedName namespaceOrAliasFQN) {
+    if (aliasToNamespaceInfo == null) {
+      aliasToNamespaceInfo = createAliasToNamespaceInfo();
+    }
+    FullQualifiedName finalFQN = null;
+    if (namespaceOrAliasFQN != null) {
+      final String namespace = aliasToNamespaceInfo.get(namespaceOrAliasFQN.getNamespace());
+      // If not contained in info it must be a namespace
+      if (namespace == null) {
+        finalFQN = namespaceOrAliasFQN;
+      } else {
+        finalFQN = new FullQualifiedName(namespace, namespaceOrAliasFQN.getName());
+      }
+    }
+    return finalFQN;
+  }
+
+  protected abstract Map<String, String> createAliasToNamespaceInfo();
+
+  protected abstract EdmEntityContainer createEntityContainer(FullQualifiedName containerName);
+
+  protected abstract EdmEnumType createEnumType(FullQualifiedName enumName);
+
+  protected abstract EdmTypeDefinition createTypeDefinition(FullQualifiedName typeDefinitionName);
+
+  protected abstract EdmEntityType createEntityType(FullQualifiedName entityTypeName);
+
+  protected abstract EdmComplexType createComplexType(FullQualifiedName complexTypeName);
+
+  protected abstract EdmAction createUnboundAction(FullQualifiedName actionName);
+
+  protected abstract EdmFunction createUnboundFunction(FullQualifiedName functionName, List<String> parameterNames);
+
+  protected abstract EdmAction createBoundAction(FullQualifiedName actionName,
+      FullQualifiedName bindingParameterTypeName,
+      Boolean isBindingParameterCollection);
+
+  protected abstract EdmFunction createBoundFunction(FullQualifiedName functionName,
+      FullQualifiedName bindingParameterTypeName, Boolean isBindingParameterCollection,
+      List<String> parameterNames);
+
+  protected abstract EdmServiceMetadata createServiceMetadata();
+
+  protected abstract List<EdmSchema> createSchemas();
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmImpl.java
deleted file mode 100644
index b4c99d8..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmImpl.java
+++ /dev/null
@@ -1,333 +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.commons.core.edm;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAction;
-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.EdmSchema;
-import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-public abstract class AbstractEdmImpl implements Edm {
-
-  private final Map<FullQualifiedName, EdmEntityContainer> entityContainers =
-      new HashMap<FullQualifiedName, EdmEntityContainer>();
-
-  private final Map<FullQualifiedName, EdmEnumType> enumTypes = new HashMap<FullQualifiedName, EdmEnumType>();
-
-  private final Map<FullQualifiedName, EdmTypeDefinition> typeDefinitions =
-      new HashMap<FullQualifiedName, EdmTypeDefinition>();
-
-  private final Map<FullQualifiedName, EdmEntityType> entityTypes = new HashMap<FullQualifiedName, EdmEntityType>();
-
-  private final Map<FullQualifiedName, EdmComplexType> complexTypes = new HashMap<FullQualifiedName, EdmComplexType>();
-
-  private final Map<FullQualifiedName, EdmAction> unboundActions = new HashMap<FullQualifiedName, EdmAction>();
-
-  private final Map<FunctionMapKey, EdmFunction> unboundFunctions = new HashMap<FunctionMapKey, EdmFunction>();
-
-  private final Map<ActionMapKey, EdmAction> boundActions = new HashMap<ActionMapKey, EdmAction>();
-
-  private final Map<FunctionMapKey, EdmFunction> boundFunctions = new HashMap<FunctionMapKey, EdmFunction>();
-
-  private EdmServiceMetadata serviceMetadata;
-
-  private Map<String, String> aliasToNamespaceInfo;
-
-  private List<EdmSchema> schemas;
-
-  @Override
-  public List<EdmSchema> getSchemas() {
-    if (schemas == null) {
-      schemas = createSchemas();
-      if (schemas != null) {
-        aliasToNamespaceInfo = new HashMap<String, String>();
-        for (EdmSchema schema : schemas) {
-          String namespace = schema.getNamespace();
-          if (schema.getAlias() != null) {
-            aliasToNamespaceInfo.put(schema.getAlias(), namespace);
-          }
-
-          List<EdmEnumType> localEnumTypes = schema.getEnumTypes();
-          if (localEnumTypes != null) {
-            for (EdmEnumType enumType : localEnumTypes) {
-              enumTypes.put(new FullQualifiedName(namespace, enumType.getName()), enumType);
-            }
-          }
-
-          List<EdmTypeDefinition> localTypeDefinitions = schema.getTypeDefinitions();
-          if (localTypeDefinitions != null) {
-            for (EdmTypeDefinition typeDef : localTypeDefinitions) {
-              typeDefinitions.put(new FullQualifiedName(namespace, typeDef.getName()), typeDef);
-            }
-          }
-
-          List<EdmComplexType> localComplexTypes = schema.getComplexTypes();
-          if (localComplexTypes != null) {
-            for (EdmComplexType complexType : localComplexTypes) {
-              complexTypes.put(new FullQualifiedName(namespace, complexType.getName()), complexType);
-            }
-          }
-
-          List<EdmEntityType> localEntityTypes = schema.getEntityTypes();
-          if (localEntityTypes != null) {
-            for (EdmEntityType entityType : localEntityTypes) {
-              entityTypes.put(new FullQualifiedName(namespace, entityType.getName()), entityType);
-            }
-          }
-
-          List<EdmAction> localActions = schema.getActions();
-          if (localActions != null) {
-            for (EdmAction action : localActions) {
-              if (action.isBound()) {
-                ActionMapKey key = new ActionMapKey(new FullQualifiedName(namespace, action.getName()),
-                    action.getBindingParameterTypeFqn(), action.isBindingParameterTypeCollection());
-                boundActions.put(key, action);
-              } else {
-                unboundActions.put(new FullQualifiedName(namespace, action.getName()), action);
-              }
-            }
-          }
-
-          List<EdmFunction> localFunctions = schema.getFunctions();
-          if (localFunctions != null) {
-            for (EdmFunction function : localFunctions) {
-              FunctionMapKey key =
-                  new FunctionMapKey(new FullQualifiedName(namespace, function.getName()), function
-                      .getBindingParameterTypeFqn(), function.isBindingParameterTypeCollection(), function
-                      .getParameterNames());
-
-              if (function.isBound()) {
-                boundFunctions.put(key, function);
-              } else {
-                unboundFunctions.put(key, function);
-              }
-            }
-          }
-          
-          EdmEntityContainer entityContainer = schema.getEntityContainer();
-          if(entityContainer != null){
-            entityContainers.put(new FullQualifiedName(namespace, entityContainer.getName()), entityContainer);
-            if(!entityContainers.containsKey(null)){
-              entityContainers.put(null, entityContainer);
-            }
-          }
-        }
-      }
-    }
-    return schemas;
-  }
-
-  @Override
-  public EdmEntityContainer getEntityContainer(final FullQualifiedName namespaceOrAliasFQN) {
-    final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
-    EdmEntityContainer container = entityContainers.get(fqn);
-    if (container == null) {
-      container = createEntityContainer(fqn);
-      if (container != null) {
-        entityContainers.put(fqn, container);
-        if (fqn == null) {
-          entityContainers.put(new FullQualifiedName(container.getNamespace(), container.getName()), container);
-        }
-      }
-    }
-    return container;
-  }
-
-  @Override
-  public EdmEnumType getEnumType(final FullQualifiedName namespaceOrAliasFQN) {
-    final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
-    EdmEnumType enumType = enumTypes.get(fqn);
-    if (enumType == null) {
-      enumType = createEnumType(fqn);
-      if (enumType != null) {
-        enumTypes.put(fqn, enumType);
-      }
-    }
-    return enumType;
-  }
-
-  @Override
-  public EdmTypeDefinition getTypeDefinition(final FullQualifiedName namespaceOrAliasFQN) {
-    final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
-    EdmTypeDefinition typeDefinition = typeDefinitions.get(fqn);
-    if (typeDefinition == null) {
-      typeDefinition = createTypeDefinition(fqn);
-      if (typeDefinition != null) {
-        typeDefinitions.put(fqn, typeDefinition);
-      }
-    }
-    return typeDefinition;
-  }
-
-  @Override
-  public EdmEntityType getEntityType(final FullQualifiedName namespaceOrAliasFQN) {
-    final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
-    EdmEntityType entityType = entityTypes.get(fqn);
-    if (entityType == null) {
-      entityType = createEntityType(fqn);
-      if (entityType != null) {
-        entityTypes.put(fqn, entityType);
-      }
-    }
-    return entityType;
-  }
-
-  @Override
-  public EdmComplexType getComplexType(final FullQualifiedName namespaceOrAliasFQN) {
-    final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
-    EdmComplexType complexType = complexTypes.get(fqn);
-    if (complexType == null) {
-      complexType = createComplexType(fqn);
-      if (complexType != null) {
-        complexTypes.put(fqn, complexType);
-      }
-    }
-    return complexType;
-  }
-
-  @Override
-  public EdmAction getAction(final FullQualifiedName actionName, final FullQualifiedName bindingParameterTypeName,
-      final Boolean isBindingParameterCollection) {
-
-    EdmAction action = null;
-
-    final FullQualifiedName actionFqn = resolvePossibleAlias(actionName);
-    if (bindingParameterTypeName == null) {
-      action = unboundActions.get(actionName);
-      if (action == null) {
-        action = createUnboundAction(actionFqn);
-        if (action != null) {
-          unboundActions.put(actionName, action);
-        }
-      }
-    } else {
-      final FullQualifiedName bindingParameterTypeFqn = resolvePossibleAlias(bindingParameterTypeName);
-      final ActionMapKey key = new ActionMapKey(actionFqn, bindingParameterTypeFqn, isBindingParameterCollection);
-      action = boundActions.get(key);
-      if (action == null) {
-        action = createBoundAction(actionFqn, bindingParameterTypeFqn, isBindingParameterCollection);
-        if (action != null) {
-          boundActions.put(key, action);
-        }
-      }
-    }
-
-    return action;
-  }
-
-  @Override
-  public EdmFunction getFunction(final FullQualifiedName functionName,
-      final FullQualifiedName bindingParameterTypeName,
-      final Boolean isBindingParameterCollection, final List<String> parameterNames) {
-
-    EdmFunction function = null;
-
-    final FullQualifiedName functionFqn = resolvePossibleAlias(functionName);
-    if (bindingParameterTypeName == null) {
-      final FunctionMapKey key = new FunctionMapKey(
-          functionFqn, bindingParameterTypeName, isBindingParameterCollection, parameterNames);
-      function = unboundFunctions.get(key);
-      if (function == null) {
-        function = createUnboundFunction(functionFqn, parameterNames);
-        if (function != null) {
-          unboundFunctions.put(key, function);
-        }
-      }
-    } else {
-      final FullQualifiedName bindingParameterTypeFqn = resolvePossibleAlias(bindingParameterTypeName);
-      final FunctionMapKey key =
-          new FunctionMapKey(functionFqn, bindingParameterTypeFqn, isBindingParameterCollection, parameterNames);
-      function = boundFunctions.get(key);
-      if (function == null) {
-        function = createBoundFunction(functionFqn, bindingParameterTypeFqn, isBindingParameterCollection,
-            parameterNames);
-        if (function != null) {
-          boundFunctions.put(key, function);
-        }
-      }
-    }
-
-    return function;
-  }
-
-  @Override
-  public EdmServiceMetadata getServiceMetadata() {
-    if (serviceMetadata == null) {
-      serviceMetadata = createServiceMetadata();
-    }
-    return serviceMetadata;
-  }
-
-  private FullQualifiedName resolvePossibleAlias(final FullQualifiedName namespaceOrAliasFQN) {
-    if (aliasToNamespaceInfo == null) {
-      aliasToNamespaceInfo = createAliasToNamespaceInfo();
-    }
-    FullQualifiedName finalFQN = null;
-    if (namespaceOrAliasFQN != null) {
-      final String namespace = aliasToNamespaceInfo.get(namespaceOrAliasFQN.getNamespace());
-      // If not contained in info it must be a namespace
-      if (namespace == null) {
-        finalFQN = namespaceOrAliasFQN;
-      } else {
-        finalFQN = new FullQualifiedName(namespace, namespaceOrAliasFQN.getName());
-      }
-    }
-    return finalFQN;
-  }
-
-  protected abstract Map<String, String> createAliasToNamespaceInfo();
-
-  protected abstract EdmEntityContainer createEntityContainer(FullQualifiedName containerName);
-
-  protected abstract EdmEnumType createEnumType(FullQualifiedName enumName);
-
-  protected abstract EdmTypeDefinition createTypeDefinition(FullQualifiedName typeDefinitionName);
-
-  protected abstract EdmEntityType createEntityType(FullQualifiedName entityTypeName);
-
-  protected abstract EdmComplexType createComplexType(FullQualifiedName complexTypeName);
-
-  protected abstract EdmAction createUnboundAction(FullQualifiedName actionName);
-
-  protected abstract EdmFunction createUnboundFunction(FullQualifiedName functionName, List<String> parameterNames);
-
-  protected abstract EdmAction createBoundAction(FullQualifiedName actionName,
-      FullQualifiedName bindingParameterTypeName,
-      Boolean isBindingParameterCollection);
-
-  protected abstract EdmFunction createBoundFunction(FullQualifiedName functionName,
-      FullQualifiedName bindingParameterTypeName, Boolean isBindingParameterCollection,
-      List<String> parameterNames);
-
-  protected abstract EdmServiceMetadata createServiceMetadata();
-
-  protected abstract List<EdmSchema> createSchemas();
-
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchema.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchema.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchema.java
new file mode 100644
index 0000000..64bd3b9
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchema.java
@@ -0,0 +1,154 @@
+/*
+ * 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;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.EdmAction;
+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.EdmSchema;
+import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+
+public abstract class AbstractEdmSchema implements EdmSchema {
+
+  protected final String namespace;
+
+  private final String alias;
+
+  private List<EdmTypeDefinition> typeDefinitions;
+
+  private List<EdmEnumType> enumTypes;
+
+  private List<EdmEntityType> entityTypes;
+
+  private List<EdmComplexType> complexTypes;
+
+  private List<EdmAction> actions;
+
+  private List<EdmFunction> functions;
+
+  private EdmEntityContainer entityContainer;
+
+  public AbstractEdmSchema(String namespace, String alias) {
+    this.namespace = namespace;
+    this.alias = alias;
+  }
+
+  protected abstract EdmEntityContainer createEntityContainer();
+
+  protected abstract List<EdmTypeDefinition> createTypeDefinitions();
+
+  protected abstract List<EdmEnumType> createEnumTypes();
+
+  protected abstract List<EdmEntityType> createEntityTypes();
+
+  protected abstract List<EdmComplexType> createComplexTypes();
+
+  protected abstract List<EdmAction> createActions();
+
+  protected abstract List<EdmFunction> createFunctions();
+
+  @Override
+  public List<EdmTypeDefinition> getTypeDefinitions() {
+    if (typeDefinitions == null) {
+      typeDefinitions = createTypeDefinitions();
+    }
+    return typeDefinitions;
+  }
+
+  @Override
+  public List<EdmEnumType> getEnumTypes() {
+    if (enumTypes == null) {
+      enumTypes = createEnumTypes();
+    }
+    return enumTypes;
+  }
+
+  @Override
+  public List<EdmEntityType> getEntityTypes() {
+    if (entityTypes == null) {
+      entityTypes = createEntityTypes();
+    }
+    return entityTypes;
+  }
+
+  @Override
+  public List<EdmComplexType> getComplexTypes() {
+    if (complexTypes == null) {
+      complexTypes = createComplexTypes();
+    }
+    return complexTypes;
+  }
+
+  @Override
+  public List<EdmAction> getActions() {
+    if (actions == null) {
+      actions = createActions();
+    }
+    return actions;
+  }
+
+  @Override
+  public List<EdmFunction> getFunctions() {
+    if (functions == null) {
+      functions = createFunctions();
+    }
+    return functions;
+  }
+
+  @Override
+  public EdmEntityContainer getEntityContainer() {
+    if (entityContainer == null) {
+      entityContainer = createEntityContainer();
+    }
+    return entityContainer;
+  }
+
+  @Override
+  public List<EdmEntityContainer> getEntityContainers() {
+    return Collections.singletonList(getEntityContainer());
+  }
+
+  @Override
+  public EdmEntityContainer getEntityContainer(final FullQualifiedName name) {
+    return getEntityContainer() == null
+            ? null
+            : name == null
+            ? getEntityContainer()
+            : name.equals(new FullQualifiedName(getEntityContainer().getNamespace(), getEntityContainer().getName()))
+            ? getEntityContainer()
+            : null;
+  }
+
+  @Override
+  public String getNamespace() {
+    return namespace;
+  }
+
+  @Override
+  public String getAlias() {
+    return alias;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchemaImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchemaImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchemaImpl.java
deleted file mode 100644
index 20f7c92..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchemaImpl.java
+++ /dev/null
@@ -1,154 +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.commons.core.edm;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.EdmAction;
-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.EdmSchema;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-public abstract class AbstractEdmSchemaImpl implements EdmSchema {
-
-  protected final String namespace;
-
-  private final String alias;
-
-  private List<EdmTypeDefinition> typeDefinitions;
-
-  private List<EdmEnumType> enumTypes;
-
-  private List<EdmEntityType> entityTypes;
-
-  private List<EdmComplexType> complexTypes;
-
-  private List<EdmAction> actions;
-
-  private List<EdmFunction> functions;
-
-  private EdmEntityContainer entityContainer;
-
-  public AbstractEdmSchemaImpl(String namespace, String alias) {
-    this.namespace = namespace;
-    this.alias = alias;
-  }
-
-  protected abstract EdmEntityContainer createEntityContainer();
-
-  protected abstract List<EdmTypeDefinition> createTypeDefinitions();
-
-  protected abstract List<EdmEnumType> createEnumTypes();
-
-  protected abstract List<EdmEntityType> createEntityTypes();
-
-  protected abstract List<EdmComplexType> createComplexTypes();
-
-  protected abstract List<EdmAction> createActions();
-
-  protected abstract List<EdmFunction> createFunctions();
-
-  @Override
-  public List<EdmTypeDefinition> getTypeDefinitions() {
-    if (typeDefinitions == null) {
-      typeDefinitions = createTypeDefinitions();
-    }
-    return typeDefinitions;
-  }
-
-  @Override
-  public List<EdmEnumType> getEnumTypes() {
-    if (enumTypes == null) {
-      enumTypes = createEnumTypes();
-    }
-    return enumTypes;
-  }
-
-  @Override
-  public List<EdmEntityType> getEntityTypes() {
-    if (entityTypes == null) {
-      entityTypes = createEntityTypes();
-    }
-    return entityTypes;
-  }
-
-  @Override
-  public List<EdmComplexType> getComplexTypes() {
-    if (complexTypes == null) {
-      complexTypes = createComplexTypes();
-    }
-    return complexTypes;
-  }
-
-  @Override
-  public List<EdmAction> getActions() {
-    if (actions == null) {
-      actions = createActions();
-    }
-    return actions;
-  }
-
-  @Override
-  public List<EdmFunction> getFunctions() {
-    if (functions == null) {
-      functions = createFunctions();
-    }
-    return functions;
-  }
-
-  @Override
-  public EdmEntityContainer getEntityContainer() {
-    if (entityContainer == null) {
-      entityContainer = createEntityContainer();
-    }
-    return entityContainer;
-  }
-
-  @Override
-  public List<EdmEntityContainer> getEntityContainers() {
-    return Collections.singletonList(getEntityContainer());
-  }
-
-  @Override
-  public EdmEntityContainer getEntityContainer(final FullQualifiedName name) {
-    return getEntityContainer() == null
-            ? null
-            : name == null
-            ? getEntityContainer()
-            : name.equals(new FullQualifiedName(getEntityContainer().getNamespace(), getEntityContainer().getName()))
-            ? getEntityContainer()
-            : null;
-  }
-
-  @Override
-  public String getNamespace() {
-    return namespace;
-  }
-
-  @Override
-  public String getAlias() {
-    return alias;
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
index a4cd47d..af4f2dd 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
@@ -35,15 +35,18 @@ import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
 public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements EdmStructuredType {
 
   protected EdmStructuredType baseType;
+
   protected FullQualifiedName baseTypeName;
+
   private List<String> propertyNames;
+
   private List<String> navigationPropertyNames;
 
   public AbstractEdmStructuredType(
-      final Edm edm,
-      final FullQualifiedName typeName,
-      final EdmTypeKind kind,
-      final FullQualifiedName baseTypeName) {
+          final Edm edm,
+          final FullQualifiedName typeName,
+          final EdmTypeKind kind,
+          final FullQualifiedName baseTypeName) {
 
     super(edm, typeName, kind);
     this.baseTypeName = baseTypeName;
@@ -54,7 +57,7 @@ public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements E
   protected abstract Map<String, EdmProperty> getProperties();
 
   protected abstract Map<String, EdmNavigationProperty> getNavigationProperties();
-  
+
   protected abstract void checkBaseType();
 
   @Override
@@ -125,7 +128,7 @@ public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements E
       throw new EdmException("Target type must not be null");
     }
     while (!sourceType.getName().equals(targetType.getName())
-        || !sourceType.getNamespace().equals(targetType.getNamespace())) {
+            || !sourceType.getNamespace().equals(targetType.getNamespace())) {
 
       sourceType = sourceType.getBaseType();
       if (sourceType == null) {
@@ -135,4 +138,5 @@ public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements E
 
     return true;
   }
+
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmStructuredTypeHelper.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmStructuredTypeHelper.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmStructuredTypeHelper.java
index e1226dd..a14700b 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmStructuredTypeHelper.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmStructuredTypeHelper.java
@@ -28,4 +28,7 @@ public interface EdmStructuredTypeHelper {
   Map<String, EdmProperty> getProperties();
 
   Map<String, EdmNavigationProperty> getNavigationProperties();
+
+  boolean isOpenType();
+
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java
index 4eba1db..474a58d 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java
@@ -41,7 +41,7 @@ import org.apache.olingo.commons.api.edm.EdmSchema;
 import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.AbstractEdmImpl;
+import org.apache.olingo.commons.core.edm.AbstractEdm;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -260,7 +260,7 @@ public class EdmImplCachingTest {
     edm = new LocalEdm();
   }
 
-  private class LocalEdm extends AbstractEdmImpl {
+  private class LocalEdm extends AbstractEdm {
 
     @Override
     public EdmEntityContainer createEntityContainer(final FullQualifiedName fqn) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCallCreateTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCallCreateTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCallCreateTest.java
index 71e1acd..52d47e2 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCallCreateTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCallCreateTest.java
@@ -41,7 +41,7 @@ import org.apache.olingo.commons.api.edm.EdmSchema;
 import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.AbstractEdmImpl;
+import org.apache.olingo.commons.core.edm.AbstractEdm;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -158,7 +158,7 @@ public class EdmImplCallCreateTest {
     edm = new LocalEdm();
   }
 
-  private class LocalEdm extends AbstractEdmImpl {
+  private class LocalEdm extends AbstractEdm {
 
     @Override
     public EdmEntityContainer createEntityContainer(final FullQualifiedName fqn) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
index 34df670..91bec42 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
@@ -33,7 +33,7 @@ public class EdmComplexTypeImpl extends AbstractEdmComplexType {
   private final EdmStructuredTypeHelper helper;
 
   public static EdmComplexTypeImpl getInstance(
-      final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
+          final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
 
     final EdmComplexTypeImpl instance = new EdmComplexTypeImpl(edm, name, complexType);
     return instance;
@@ -54,4 +54,9 @@ public class EdmComplexTypeImpl extends AbstractEdmComplexType {
     return helper.getNavigationProperties();
   }
 
+  @Override
+  public boolean isOpenType() {
+    return helper.isOpenType();
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
index c6360d8..b6c7828 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
@@ -90,7 +90,7 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
 
   @Override
   public boolean isOpenType() {
-    return entityType.isOpenType();
+    return helper.isOpenType();
   }
 
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmProviderImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmProviderImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmProviderImpl.java
index e4cf9b2..d35d55d 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmProviderImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmProviderImpl.java
@@ -36,7 +36,7 @@ import org.apache.olingo.commons.api.edm.EdmSchema;
 import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.AbstractEdmImpl;
+import org.apache.olingo.commons.core.edm.AbstractEdm;
 import org.apache.olingo.server.api.edm.provider.Action;
 import org.apache.olingo.server.api.edm.provider.AliasInfo;
 import org.apache.olingo.server.api.edm.provider.ComplexType;
@@ -49,7 +49,7 @@ import org.apache.olingo.server.api.edm.provider.Parameter;
 import org.apache.olingo.server.api.edm.provider.Schema;
 import org.apache.olingo.server.api.edm.provider.TypeDefinition;
 
-public class EdmProviderImpl extends AbstractEdmImpl {
+public class EdmProviderImpl extends AbstractEdm {
 
   private final EdmProvider provider;
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java
index 34d34b4..f95338e 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java
@@ -30,7 +30,7 @@ import org.apache.olingo.commons.api.edm.EdmEnumType;
 import org.apache.olingo.commons.api.edm.EdmFunction;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.AbstractEdmSchemaImpl;
+import org.apache.olingo.commons.core.edm.AbstractEdmSchema;
 import org.apache.olingo.server.api.edm.provider.Action;
 import org.apache.olingo.server.api.edm.provider.ComplexType;
 import org.apache.olingo.server.api.edm.provider.EdmProvider;
@@ -40,7 +40,7 @@ import org.apache.olingo.server.api.edm.provider.Function;
 import org.apache.olingo.server.api.edm.provider.Schema;
 import org.apache.olingo.server.api.edm.provider.TypeDefinition;
 
-public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
+public class EdmSchemaImpl extends AbstractEdmSchema {
 
   private final Schema schema;
   private final Edm edm;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/25174231/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java
index cc12769..4fdda9c 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java
@@ -64,10 +64,16 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
       if (structuredType.getNavigationProperties() != null) {
         for (NavigationProperty navigationProperty : structuredType.getNavigationProperties()) {
           navigationProperties.put(navigationProperty.getName(),
-              new EdmNavigationPropertyImpl(edm, navigationProperty));
+                  new EdmNavigationPropertyImpl(edm, navigationProperty));
         }
       }
     }
     return navigationProperties;
   }
+
+  @Override
+  public boolean isOpenType() {
+    return structuredType.isOpenType();
+  }
+
 }