You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/03/10 10:02:57 UTC

[41/51] [abbrv] [partial] [OLINGO-192] rename java packages

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/EntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/EntitySetImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/EntitySetImpl.java
new file mode 100644
index 0000000..f344a21
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/EntitySetImpl.java
@@ -0,0 +1,120 @@
+/* 
+ * 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.client.core.deserializer;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.olingo.client.api.deserializer.Entity;
+import org.apache.olingo.client.api.deserializer.EntitySet;
+
+import com.fasterxml.jackson.core.JsonParseException;
+
+public class EntitySetImpl implements EntitySet, Iterator<Entity> {
+
+  private String odataContext;
+
+  private Long odataCount;
+
+  private String odataNextLink;
+
+  private String odataDeltaLink;
+
+  private List<Entity> entities = null;
+
+  private PropertyCollectionBuilder propertyCollectionsBuilder;
+
+  @Override
+  public String getODataContext() {
+    return odataContext;
+  }
+
+  @Override
+  public Long getODataCount() {
+    return odataCount;
+  }
+
+  @Override
+  public String getODataNextLink() {
+    return odataNextLink;
+  }
+
+  @Override
+  public String getODataDeltaLink() {
+    return odataDeltaLink;
+  }
+
+  public void addAnnotation(final String name, final String value) {
+    if ("odata.context".equalsIgnoreCase(name)) {
+      odataContext = value;
+    } else if ("odata.deltaLink".equalsIgnoreCase(name)) {
+      odataDeltaLink = value;
+    } else if ("odata.count".equalsIgnoreCase(name)) {
+      odataCount = Long.parseLong(value);
+    } else if ("odata.nextLink".equalsIgnoreCase(name)) {
+      odataNextLink = value;
+    }
+  }
+
+  @Override
+  public List<Entity> getEntities() {
+    if (entities == null) {
+      entities = new ArrayList<Entity>();
+
+      while (propertyCollectionsBuilder.parseNext()) {
+        entities.add(propertyCollectionsBuilder.buildEntity());
+      }
+    }
+
+    return entities;
+  }
+
+  public void setPropertyCollectionBuilder(final PropertyCollectionBuilder builder) {
+    propertyCollectionsBuilder = builder;
+  }
+
+  @Override
+  public boolean hasNext() {
+    try {
+      return propertyCollectionsBuilder.hasNext();
+    } catch (JsonParseException e) {
+    } catch (IOException e) {
+    }
+    return false;
+  }
+
+  @Override
+  public Entity next() {
+    if (propertyCollectionsBuilder.parseNext()) {
+      return propertyCollectionsBuilder.buildEntity();
+    }
+    return null;
+  }
+
+  @Override
+  public void remove() {
+  }
+
+  @Override
+  public Iterator<Entity> iterator() {
+    return this;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/JsonReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/JsonReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/JsonReader.java
new file mode 100644
index 0000000..105065c
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/JsonReader.java
@@ -0,0 +1,89 @@
+/* 
+ * 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.client.core.deserializer;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+
+import org.apache.olingo.client.api.deserializer.ClientException;
+import org.apache.olingo.client.api.deserializer.Entity;
+import org.apache.olingo.client.api.deserializer.EntitySet;
+import org.apache.olingo.client.api.deserializer.Property;
+import org.apache.olingo.client.api.deserializer.Reader;
+import org.apache.olingo.client.api.deserializer.StructuralProperty;
+
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonParser;
+
+public class JsonReader implements Reader {
+
+  @Override
+  public EntitySet readEntitySet(final InputStream in) throws ClientException {
+
+    final JsonFactory jsonFactory = new JsonFactory();
+    // or, for data binding, org.codehaus.jackson.mapper.MappingJsonFactory
+    try {
+      JsonParser jp = jsonFactory.createParser(in);
+      EntitySetBuilder entitySet = new EntitySetBuilder(jp);
+      return entitySet.buildEntitySet();
+    } catch (JsonParseException e) {
+      throw new ClientException("JSON Parsing failed.", e);
+    } catch (IOException e) {
+      throw new ClientException("JSON Parsing failed.", e);
+    }
+  }
+
+  @Override
+  public Entity readEntity(final InputStream in) throws ClientException {
+    Entity entity = null;
+
+    final JsonFactory jsonFactory = new JsonFactory();
+    // or, for data binding, org.codehaus.jackson.mapper.MappingJsonFactory
+    try {
+      final JsonParser jp = jsonFactory.createParser(in);
+      final PropertyCollectionBuilder builder = new PropertyCollectionBuilder(jp);
+      builder.parseNext();
+      entity = builder.buildEntity();
+    } catch (JsonParseException e) {
+      throw new ClientException("JSON Parsing failed.", e);
+    } catch (IOException e) {
+      throw new ClientException("JSON Parsing failed.", e);
+    }
+
+    return entity;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.olingo.core.consumer.Reader#parseProperty(java.io.InputStream)
+   */
+  @Override
+  public Property readProperty(final InputStream in) throws ClientException {
+    final Entity entity = readEntity(in);
+
+    final Map<String, StructuralProperty> properties = entity.getStructuralProperties();
+    if (properties.size() == 1) {
+      return properties.values().iterator().next();
+    }
+    return null;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/NavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/NavigationPropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/NavigationPropertyImpl.java
new file mode 100644
index 0000000..1c09a90
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/NavigationPropertyImpl.java
@@ -0,0 +1,89 @@
+/* 
+ * 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.client.core.deserializer;
+
+import org.apache.olingo.client.api.deserializer.NavigationProperty;
+
+public class NavigationPropertyImpl implements NavigationProperty {
+
+  private final String name;
+
+  private String associationLink;
+
+  private String navigationLink;
+
+  public NavigationPropertyImpl(final String name) {
+    this.name = parseName(name);
+  }
+
+  public NavigationPropertyImpl(final String name, final String link) {
+    this(name);
+    updateLink(name, link);
+  }
+
+  @Override
+  public String getName() {
+    return name;
+  }
+
+  @Override
+  public String getAssociationLink() {
+    return associationLink;
+  }
+
+  @Override
+  public String getNavigationLink() {
+    return navigationLink;
+  }
+
+  public void updateLink(final String name, final String link) {
+    final String regexNavigationLink = ".*@odata.navigationLink$";
+    final String regexAssociationLink = ".*@odata.associationLink$";
+    if (name.matches(regexNavigationLink)) {
+      navigationLink = link;
+    } else if (name.matches(regexAssociationLink)) {
+      associationLink = link;
+    }
+  }
+
+  private String parseName(final String nameToParse) {
+    final String[] split = nameToParse.split("@");
+    if (split.length == 2) {
+      return split[0];
+    } else {
+      throw new IllegalArgumentException("Got OData Navigation with unparseable format '"
+              + nameToParse + "'.");
+    }
+  }
+
+  public void updateLink(final NavigationProperty navigationProperty) {
+    if (navigationProperty.getAssociationLink() != null) {
+      associationLink = navigationProperty.getAssociationLink();
+    }
+    if (navigationProperty.getNavigationLink() != null) {
+      navigationLink = navigationProperty.getNavigationLink();
+    }
+  }
+
+  @Override
+  public String toString() {
+    return "NavigationPropertyImpl [name=" + name + ", associationLink=" + associationLink
+            + ", navigationLink=" + navigationLink + "]";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/PrimitiveValue.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/PrimitiveValue.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/PrimitiveValue.java
new file mode 100644
index 0000000..c28bffa
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/PrimitiveValue.java
@@ -0,0 +1,51 @@
+/* 
+ * 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.client.core.deserializer;
+
+import org.apache.olingo.client.api.deserializer.Value;
+
+public class PrimitiveValue implements Value {
+
+  private final Object content;
+
+  public PrimitiveValue(final Object content) {
+    this.content = content;
+  }
+
+  @Override
+  public boolean isComplex() {
+    return false;
+  }
+
+  @Override
+  public Object getContent() {
+    return content;
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public <T> T getContentAs(final T type) {
+    return (T) content;
+  }
+
+  @Override
+  public String toString() {
+    return String.valueOf(content);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/PropertyCollection.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/PropertyCollection.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/PropertyCollection.java
new file mode 100644
index 0000000..8b10213
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/PropertyCollection.java
@@ -0,0 +1,96 @@
+/* 
+ * 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.client.core.deserializer;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.client.api.deserializer.AnnotationProperty;
+import org.apache.olingo.client.api.deserializer.NavigationProperty;
+import org.apache.olingo.client.api.deserializer.Property;
+import org.apache.olingo.client.api.deserializer.StructuralProperty;
+
+abstract class PropertyCollection {
+
+  protected Map<String, AnnotationProperty> annotationProperties = new HashMap<String, AnnotationProperty>();
+
+  protected Map<String, NavigationProperty> navigationProperties = new HashMap<String, NavigationProperty>();
+
+  protected Map<String, StructuralProperty> structuralProperties = new HashMap<String, StructuralProperty>();
+
+  public PropertyCollection() {
+  }
+
+  protected PropertyCollection(final Map<String, AnnotationProperty> annotationProperties,
+          final Map<String, NavigationProperty> navigationProperties,
+          final Map<String, StructuralProperty> structuralProperties) {
+
+    this.annotationProperties = annotationProperties;
+    this.navigationProperties = navigationProperties;
+    this.structuralProperties = structuralProperties;
+  }
+
+  public List<Property> getProperties() {
+    final int initialCapacity = annotationProperties.size() + navigationProperties.size() + structuralProperties.size();
+
+    final List<Property> properties = new ArrayList<Property>(initialCapacity);
+    properties.addAll(annotationProperties.values());
+    properties.addAll(navigationProperties.values());
+    properties.addAll(structuralProperties.values());
+
+    return properties;
+  }
+
+  public Map<String, AnnotationProperty> getAnnotationProperties() {
+    return Collections.unmodifiableMap(annotationProperties);
+  }
+
+  public Map<String, NavigationProperty> getNavigationProperties() {
+    return Collections.unmodifiableMap(navigationProperties);
+  }
+
+  public Map<String, StructuralProperty> getStructuralProperties() {
+    return Collections.unmodifiableMap(structuralProperties);
+  }
+
+  public void addProperty(final Property property) {
+    if (property == null) {
+      throw new IllegalArgumentException("Property parameter MUST NOT be NULL.");
+    }
+
+    if (property instanceof NavigationPropertyImpl) {
+      final NavigationPropertyImpl navProperty = (NavigationPropertyImpl) navigationProperties.get(property.getName());
+      if (navProperty == null) {
+        navigationProperties.put(property.getName(), (NavigationPropertyImpl) property);
+      } else {
+        final NavigationProperty temp = (NavigationProperty) property;
+        navProperty.updateLink(temp);
+      }
+    } else if (property instanceof AnnotationPropertyImpl) {
+      annotationProperties.put(property.getName(), (AnnotationPropertyImpl) property);
+    } else if (property instanceof StructuralProperty) {
+      structuralProperties.put(property.getName(), (StructuralProperty) property);
+    } else {
+      throw new IllegalArgumentException("Unknown class '" + property.getClass() + "'.");
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/PropertyCollectionBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/PropertyCollectionBuilder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/PropertyCollectionBuilder.java
new file mode 100644
index 0000000..7643e49
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/PropertyCollectionBuilder.java
@@ -0,0 +1,221 @@
+/* 
+ * 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.client.core.deserializer;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.olingo.client.api.deserializer.AnnotationProperty;
+import org.apache.olingo.client.api.deserializer.ComplexValue;
+import org.apache.olingo.client.api.deserializer.Entity;
+import org.apache.olingo.client.api.deserializer.NavigationProperty;
+import org.apache.olingo.client.api.deserializer.Property;
+import org.apache.olingo.client.api.deserializer.StructuralProperty;
+import org.apache.olingo.client.api.deserializer.Value;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PropertyCollectionBuilder extends PropertyCollection {
+
+  private static final Logger LOG = LoggerFactory.getLogger(PropertyCollectionBuilder.class);
+
+  private JsonParser parser;
+
+  private EntitySetImpl enclosingEntitySet;
+
+  private PropertyCollectionBuilder next = null;
+
+  public PropertyCollectionBuilder(final JsonParser parser) {
+    this.parser = parser;
+  }
+
+  private PropertyCollectionBuilder() {
+  }
+
+  public PropertyCollectionBuilder(final JsonParser jp, final EntitySetImpl entitySet) {
+    this(jp);
+    enclosingEntitySet = entitySet;
+  }
+
+  public Entity buildEntity() {
+    final Entity entity = new EntityImpl(annotationProperties, navigationProperties, structuralProperties);
+    resetProperties();
+    return entity;
+  }
+
+  public ComplexValue buildComplexValue() {
+    final ComplexValue value = new ComplexValueImpl(annotationProperties, navigationProperties, structuralProperties);
+    resetProperties();
+    return value;
+  }
+
+  private void resetProperties() {
+    annotationProperties = new HashMap<String, AnnotationProperty>();
+    navigationProperties = new HashMap<String, NavigationProperty>();
+    structuralProperties = new HashMap<String, StructuralProperty>();
+  }
+
+  public boolean hasNext() throws JsonParseException, IOException {
+    if (parser.isClosed()) {
+      return false;
+    }
+    next = parseNextObject(parser, this);
+    return (next != null);
+  }
+
+  public boolean parseNext() {
+    try {
+      if (hasNext()) {
+        if (next != null) {
+          return true;
+        }
+
+        if (next == null) {
+          parser.close();
+          return false;
+        }
+        return true;
+      }
+    } catch (JsonParseException e) {
+      LOG.error("While parsing", e);
+    } catch (IOException e) {
+      LOG.error("While parsing", e);
+    }
+    return false;
+
+  }
+
+  /**
+   *
+   * @param jp
+   * @param builder
+   * @return
+   * @throws IOException
+   * @throws JsonParseException
+   */
+  private PropertyCollectionBuilder parseNextObject(final JsonParser jp, final PropertyCollectionBuilder builder)
+          throws JsonParseException, IOException {
+
+    boolean endReached = readToStartObjectOrEnd(jp);
+    if (endReached) {
+      return null;
+    }
+
+    //
+    String currentFieldName = null;
+    List<Value> values = null;
+
+    while (jp.nextToken() != null) {
+      final JsonToken token = jp.getCurrentToken();
+      switch (token) {
+        case START_OBJECT:
+          if (currentFieldName != null) {
+            final ComplexValue cvp = parseNextObject(jp, new PropertyCollectionBuilder()).buildComplexValue();
+            if (values == null) {
+              builder.addProperty(new StructuralPropertyImpl(currentFieldName, cvp));
+            } else {
+              values.add(cvp);
+            }
+          }
+          break;
+        case END_OBJECT:
+          return builder;
+        case START_ARRAY:
+          values = new ArrayList<Value>();
+          break;
+        case END_ARRAY:
+          if (values != null) {
+            builder.addProperty(new StructuralPropertyImpl(currentFieldName, values));
+            values = null;
+          }
+          break;
+        case FIELD_NAME:
+          currentFieldName = jp.getCurrentName();
+          break;
+        case NOT_AVAILABLE:
+          break;
+        case VALUE_EMBEDDED_OBJECT:
+          break;
+        case VALUE_NULL:
+          Property nullProperty = createProperty(jp.getCurrentName(), null);
+          builder.addProperty(nullProperty);
+          break;
+        case VALUE_FALSE:
+        case VALUE_NUMBER_FLOAT:
+        case VALUE_NUMBER_INT:
+        case VALUE_STRING:
+        case VALUE_TRUE:
+          if (values == null) {
+            Property property = createProperty(jp.getCurrentName(), jp.getValueAsString());
+            builder.addProperty(property);
+          } else {
+            PrimitiveValue value = new PrimitiveValue(jp.getValueAsString());
+            values.add(value);
+          }
+          break;
+        default:
+          break;
+      }
+    }
+
+    return null;
+  }
+
+  private boolean readToStartObjectOrEnd(final JsonParser jp) throws IOException, JsonParseException {
+    final JsonToken endToken = JsonToken.START_OBJECT;
+    JsonToken token = jp.getCurrentToken() == null ? jp.nextToken() : jp.getCurrentToken();
+    while (token != null && token != endToken) {
+      if (enclosingEntitySet != null) {
+        switch (token) {
+          case VALUE_FALSE:
+          case VALUE_NUMBER_FLOAT:
+          case VALUE_NUMBER_INT:
+          case VALUE_TRUE:
+          case VALUE_STRING:
+            enclosingEntitySet.addAnnotation(jp.getCurrentName(), jp.getValueAsString());
+            break;
+
+          default:
+            break;
+        }
+      }
+      //
+      token = jp.nextToken();
+    }
+
+    return token == null;
+  }
+
+  private Property createProperty(final String name, final String value) {
+    if (name.contains("@")) {
+      return new NavigationPropertyImpl(name, value);
+    } else if (name.contains(".")) {
+      return new AnnotationPropertyImpl(name, value);
+    } else {
+      return new StructuralPropertyImpl(name, new PrimitiveValue(value));
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/StructuralPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/StructuralPropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/StructuralPropertyImpl.java
new file mode 100644
index 0000000..59ba264
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/StructuralPropertyImpl.java
@@ -0,0 +1,83 @@
+/* 
+ * 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.client.core.deserializer;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.client.api.deserializer.StructuralProperty;
+import org.apache.olingo.client.api.deserializer.Value;
+
+public class StructuralPropertyImpl implements StructuralProperty {
+
+  private final List<Value> values;
+
+  private final String name;
+
+  private final boolean containsCollection;
+
+  public StructuralPropertyImpl(final String name, final Value value) {
+    this(name, false, value);
+  }
+
+  public StructuralPropertyImpl(final String name, final List<Value> values) {
+    // XXX: ugly -> refactor
+    this(name, true, values.toArray(new Value[0]));
+  }
+
+  public StructuralPropertyImpl(final String name, final boolean asCollection, final Value... value) {
+    if (value == null || value.length == 0) {
+      throw new IllegalArgumentException("Missing or NULL value argument.");
+    }
+
+    containsCollection = asCollection;
+    this.name = name;
+    values = new ArrayList<Value>(value.length);
+    for (Value v : value) {
+      values.add(v);
+    }
+  }
+
+  @Override
+  public Value getValue() {
+    return values.get(0);
+  }
+
+  @Override
+  public List<Value> getValues() {
+    return Collections.unmodifiableList(values);
+  }
+
+  @Override
+  public String getName() {
+    return name;
+  }
+
+  @Override
+  public boolean containsCollection() {
+    return containsCollection;
+  }
+
+  @Override
+  public String toString() {
+    return "StructuralPropertyImpl [name=" + name + ", containsCollection=" + containsCollection
+            + ", values=" + values + "]";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/AbstractEdmServiceMetadataImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/AbstractEdmServiceMetadataImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/AbstractEdmServiceMetadataImpl.java
new file mode 100644
index 0000000..6508224
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/AbstractEdmServiceMetadataImpl.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.client.core.edm;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.olingo.client.api.edm.xml.EntityContainer;
+import org.apache.olingo.client.api.edm.xml.EntitySet;
+import org.apache.olingo.client.api.edm.xml.Schema;
+import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.commons.api.edm.EdmActionImportInfo;
+import org.apache.olingo.commons.api.edm.EdmEntitySetInfo;
+import org.apache.olingo.commons.api.edm.EdmFunctionImportInfo;
+import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
+import org.apache.olingo.commons.core.edm.EdmEntitySetInfoImpl;
+
+public abstract class AbstractEdmServiceMetadataImpl implements EdmServiceMetadata {
+
+  protected final XMLMetadata xmlMetadata;
+
+  private List<EdmEntitySetInfo> entitySetInfos;
+
+  protected List<EdmFunctionImportInfo> functionImportInfos;
+
+  protected List<EdmActionImportInfo> actionImportInfos;
+
+  public static EdmServiceMetadata getInstance(final XMLMetadata xmlMetadata) {
+    return xmlMetadata instanceof org.apache.olingo.client.core.edm.xml.v3.XMLMetadataImpl
+            ? new org.apache.olingo.client.core.edm.v3.EdmServiceMetadataImpl(
+                    (org.apache.olingo.client.core.edm.xml.v3.XMLMetadataImpl) xmlMetadata)
+            : new org.apache.olingo.client.core.edm.v4.EdmServiceMetadataImpl(
+                    (org.apache.olingo.client.core.edm.xml.v4.XMLMetadataImpl) xmlMetadata);
+
+  }
+
+  public AbstractEdmServiceMetadataImpl(final XMLMetadata xmlMetadata) {
+    this.xmlMetadata = xmlMetadata;
+  }
+
+  @Override
+  public InputStream getMetadata() {
+    throw new UnsupportedOperationException("Not supported in client code.");
+  }
+
+  @Override
+  public List<EdmEntitySetInfo> getEntitySetInfos() {
+    synchronized (this) {
+      if (entitySetInfos == null) {
+        entitySetInfos = new ArrayList<EdmEntitySetInfo>();
+        for (Schema schema : xmlMetadata.getSchemas()) {
+          for (EntityContainer entityContainer : schema.getEntityContainers()) {
+            for (EntitySet entitySet : entityContainer.getEntitySets()) {
+              entitySetInfos.add(
+                      new EdmEntitySetInfoImpl(entityContainer.getName(), entitySet.getName()));
+            }
+          }
+        }
+      }
+      return entitySetInfos;
+    }
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    return EqualsBuilder.reflectionEquals(this, obj);
+  }
+
+  @Override
+  public int hashCode() {
+    return HashCodeBuilder.reflectionHashCode(this);
+  }
+
+  @Override
+  public String toString() {
+    return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImpl.java
new file mode 100644
index 0000000..acbfce9
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImpl.java
@@ -0,0 +1,37 @@
+/*
+ * 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.client.core.edm;
+
+import org.apache.olingo.client.api.edm.xml.v4.Action;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAction;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+
+public class EdmActionImpl extends EdmOperationImpl implements EdmAction {
+
+  public static EdmActionImpl getInstance(final Edm edm, final FullQualifiedName name, final Action action) {
+    return EdmOperationImpl.getInstance(new EdmActionImpl(edm, name, action));
+  }
+
+  private EdmActionImpl(final Edm edm, final FullQualifiedName name, final Action action) {
+    super(edm, name, action, EdmTypeKind.ACTION);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
new file mode 100644
index 0000000..ad1fb68
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
@@ -0,0 +1,45 @@
+/*
+ * 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.client.core.edm;
+
+import org.apache.olingo.client.api.edm.xml.v4.ActionImport;
+import org.apache.olingo.client.api.utils.EdmTypeInfo;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAction;
+import org.apache.olingo.commons.api.edm.EdmActionImport;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+
+public class EdmActionImportImpl extends EdmOperationImportImpl implements EdmActionImport {
+
+  private final ActionImport actionImport;
+
+  public EdmActionImportImpl(final Edm edm, final EdmEntityContainer container, final String name,
+          final ActionImport actionImport) {
+
+    super(edm, container, name, actionImport.getEntitySet());
+    this.actionImport = actionImport;
+  }
+
+  @Override
+  public EdmAction getAction() {
+    return edm.getAction(
+            new EdmTypeInfo(actionImport.getAction(), container.getNamespace()).getFullQualifiedName(), null, null);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java
new file mode 100644
index 0000000..6f1990e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java
@@ -0,0 +1,79 @@
+/*
+ * 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.client.core.edm;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.olingo.client.api.edm.xml.v4.BindingTarget;
+import org.apache.olingo.client.api.edm.xml.v4.NavigationPropertyBinding;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmBindingTarget;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.Target;
+import org.apache.olingo.commons.core.edm.AbstractEdmBindingTarget;
+
+public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
+
+  private final BindingTarget target;
+
+  public EdmBindingTargetImpl(final Edm edm, final EdmEntityContainer container,
+          final String name, final FullQualifiedName type, final BindingTarget target) {
+
+    super(edm, container, name, type);
+    this.target = target;
+  }
+
+  @Override
+  public EdmBindingTarget getRelatedBindingTarget(final String path) {
+    EdmBindingTarget bindingTarget = null;
+
+    final List<? extends NavigationPropertyBinding> navigationPropertyBindings = target.getNavigationPropertyBindings();
+    boolean found = false;
+    for (final Iterator<? extends NavigationPropertyBinding> itor = navigationPropertyBindings.iterator();
+            itor.hasNext() && !found;) {
+
+      final NavigationPropertyBinding binding = itor.next();
+      if (binding.getPath().equals(path)) {
+        final Target edmTarget = new Target.Builder(binding.getTarget(), container).build();
+
+        final EdmEntityContainer entityContainer = edm.getEntityContainer(edmTarget.getEntityContainer());
+        if (entityContainer == null) {
+          throw new EdmException("Cannot find entity container with name: " + edmTarget.getEntityContainer());
+        }
+        bindingTarget = entityContainer.getEntitySet(edmTarget.getTargetName());
+        if (bindingTarget == null) {
+          bindingTarget = entityContainer.getSingleton(edmTarget.getTargetName());
+          if (bindingTarget == null) {
+            throw new EdmException("Cannot find target with name: " + edmTarget.getTargetName());
+          }
+
+          found = true;
+        } else {
+          found = true;
+        }
+      }
+    }
+
+    return bindingTarget;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/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
new file mode 100644
index 0000000..332e673
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
@@ -0,0 +1,371 @@
+/*
+ * 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.client.core.edm;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.olingo.client.api.UnsupportedInV3Exception;
+import org.apache.olingo.client.api.edm.xml.CommonParameter;
+import org.apache.olingo.client.api.edm.xml.ComplexType;
+import org.apache.olingo.client.api.edm.xml.EntityContainer;
+import org.apache.olingo.client.api.edm.xml.EntityType;
+import org.apache.olingo.client.api.edm.xml.EnumType;
+import org.apache.olingo.client.api.edm.xml.Schema;
+import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
+import org.apache.olingo.client.api.edm.xml.v4.Action;
+import org.apache.olingo.client.api.edm.xml.v4.Function;
+import org.apache.olingo.client.api.edm.xml.v4.TypeDefinition;
+import org.apache.olingo.client.api.utils.EdmTypeInfo;
+import org.apache.olingo.client.core.edm.v3.EdmActionProxy;
+import org.apache.olingo.client.core.edm.v3.EdmFunctionProxy;
+import org.apache.olingo.client.core.edm.v3.V3FunctionImportUtils;
+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.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;
+
+public class EdmClientImpl extends AbstractEdmImpl {
+
+  private final XMLMetadata xmlMetadata;
+
+  private final EdmServiceMetadata serviceMetadata;
+
+  public EdmClientImpl(final XMLMetadata xmlMetadata) {
+    this.xmlMetadata = xmlMetadata;
+    this.serviceMetadata = AbstractEdmServiceMetadataImpl.getInstance(xmlMetadata);
+  }
+
+  public XMLMetadata getXMLMetadata() {
+    return xmlMetadata;
+  }
+
+  @Override
+  protected EdmServiceMetadata createServiceMetadata() {
+    return serviceMetadata;
+  }
+
+  @Override
+  protected Map<String, String> createAliasToNamespaceInfo() {
+    final Map<String, String> aliasToNamespace = new HashMap<String, String>();
+
+    for (Schema schema : xmlMetadata.getSchemas()) {
+      aliasToNamespace.put(null, schema.getNamespace());
+      if (StringUtils.isNotBlank(schema.getAlias())) {
+        aliasToNamespace.put(schema.getAlias(), schema.getNamespace());
+      }
+    }
+
+    return aliasToNamespace;
+  }
+
+  @Override
+  protected EdmEntityContainer createEntityContainer(final FullQualifiedName containerName) {
+    EdmEntityContainer result = null;
+
+    final Schema schema = xmlMetadata.getSchema(containerName.getNamespace());
+    if (schema != null) {
+      final EntityContainer xmlEntityContainer = schema.getDefaultEntityContainer();
+      if (xmlEntityContainer != null) {
+        result = new EdmEntityContainerImpl(this, containerName, xmlEntityContainer, xmlMetadata);
+      }
+    }
+
+    return result;
+  }
+
+  @Override
+  protected EdmEnumType createEnumType(final FullQualifiedName enumName) {
+    EdmEnumType result = null;
+
+    final Schema schema = xmlMetadata.getSchema(enumName.getNamespace());
+    if (schema != null) {
+      final EnumType xmlEnumType = schema.getEnumType(enumName.getName());
+      if (xmlEnumType != null) {
+        result = new EdmEnumTypeImpl(this, enumName, xmlEnumType);
+      }
+    }
+
+    return result;
+  }
+
+  @Override
+  protected EdmTypeDefinition createTypeDefinition(final FullQualifiedName typeDefinitionName) {
+    EdmTypeDefinition result = null;
+
+    final Schema schema = xmlMetadata.getSchema(typeDefinitionName.getNamespace());
+    if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
+      final TypeDefinition xmlTypeDefinition = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).
+              getTypeDefinition(typeDefinitionName.getName());
+      if (xmlTypeDefinition != null) {
+        result = new EdmTypeDefinitionImpl(this, typeDefinitionName, xmlTypeDefinition);
+      }
+    } else {
+      throw new UnsupportedInV3Exception();
+    }
+
+    return result;
+  }
+
+  @Override
+  protected EdmEntityType createEntityType(final FullQualifiedName entityTypeName) {
+    EdmEntityType result = null;
+
+    final Schema schema = xmlMetadata.getSchema(entityTypeName.getNamespace());
+    final EntityType xmlEntityType = schema.getEntityType(entityTypeName.getName());
+    if (xmlEntityType != null) {
+      result = EdmEntityTypeImpl.getInstance(this, entityTypeName, xmlEntityType);
+    }
+
+    return result;
+  }
+
+  @Override
+  protected EdmComplexType createComplexType(final FullQualifiedName complexTypeName) {
+    EdmComplexType result = null;
+
+    final Schema schema = xmlMetadata.getSchema(complexTypeName.getNamespace());
+    final ComplexType xmlComplexType = schema.getComplexType(complexTypeName.getName());
+    if (xmlComplexType != null) {
+      result = EdmComplexTypeImpl.getInstance(this, complexTypeName, xmlComplexType);
+    }
+
+    return result;
+  }
+
+  @Override
+  protected EdmAction createUnboundAction(final FullQualifiedName actionName) {
+    EdmAction result = null;
+
+    final Schema schema = xmlMetadata.getSchema(actionName.getNamespace());
+    if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
+      final List<Action> actions = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).
+              getActions(actionName.getName());
+      boolean found = false;
+      for (final Iterator<Action> itor = actions.iterator(); itor.hasNext() && !found;) {
+        final Action action = itor.next();
+        if (!action.isBound()) {
+          found = true;
+          result = EdmActionImpl.getInstance(this, actionName, action);
+        }
+      }
+    } else {
+      for (EntityContainer entityContainer : schema.getEntityContainers()) {
+        @SuppressWarnings("unchecked")
+        final List<FunctionImport> functionImports = (List<FunctionImport>) entityContainer.
+                getFunctionImports(actionName.getName());
+        boolean found = false;
+        for (final Iterator<FunctionImport> itor = functionImports.iterator(); itor.hasNext() && !found;) {
+          final FunctionImport functionImport = itor.next();
+          if (!V3FunctionImportUtils.canProxyFunction(functionImport) && !functionImport.isBindable()) {
+            found = functionImport.getParameters().isEmpty();
+            result = EdmActionProxy.getInstance(this, actionName, functionImport);
+          }
+        }
+      }
+    }
+
+    return result;
+  }
+
+  @Override
+  protected EdmFunction createUnboundFunction(final FullQualifiedName functionName, final List<String> parameterNames) {
+    EdmFunction result = null;
+
+    final Schema schema = xmlMetadata.getSchema(functionName.getNamespace());
+    if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
+      final List<Function> functions = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).
+              getFunctions(functionName.getName());
+      boolean found = false;
+      for (final Iterator<Function> itor = functions.iterator(); itor.hasNext() && !found;) {
+        final Function function = itor.next();
+        if (!function.isBound()) {
+          final Set<String> functionParamNames = new HashSet<String>();
+          for (CommonParameter param : function.getParameters()) {
+            functionParamNames.add(param.getName());
+          }
+          found = parameterNames == null
+                  ? functionParamNames.isEmpty()
+                  : functionParamNames.containsAll(parameterNames);
+          result = EdmFunctionImpl.getInstance(this, functionName, function);
+        }
+      }
+    } else {
+      for (EntityContainer entityContainer : schema.getEntityContainers()) {
+        @SuppressWarnings("unchecked")
+        final List<FunctionImport> functionImports = (List<FunctionImport>) entityContainer.
+                getFunctionImports(functionName.getName());
+        boolean found = false;
+        for (final Iterator<FunctionImport> itor = functionImports.iterator(); itor.hasNext() && !found;) {
+          final FunctionImport functionImport = itor.next();
+          if (V3FunctionImportUtils.canProxyFunction(functionImport) && !functionImport.isBindable()) {
+            final Set<String> functionParamNames = new HashSet<String>();
+            for (CommonParameter param : functionImport.getParameters()) {
+              functionParamNames.add(param.getName());
+            }
+            found = parameterNames == null
+                    ? functionParamNames.isEmpty()
+                    : functionParamNames.containsAll(parameterNames);
+            result = EdmFunctionProxy.getInstance(this, functionName, functionImport);
+          }
+        }
+      }
+    }
+
+    return result;
+  }
+
+  @Override
+  protected EdmAction createBoundAction(final FullQualifiedName actionName,
+          final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection) {
+
+    EdmAction result = null;
+
+    final Schema schema = xmlMetadata.getSchema(actionName.getNamespace());
+    if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
+      final List<Action> actions = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).
+              getActions(actionName.getName());
+      boolean found = false;
+      for (final Iterator<Action> itor = actions.iterator(); itor.hasNext() && !found;) {
+        final Action action = itor.next();
+        if (action.isBound()) {
+          final EdmTypeInfo boundParam = new EdmTypeInfo(action.getParameters().get(0).getType());
+          if (bindingParameterTypeName.equals(boundParam.getFullQualifiedName())
+                  && isBindingParameterCollection.booleanValue() == boundParam.isCollection()) {
+
+            found = true;
+            result = EdmActionImpl.getInstance(this, actionName, action);
+          }
+        }
+      }
+    } else {
+      for (EntityContainer entityContainer : schema.getEntityContainers()) {
+        @SuppressWarnings("unchecked")
+        final List<FunctionImport> functionImports = (List<FunctionImport>) entityContainer.
+                getFunctionImports(actionName.getName());
+        boolean found = false;
+        for (final Iterator<FunctionImport> itor = functionImports.iterator(); itor.hasNext() && !found;) {
+          final FunctionImport functionImport = itor.next();
+          if (!V3FunctionImportUtils.canProxyFunction(functionImport) && functionImport.isBindable()) {
+            final EdmTypeInfo boundParam = new EdmTypeInfo(functionImport.getParameters().get(0).getType());
+            if (bindingParameterTypeName.equals(boundParam.getFullQualifiedName())
+                    && isBindingParameterCollection.booleanValue() == boundParam.isCollection()) {
+
+              found = true;
+              result = EdmActionProxy.getInstance(this, actionName, functionImport);
+            }
+          }
+        }
+      }
+    }
+
+    return result;
+  }
+
+  @Override
+  protected EdmFunction createBoundFunction(final FullQualifiedName functionName,
+          final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection,
+          final List<String> parameterNames) {
+
+    EdmFunction result = null;
+
+    final Schema schema = xmlMetadata.getSchema(functionName.getNamespace());
+    if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
+      final List<Function> functions = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).
+              getFunctions(functionName.getName());
+      boolean found = false;
+      for (final Iterator<Function> itor = functions.iterator(); itor.hasNext() && !found;) {
+        final Function function = itor.next();
+        if (function.isBound()) {
+          final EdmTypeInfo boundParam = new EdmTypeInfo(function.getParameters().get(0).getType());
+          if (bindingParameterTypeName.equals(boundParam.getFullQualifiedName())
+                  && isBindingParameterCollection.booleanValue() == boundParam.isCollection()) {
+
+            final Set<String> functionParamNames = new HashSet<String>();
+            for (CommonParameter param : function.getParameters()) {
+              functionParamNames.add(param.getName());
+            }
+            found = parameterNames == null
+                    ? functionParamNames.isEmpty()
+                    : functionParamNames.containsAll(parameterNames);
+            result = EdmFunctionImpl.getInstance(this, functionName, function);
+          }
+        }
+      }
+    } else {
+      for (EntityContainer entityContainer : schema.getEntityContainers()) {
+        @SuppressWarnings("unchecked")
+        final List<FunctionImport> functionImports = (List<FunctionImport>) entityContainer.
+                getFunctionImports(functionName.getName());
+        boolean found = false;
+        for (final Iterator<FunctionImport> itor = functionImports.iterator(); itor.hasNext() && !found;) {
+          final FunctionImport functionImport = itor.next();
+          if (!V3FunctionImportUtils.canProxyFunction(functionImport) && functionImport.isBindable()) {
+            final EdmTypeInfo boundParam = new EdmTypeInfo(functionImport.getParameters().get(0).getType());
+            if (bindingParameterTypeName.equals(boundParam.getFullQualifiedName())
+                    && isBindingParameterCollection.booleanValue() == boundParam.isCollection()) {
+
+              final Set<String> functionParamNames = new HashSet<String>();
+              for (CommonParameter param : functionImport.getParameters()) {
+                functionParamNames.add(param.getName());
+              }
+              found = parameterNames == null
+                      ? functionParamNames.isEmpty()
+                      : functionParamNames.containsAll(parameterNames);
+              result = EdmFunctionProxy.getInstance(this, functionName, functionImport);
+            }
+          }
+        }
+      }
+    }
+
+    return result;
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    return EqualsBuilder.reflectionEquals(this, obj);
+  }
+
+  @Override
+  public int hashCode() {
+    return HashCodeBuilder.reflectionHashCode(this);
+  }
+
+  @Override
+  public String toString() {
+    return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/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
new file mode 100644
index 0000000..7f126f9
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java
@@ -0,0 +1,68 @@
+/*
+ * 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.client.core.edm;
+
+import java.util.Map;
+
+import org.apache.olingo.client.api.edm.xml.ComplexType;
+import org.apache.olingo.client.api.utils.EdmTypeInfo;
+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.core.edm.AbstractEdmComplexType;
+import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper;
+
+public class EdmComplexTypeImpl extends AbstractEdmComplexType {
+
+  private final EdmStructuredTypeHelper helper;
+
+  public static EdmComplexTypeImpl getInstance(final Edm edm, final FullQualifiedName fqn,
+          final ComplexType complexType) {
+
+    FullQualifiedName baseTypeName = null;
+    if (complexType instanceof org.apache.olingo.client.api.edm.xml.v4.ComplexType) {
+      final String baseType = ((org.apache.olingo.client.api.edm.xml.v4.ComplexType) complexType).getBaseType();
+      baseTypeName = baseType == null
+              ? null : new EdmTypeInfo(baseType).getFullQualifiedName();
+    }
+    final EdmComplexTypeImpl instance = new EdmComplexTypeImpl(edm, fqn, baseTypeName, complexType);
+    instance.baseType = instance.buildBaseType(baseTypeName);
+
+    return instance;
+  }
+
+  private EdmComplexTypeImpl(final Edm edm, final FullQualifiedName fqn, final FullQualifiedName baseTypeName,
+          final ComplexType complexType) {
+
+    super(edm, fqn, baseTypeName);
+    this.helper = new EdmStructuredTypeHelperImpl(edm, complexType);
+  }
+
+  @Override
+  protected Map<String, EdmProperty> getProperties() {
+    return helper.getProperties();
+  }
+
+  @Override
+  protected Map<String, EdmNavigationProperty> getNavigationProperties() {
+    return helper.getNavigationProperties();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
new file mode 100644
index 0000000..fdbbed2
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
@@ -0,0 +1,125 @@
+/*
+ * 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.client.core.edm;
+
+import org.apache.olingo.client.api.UnsupportedInV3Exception;
+import org.apache.olingo.client.api.edm.xml.CommonFunctionImport;
+import org.apache.olingo.client.api.edm.xml.EntityContainer;
+import org.apache.olingo.client.api.edm.xml.EntitySet;
+import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
+import org.apache.olingo.client.api.edm.xml.v4.ActionImport;
+import org.apache.olingo.client.api.edm.xml.v4.Singleton;
+import org.apache.olingo.client.api.utils.EdmTypeInfo;
+import org.apache.olingo.client.core.edm.v3.EdmActionImportProxy;
+import org.apache.olingo.client.core.edm.v3.EdmEntitySetProxy;
+import org.apache.olingo.client.core.edm.v3.EdmFunctionImportProxy;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmActionImport;
+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.FullQualifiedName;
+import org.apache.olingo.commons.core.edm.AbstractEdmEntityContainer;
+
+public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
+
+  private final EntityContainer xmlEntityContainer;
+
+  private final XMLMetadata xmlMetadata;
+
+  public EdmEntityContainerImpl(final Edm edm, final FullQualifiedName entityContainerName,
+          final EntityContainer xmlEntityContainer, final XMLMetadata xmlMetadata) {
+
+    super(edm, entityContainerName);
+
+    this.xmlEntityContainer = xmlEntityContainer;
+    this.xmlMetadata = xmlMetadata;
+  }
+
+  @Override
+  protected EdmSingleton createSingleton(final String singletonName) {
+    if (!(xmlEntityContainer instanceof org.apache.olingo.client.api.edm.xml.v4.EntityContainer)) {
+      throw new UnsupportedInV3Exception();
+    }
+
+    final Singleton singleton = ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer).
+            getSingleton(singletonName);
+    if (singleton == null) {
+      throw new EdmException("Singleton named '" + singletonName + "' not found in " + entityContainerName);
+    }
+    return new EdmSingletonImpl(edm, this, singletonName,
+            new EdmTypeInfo(singleton.getEntityType(), entityContainerName.getNamespace()).getFullQualifiedName(),
+            singleton);
+  }
+
+  @Override
+  protected EdmEntitySet createEntitySet(final String entitySetName) {
+    final EntitySet entitySet = xmlEntityContainer.getEntitySet(entitySetName);
+    if (entitySet == null) {
+      throw new EdmException("EntitySet named '" + entitySetName + "' not found in " + entityContainerName);
+    }
+
+    if (entitySet instanceof org.apache.olingo.client.api.edm.xml.v4.EntitySet) {
+      return new EdmEntitySetImpl(edm, this, entitySetName,
+              new EdmTypeInfo(entitySet.getEntityType(), entityContainerName.getNamespace()).getFullQualifiedName(),
+              (org.apache.olingo.client.api.edm.xml.v4.EntitySet) entitySet);
+    } else {
+      return new EdmEntitySetProxy(edm, this, entitySetName,
+              new EdmTypeInfo(entitySet.getEntityType(), entityContainerName.getNamespace()).getFullQualifiedName(),
+              xmlMetadata);
+    }
+  }
+
+  @Override
+  protected EdmActionImport createActionImport(final String actionImportName) {
+    if (xmlEntityContainer instanceof org.apache.olingo.client.api.edm.xml.v4.EntityContainer) {
+      final ActionImport actionImport
+              = ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer).
+              getActionImport(actionImportName);
+      if (actionImport == null) {
+        throw new EdmException("ActionImport named '" + actionImportName + "' not found in " + entityContainerName);
+      }
+      return new EdmActionImportImpl(edm, this, actionImportName, actionImport);
+    } else {
+      final FunctionImport functionImport = (FunctionImport) xmlEntityContainer.getFunctionImport(actionImportName);
+      if (functionImport == null) {
+        throw new EdmException("FunctionImport named '" + actionImportName + "' not found in " + entityContainerName);
+      }
+      return new EdmActionImportProxy(edm, this, actionImportName, functionImport);
+    }
+  }
+
+  @Override
+  protected EdmFunctionImport createFunctionImport(final String functionImportName) {
+    final CommonFunctionImport functionImport = xmlEntityContainer.getFunctionImport(functionImportName);
+    if (functionImport == null) {
+      throw new EdmException("FunctionImport named '" + functionImportName + "' not found in " + entityContainerName);
+    }
+
+    if (functionImport instanceof org.apache.olingo.client.api.edm.xml.v4.FunctionImport) {
+      return new EdmFunctionImportImpl(edm, this, functionImportName,
+              (org.apache.olingo.client.api.edm.xml.v4.FunctionImport) functionImport);
+    } else {
+      return new EdmFunctionImportProxy(edm, this, functionImportName,
+              (org.apache.olingo.client.api.edm.xml.v3.FunctionImport) functionImport);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntitySetImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntitySetImpl.java
new file mode 100644
index 0000000..3708a45
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntitySetImpl.java
@@ -0,0 +1,35 @@
+/*
+ * 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.client.core.edm;
+
+import org.apache.olingo.client.api.edm.xml.v4.EntitySet;
+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.FullQualifiedName;
+
+public class EdmEntitySetImpl extends EdmBindingTargetImpl implements EdmEntitySet {
+
+  public EdmEntitySetImpl(final Edm edm, final EdmEntityContainer container, final String name,
+          final FullQualifiedName type, final EntitySet entitySet) {
+
+    super(edm, container, name, type, entitySet);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/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
new file mode 100644
index 0000000..218c5cb
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
@@ -0,0 +1,80 @@
+/*
+ * 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.client.core.edm;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.client.api.edm.xml.EntityType;
+import org.apache.olingo.client.api.edm.xml.PropertyRef;
+import org.apache.olingo.client.api.utils.EdmTypeInfo;
+import org.apache.olingo.commons.api.edm.Edm;
+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.FullQualifiedName;
+import org.apache.olingo.commons.core.edm.AbstractEdmEntityType;
+import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper;
+
+public class EdmEntityTypeImpl extends AbstractEdmEntityType {
+
+  private final EdmStructuredTypeHelper helper;
+
+  public static EdmEntityTypeImpl getInstance(final Edm edm, final FullQualifiedName fqn, final EntityType entityType) {
+    final FullQualifiedName baseTypeName = entityType.getBaseType() == null
+            ? null : new EdmTypeInfo(entityType.getBaseType()).getFullQualifiedName();
+    final EdmEntityTypeImpl instance = new EdmEntityTypeImpl(edm, fqn, baseTypeName, entityType);
+    instance.baseType = instance.buildBaseType(baseTypeName);
+
+    if (instance.baseType == null) {
+      instance.entityBaseType = null;
+
+      final List<EdmKeyPropertyRef> edmKey = new ArrayList<EdmKeyPropertyRef>(
+              entityType.getKey().getPropertyRefs().size());
+      for (PropertyRef ref : entityType.getKey().getPropertyRefs()) {
+        edmKey.add(new EdmKeyPropertyRefImpl(instance, ref));
+      }
+      instance.setEdmKeyPropertyRef(edmKey);
+    } else {
+      instance.entityBaseType = (EdmEntityType) instance.baseType;
+    }
+
+    return instance;
+  }
+
+  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);
+  }
+
+  @Override
+  protected Map<String, EdmProperty> getProperties() {
+    return helper.getProperties();
+  }
+
+  @Override
+  protected Map<String, EdmNavigationProperty> getNavigationProperties() {
+    return helper.getNavigationProperties();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java
new file mode 100644
index 0000000..3260802
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.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.client.core.edm;
+
+import org.apache.olingo.client.api.edm.xml.EnumType;
+import org.apache.olingo.client.api.edm.xml.Member;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmMember;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.core.edm.AbstractEdmEnumType;
+import org.apache.olingo.commons.core.edm.EdmMemberImpl;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType {
+
+  private final EdmPrimitiveType underlyingType;
+
+  private final List<String> memberNames;
+
+  private final Map<String, EdmMember> members;
+
+  public EdmEnumTypeImpl(final Edm edm, final FullQualifiedName fqn, final EnumType xmlEnumType) {
+    super(edm, fqn, xmlEnumType.isFlags());
+
+    if (xmlEnumType.getUnderlyingType() == null) {
+      this.underlyingType = EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance();
+    } else {
+      this.underlyingType = EdmPrimitiveTypeKind.fromString(
+              xmlEnumType.getUnderlyingType()).getEdmPrimitiveTypeInstance();
+      // TODO: Should we validate that the underlying type is of byte, sbyte, in16, int32 or int64?
+    }
+
+    final List<? extends Member> xmlMembers = xmlEnumType.getMembers();
+    final List<String> _memberNames = new ArrayList<String>();
+    final Map<String, EdmMember> _members = new LinkedHashMap<String, EdmMember>(xmlMembers.size());
+    for (Member xmlMember : xmlMembers) {
+      _memberNames.add(xmlMember.getName());
+      _members.put(xmlMember.getName(), new EdmMemberImpl(edm, xmlMember.getName(), xmlMember.getValue()));
+    }
+    this.memberNames = Collections.unmodifiableList(_memberNames);
+    this.members = Collections.unmodifiableMap(_members);
+  }
+
+  @Override
+  public EdmPrimitiveType getUnderlyingType() {
+    return underlyingType;
+  }
+
+  @Override
+  public List<String> getMemberNames() {
+    return memberNames;
+  }
+
+  @Override
+  protected Collection<? extends EdmMember> getMembers() {
+    return members.values();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImpl.java
new file mode 100644
index 0000000..d2831fc
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImpl.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.client.core.edm;
+
+import org.apache.olingo.client.api.edm.xml.v4.Function;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmFunction;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+
+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();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImportImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImportImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImportImpl.java
new file mode 100644
index 0000000..d3004cb
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImportImpl.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.client.core.edm;
+
+import java.util.List;
+
+import org.apache.olingo.client.api.edm.xml.v4.FunctionImport;
+import org.apache.olingo.client.api.utils.EdmTypeInfo;
+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;
+
+public class EdmFunctionImportImpl extends EdmOperationImportImpl implements EdmFunctionImport {
+
+  private final FunctionImport functionImport;
+
+  public EdmFunctionImportImpl(final Edm edm, final EdmEntityContainer container, final String name,
+          final FunctionImport functionImport) {
+
+    super(edm, container, name, functionImport.getEntitySet());
+    this.functionImport = functionImport;
+  }
+
+  @Override
+  public EdmFunction getFunction(final List<String> parameterNames) {
+    return edm.getFunction(
+            new EdmTypeInfo(functionImport.getFunction(), container.getNamespace()).getFullQualifiedName(),
+            null, null, parameterNames);
+  }
+
+}

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

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
new file mode 100644
index 0000000..cab0297
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
@@ -0,0 +1,75 @@
+/*
+ * 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.client.core.edm;
+
+import java.util.List;
+
+import org.apache.olingo.client.api.edm.xml.v4.NavigationProperty;
+import org.apache.olingo.client.api.edm.xml.v4.ReferentialConstraint;
+import org.apache.olingo.client.api.utils.EdmTypeInfo;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.core.edm.AbstractEdmNavigationProperty;
+
+public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty {
+
+  private final NavigationProperty navigationProperty;
+
+  private final EdmTypeInfo edmTypeInfo;
+
+  public EdmNavigationPropertyImpl(final Edm edm, final NavigationProperty navigationProperty) {
+    super(edm, navigationProperty.getName());
+    this.navigationProperty = navigationProperty;
+    this.edmTypeInfo = new EdmTypeInfo(navigationProperty.getType());
+  }
+
+  @Override
+  protected FullQualifiedName getTypeFQN() {
+    return edmTypeInfo.getFullQualifiedName();
+  }
+
+  @Override
+  protected String internatGetPartner() {
+    return navigationProperty.getPartner();
+  }
+
+  @Override
+  public boolean isCollection() {
+    return edmTypeInfo.isCollection();
+  }
+
+  @Override
+  public Boolean isNullable() {
+    return navigationProperty.isNullable();
+  }
+
+  @Override
+  public String getReferencingPropertyName(final String referencedPropertyName) {
+    final List<? extends ReferentialConstraint> referentialConstraints = navigationProperty.getReferentialConstraints();
+    if (referentialConstraints != null) {
+      for (ReferentialConstraint constraint : referentialConstraints) {
+        if (constraint.getReferencedProperty().equals(referencedPropertyName)) {
+          return constraint.getProperty();
+        }
+      }
+    }
+    return null;
+  }
+
+}