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:03:05 UTC

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

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
new file mode 100644
index 0000000..b25a213
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
@@ -0,0 +1,488 @@
+/*
+ * 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.api.domain;
+
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.domain.geospatial.Geospatial;
+import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
+import org.apache.olingo.client.api.domain.geospatial.LineString;
+import org.apache.olingo.client.api.domain.geospatial.MultiLineString;
+import org.apache.olingo.client.api.domain.geospatial.MultiPoint;
+import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
+import org.apache.olingo.client.api.domain.geospatial.Point;
+import org.apache.olingo.client.api.domain.geospatial.Polygon;
+import org.apache.olingo.client.api.utils.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class ODataGeospatialValue extends ODataPrimitiveValue {
+
+  private static final long serialVersionUID = -3984105137562291082L;
+
+  /**
+   * Geospatial value builder.
+   */
+  public static class Builder extends AbstractBuilder {
+
+    private final ODataGeospatialValue ogv;
+
+    /**
+     * Constructor.
+     */
+    public Builder(final ODataClient client) {
+      super(client);
+      this.ogv = new ODataGeospatialValue(client);
+    }
+
+    /**
+     * Sets the given value provided as a DOM tree.
+     *
+     * @param tree value.
+     * @return the current builder.
+     */
+    public Builder setTree(final Element tree) {
+      this.ogv.tree = tree;
+      return this;
+    }
+
+    /**
+     * Sets the actual object value.
+     *
+     * @param value value.
+     * @return the current builder.
+     */
+    public <T extends Geospatial> Builder setValue(final T value) {
+      this.ogv.value = value;
+      return this;
+    }
+
+    /**
+     * Sets actual value type.
+     *
+     * @param type type.
+     * @return the current builder.
+     */
+    public Builder setType(final EdmSimpleType type) {
+      isSupported(type);
+
+      if (!type.isGeospatial()) {
+        throw new IllegalArgumentException(
+                "Use " + ODataPrimitiveValue.class.getSimpleName() + " for non-geospatial types");
+      }
+
+      if (type == EdmSimpleType.Geography || type == EdmSimpleType.Geometry) {
+        throw new IllegalArgumentException(
+                type + "is not an instantiable type. "
+                + "An entity can declare a property to be of type Geometry. "
+                + "An instance of an entity MUST NOT have a value of type Geometry. "
+                + "Each value MUST be of some subtype.");
+      }
+      this.ogv.type = type;
+      return this;
+    }
+
+    /**
+     * Builds the geospatial value.
+     *
+     * @return <tt>ODataGeospatialValue</tt> object.
+     */
+    public ODataGeospatialValue build() {
+      if (this.ogv.tree == null && this.ogv.value == null) {
+        throw new IllegalArgumentException("Must provide either tree or value");
+      }
+      if (this.ogv.tree != null && this.ogv.value != null) {
+        throw new IllegalArgumentException("Cannot provide both tree and value");
+      }
+
+      if (this.ogv.type == null) {
+        throw new IllegalArgumentException("Must provide geospatial type");
+      }
+
+      if (this.ogv.tree != null) {
+        this.ogv.value = this.ogv.parseTree(this.ogv.tree, this.ogv.type);
+      }
+      if (this.ogv.value != null) {
+        this.ogv.tree = this.ogv.parseGeospatial((Geospatial) this.ogv.value);
+      }
+
+      return this.ogv;
+    }
+  }
+
+  /**
+   * DOM tree.
+   */
+  private Element tree;
+
+  /**
+   * Protected constructor, need to use the builder to instantiate this class.
+   *
+   * @see Builder
+   */
+  protected ODataGeospatialValue(final ODataClient client) {
+    super(client);
+  }
+
+  private Geospatial.Dimension getDimension() {
+    Geospatial.Dimension dimension;
+
+    switch (this.type) {
+      case Geography:
+      case GeographyCollection:
+      case GeographyLineString:
+      case GeographyMultiLineString:
+      case GeographyPoint:
+      case GeographyMultiPoint:
+      case GeographyPolygon:
+      case GeographyMultiPolygon:
+        dimension = Geospatial.Dimension.GEOGRAPHY;
+        break;
+
+      default:
+        dimension = Geospatial.Dimension.GEOMETRY;
+    }
+
+    return dimension;
+  }
+
+  private List<Point> parsePoints(final NodeList posList) {
+    final List<Point> result = new ArrayList<Point>();
+    for (int i = 0; i < posList.getLength(); i++) {
+      final String[] pointInfo = posList.item(i).getTextContent().split(" ");
+      final Point point = new Point(getDimension());
+      point.setX(Double.valueOf(pointInfo[0]));
+      point.setY(Double.valueOf(pointInfo[1]));
+
+      result.add(point);
+    }
+    return result;
+  }
+
+  private LineString parseLineString(final Element element) {
+    return new LineString(getDimension(),
+            parsePoints(element.getElementsByTagName(Constants.ELEM_POS)));
+  }
+
+  private Polygon parsePolygon(final Element element) {
+    List<Point> extPoints = null;
+    final Element exterior
+            = (Element) element.getElementsByTagName(Constants.ELEM_POLYGON_EXTERIOR).item(0);
+    if (exterior != null) {
+      extPoints = parsePoints(
+              ((Element) exterior.getElementsByTagName(Constants.ELEM_POLYGON_LINEARRING).item(0)).
+              getElementsByTagName(Constants.ELEM_POS));
+    }
+    List<Point> intPoints = null;
+    final Element interior
+            = (Element) element.getElementsByTagName(Constants.ELEM_POLYGON_INTERIOR).item(0);
+    if (interior != null) {
+      intPoints = parsePoints(
+              ((Element) interior.getElementsByTagName(Constants.ELEM_POLYGON_LINEARRING).item(0)).
+              getElementsByTagName(Constants.ELEM_POS));
+    }
+
+    return new Polygon(getDimension(), intPoints, extPoints);
+  }
+
+  /**
+   * Parses given tree as geospatial value.
+   */
+  private Geospatial parseTree(final Element tree, final EdmSimpleType type) {
+    Geospatial value;
+
+    switch (type) {
+      case GeographyPoint:
+      case GeometryPoint:
+        value = parsePoints(tree.getElementsByTagName(Constants.ELEM_POS)).get(0);
+        break;
+
+      case GeographyMultiPoint:
+      case GeometryMultiPoint:
+        final Element pMembs
+                = (Element) tree.getElementsByTagName(Constants.ELEM_POINTMEMBERS).item(0);
+        final List<Point> points = pMembs == null
+                ? Collections.<Point>emptyList()
+                : parsePoints(pMembs.getElementsByTagName(Constants.ELEM_POS));
+        value = new MultiPoint(getDimension(), points);
+        break;
+
+      case GeographyLineString:
+      case GeometryLineString:
+        value = parseLineString(tree);
+        break;
+
+      case GeographyMultiLineString:
+      case GeometryMultiLineString:
+        final Element mlMembs
+                = (Element) tree.getElementsByTagName(Constants.ELEM_LINESTRINGMEMBERS).item(0);
+        final List<LineString> lineStrings;
+        if (mlMembs == null) {
+          lineStrings = Collections.<LineString>emptyList();
+        } else {
+          lineStrings = new ArrayList<LineString>();
+          final NodeList lineStringNodes = mlMembs.getElementsByTagName(Constants.ELEM_LINESTRING);
+          for (int i = 0; i < lineStringNodes.getLength(); i++) {
+            lineStrings.add(parseLineString((Element) lineStringNodes.item(i)));
+          }
+        }
+        value = new MultiLineString(getDimension(), lineStrings);
+        break;
+
+      case GeographyPolygon:
+      case GeometryPolygon:
+        value = parsePolygon(tree);
+        break;
+
+      case GeographyMultiPolygon:
+      case GeometryMultiPolygon:
+        final Element mpMembs
+                = (Element) tree.getElementsByTagName(Constants.ELEM_SURFACEMEMBERS).item(0);
+        final List<Polygon> polygons;
+        if (mpMembs == null) {
+          polygons = Collections.<Polygon>emptyList();
+        } else {
+          polygons = new ArrayList<Polygon>();
+          final NodeList polygonNodes = mpMembs.getElementsByTagName(Constants.ELEM_POLYGON);
+          for (int i = 0; i < polygonNodes.getLength(); i++) {
+            polygons.add(parsePolygon((Element) polygonNodes.item(i)));
+          }
+        }
+        value = new MultiPolygon(getDimension(), polygons);
+        break;
+
+      case GeographyCollection:
+      case GeometryCollection:
+        final Element cMembs
+                = (Element) tree.getElementsByTagName(Constants.ELEM_GEOMEMBERS).item(0);
+        final List<Geospatial> geospatials;
+        if (cMembs == null) {
+          geospatials = Collections.<Geospatial>emptyList();
+        } else {
+          geospatials = new ArrayList<Geospatial>();
+          for (Node geom : XMLUtils.getChildNodes(cMembs, Node.ELEMENT_NODE)) {
+            geospatials.add(parseTree((Element) geom, XMLUtils.simpleTypeForNode(getDimension(), geom)));
+          }
+        }
+        value = new GeospatialCollection(getDimension(), geospatials);
+        break;
+
+      default:
+        value = null;
+    }
+
+    return value;
+  }
+
+  private void parsePoints(final Element parent, final Iterator<Point> itor, final boolean wrap) {
+    while (itor.hasNext()) {
+      final Point point = itor.next();
+
+      final Element pos = parent.getOwnerDocument().
+              createElementNS(Constants.NS_GML, Constants.ELEM_POS);
+      pos.appendChild(parent.getOwnerDocument().createTextNode(
+              Double.toString(point.getX()) + " " + point.getY()));
+
+      final Element appendable;
+      if (wrap) {
+        final Element epoint = parent.getOwnerDocument().
+                createElementNS(Constants.NS_GML, Constants.ELEM_POINT);
+        parent.appendChild(epoint);
+        appendable = epoint;
+      } else {
+        appendable = parent;
+      }
+      appendable.appendChild(pos);
+    }
+  }
+
+  private void parseLineStrings(final Element parent, final Iterator<LineString> itor, final boolean wrap) {
+    while (itor.hasNext()) {
+      final LineString lineString = itor.next();
+
+      final Element appendable;
+      if (wrap) {
+        final Element eLineString = parent.getOwnerDocument().
+                createElementNS(Constants.NS_GML, Constants.ELEM_LINESTRING);
+        parent.appendChild(eLineString);
+        appendable = eLineString;
+      } else {
+        appendable = parent;
+      }
+      parsePoints(appendable, lineString.iterator(), false);
+    }
+  }
+
+  private void parsePolygons(final Element parent, final Iterator<Polygon> itor, final boolean wrap) {
+    while (itor.hasNext()) {
+      final Polygon polygon = itor.next();
+
+      final Element appendable;
+      if (wrap) {
+        final Element ePolygon = parent.getOwnerDocument().createElementNS(
+                Constants.NS_GML, Constants.ELEM_POLYGON);
+        parent.appendChild(ePolygon);
+        appendable = ePolygon;
+      } else {
+        appendable = parent;
+      }
+
+      if (!polygon.getExterior().isEmpty()) {
+        final Element exterior = parent.getOwnerDocument().createElementNS(
+                Constants.NS_GML, Constants.ELEM_POLYGON_EXTERIOR);
+        appendable.appendChild(exterior);
+        final Element linearRing = parent.getOwnerDocument().createElementNS(
+                Constants.NS_GML, Constants.ELEM_POLYGON_LINEARRING);
+        exterior.appendChild(linearRing);
+
+        parsePoints(linearRing, polygon.getExterior().iterator(), false);
+      }
+      if (!polygon.getInterior().isEmpty()) {
+        final Element interior = parent.getOwnerDocument().createElementNS(
+                Constants.NS_GML, Constants.ELEM_POLYGON_INTERIOR);
+        appendable.appendChild(interior);
+        final Element linearRing = parent.getOwnerDocument().createElementNS(
+                Constants.NS_GML, Constants.ELEM_POLYGON_LINEARRING);
+        interior.appendChild(linearRing);
+
+        parsePoints(linearRing, polygon.getInterior().iterator(), false);
+      }
+    }
+  }
+
+  private Element parseGeospatial(final Geospatial value) {
+    final DocumentBuilder builder;
+    try {
+      builder = XMLUtils.DOC_BUILDER_FACTORY.newDocumentBuilder();
+    } catch (ParserConfigurationException e) {
+      throw new IllegalStateException("Failure initializing Geospatial DOM tree", e);
+    }
+    final Document doc = builder.newDocument();
+
+    final Element tree;
+
+    switch (value.getEdmSimpleType()) {
+      case GeographyPoint:
+      case GeometryPoint:
+        tree = doc.createElementNS(Constants.NS_GML, Constants.ELEM_POINT);
+
+        parsePoints(tree, Collections.singleton((Point) value).iterator(), false);
+        break;
+
+      case GeometryMultiPoint:
+      case GeographyMultiPoint:
+        tree = doc.createElementNS(Constants.NS_GML, Constants.ELEM_MULTIPOINT);
+
+        final Element pMembs = doc.createElementNS(Constants.NS_GML, Constants.ELEM_POINTMEMBERS);
+        tree.appendChild(pMembs);
+
+        parsePoints(pMembs, ((MultiPoint) value).iterator(), true);
+        break;
+
+      case GeometryLineString:
+      case GeographyLineString:
+        tree = doc.createElementNS(Constants.NS_GML, Constants.ELEM_LINESTRING);
+
+        parseLineStrings(tree, Collections.singleton((LineString) value).iterator(), false);
+        break;
+
+      case GeometryMultiLineString:
+      case GeographyMultiLineString:
+        tree = doc.createElementNS(Constants.NS_GML, Constants.ELEM_MULTILINESTRING);
+
+        final Element mlMembs
+                = doc.createElementNS(Constants.NS_GML, Constants.ELEM_LINESTRINGMEMBERS);
+        tree.appendChild(mlMembs);
+
+        parseLineStrings(mlMembs, ((MultiLineString) value).iterator(), true);
+        break;
+
+      case GeographyPolygon:
+      case GeometryPolygon:
+        tree = doc.createElementNS(Constants.NS_GML, Constants.ELEM_POLYGON);
+        parsePolygons(tree, Collections.singleton(((Polygon) value)).iterator(), false);
+        break;
+
+      case GeographyMultiPolygon:
+      case GeometryMultiPolygon:
+        tree = doc.createElementNS(Constants.NS_GML, Constants.ELEM_MULTIPOLYGON);
+
+        final Element mpMembs
+                = doc.createElementNS(Constants.NS_GML, Constants.ELEM_SURFACEMEMBERS);
+        tree.appendChild(mpMembs);
+
+        parsePolygons(mpMembs, ((MultiPolygon) value).iterator(), true);
+        break;
+
+      case GeographyCollection:
+      case GeometryCollection:
+        tree = doc.createElementNS(Constants.NS_GML, Constants.ELEM_GEOCOLLECTION);
+
+        final Element gMembs
+                = doc.createElementNS(Constants.NS_GML, Constants.ELEM_GEOMEMBERS);
+        tree.appendChild(gMembs);
+
+        final Iterator<Geospatial> itor = ((GeospatialCollection) value).iterator();
+        while (itor.hasNext()) {
+          final Geospatial geospatial = itor.next();
+          gMembs.appendChild(doc.importNode(parseGeospatial(geospatial), true));
+        }
+        break;
+
+      default:
+        tree = null;
+    }
+
+    return tree;
+  }
+
+  public Element toTree() {
+    return this.tree;
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    if (obj == null) {
+      return false;
+    }
+    if (getClass() != obj.getClass()) {
+      return false;
+    }
+    final ODataGeospatialValue other = (ODataGeospatialValue) obj;
+    return this.tree.isEqualNode(other.tree);
+  }
+
+  @Override
+  public String toString() {
+    final StringWriter writer = new StringWriter();
+    client.getSerializer().dom(this.tree, writer);
+    return writer.toString();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataInvokeResult.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataInvokeResult.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataInvokeResult.java
new file mode 100644
index 0000000..c55dfe6
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataInvokeResult.java
@@ -0,0 +1,30 @@
+/*
+ * 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.api.domain;
+
+/**
+ * Marker interface for any OData domain object that can be returned by an operation invocation.
+ *
+ * @see ODataEntitySet
+ * @see ODataEntity
+ * @see ODataProperty
+ * @see ODataNoContent
+ */
+public interface ODataInvokeResult {
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
new file mode 100644
index 0000000..8a4b05d
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
@@ -0,0 +1,378 @@
+/*
+ * 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.api.domain;
+
+import java.math.BigDecimal;
+import java.net.URI;
+import java.sql.Timestamp;
+import java.text.DecimalFormat;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.xml.datatype.Duration;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.domain.EdmSimpleType;
+import org.apache.olingo.client.api.domain.ODataDuration;
+import org.apache.olingo.client.api.domain.ODataTimestamp;
+import org.apache.olingo.client.api.domain.ODataValue;
+
+/**
+ * OData primitive property value.
+ */
+public class ODataPrimitiveValue extends ODataValue {
+
+  private static final long serialVersionUID = 2841837627899878223L;
+
+  protected abstract static class AbstractBuilder {
+
+    private final ODataClient client;
+
+    /**
+     * Constructor.
+     */
+    public AbstractBuilder(final ODataClient client) {
+      this.client = client;
+    }
+
+    public AbstractBuilder isSupported(final EdmSimpleType type) {
+      if (type != null && !ArrayUtils.contains(type.getSupportedVersions(), client.getServiceVersion())) {
+        throw new IllegalArgumentException(String.format(
+                "Type %s not supported by the current OData working version", type.toString()));
+      }
+
+      return this;
+    }
+  }
+
+  /**
+   * Primitive value builder.
+   */
+  public static class Builder extends AbstractBuilder {
+
+    private final ODataPrimitiveValue opv;
+
+    /**
+     * Constructor.
+     */
+    public Builder(final ODataClient client) {
+      super(client);
+      this.opv = new ODataPrimitiveValue(client);
+    }
+
+    /**
+     * Sets the given value provided as a text.
+     *
+     * @param text value.
+     * @return the current builder.
+     */
+    public Builder setText(final String text) {
+      this.opv.text = text;
+      return this;
+    }
+
+    /**
+     * Sets the actual object value.
+     *
+     * @param value value.
+     * @return the current builder.
+     */
+    public Builder setValue(final Object value) {
+      this.opv.value = value;
+      return this;
+    }
+
+    /**
+     * Sets actual value type.
+     *
+     * @param type type.
+     * @return the current builder.
+     */
+    public Builder setType(final EdmSimpleType type) {
+      isSupported(type);
+
+      if (type == EdmSimpleType.Stream) {
+        throw new IllegalArgumentException(String.format(
+                "Cannot build a primitive value for %s", EdmSimpleType.Stream.toString()));
+      }
+
+      this.opv.type = type;
+      return this;
+    }
+
+    /**
+     * Builds the primitive value.
+     *
+     * @return <code>ODataPrimitiveValue</code> object.
+     */
+    public ODataPrimitiveValue build() {
+      if (this.opv.text == null && this.opv.value == null) {
+        throw new IllegalArgumentException("Must provide either text or value");
+      }
+      if (this.opv.text != null && this.opv.value != null) {
+        throw new IllegalArgumentException("Cannot provide both text and value");
+      }
+
+      if (this.opv.type == null) {
+        this.opv.type = EdmSimpleType.String;
+      }
+
+      if (this.opv.type.isGeospatial()) {
+        throw new IllegalArgumentException(
+                "Use " + ODataGeospatialValue.class.getSimpleName() + " for geospatial types");
+      }
+
+      if (this.opv.value instanceof Timestamp) {
+        this.opv.value = ODataTimestamp.getInstance(this.opv.type, (Timestamp) this.opv.value);
+      } else if (this.opv.value instanceof Date) {
+        this.opv.value = ODataTimestamp.getInstance(this.opv.type,
+                new Timestamp(((Date) this.opv.value).getTime()));
+      }
+      if (this.opv.value instanceof Duration) {
+        this.opv.value = new ODataDuration((Duration) this.opv.value);
+      }
+
+      if (this.opv.value != null && !this.opv.type.javaType().isAssignableFrom(this.opv.value.getClass())) {
+        throw new IllegalArgumentException("Provided value is not compatible with " + this.opv.type.toString());
+      }
+
+      if (this.opv.text != null) {
+        this.opv.parseText();
+      }
+      if (this.opv.value != null) {
+        this.opv.formatValue();
+      }
+
+      return this.opv;
+    }
+  }
+
+  protected ODataClient client;
+
+  /**
+   * Text value.
+   */
+  private String text;
+
+  /**
+   * Actual value.
+   */
+  protected Object value;
+
+  /**
+   * Value type.
+   */
+  protected EdmSimpleType type;
+
+  /**
+   * Protected constructor, need to use the builder to instantiate this class.
+   *
+   * @see Builder
+   */
+  protected ODataPrimitiveValue(final ODataClient client) {
+    super();
+    this.client = client;
+  }
+
+  /**
+   * Parses given text as object value.
+   */
+  private void parseText() {
+    switch (this.type) {
+      case Null:
+        this.value = null;
+        break;
+
+      case Binary:
+        this.value = Base64.decodeBase64(this.toString());
+        break;
+
+      case SByte:
+        this.value = Byte.parseByte(this.toString());
+        break;
+
+      case Boolean:
+        this.value = Boolean.parseBoolean(this.toString());
+        break;
+
+      case Date:
+      case DateTime:
+      case DateTimeOffset:
+        this.value = ODataTimestamp.parse(this.type, this.toString());
+        break;
+
+      case Time:
+      case TimeOfDay:
+        this.value = new ODataDuration(this.toString());
+        break;
+
+      case Decimal:
+        this.value = new BigDecimal(this.toString());
+        break;
+
+      case Single:
+        this.value = Float.parseFloat(this.toString());
+        break;
+
+      case Double:
+        this.value = Double.parseDouble(this.toString());
+        break;
+
+      case Guid:
+        this.value = UUID.fromString(this.toString());
+        break;
+
+      case Int16:
+        this.value = Short.parseShort(this.toString());
+        break;
+
+      case Byte:
+      case Int32:
+        this.value = Integer.parseInt(this.toString());
+        break;
+
+      case Int64:
+        this.value = Long.parseLong(this.toString());
+        break;
+
+      case Stream:
+        this.value = URI.create(this.toString());
+        break;
+
+      case String:
+        this.value = this.toString();
+        break;
+
+      default:
+    }
+  }
+
+  /**
+   * Format given value as text.
+   */
+  private void formatValue() {
+    switch (this.type) {
+      case Null:
+        this.text = StringUtils.EMPTY;
+        break;
+
+      case Binary:
+        this.text = Base64.encodeBase64String(this.<byte[]>toCastValue());
+        break;
+
+      case SByte:
+        this.text = this.<Byte>toCastValue().toString();
+        break;
+
+      case Boolean:
+        this.text = this.<Boolean>toCastValue().toString();
+        break;
+
+      case Date:
+      case DateTime:
+      case DateTimeOffset:
+        this.text = this.<ODataTimestamp>toCastValue().toString();
+        break;
+
+      case Time:
+      case TimeOfDay:
+        this.text = this.<ODataDuration>toCastValue().toString();
+        break;
+
+      case Decimal:
+        this.text = new DecimalFormat(this.type.pattern()).format(this.<BigDecimal>toCastValue());
+        break;
+
+      case Single:
+        this.text = new DecimalFormat(this.type.pattern()).format(this.<Float>toCastValue());
+        break;
+
+      case Double:
+        this.text = new DecimalFormat(this.type.pattern()).format(this.<Double>toCastValue());
+        break;
+
+      case Guid:
+        this.text = this.<UUID>toCastValue().toString();
+        break;
+
+      case Int16:
+        this.text = this.<Short>toCastValue().toString();
+        break;
+
+      case Byte:
+      case Int32:
+        this.text = this.<Integer>toCastValue().toString();
+        break;
+
+      case Int64:
+        this.text = this.<Long>toCastValue().toString();
+        break;
+
+      case Stream:
+        this.text = this.<URI>toCastValue().toASCIIString();
+        break;
+
+      case String:
+        this.text = this.<String>toCastValue();
+        break;
+
+      default:
+    }
+  }
+
+  /**
+   * Gets type name.
+   *
+   * @return type name.
+   */
+  public String getTypeName() {
+    return type.toString();
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public String toString() {
+    return this.text;
+  }
+
+  /**
+   * Gets actual primitive value.
+   *
+   * @return
+   */
+  public Object toValue() {
+    return this.value;
+  }
+
+  /**
+   * Casts primitive value.
+   *
+   * @param <T> cast.
+   * @return casted value.
+   */
+  @SuppressWarnings("unchecked")
+  public <T> T toCastValue() {
+    return (T) type.javaType().cast(toValue());
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataProperty.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataProperty.java
new file mode 100644
index 0000000..940b15c
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataProperty.java
@@ -0,0 +1,192 @@
+/*
+ * 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.api.domain;
+
+import java.io.Serializable;
+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;
+
+/**
+ * OData entity property.
+ */
+public class ODataProperty implements Serializable, ODataInvokeResult {
+
+  /**
+   * Property type.
+   */
+  public enum PropertyType {
+
+    /**
+     * Primitive.
+     */
+    PRIMITIVE,
+    /**
+     * Collection
+     */
+    COLLECTION,
+    /**
+     * Complex.
+     */
+    COMPLEX,
+    /**
+     * Empty type (possibly, no type information could be retrieved).
+     */
+    EMPTY
+
+  }
+
+  private static final long serialVersionUID = 926939448778950450L;
+
+  /**
+   * Property name.
+   */
+  private final String name;
+
+  /**
+   * Property value.
+   */
+  private ODataValue value;
+
+  /**
+   * Constructor.
+   *
+   * @param name property name.
+   * @param value property value.
+   */
+  ODataProperty(final String name, final ODataValue value) {
+    this.name = name;
+    this.value = value;
+  }
+
+  /**
+   * Returns property name.
+   *
+   * @return property name.
+   */
+  public String getName() {
+    return name;
+  }
+
+  /**
+   * Returns property value.
+   *
+   * @return property value.
+   */
+  public ODataValue getValue() {
+    return value;
+  }
+
+  /**
+   * Updates property value.
+   *
+   * @param value property value that replaces current.
+   */
+  public void setValue(final ODataValue value) {
+    this.value = value;
+  }
+
+  /**
+   * Checks if has null value.
+   *
+   * @return 'TRUE' if has null value; 'FALSE' otherwise.
+   */
+  public boolean hasNullValue() {
+    return this.value == null;
+  }
+
+  /**
+   * Checks if has primitive value.
+   *
+   * @return 'TRUE' if has primitive value; 'FALSE' otherwise.
+   */
+  public boolean hasPrimitiveValue() {
+    return !hasNullValue() && this.value.isPrimitive();
+  }
+
+  /**
+   * Gets primitive value.
+   *
+   * @return primitive value if exists; null otherwise.
+   */
+  public ODataPrimitiveValue getPrimitiveValue() {
+    return hasPrimitiveValue() ? this.value.asPrimitive() : null;
+  }
+
+  /**
+   * Checks if has complex value.
+   *
+   * @return 'TRUE' if has complex value; 'FALSE' otherwise.
+   */
+  public boolean hasComplexValue() {
+    return !hasNullValue() && this.value.isComplex();
+  }
+
+  /**
+   * Gets complex value.
+   *
+   * @return complex value if exists; null otherwise.
+   */
+  public ODataComplexValue getComplexValue() {
+    return hasComplexValue() ? this.value.asComplex() : null;
+  }
+
+  /**
+   * Checks if has collection value.
+   *
+   * @return 'TRUE' if has collection value; 'FALSE' otherwise.
+   */
+  public boolean hasCollectionValue() {
+    return !hasNullValue() && this.value.isCollection();
+  }
+
+  /**
+   * Gets collection value.
+   *
+   * @return collection value if exists; null otherwise.
+   */
+  public ODataCollectionValue getCollectionValue() {
+    return hasCollectionValue() ? this.value.asCollection() : null;
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public boolean equals(final Object obj) {
+    return EqualsBuilder.reflectionEquals(this, obj);
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public int hashCode() {
+    return HashCodeBuilder.reflectionHashCode(this);
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @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-api/src/main/java/org/apache/olingo/client/api/domain/ODataServiceDocument.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataServiceDocument.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataServiceDocument.java
new file mode 100644
index 0000000..d0f495d
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataServiceDocument.java
@@ -0,0 +1,183 @@
+/*
+ * 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.api.domain;
+
+import java.net.URI;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ODataServiceDocument {
+
+  private URI metadataContext;
+
+  private String metadataETag;
+
+  private final Map<String, URI> entitySets = new HashMap<String, URI>();
+
+  private final Map<String, URI> functionImports = new HashMap<String, URI>();
+
+  private final Map<String, URI> singletons = new HashMap<String, URI>();
+
+  private final Map<String, URI> relatedServiceDocuments = new HashMap<String, URI>();
+
+  public URI getMetadataContext() {
+    return metadataContext;
+  }
+
+  public void setMetadataContext(final URI metadataContext) {
+    this.metadataContext = metadataContext;
+  }
+
+  public String getMetadataETag() {
+    return metadataETag;
+  }
+
+  public void setMetadataETag(final String metadataETag) {
+    this.metadataETag = metadataETag;
+  }
+
+  public Map<String, URI> getEntitySets() {
+    return entitySets;
+  }
+
+  /**
+   * Gets entity set titles.
+   *
+   * @return entity set titles.
+   */
+  public Collection<String> getEntitySetTitles() {
+    return entitySets.keySet();
+  }
+
+  /**
+   * Gets entity set URIs.
+   *
+   * @return entity set URIs.
+   */
+  public Collection<URI> getEntitySetURIs() {
+    return entitySets.values();
+  }
+
+  /**
+   * Gets URI about the given entity set.
+   *
+   * @param title title.
+   * @return URI.
+   */
+  public URI getEntitySetURI(final String title) {
+    return entitySets.get(title);
+  }
+
+  public Map<String, URI> getFunctionImports() {
+    return functionImports;
+  }
+
+  /**
+   * Gets function import titles.
+   *
+   * @return function import titles.
+   */
+  public Collection<String> getFunctionImportTitles() {
+    return functionImports.keySet();
+  }
+
+  /**
+   * Gets function import URIs.
+   *
+   * @return function import URIs.
+   */
+  public Collection<URI> getFunctionImportURIs() {
+    return functionImports.values();
+  }
+
+  /**
+   * Gets URI of the given function import.
+   *
+   * @param title title.
+   * @return URI.
+   */
+  public URI getFunctionImportURI(final String title) {
+    return functionImports.get(title);
+  }
+
+  public Map<String, URI> getSingletons() {
+    return singletons;
+  }
+
+  /**
+   * Gets singleton titles.
+   *
+   * @return singleton titles.
+   */
+  public Collection<String> getSingletonTitles() {
+    return singletons.keySet();
+  }
+
+  /**
+   * Gets singleton URIs.
+   *
+   * @return singleton URIs.
+   */
+  public Collection<URI> getSingletonURIs() {
+    return singletons.values();
+  }
+
+  /**
+   * Gets URI of the given singleton.
+   *
+   * @param title title.
+   * @return URI.
+   */
+  public URI getSingletonURI(final String title) {
+    return singletons.get(title);
+  }
+
+  public Map<String, URI> getRelatedServiceDocuments() {
+    return relatedServiceDocuments;
+  }
+
+  /**
+   * Gets related service documents titles.
+   *
+   * @return related service documents titles.
+   */
+  public Collection<String> getRelatedServiceDocumentsTitles() {
+    return relatedServiceDocuments.keySet();
+  }
+
+  /**
+   * Gets related service documents URIs.
+   *
+   * @return related service documents URIs.
+   */
+  public Collection<URI> getRelatedServiceDocumentsURIs() {
+    return relatedServiceDocuments.values();
+  }
+
+  /**
+   * Gets URI of the given related service documents.
+   *
+   * @param title title.
+   * @return URI.
+   */
+  public URI getRelatedServiceDocumentURI(final String title) {
+    return relatedServiceDocuments.get(title);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java
new file mode 100644
index 0000000..90edda7
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java
@@ -0,0 +1,138 @@
+/*
+ * 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.api.domain;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+/**
+ * Helper class for handling datetime and datetime-offset primitive values.
+ */
+public final class ODataTimestamp implements Serializable {
+
+  private static final long serialVersionUID = 4053990618660356004L;
+
+  private final SimpleDateFormat sdf;
+
+  private final Timestamp timestamp;
+
+  private String timezone;
+
+  private final boolean offset;
+
+  public static ODataTimestamp getInstance(final EdmSimpleType type, final Timestamp timestamp) {
+    return new ODataTimestamp(new SimpleDateFormat(type.pattern()),
+            new Date(timestamp.getTime()), timestamp.getNanos(), type == EdmSimpleType.DateTimeOffset);
+  }
+
+  public static ODataTimestamp parse(final EdmSimpleType type, final String input) {
+    final ODataTimestamp instance;
+
+    final String[] dateParts = input.split("\\.");
+    final SimpleDateFormat sdf = new SimpleDateFormat(type.pattern());
+    final boolean isOffset = type == EdmSimpleType.DateTimeOffset;
+
+    try {
+      final Date date = sdf.parse(dateParts[0]);
+      if (dateParts.length > 1) {
+        int idx = dateParts[1].indexOf('+');
+        if (idx == -1) {
+          idx = dateParts[1].indexOf('-');
+        }
+        if (idx == -1) {
+          instance = new ODataTimestamp(sdf, date, Integer.parseInt(dateParts[1]), isOffset);
+        } else {
+          instance = new ODataTimestamp(sdf, date,
+                  Integer.parseInt(dateParts[1].substring(0, idx)), dateParts[1].substring(idx), isOffset);
+        }
+      } else {
+        instance = new ODataTimestamp(sdf, date, isOffset);
+      }
+    } catch (Exception e) {
+      throw new IllegalArgumentException("Cannot parse " + type.pattern(), e);
+    }
+
+    return instance;
+  }
+
+  private ODataTimestamp(final SimpleDateFormat sdf, final Date date, final boolean offset) {
+    this.sdf = sdf;
+    this.timestamp = new Timestamp(date.getTime());
+    this.offset = offset;
+  }
+
+  private ODataTimestamp(final SimpleDateFormat sdf, final Date date, final int nanos, final boolean offset) {
+    this(sdf, date, offset);
+    this.timestamp.setNanos(nanos);
+  }
+
+  private ODataTimestamp(
+          final SimpleDateFormat sdf, final Date date, final int nanos, final String timezone, final boolean offset) {
+    this(sdf, date, nanos, offset);
+    this.timezone = timezone;
+  }
+
+  public Timestamp getTimestamp() {
+    return timestamp;
+  }
+
+  public String getTimezone() {
+    return timezone;
+  }
+
+  public boolean isOffset() {
+    return offset;
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public boolean equals(final Object obj) {
+    return EqualsBuilder.reflectionEquals(this, obj, "sdf");
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public int hashCode() {
+    return HashCodeBuilder.reflectionHashCode(this, "sdf");
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public String toString() {
+    final StringBuilder formatted = new StringBuilder().append(sdf.format(timestamp));
+    if (timestamp.getNanos() > 0) {
+      formatted.append('.').append(String.valueOf(timestamp.getNanos()));
+    }
+    if (StringUtils.isNotBlank(timezone)) {
+      formatted.append(timezone);
+    }
+    return formatted.toString();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataValue.java
new file mode 100644
index 0000000..e6b5279
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataValue.java
@@ -0,0 +1,111 @@
+/*
+ * 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.api.domain;
+
+import java.io.Serializable;
+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;
+
+/**
+ * Abstract representation of an OData entity property value.
+ */
+public abstract class ODataValue implements Serializable {
+
+  private static final long serialVersionUID = 7445422004232581877L;
+
+  /**
+   * Check is is a primitive value.
+   *
+   * @return 'TRUE' if primitive; 'FALSE' otherwise.
+   */
+  public boolean isPrimitive() {
+    return (this instanceof ODataPrimitiveValue);
+  }
+
+  /**
+   * Casts to primitive value.
+   *
+   * @return primitive value.
+   */
+  public ODataPrimitiveValue asPrimitive() {
+    return isPrimitive() ? (ODataPrimitiveValue) this : null;
+  }
+
+  /**
+   * Check is is a complex value.
+   *
+   * @return 'TRUE' if complex; 'FALSE' otherwise.
+   */
+  public boolean isComplex() {
+    return (this instanceof ODataComplexValue);
+  }
+
+  /**
+   * Casts to complex value.
+   *
+   * @return complex value.
+   */
+  public ODataComplexValue asComplex() {
+    return isComplex() ? (ODataComplexValue) this : null;
+  }
+
+  /**
+   * Check is is a collection value.
+   *
+   * @return 'TRUE' if collection; 'FALSE' otherwise.
+   */
+  public boolean isCollection() {
+    return (this instanceof ODataCollectionValue);
+  }
+
+  /**
+   * Casts to collection value.
+   *
+   * @return collection value.
+   */
+  public ODataCollectionValue asCollection() {
+    return isCollection() ? (ODataCollectionValue) this : null;
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public boolean equals(final Object obj) {
+    return EqualsBuilder.reflectionEquals(this, obj);
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public int hashCode() {
+    return HashCodeBuilder.reflectionHashCode(this);
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @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-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/ComposedGeospatial.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/ComposedGeospatial.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/ComposedGeospatial.java
new file mode 100644
index 0000000..40b50ec
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/ComposedGeospatial.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.api.domain.geospatial;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Abstract base class for all Geometries that are composed out of other geospatial elements.
+ */
+public abstract class ComposedGeospatial<T extends Geospatial> extends Geospatial implements Iterable<T> {
+
+  private static final long serialVersionUID = 8796254901098541307L;
+
+  protected final List<T> geospatials;
+
+  /**
+   * Constructor.
+   *
+   * @param dimension dimension.
+   * @param type type.
+   * @param geospatials geospatials info.
+   */
+  protected ComposedGeospatial(final Dimension dimension, final Type type, final List<T> geospatials) {
+    super(dimension, type);
+    this.geospatials = new ArrayList<T>();
+    if (geospatials != null) {
+      this.geospatials.addAll(geospatials);
+    }
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public Iterator<T> iterator() {
+    return this.geospatials.iterator();
+  }
+
+  /**
+   * Checks if is empty.
+   *
+   * @return 'TRUE' if is empty; 'FALSE' otherwise.
+   */
+  public boolean isEmpty() {
+    return geospatials.isEmpty();
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public void setSrid(final Integer srid) {
+    for (Geospatial geospatial : this.geospatials) {
+      geospatial.setSrid(srid);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Geospatial.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Geospatial.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Geospatial.java
new file mode 100644
index 0000000..4bec1b8
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Geospatial.java
@@ -0,0 +1,157 @@
+/*
+ * 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.api.domain.geospatial;
+
+import java.io.Serializable;
+
+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.domain.EdmSimpleType;
+
+/**
+ * Base class for all geospatial info.
+ */
+public abstract class Geospatial implements Serializable {
+
+    public enum Dimension {
+
+        GEOMETRY,
+        GEOGRAPHY;
+
+    }
+
+    public enum Type {
+
+        /**
+         * The OGIS geometry type number for points.
+         */
+        POINT,
+        /**
+         * The OGIS geometry type number for lines.
+         */
+        LINESTRING,
+        /**
+         * The OGIS geometry type number for polygons.
+         */
+        POLYGON,
+        /**
+         * The OGIS geometry type number for aggregate points.
+         */
+        MULTIPOINT,
+        /**
+         * The OGIS geometry type number for aggregate lines.
+         */
+        MULTILINESTRING,
+        /**
+         * The OGIS geometry type number for aggregate polygons.
+         */
+        MULTIPOLYGON,
+        /**
+         * The OGIS geometry type number for feature collections.
+         */
+        GEOSPATIALCOLLECTION;
+
+    }
+
+    protected final Dimension dimension;
+
+    protected final Type type;
+
+    /**
+     * Null value means it is expected to vary per instance.
+     */
+    protected Integer srid;
+
+    /**
+     * Constructor.
+     *
+     * @param dimension dimension.
+     * @param type type.
+     */
+    protected Geospatial(final Dimension dimension, final Type type) {
+        this.dimension = dimension;
+        this.type = type;
+    }
+
+    /**
+     * Gets dimension.
+     *
+     * @return dimension.
+     * @see Dimension
+     */
+    public Dimension getDimension() {
+        return dimension;
+    }
+
+    /**
+     * Gets type.
+     *
+     * @return type.
+     * @see Type
+     */
+    public Type getType() {
+        return type;
+    }
+
+    /**
+     * Gets s-rid.
+     *
+     * @return s-rid.
+     */
+    public Integer getSrid() {
+        return srid;
+    }
+
+    /**
+     * Sets s-rid.
+     *
+     * @param srid s-rid.
+     */
+    public void setSrid(final Integer srid) {
+        this.srid = srid;
+    }
+
+    public abstract EdmSimpleType getEdmSimpleType();
+
+    /**
+     * {@inheritDoc }
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        return EqualsBuilder.reflectionEquals(this, obj);
+    }
+
+    /**
+     * {@inheritDoc }
+     */
+    @Override
+    public int hashCode() {
+        return HashCodeBuilder.reflectionHashCode(this);
+    }
+
+    /**
+     * {@inheritDoc }
+     */
+    @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-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/GeospatialCollection.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/GeospatialCollection.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/GeospatialCollection.java
new file mode 100644
index 0000000..3626dcc
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/GeospatialCollection.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.api.domain.geospatial;
+
+import java.util.List;
+
+import org.apache.olingo.client.api.domain.EdmSimpleType;
+
+/**
+ * Wrapper for a collection of geospatials info.
+ */
+public class GeospatialCollection extends ComposedGeospatial<Geospatial> {
+
+    private static final long serialVersionUID = -9181547636133878977L;
+
+    /**
+     * Constructor.
+     *
+     * @param dimension dimension.
+     * @param geospatials geospatials info.
+     */
+    public GeospatialCollection(final Dimension dimension, final List<Geospatial> geospatials) {
+        super(dimension, Type.GEOSPATIALCOLLECTION, geospatials);
+    }
+
+    @Override
+    public EdmSimpleType getEdmSimpleType() {
+        return dimension == Dimension.GEOGRAPHY
+                ? EdmSimpleType.GeographyCollection
+                : EdmSimpleType.GeometryCollection;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/LineString.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/LineString.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/LineString.java
new file mode 100644
index 0000000..926c605
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/LineString.java
@@ -0,0 +1,39 @@
+/*
+ * 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.api.domain.geospatial;
+
+import java.util.List;
+
+import org.apache.olingo.client.api.domain.EdmSimpleType;
+
+public class LineString extends ComposedGeospatial<Point> {
+
+    private static final long serialVersionUID = 3207958185407535907L;
+
+    public LineString(final Dimension dimension, final List<Point> points) {
+        super(dimension, Type.LINESTRING, points);
+    }
+
+    @Override
+    public EdmSimpleType getEdmSimpleType() {
+        return dimension == Dimension.GEOGRAPHY
+                ? EdmSimpleType.GeographyLineString
+                : EdmSimpleType.GeometryLineString;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiLineString.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiLineString.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiLineString.java
new file mode 100644
index 0000000..774f5f0
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiLineString.java
@@ -0,0 +1,39 @@
+/*
+ * 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.api.domain.geospatial;
+
+import java.util.List;
+
+import org.apache.olingo.client.api.domain.EdmSimpleType;
+
+public class MultiLineString extends ComposedGeospatial<LineString> {
+
+  private static final long serialVersionUID = -5042414471218124125L;
+
+  public MultiLineString(final Dimension dimension, final List<LineString> lineStrings) {
+    super(dimension, Type.MULTILINESTRING, lineStrings);
+  }
+
+  @Override
+  public EdmSimpleType getEdmSimpleType() {
+    return dimension == Dimension.GEOGRAPHY
+            ? EdmSimpleType.GeographyMultiLineString
+            : EdmSimpleType.GeometryMultiLineString;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPoint.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPoint.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPoint.java
new file mode 100644
index 0000000..9acae5e
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPoint.java
@@ -0,0 +1,39 @@
+/*
+ * 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.api.domain.geospatial;
+
+import java.util.List;
+
+import org.apache.olingo.client.api.domain.EdmSimpleType;
+
+public class MultiPoint extends ComposedGeospatial<Point> {
+
+  private static final long serialVersionUID = 4951011255142116129L;
+
+  public MultiPoint(final Dimension dimension, final List<Point> points) {
+    super(dimension, Type.MULTIPOINT, points);
+  }
+
+  @Override
+  public EdmSimpleType getEdmSimpleType() {
+    return dimension == Dimension.GEOGRAPHY
+            ? EdmSimpleType.GeographyMultiPoint
+            : EdmSimpleType.GeometryMultiPoint;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPolygon.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPolygon.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPolygon.java
new file mode 100644
index 0000000..3513ec6
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPolygon.java
@@ -0,0 +1,39 @@
+/*
+ * 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.api.domain.geospatial;
+
+import java.util.List;
+
+import org.apache.olingo.client.api.domain.EdmSimpleType;
+
+public class MultiPolygon extends ComposedGeospatial<Polygon> {
+
+  private static final long serialVersionUID = -160184788048512883L;
+
+  public MultiPolygon(final Dimension dimension, final List<Polygon> polygons) {
+    super(dimension, Type.MULTIPOLYGON, polygons);
+  }
+
+  @Override
+  public EdmSimpleType getEdmSimpleType() {
+    return dimension == Dimension.GEOGRAPHY
+            ? EdmSimpleType.GeographyMultiPolygon
+            : EdmSimpleType.GeometryMultiPolygon;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Point.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Point.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Point.java
new file mode 100644
index 0000000..15f42a3
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Point.java
@@ -0,0 +1,77 @@
+/*
+ * 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.api.domain.geospatial;
+
+import org.apache.olingo.client.api.domain.EdmSimpleType;
+
+public class Point extends Geospatial {
+
+  private static final long serialVersionUID = 4917380107331557828L;
+
+  /**
+   * The X coordinate of the point. In most long/lat systems, this is the longitude.
+   */
+  private double x;
+
+  /**
+   * The Y coordinate of the point. In most long/lat systems, this is the latitude.
+   */
+  private double y;
+
+  /**
+   * The Z coordinate of the point. In most long/lat systems, this is a radius from the center of the earth, or the
+   * height / elevation over the ground.
+   */
+  private double z;
+
+  public Point(final Dimension dimension) {
+    super(dimension, Type.POINT);
+  }
+
+  public double getX() {
+    return x;
+  }
+
+  public void setX(double x) {
+    this.x = x;
+  }
+
+  public double getY() {
+    return y;
+  }
+
+  public void setY(double y) {
+    this.y = y;
+  }
+
+  public double getZ() {
+    return z;
+  }
+
+  public void setZ(double z) {
+    this.z = z;
+  }
+
+  @Override
+  public EdmSimpleType getEdmSimpleType() {
+    return dimension == Dimension.GEOGRAPHY
+            ? EdmSimpleType.GeographyPoint
+            : EdmSimpleType.GeometryPoint;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Polygon.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Polygon.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Polygon.java
new file mode 100644
index 0000000..2c0fcbd
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Polygon.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.domain.geospatial;
+
+import java.util.List;
+
+import org.apache.olingo.client.api.domain.EdmSimpleType;
+
+/**
+ * Polygon.
+ */
+public class Polygon extends Geospatial {
+
+  private static final long serialVersionUID = 7797602503445391678L;
+
+  final ComposedGeospatial<Point> interior;
+
+  final ComposedGeospatial<Point> exterior;
+
+  /**
+   * Constructor.
+   *
+   * @param dimension dimension.
+   * @param interior interior points.
+   * @param exterior exterior points.
+   */
+  public Polygon(final Dimension dimension, final List<Point> interior, final List<Point> exterior) {
+    super(dimension, Type.POLYGON);
+    this.interior = new MultiPoint(dimension, interior);
+    this.exterior = new MultiPoint(dimension, exterior);
+  }
+
+  /**
+   * Gest interior points.
+   *
+   * @return interior points.
+   */
+  public ComposedGeospatial<Point> getInterior() {
+    return interior;
+  }
+
+  /**
+   * Gets exterior points.
+   *
+   * @return exterior points.I
+   */
+  public ComposedGeospatial<Point> getExterior() {
+    return exterior;
+  }
+
+  @Override
+  public EdmSimpleType getEdmSimpleType() {
+    return dimension == Dimension.GEOGRAPHY
+            ? EdmSimpleType.GeographyPolygon
+            : EdmSimpleType.GeometryPolygon;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonAnnotations.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonAnnotations.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonAnnotations.java
new file mode 100644
index 0000000..b79328f
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonAnnotations.java
@@ -0,0 +1,26 @@
+/*
+ * 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.api.edm.xml;
+
+public abstract interface CommonAnnotations {
+
+  String getTarget();
+
+  String getQualifier();
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonFunctionImport.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonFunctionImport.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonFunctionImport.java
new file mode 100644
index 0000000..c590387
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonFunctionImport.java
@@ -0,0 +1,22 @@
+/*
+ * 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.api.edm.xml;
+
+public interface CommonFunctionImport extends Named {
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonNavigationProperty.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonNavigationProperty.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonNavigationProperty.java
new file mode 100644
index 0000000..20eb9de
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonNavigationProperty.java
@@ -0,0 +1,22 @@
+/*
+ * 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.api.edm.xml;
+
+public interface CommonNavigationProperty extends Named {
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonParameter.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonParameter.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonParameter.java
new file mode 100644
index 0000000..ec96dc0
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonParameter.java
@@ -0,0 +1,33 @@
+/*
+ * 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.api.edm.xml;
+
+public interface CommonParameter extends Named {
+
+  String getType();
+
+  boolean isNullable();
+
+  Integer getMaxLength();
+
+  Integer getPrecision();
+
+  Integer getScale();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonProperty.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonProperty.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonProperty.java
new file mode 100644
index 0000000..28688ab
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/CommonProperty.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.api.edm.xml;
+
+import org.apache.olingo.commons.api.edm.constants.ConcurrencyMode;
+import org.apache.olingo.commons.api.edm.constants.StoreGeneratedPattern;
+
+public interface CommonProperty extends Named {
+
+  String getType();
+
+  boolean isNullable();
+
+  String getDefaultValue();
+
+  Integer getMaxLength();
+
+  boolean isFixedLength();
+
+  Integer getPrecision();
+
+  Integer getScale();
+
+  boolean isUnicode();
+
+  String getCollation();
+
+  String getSrid();
+
+  ConcurrencyMode getConcurrencyMode();
+
+  StoreGeneratedPattern getStoreGeneratedPattern();
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/ComplexType.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/ComplexType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/ComplexType.java
new file mode 100644
index 0000000..9e85e22
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/ComplexType.java
@@ -0,0 +1,32 @@
+/*
+ * 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.api.edm.xml;
+
+import java.util.List;
+
+public interface ComplexType extends Named {
+
+  CommonProperty getProperty(String name);
+
+  List<? extends CommonProperty> getProperties();
+
+  CommonNavigationProperty getNavigationProperty(String name);
+
+  List<? extends CommonNavigationProperty> getNavigationProperties();
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/DataServices.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/DataServices.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/DataServices.java
new file mode 100644
index 0000000..961f69c
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/DataServices.java
@@ -0,0 +1,30 @@
+/*
+ * 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.api.edm.xml;
+
+import java.util.List;
+
+public interface DataServices {
+
+  String getDataServiceVersion();
+
+  String getMaxDataServiceVersion();
+
+  List<? extends Schema> getSchemas();
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/Edmx.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/Edmx.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/Edmx.java
new file mode 100644
index 0000000..ee495c2
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/Edmx.java
@@ -0,0 +1,26 @@
+/*
+ * 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.api.edm.xml;
+
+public interface Edmx {
+
+  String getVersion();
+
+  DataServices getDataServices();
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/EntityContainer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/EntityContainer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/EntityContainer.java
new file mode 100644
index 0000000..b748c5f
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/EntityContainer.java
@@ -0,0 +1,40 @@
+/*
+ * 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.api.edm.xml;
+
+import java.util.List;
+
+public interface EntityContainer extends Named {
+
+  String getExtends();
+
+  boolean isLazyLoadingEnabled();
+
+  boolean isDefaultEntityContainer();
+
+  EntitySet getEntitySet(String name);
+
+  List<? extends EntitySet> getEntitySets();
+
+  CommonFunctionImport getFunctionImport(String name);
+
+  List<? extends CommonFunctionImport> getFunctionImports(String name);
+
+  List<? extends CommonFunctionImport> getFunctionImports();
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/EntityKey.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/EntityKey.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/EntityKey.java
new file mode 100644
index 0000000..c1c43ec
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/EntityKey.java
@@ -0,0 +1,26 @@
+/*
+ * 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.api.edm.xml;
+
+import java.util.List;
+
+public interface EntityKey {
+
+  List<PropertyRef> getPropertyRefs();
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/EntitySet.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/EntitySet.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/EntitySet.java
new file mode 100644
index 0000000..3dea8b4
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/edm/xml/EntitySet.java
@@ -0,0 +1,25 @@
+/*
+ * 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.api.edm.xml;
+
+public interface EntitySet extends Named {
+
+  String getEntityType();
+
+}