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

[01/11] [OLINGO-65] Geospatial types implemented, EdmStream mock implemented with URI as backend, V3 pruned types implemented, EdmSimpleTypeKind adapted, EdmSimpleTypeFactory introduces

Repository: incubator-olingo-odata4
Updated Branches:
  refs/heads/olingo200 bab036240 -> 4780fc513


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java
index 31392d2..483fc5c 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java
@@ -54,7 +54,6 @@ import org.apache.olingo.server.core.uri.queryoption.CustomQueryOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.SelectOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
-import org.apache.olingo.server.core.uri.queryoption.expression.MemberImpl;
 
 public class ResourceValidator implements Validator {
   private Edm edm;


[11/11] git commit: [OLINGO-65] Implementation completed

Posted by il...@apache.org.
[OLINGO-65] Implementation completed


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

Branch: refs/heads/olingo200
Commit: 4780fc513b5f85ae6a6aa0615fdde0e258caa4f5
Parents: 130a49f
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 22 16:12:31 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 22 16:12:31 2014 +0100

----------------------------------------------------------------------
 .../EdmSingleSet/3.4028235E38f/entity.full.json |   2 +-
 .../v3/EdmSingleSet/3.4028235E38f/entity.xml    |   8 +-
 .../olingo/client/api/CommonODataClient.java    |   2 +-
 .../request/retrieve/ODataValueRequest.java     |   4 +-
 .../response/ODataValueUpdateResponse.java      |   4 +-
 .../client/api/domain/AbstractODataValue.java   | 127 ++++++
 .../client/api/domain/ODataCollectionValue.java |   4 +-
 .../client/api/domain/ODataComplexValue.java    |   6 +-
 .../olingo/client/api/domain/ODataDuration.java |  79 ----
 .../client/api/domain/ODataGeospatialValue.java |  92 +---
 .../olingo/client/api/domain/ODataLink.java     |  29 +-
 .../client/api/domain/ODataObjectFactory.java   |  20 +-
 .../client/api/domain/ODataPrimitiveValue.java  | 415 +------------------
 .../olingo/client/api/domain/ODataProperty.java |  18 +
 .../client/api/domain/ODataTimestamp.java       | 147 -------
 .../olingo/client/api/domain/ODataValue.java    |  65 +--
 .../olingo/client/api/utils/URIUtils.java       | 196 ---------
 .../olingo/client/core/AbstractODataClient.java |  12 +-
 .../cud/ODataEntityCreateRequestImpl.java       |   2 +-
 .../cud/ODataEntityUpdateRequestImpl.java       |   2 +-
 .../request/cud/ODataLinkCreateRequestImpl.java |   2 +-
 .../request/cud/ODataLinkUpdateRequestImpl.java |   2 +-
 .../cud/ODataPropertyUpdateRequestImpl.java     |   2 +-
 .../cud/ODataValueUpdateRequestImpl.java        |  17 +-
 .../request/invoke/ODataInvokeRequestImpl.java  |   2 +-
 .../invoke/v3/InvokeRequestFactoryImpl.java     |   1 +
 .../request/retrieve/ODataValueRequestImpl.java |  15 +-
 .../streamed/AbstractODataStreamedRequest.java  |   2 +-
 .../core/data/AtomGeoValueSerializer.java       |   4 +-
 .../core/data/AtomPropertyDeserializer.java     |  10 +-
 .../core/domain/ODataGeospatialValueImpl.java   | 130 ++++++
 .../core/domain/ODataPrimitiveValueImpl.java    | 174 ++++++++
 .../core/op/impl/AbstractODataBinder.java       |  27 +-
 .../core/op/impl/ODataObjectFactoryImpl.java    | 145 +------
 .../client/core/op/impl/v4/ODataBinderImpl.java |   2 +-
 .../client/core/uri/AbstractURIBuilder.java     |   1 -
 .../olingo/client/core/uri/FilterLiteral.java   |   1 -
 .../apache/olingo/client/core/uri/URIUtils.java | 202 +++++++++
 .../client/core/uri/v3/URIBuilderImpl.java      |   2 +-
 .../client/core/AbstractPrimitiveTest.java      | 156 ++++---
 .../client/core/AbstractPropertyTest.java       |  16 +-
 .../client/core/it/AbstractTestITCase.java      |   6 +-
 .../client/core/it/v3/AsyncTestITCase.java      |   9 +-
 .../client/core/it/v3/CountTestITCase.java      |  52 ++-
 .../core/it/v3/EntityCreateTestITCase.java      |  29 +-
 .../core/it/v3/EntityRetrieveTestITCase.java    |   9 +-
 .../client/core/it/v3/EntitySetTestITCase.java  |   2 +-
 .../core/it/v3/EntityUpdateTestITCase.java      |  25 +-
 .../client/core/it/v3/ErrorTestITCase.java      |   2 +-
 .../core/it/v3/MediaEntityTestITCase.java       |   2 +-
 .../it/v3/NavigationLinkCreateTestITCase.java   |  15 +-
 .../client/core/it/v3/OpenTypeTestITCase.java   |  76 ++--
 .../core/it/v3/PrimitiveKeysTestITCase.java     |  13 +-
 .../client/core/it/v3/PropertyTestITCase.java   |  30 +-
 .../core/it/v3/QueryOptionsTestITCase.java      |  11 +-
 .../olingo/client/core/v3/EntityTest.java       |  10 +-
 .../client/core/v3/PrimitiveValueTest.java      | 176 ++++----
 .../client/core/v4/PrimitiveValueTest.java      |  61 ++-
 58 files changed, 1177 insertions(+), 1498 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.full.json b/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.full.json
index 468dd3b..61537ff 100644
--- a/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.full.json
+++ b/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.full.json
@@ -1 +1 @@
-{"odata.metadata":"http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#EdmSingleSet/@Element","Id":3.40282347E+38}
\ No newline at end of file
+{"odata.metadata":"http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#EdmSingleSet/@Element","Id":3.4028235E+38}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.xml b/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.xml
index 420d5cd..0dc282f 100644
--- a/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.xml
+++ b/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.xml
@@ -20,9 +20,9 @@
 
 -->
 <entry xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
-  <id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/EdmSingleSet(3.40282347E%2B38f)</id>
+  <id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/EdmSingleSet(3.4028235E%2B38f)</id>
   <category term="Microsoft.Test.OData.Services.PrimitiveKeysService.EdmSingle" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
-  <link rel="edit" title="EdmSingle" href="EdmSingleSet(3.40282347E%2B38f)" />
+  <link rel="edit" title="EdmSingle" href="EdmSingleSet(3.4028235E%2B38f)" />
   <title />
   <updated>2014-02-12T15:20:45Z</updated>
   <author>
@@ -30,7 +30,7 @@
   </author>
   <content type="application/xml">
     <m:properties>
-      <d:Id m:type="Edm.Single">3.40282347E+38</d:Id>
+      <d:Id m:type="Edm.Single">3.4028235E+38</d:Id>
     </m:properties>
   </content>
-</entry>
\ No newline at end of file
+</entry>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
index 1ad480a..6c44360 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
@@ -24,8 +24,8 @@ import org.apache.olingo.client.api.communication.request.cud.CommonCUDRequestFa
 import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
 import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
 import org.apache.olingo.client.api.communication.request.streamed.CommonStreamedRequestFactory;
-import org.apache.olingo.client.api.domain.ODataGeospatialValue;
 import org.apache.olingo.client.api.domain.ODataObjectFactory;
+import org.apache.olingo.client.api.domain.ODataGeospatialValue;
 import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
 import org.apache.olingo.client.api.op.CommonODataBinder;
 import org.apache.olingo.client.api.op.CommonODataDeserializer;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java
index d125c65..e731dfe 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java
@@ -18,11 +18,11 @@
  */
 package org.apache.olingo.client.api.communication.request.retrieve;
 
-import org.apache.olingo.client.api.domain.ODataValue;
+import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
 import org.apache.olingo.client.api.format.ODataValueFormat;
 
 /**
  * This class implements an OData entity property value query request.
  */
-public interface ODataValueRequest extends ODataRetrieveRequest<ODataValue, ODataValueFormat> {
+public interface ODataValueRequest extends ODataRetrieveRequest<ODataPrimitiveValue, ODataValueFormat> {
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java
index 5a7aaae..9d8855b 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java
@@ -18,7 +18,7 @@
  */
 package org.apache.olingo.client.api.communication.response;
 
-import org.apache.olingo.client.api.domain.ODataValue;
+import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
 
 /**
  * This class implements the response to an OData update entity property request.
@@ -32,5 +32,5 @@ public interface ODataValueUpdateResponse extends ODataResponse {
    *
    * @return updated object.
    */
-  ODataValue getBody();
+  ODataPrimitiveValue getBody();
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractODataValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractODataValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractODataValue.java
new file mode 100644
index 0000000..37ca0da
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractODataValue.java
@@ -0,0 +1,127 @@
+/*
+ * 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 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 AbstractODataValue implements ODataValue {
+
+  private static final long serialVersionUID = 7445422004232581877L;
+
+  /**
+   * Check is is a primitive value.
+   *
+   * @return 'TRUE' if primitive; 'FALSE' otherwise.
+   */
+  @Override
+  public boolean isPrimitive() {
+    return (this instanceof ODataPrimitiveValue);
+  }
+
+  /**
+   * Casts to primitive value.
+   *
+   * @return primitive value.
+   */
+  @Override
+  public ODataPrimitiveValue asPrimitive() {
+    return isPrimitive() ? (ODataPrimitiveValue) this : null;
+  }
+
+  /**
+   * Check is is a geospatail value.
+   *
+   * @return 'TRUE' if geospatail; 'FALSE' otherwise.
+   */
+  @Override
+  public boolean isGeospatial() {
+    return (this instanceof ODataGeospatialValue);
+  }
+
+  /**
+   * Casts to geospatail value.
+   *
+   * @return geospatail value.
+   */
+  @Override
+  public ODataGeospatialValue asGeospatial() {
+    return isGeospatial() ? (ODataGeospatialValue) this : null;
+  }
+
+  /**
+   * Check is is a complex value.
+   *
+   * @return 'TRUE' if complex; 'FALSE' otherwise.
+   */
+  @Override
+  public boolean isComplex() {
+    return (this instanceof ODataComplexValue);
+  }
+
+  /**
+   * Casts to complex value.
+   *
+   * @return complex value.
+   */
+  @Override
+  public ODataComplexValue asComplex() {
+    return isComplex() ? (ODataComplexValue) this : null;
+  }
+
+  /**
+   * Check is is a collection value.
+   *
+   * @return 'TRUE' if collection; 'FALSE' otherwise.
+   */
+  @Override
+  public boolean isCollection() {
+    return (this instanceof ODataCollectionValue);
+  }
+
+  /**
+   * Casts to collection value.
+   *
+   * @return collection value.
+   */
+  @Override
+  public ODataCollectionValue asCollection() {
+    return isCollection() ? (ODataCollectionValue) this : null;
+  }
+
+  @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/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataCollectionValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataCollectionValue.java
index afe46b7..df743df 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataCollectionValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataCollectionValue.java
@@ -25,7 +25,7 @@ import java.util.List;
 /**
  * OData collection property value.
  */
-public class ODataCollectionValue extends ODataValue implements Iterable<ODataValue> {
+public class ODataCollectionValue extends AbstractODataValue implements Iterable<ODataValue> {
 
   private static final long serialVersionUID = -3665659846001987187L;
 
@@ -74,7 +74,7 @@ public class ODataCollectionValue extends ODataValue implements Iterable<ODataVa
    *
    * @return value type name.
    */
-  public String getTypeName() {
+  public String getType() {
     return typeName;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataComplexValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataComplexValue.java
index 2e15c8b..d9b8a24 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataComplexValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataComplexValue.java
@@ -25,7 +25,7 @@ import java.util.Map;
 /**
  * OData complex property value.
  */
-public class ODataComplexValue extends ODataValue implements Iterable<ODataProperty> {
+public class ODataComplexValue extends AbstractODataValue implements Iterable<ODataProperty> {
 
   private static final long serialVersionUID = -1878555027714020431L;
 
@@ -42,7 +42,7 @@ public class ODataComplexValue extends ODataValue implements Iterable<ODataPrope
   /**
    * Constructor.
    *
-   * @param typeName type name.
+   * @param type type name.
    */
   public ODataComplexValue(final String typeName) {
     this.typeName = typeName;
@@ -82,7 +82,7 @@ public class ODataComplexValue extends ODataValue implements Iterable<ODataPrope
    *
    * @return value type name.
    */
-  public String getTypeName() {
+  public String getType() {
     return typeName;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataDuration.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataDuration.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataDuration.java
deleted file mode 100644
index 2d3b1b2..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataDuration.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.domain;
-
-import java.io.Serializable;
-import javax.xml.datatype.DatatypeConfigurationException;
-import javax.xml.datatype.DatatypeFactory;
-import javax.xml.datatype.Duration;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-
-/**
- * Helper class for handling time (as duration) primitive values.
- *
- * @see Duration
- */
-public final class ODataDuration implements Serializable {
-
-  private static final long serialVersionUID = 778404231943967899L;
-
-  private final Duration duration;
-
-  public ODataDuration(final String input) {
-    try {
-      final DatatypeFactory dtFactory = DatatypeFactory.newInstance();
-      this.duration = dtFactory.newDuration(input);
-    } catch (DatatypeConfigurationException e) {
-      throw new IllegalArgumentException("Could not parse '" + input + "' as Duration", e);
-    }
-  }
-
-  public ODataDuration(final Duration duration) {
-    this.duration = duration;
-  }
-
-  public Duration getDuration() {
-    return duration;
-  }
-
-  /**
-   * {@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 this.duration.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/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
index bd96587..af1c545 100644
--- 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
@@ -18,92 +18,40 @@
  */
 package org.apache.olingo.client.api.domain;
 
-import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.commons.api.edm.EdmGeospatialType;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.geo.Geospatial;
 
-public class ODataGeospatialValue extends ODataPrimitiveValue {
+public interface ODataGeospatialValue extends ODataValue {
 
-  private static final long serialVersionUID = -3984105137562291082L;
+  interface Builder {
 
-  /**
-   * Geospatial value builder.
-   */
-  public static class Builder extends AbstractBuilder {
-
-    private final ODataGeospatialValue ogv;
+    Builder setType(EdmPrimitiveTypeKind type);
 
-    /**
-     * Constructor.
-     */
-    public Builder(final CommonODataClient client) {
-      super(client);
-      this.ogv = new ODataGeospatialValue(client);
-    }
+    Builder setValue(Geospatial value);
 
-    /**
-     * 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;
-    }
+    ODataGeospatialValue build();
 
-    /**
-     * Sets actual value type.
-     *
-     * @param type type.
-     * @return the current builder.
-     */
-    public Builder setType(final EdmPrimitiveTypeKind type) {
-      isSupported(type);
-
-      if (type != null && !type.isGeospatial()) {
-        throw new IllegalArgumentException(
-                "Use " + ODataPrimitiveValue.class.getSimpleName() + " for non-geospatial types");
-      }
+  }
 
-      if (type == EdmPrimitiveTypeKind.Geography || type == EdmPrimitiveTypeKind.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;
-    }
+  EdmPrimitiveTypeKind getTypeKind();
 
-    /**
-     * Builds the geospatial value.
-     *
-     * @return <tt>ODataGeospatialValue</tt> object.
-     */
-    public ODataGeospatialValue build() {
-      if (this.ogv.value == null) {
-        throw new IllegalArgumentException("No Geospatial value provided");
-      }
-      if (this.ogv.type == null) {
-        this.ogv.type = ((Geospatial) this.ogv.value).getEdmPrimitiveTypeKind();
-      }
+  EdmGeospatialType getType();
 
-      return this.ogv;
-    }
-  }
+  /**
+   * Returns the current geospatial value.
+   *
+   * @return the current geospatial value.
+   */
+  Geospatial toValue();
 
   /**
-   * Protected constructor, need to use the builder to instantiate this class.
+   * Returns the current value casted to the given type.
    *
-   * @see Builder
+   * @param <T> cast type
+   * @param reference class reference
+   * @return the current value as typed java instance
    */
-  protected ODataGeospatialValue(final CommonODataClient client) {
-    super(client);
-  }
+  <T extends Geospatial> T toCastValue(Class<T> reference);
 
-  public Geospatial getGeospatial() {
-    return (Geospatial) this.value;
-  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLink.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLink.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLink.java
index 67746dc..11005a7 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLink.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLink.java
@@ -19,7 +19,6 @@
 package org.apache.olingo.client.api.domain;
 
 import java.net.URI;
-import org.apache.olingo.client.api.utils.URIUtils;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 
 /**
@@ -52,7 +51,7 @@ public class ODataLink extends ODataItem {
     }
 
     public Builder setURI(final URI baseURI, final String href) {
-      this.uri = URIUtils.getURI(baseURI, href);
+      this.uri = getURI(baseURI, href);
       return this;
     }
 
@@ -76,6 +75,30 @@ public class ODataLink extends ODataItem {
       return instance;
     }
   }
+
+  /**
+   * Build URI starting from the given base and href.
+   * <br/>
+   * If href is absolute or base is null then base will be ignored.
+   *
+   * @param base URI prefix.
+   * @param href URI suffix.
+   * @return built URI.
+   */
+  private static URI getURI(final URI base, final String href) {
+    if (href == null) {
+      throw new IllegalArgumentException("Null link provided");
+    }
+
+    URI uri = URI.create(href);
+
+    if (!uri.isAbsolute() && base != null) {
+      uri = URI.create(base.toASCIIString() + "/" + href);
+    }
+
+    return uri.normalize();
+  }
+
   /**
    * Link type.
    */
@@ -134,7 +157,7 @@ public class ODataLink extends ODataItem {
   protected ODataLink(final ODataServiceVersion version,
           final URI baseURI, final String href, final ODataLinkType type, final String title) {
 
-    this(version, URIUtils.getURI(baseURI, href), type, title);
+    this(version, getURI(baseURI, href), type, title);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataObjectFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataObjectFactory.java
index 7ba039d..ddafea4 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataObjectFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataObjectFactory.java
@@ -19,15 +19,6 @@
 package org.apache.olingo.client.api.domain;
 
 import java.net.URI;
-import org.apache.olingo.client.api.domain.ODataCollectionValue;
-import org.apache.olingo.client.api.domain.ODataComplexValue;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataInlineEntity;
-import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataProperty;
 
 /**
  * Entry point for generating OData domain objects.
@@ -193,12 +184,21 @@ public interface ODataObjectFactory {
    * Instantiates a new primitive property.
    *
    * @param name name.
-   * @param value value.
+   * @param value primitive value.
    * @return primitive property.
    */
   ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
 
   /**
+   * Instantiates a new primitive property.
+   *
+   * @param name name.
+   * @param value geospatial value.
+   * @return primitive property.
+   */
+  ODataProperty newPrimitiveProperty(String name, ODataGeospatialValue value);
+
+  /**
    * Instantiates a new complex property.
    *
    * @param name name.

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/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
index 21d8562..a615eed 100644
--- 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
@@ -18,419 +18,50 @@
  */
 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.olingo.client.api.CommonODataClient;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 
-/**
- * OData primitive property value.
- */
-public class ODataPrimitiveValue extends ODataValue {
-
-  private static final long serialVersionUID = 2841837627899878223L;
+public interface ODataPrimitiveValue extends ODataValue {
 
-  protected abstract static class AbstractBuilder {
+  interface Builder {
 
-    private final CommonODataClient client;
+    Builder setType(EdmPrimitiveTypeKind type);
 
-    /**
-     * Constructor.
-     */
-    public AbstractBuilder(final CommonODataClient client) {
-      this.client = client;
-    }
+    Builder setText(String text);
 
-    public AbstractBuilder isSupported(final EdmPrimitiveTypeKind type) {
-      if (type != null && !type.getSupportedVersions().contains(client.getServiceVersion())) {
-        throw new IllegalArgumentException(String.format(
-                "Type %s not supported by the current OData working version", type.toString()));
-      }
+    Builder setValue(Object value);
 
-      return this;
-    }
+    ODataPrimitiveValue build();
   }
 
-  /**
-   * Primitive value builder.
-   */
-  public static class Builder extends AbstractBuilder {
-
-    private final ODataPrimitiveValue opv;
-
-    /**
-     * Constructor.
-     */
-    public Builder(final CommonODataClient 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 EdmPrimitiveTypeKind type) {
-      isSupported(type);
-
-      if (type == EdmPrimitiveTypeKind.Stream) {
-        throw new IllegalArgumentException(String.format(
-                "Cannot build a primitive value for %s", EdmPrimitiveTypeKind.Stream.toString()));
-      }
-
-      this.opv.type = type;
-      return this;
-    }
+  EdmPrimitiveTypeKind getTypeKind();
 
-    /**
-     * 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 = EdmPrimitiveTypeKind.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.getJavaType().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 CommonODataClient client;
-
-  /**
-   * Text value.
-   */
-  private String text;
+  EdmPrimitiveType getType();
 
   /**
-   * Actual value.
-   */
-  protected Object value;
-
-  /**
-   * Value type.
-   */
-  protected EdmPrimitiveTypeKind type;
-
-  /**
-   * Protected constructor, need to use the builder to instantiate this class.
+   * Returns the current value as generic Object.
    *
-   * @see Builder
+   * @return an uncasted instance of this value
    */
-  protected ODataPrimitiveValue(final CommonODataClient client) {
-    super();
-    this.client = client;
-  }
-
-  private Class<?> getJavaType() {
-    Class<?> javaType = null;
-
-    switch (this.type) {
-      case Binary:
-        javaType = byte[].class;
-        break;
-
-      case SByte:
-        javaType = Byte.class;
-        break;
-
-      case Boolean:
-        javaType = Boolean.class;
-        break;
-
-      case Date:
-      case DateTime:
-      case DateTimeOffset:
-        javaType = ODataTimestamp.class;
-        break;
-
-      case Time:
-      case TimeOfDay:
-        javaType = ODataDuration.class;
-        break;
-
-      case Decimal:
-        javaType = BigDecimal.class;
-        break;
-
-      case Single:
-        javaType = Float.class;
-        break;
-
-      case Double:
-        javaType = Double.class;
-        break;
-
-      case Guid:
-        javaType = UUID.class;
-        break;
-
-      case Int16:
-        javaType = Short.class;
-        break;
-
-      case Byte:
-      case Int32:
-        javaType = Integer.class;
-        break;
-
-      case Int64:
-        javaType = Long.class;
-        break;
-
-      case Stream:
-        javaType = URI.class;
-        break;
-
-      case String:
-        javaType = String.class;
-        break;
-
-      default:
-        javaType = this.value.getClass();
-    }
-
-    return javaType;
-  }
+  Object toValue();
 
   /**
-   * Parses given text as object value.
-   */
-  private void parseText() {
-    switch (this.type) {
-      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 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("#.#######################").format(this.<BigDecimal>toCastValue());
-        break;
-
-      case Single:
-        this.text = new DecimalFormat("#.#######E0").format(this.<Float>toCastValue());
-        break;
-
-      case Double:
-        this.text = new DecimalFormat("#.#######################E0").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.
+   * Returns the current value casted to the given type.
    *
-   * @return type name.
+   * @param <T> cast type
+   * @param reference class reference
+   * @return the current value as typed java instance
+   * @throws EdmPrimitiveTypeException if the object is not assignable to the type T.
    */
-  public String getTypeName() {
-    return type.getFullQualifiedName().toString();
-  }
-
-  /**
-   * {@inheritDoc }
-   */
-  @Override
-  public String toString() {
-    return this.text;
-  }
+  <T> T toCastValue(Class<T> reference) throws EdmPrimitiveTypeException;
 
   /**
-   * Gets actual primitive value.
+   * Serialize the current value as String.
    *
-   * @return
+   * @return a String representation of this value
    */
-  public Object toValue() {
-    return this.value;
-  }
+  @Override
+  String toString();
 
-  /**
-   * Casts primitive value.
-   *
-   * @param <T> cast.
-   * @return casted value.
-   */
-  @SuppressWarnings("unchecked")
-  public <T> T toCastValue() {
-    return (T) getJavaType().cast(toValue());
-  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/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
index 04350cf..440b461 100644
--- 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
@@ -107,6 +107,24 @@ public class ODataProperty implements Serializable, ODataInvokeResult {
   }
 
   /**
+   * Checks if has geospatial value.
+   *
+   * @return 'TRUE' if has geospatial value; 'FALSE' otherwise.
+   */
+  public boolean hasGeospatialValue() {
+    return !hasNullValue() && this.value.isGeospatial();
+  }
+
+  /**
+   * Gets geospatial value.
+   *
+   * @return geospatial value if exists; null otherwise.
+   */
+  public ODataGeospatialValue getGeospatialValue() {
+    return hasGeospatialValue() ? this.value.asGeospatial() : null;
+  }
+
+  /**
    * Checks if has complex value.
    *
    * @return 'TRUE' if has complex value; 'FALSE' otherwise.

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/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
deleted file mode 100644
index 3f3eb9c..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.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;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-
-/**
- * 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;
-
-  private static String getPattern(final EdmPrimitiveTypeKind type) {
-    return type == EdmPrimitiveTypeKind.DateTime
-            ? "yyyy-MM-dd'T'HH:mm:ss"
-            : type == EdmPrimitiveTypeKind.Date
-            ? "yyyy-MM-dd"
-            : "yyyy-MM-dd'T'HH:mm:ss";
-  }
-
-  public static ODataTimestamp getInstance(final EdmPrimitiveTypeKind type, final Timestamp timestamp) {
-    return new ODataTimestamp(new SimpleDateFormat(getPattern(type)),
-            new Date(timestamp.getTime()), timestamp.getNanos(), type == EdmPrimitiveTypeKind.DateTimeOffset);
-  }
-
-  public static ODataTimestamp parse(final EdmPrimitiveTypeKind type, final String input) {
-    final ODataTimestamp instance;
-
-    final String[] dateParts = input.split("\\.");
-    final SimpleDateFormat sdf = new SimpleDateFormat(getPattern(type));
-    final boolean isOffset = type == EdmPrimitiveTypeKind.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 " + getPattern(type), 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/4780fc51/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
index e6b5279..d56f188 100644
--- 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
@@ -19,93 +19,66 @@
 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;
+public interface ODataValue extends Serializable {
 
   /**
    * Check is is a primitive value.
    *
    * @return 'TRUE' if primitive; 'FALSE' otherwise.
    */
-  public boolean isPrimitive() {
-    return (this instanceof ODataPrimitiveValue);
-  }
+  boolean isPrimitive();
 
   /**
    * Casts to primitive value.
    *
    * @return primitive value.
    */
-  public ODataPrimitiveValue asPrimitive() {
-    return isPrimitive() ? (ODataPrimitiveValue) this : null;
-  }
+  ODataPrimitiveValue asPrimitive();
 
   /**
-   * Check is is a complex value.
+   * Check is is a geospatail value.
    *
-   * @return 'TRUE' if complex; 'FALSE' otherwise.
+   * @return 'TRUE' if geospatail; 'FALSE' otherwise.
    */
-  public boolean isComplex() {
-    return (this instanceof ODataComplexValue);
-  }
+  boolean isGeospatial();
 
   /**
-   * Casts to complex value.
+   * Casts to geospatail value.
    *
-   * @return complex value.
+   * @return geospatail value.
    */
-  public ODataComplexValue asComplex() {
-    return isComplex() ? (ODataComplexValue) this : null;
-  }
+  ODataGeospatialValue asGeospatial();
 
   /**
    * Check is is a collection value.
    *
    * @return 'TRUE' if collection; 'FALSE' otherwise.
    */
-  public boolean isCollection() {
-    return (this instanceof ODataCollectionValue);
-  }
+  boolean isCollection();
 
   /**
    * Casts to collection value.
    *
    * @return collection value.
    */
-  public ODataCollectionValue asCollection() {
-    return isCollection() ? (ODataCollectionValue) this : null;
-  }
+  ODataCollectionValue asCollection();
 
   /**
-   * {@inheritDoc }
+   * Check is is a complex value.
+   *
+   * @return 'TRUE' if complex; 'FALSE' otherwise.
    */
-  @Override
-  public boolean equals(final Object obj) {
-    return EqualsBuilder.reflectionEquals(this, obj);
-  }
+  boolean isComplex();
 
   /**
-   * {@inheritDoc }
+   * Casts to complex value.
+   *
+   * @return complex value.
    */
-  @Override
-  public int hashCode() {
-    return HashCodeBuilder.reflectionHashCode(this);
-  }
+  ODataComplexValue asComplex();
 
-  /**
-   * {@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/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
deleted file mode 100644
index 9ba47da..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.utils;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.net.URLEncoder;
-import java.text.DecimalFormat;
-import java.util.UUID;
-
-import org.apache.commons.codec.binary.Hex;
-import org.apache.commons.io.IOUtils;
-import org.apache.http.entity.InputStreamEntity;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.domain.ODataDuration;
-import org.apache.olingo.client.api.domain.ODataTimestamp;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * URI utilities.
- */
-public final class URIUtils {
-
-  /**
-   * Logger.
-   */
-  private static final Logger LOG = LoggerFactory.getLogger(URIUtils.class);
-
-  private URIUtils() {
-    // Empty private constructor for static utility classes
-  }
-
-  /**
-   * Build URI starting from the given base and href.
-   * <br/>
-   * If href is absolute or base is null then base will be ignored.
-   *
-   * @param base URI prefix.
-   * @param href URI suffix.
-   * @return built URI.
-   */
-  public static URI getURI(final String base, final String href) {
-    if (href == null) {
-      throw new IllegalArgumentException("Null link provided");
-    }
-
-    URI uri = URI.create(href);
-
-    if (!uri.isAbsolute() && base != null) {
-      uri = URI.create(base + "/" + href);
-    }
-
-    return uri.normalize();
-  }
-
-  /**
-   * Build URI starting from the given base and href.
-   * <br/>
-   * If href is absolute or base is null then base will be ignored.
-   *
-   * @param base URI prefix.
-   * @param href URI suffix.
-   * @return built URI.
-   */
-  public static URI getURI(final URI base, final URI href) {
-    if (href == null) {
-      throw new IllegalArgumentException("Null link provided");
-    }
-    return getURI(base, href.toASCIIString());
-  }
-
-  /**
-   * Build URI starting from the given base and href.
-   * <br/>
-   * If href is absolute or base is null then base will be ignored.
-   *
-   * @param base URI prefix.
-   * @param href URI suffix.
-   * @return built URI.
-   */
-  public static URI getURI(final URI base, final String href) {
-    if (href == null) {
-      throw new IllegalArgumentException("Null link provided");
-    }
-
-    URI uri = URI.create(href);
-
-    if (!uri.isAbsolute() && base != null) {
-      uri = URI.create(base.toASCIIString() + "/" + href);
-    }
-
-    return uri.normalize();
-  }
-
-  /**
-   * Gets function import URI segment.
-   *
-   * @param entityContainer entity container.
-   * @param functionImport function import.
-   * @return URI segment.
-   */
-  public static String rootFunctionImportURISegment(
-          final EdmEntityContainer entityContainer, final EdmFunctionImport functionImport) {
-
-    final StringBuilder result = new StringBuilder();
-    // TODO: https://issues.apache.org/jira/browse/OLINGO-209
-    // if (!entityContainer.isDefaultEntityContainer()) {
-    //  result.append(entityContainer.getName()).append('.');
-    // }
-    result.append(functionImport.getName());
-
-    return result.toString();
-  }
-
-  /**
-   * Turns primitive values into their respective URI representation.
-   *
-   * @param obj primitive value
-   * @return URI representation
-   */
-  public static String escape(final Object obj) {
-    String value;
-
-    try {
-      value = (obj instanceof UUID)
-              ? "guid'" + obj.toString() + "'"
-              : (obj instanceof byte[])
-              ? "X'" + Hex.encodeHexString((byte[]) obj) + "'"
-              : ((obj instanceof ODataTimestamp) && ((ODataTimestamp) obj).getTimezone() == null)
-              ? "datetime'" + URLEncoder.encode(((ODataTimestamp) obj).toString(), Constants.UTF8) + "'"
-              : ((obj instanceof ODataTimestamp) && ((ODataTimestamp) obj).getTimezone() != null)
-              ? "datetimeoffset'" + URLEncoder.encode(((ODataTimestamp) obj).toString(), Constants.UTF8)
-              + "'"
-              : (obj instanceof ODataDuration)
-              ? "time'" + ((ODataDuration) obj).toString() + "'"
-              : (obj instanceof BigDecimal)
-              ? new DecimalFormat("#.#######################").format((BigDecimal) obj) + "M"
-              : (obj instanceof Double)
-              ? new DecimalFormat("#.#######################E0").format((Double) obj) + "D"
-              : (obj instanceof Float)
-              ? new DecimalFormat("#.#######E0").format((Float) obj) + "f"
-              : (obj instanceof Long)
-              ? ((Long) obj).toString() + "L"
-              : (obj instanceof String)
-              ? "'" + URLEncoder.encode((String) obj, Constants.UTF8) + "'"
-              : obj.toString();
-    } catch (Exception e) {
-      LOG.warn("While escaping '{}', using toString()", obj, e);
-      value = obj.toString();
-    }
-
-    return value;
-  }
-
-  public static InputStreamEntity buildInputStreamEntity(final CommonODataClient client, final InputStream input) {
-    InputStreamEntity entity;
-    if (client.getConfiguration().isUseChuncked()) {
-      entity = new InputStreamEntity(input, -1);
-    } else {
-      byte[] bytes = new byte[0];
-      try {
-        bytes = IOUtils.toByteArray(input);
-      } catch (IOException e) {
-        LOG.error("While reading input for not chunked encoding", e);
-      }
-
-      entity = new InputStreamEntity(new ByteArrayInputStream(bytes), bytes.length);
-    }
-    entity.setChunked(client.getConfiguration().isUseChuncked());
-
-    return entity;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
index 52d5d1c..2ecd92c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
@@ -19,10 +19,10 @@
 package org.apache.olingo.client.core;
 
 import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.domain.ODataGeospatialValue;
 import org.apache.olingo.client.api.domain.ODataObjectFactory;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
 import org.apache.olingo.client.api.op.ODataWriter;
+import org.apache.olingo.client.core.domain.ODataGeospatialValueImpl;
+import org.apache.olingo.client.core.domain.ODataPrimitiveValueImpl;
 import org.apache.olingo.client.core.op.impl.ODataObjectFactoryImpl;
 import org.apache.olingo.client.core.op.impl.ODataWriterImpl;
 
@@ -35,13 +35,13 @@ public abstract class AbstractODataClient implements CommonODataClient {
   private final ODataObjectFactory objectFactory = new ODataObjectFactoryImpl(this);
 
   @Override
-  public ODataPrimitiveValue.Builder getPrimitiveValueBuilder() {
-    return new ODataPrimitiveValue.Builder(this);
+  public ODataPrimitiveValueImpl.BuilderImpl getPrimitiveValueBuilder() {
+    return new ODataPrimitiveValueImpl.BuilderImpl(this.getServiceVersion());
   }
 
   @Override
-  public ODataGeospatialValue.Builder getGeospatialValueBuilder() {
-    return new ODataGeospatialValue.Builder(this);
+  public ODataGeospatialValueImpl.BuilderImpl getGeospatialValueBuilder() {
+    return new ODataGeospatialValueImpl.BuilderImpl();
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
index 1cad2a9..6cf1927 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
@@ -31,7 +31,7 @@ import org.apache.olingo.client.api.communication.response.ODataEntityCreateResp
 import org.apache.olingo.client.api.domain.ODataEntity;
 import org.apache.olingo.client.api.format.ODataPubFormat;
 import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
 import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
 import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
index 662a844..012d975 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
@@ -31,7 +31,7 @@ import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResp
 import org.apache.olingo.client.api.domain.ODataEntity;
 import org.apache.olingo.client.api.format.ODataPubFormat;
 import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
 import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
 import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java
index f02dc34..0f91864 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java
@@ -31,7 +31,7 @@ import org.apache.olingo.client.api.communication.response.ODataLinkOperationRes
 import org.apache.olingo.client.api.domain.ODataLink;
 import org.apache.olingo.client.api.format.ODataFormat;
 import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
 import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
 import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java
index 419ee03..0fea3a9 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java
@@ -31,7 +31,7 @@ import org.apache.olingo.client.api.communication.response.ODataLinkOperationRes
 import org.apache.olingo.client.api.domain.ODataLink;
 import org.apache.olingo.client.api.format.ODataFormat;
 import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
 import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
 import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
index f782a6e..04c87cc 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
@@ -31,7 +31,7 @@ import org.apache.olingo.client.api.communication.response.ODataPropertyUpdateRe
 import org.apache.olingo.client.api.domain.ODataProperty;
 import org.apache.olingo.client.api.format.ODataFormat;
 import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
 import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
 import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
index af0eba6..dc3a727 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
@@ -18,7 +18,6 @@
  */
 package org.apache.olingo.client.core.communication.request.cud;
 
-import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
 import org.apache.commons.io.IOUtils;
@@ -30,13 +29,13 @@ import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
 import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest;
 import org.apache.olingo.client.api.communication.response.ODataValueUpdateResponse;
 import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataValue;
 import org.apache.olingo.client.api.format.ODataValueFormat;
 import org.apache.olingo.client.api.http.HttpClientException;
 import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
 import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
 import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
+import org.apache.olingo.client.core.domain.ODataPrimitiveValueImpl;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 
 /**
@@ -48,7 +47,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
   /**
    * Value to be created.
    */
-  private final ODataValue value;
+  private final ODataPrimitiveValue value;
 
   /**
    * Constructor.
@@ -59,7 +58,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
    * @param value value to be created.
    */
   ODataValueUpdateRequestImpl(final CommonODataClient odataClient,
-          final HttpMethod method, final URI targetURI, final ODataValue value) {
+          final HttpMethod method, final URI targetURI, final ODataPrimitiveValue value) {
 
     super(odataClient, ODataValueFormat.class, method, targetURI);
     // set request body
@@ -94,7 +93,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
    */
   private class ODataValueUpdateResponseImpl extends AbstractODataResponse implements ODataValueUpdateResponse {
 
-    private ODataValue value = null;
+    private ODataPrimitiveValue value = null;
 
     /**
      * Constructor.
@@ -118,17 +117,17 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
      * {@inheritDoc }
      */
     @Override
-    public ODataValue getBody() {
+    public ODataPrimitiveValue getBody() {
       if (value == null) {
         final ODataValueFormat format = ODataValueFormat.fromString(getAccept());
 
         try {
-          value = new ODataPrimitiveValue.Builder(odataClient).
+          value = new ODataPrimitiveValueImpl.BuilderImpl(odataClient.getServiceVersion()).
                   setType(format == ODataValueFormat.TEXT
                           ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
                   setText(IOUtils.toString(getRawResponse())).
                   build();
-        } catch (IOException e) {
+        } catch (Exception e) {
           throw new HttpClientException(e);
         } finally {
           this.close();

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
index 3dc9485..c6355e4 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
@@ -44,7 +44,7 @@ import org.apache.olingo.client.api.format.ODataFormat;
 import org.apache.olingo.client.api.format.ODataPubFormat;
 import org.apache.olingo.client.api.http.HttpClientException;
 import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
 import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
 import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
index f5cb270..0ccb3c7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
@@ -52,6 +52,7 @@ public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory imple
   }
 
   @Override
+  @SuppressWarnings("unchecked")
   public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(final URI uri, final Edm edm,
           final FullQualifiedName container, final String functionImport,
           final LinkedHashMap<String, ODataValue> parameters) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
index 7a2ef0c..fd4e647 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
@@ -18,7 +18,6 @@
  */
 package org.apache.olingo.client.core.communication.request.retrieve;
 
-import java.io.IOException;
 import java.net.URI;
 import org.apache.commons.io.IOUtils;
 import org.apache.http.HttpResponse;
@@ -27,15 +26,15 @@ import org.apache.olingo.client.api.CommonODataClient;
 import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
 import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataValue;
 import org.apache.olingo.client.api.format.ODataValueFormat;
 import org.apache.olingo.client.api.http.HttpClientException;
+import org.apache.olingo.client.core.domain.ODataPrimitiveValueImpl;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 
 /**
  * This class implements an OData entity property value query request.
  */
-public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataValue, ODataValueFormat>
+public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataPrimitiveValue, ODataValueFormat>
         implements ODataValueRequest {
 
   /**
@@ -52,7 +51,7 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataVal
    * {@inheritDoc }
    */
   @Override
-  public ODataRetrieveResponse<ODataValue> execute() {
+  public ODataRetrieveResponse<ODataPrimitiveValue> execute() {
     final HttpResponse res = doExecute();
     return new ODataValueResponseImpl(httpClient, res);
   }
@@ -62,7 +61,7 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataVal
    */
   protected class ODataValueResponseImpl extends ODataRetrieveResponseImpl {
 
-    private ODataValue value = null;
+    private ODataPrimitiveValue value = null;
 
     /**
      * Constructor.
@@ -86,17 +85,17 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataVal
      * {@inheritDoc }
      */
     @Override
-    public ODataValue getBody() {
+    public ODataPrimitiveValue getBody() {
       if (value == null) {
         final ODataValueFormat format = ODataValueFormat.fromString(getContentType());
 
         try {
-          value = new ODataPrimitiveValue.Builder(odataClient).
+          value = new ODataPrimitiveValueImpl.BuilderImpl(odataClient.getServiceVersion()).
                   setType(format == ODataValueFormat.TEXT
                           ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
                   setText(IOUtils.toString(getRawResponse())).
                   build();
-        } catch (IOException e) {
+        } catch (Exception e) {
           throw new HttpClientException(e);
         } finally {
           this.close();

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
index 3726e60..5563a74 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
@@ -36,7 +36,7 @@ import org.apache.olingo.client.api.communication.request.batch.ODataBatchReques
 import org.apache.olingo.client.api.communication.response.ODataResponse;
 import org.apache.olingo.client.api.format.ODataMediaFormat;
 import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
 import org.apache.olingo.client.core.communication.request.Wrapper;
 import org.apache.olingo.client.core.communication.request.ODataRequestImpl;
 import org.apache.commons.io.IOUtils;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
index 2d69ef7..78d87ba 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
@@ -36,10 +36,10 @@ import org.apache.olingo.commons.api.edm.geo.Polygon;
 
 class AtomGeoValueSerializer {
 
-  public static final ThreadLocal<DecimalFormat> DOUBLE_FORMAT = new ThreadLocal<DecimalFormat>() {
+  private static final ThreadLocal<DecimalFormat> DOUBLE_FORMAT = new ThreadLocal<DecimalFormat>() {
     @Override
     protected DecimalFormat initialValue() {
-      DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols();
+      final DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols();
       otherSymbols.setDecimalSeparator('.');
       return new DecimalFormat("#.#########################", otherSymbols);
     }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
index 9780e12..884d815 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
@@ -51,12 +51,10 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
     while (reader.hasNext() && !foundEndProperty) {
       final XMLEvent event = reader.nextEvent();
 
-      if (event.isStartElement()) {
-        if (typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
-          final EdmPrimitiveTypeKind geoType = EdmPrimitiveTypeKind.valueOfFQN(
-                  version, typeInfo.getFullQualifiedName().toString());
-          value = new GeospatialValueImpl(this.geoDeserializer.deserialize(reader, event.asStartElement(), geoType));
-        }
+      if (event.isStartElement() && typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
+        final EdmPrimitiveTypeKind geoType = EdmPrimitiveTypeKind.valueOfFQN(
+                version, typeInfo.getFullQualifiedName().toString());
+        value = new GeospatialValueImpl(this.geoDeserializer.deserialize(reader, event.asStartElement(), geoType));
       }
 
       if (event.isCharacters() && !event.asCharacters().isWhiteSpace()

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java
new file mode 100644
index 0000000..43ef056
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java
@@ -0,0 +1,130 @@
+/*
+ * 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.domain;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.olingo.client.api.domain.AbstractODataValue;
+import org.apache.olingo.client.api.domain.ODataGeospatialValue;
+import org.apache.olingo.commons.api.edm.EdmGeospatialType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+
+public class ODataGeospatialValueImpl extends AbstractODataValue implements ODataGeospatialValue {
+
+  private static final long serialVersionUID = 8277433906326348952L;
+
+  public static class BuilderImpl implements Builder {
+
+    private final ODataGeospatialValueImpl instance;
+
+    public BuilderImpl() {
+      this.instance = new ODataGeospatialValueImpl();
+    }
+
+    @Override
+    public BuilderImpl setType(final EdmPrimitiveTypeKind type) {
+      if (type != null && !type.isGeospatial()) {
+        throw new IllegalArgumentException("Don't use this for non-geospatial types");
+      }
+      if (type == EdmPrimitiveTypeKind.Geography || type == EdmPrimitiveTypeKind.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.");
+      }
+
+      if (type != null) {
+        this.instance.typeKind = type;
+        this.instance.type = EdmPrimitiveTypeFactory.getGeoInstance(type);
+      }
+
+      return this;
+    }
+
+    @Override
+    public BuilderImpl setValue(final Geospatial value) {
+      this.instance.value = value;
+      if (value != null) {
+        setType(value.getEdmPrimitiveTypeKind());
+      }
+      return this;
+    }
+
+    @Override
+    public ODataGeospatialValueImpl build() {
+      if (this.instance.type == null) {
+        throw new IllegalArgumentException("Must provide geospatial type");
+      }
+      if (this.instance.value == null) {
+        throw new IllegalArgumentException("Must provide geospatial value");
+      }
+
+      return this.instance;
+    }
+  }
+
+  /**
+   * Type kind.
+   */
+  private EdmPrimitiveTypeKind typeKind;
+
+  /**
+   * Type.
+   */
+  private EdmGeospatialType type;
+
+  /**
+   * Value.
+   */
+  private Geospatial value;
+
+  @Override
+  public EdmPrimitiveTypeKind getTypeKind() {
+    return typeKind;
+  }
+
+  @Override
+  public EdmGeospatialType getType() {
+    return type;
+  }
+
+  @Override
+  public Geospatial toValue() {
+    return value;
+  }
+
+  @Override
+  public <T extends Geospatial> T toCastValue(final Class<T> reference) {
+    return reference.cast(this.value);
+  }
+
+  @Override
+  public int hashCode() {
+    return HashCodeBuilder.reflectionHashCode(this);
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    return EqualsBuilder.reflectionEquals(this, obj);
+  }
+
+}


[10/11] [OLINGO-65] Implementation completed

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
new file mode 100644
index 0000000..4f191d8
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
@@ -0,0 +1,174 @@
+/*
+ * 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.domain;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.olingo.client.api.domain.AbstractODataValue;
+import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+
+public class ODataPrimitiveValueImpl extends AbstractODataValue implements ODataPrimitiveValue {
+
+  private static final long serialVersionUID = 8889282662298376036L;
+
+  public static class BuilderImpl implements Builder {
+
+    private final ODataServiceVersion version;
+
+    private final ODataPrimitiveValueImpl instance;
+
+    public BuilderImpl(final ODataServiceVersion version) {
+      this.version = version;
+      this.instance = new ODataPrimitiveValueImpl();
+    }
+
+    @Override
+    public BuilderImpl setType(final EdmPrimitiveTypeKind type) {
+      if (type != null && !type.getSupportedVersions().contains(version)) {
+        throw new IllegalArgumentException(String.format(
+                "Type %s not supported by OData version %s", type.toString(), version));
+      }
+      if (type == EdmPrimitiveTypeKind.Stream) {
+        throw new IllegalArgumentException(String.format(
+                "Cannot build a primitive value for %s", EdmPrimitiveTypeKind.Stream.toString()));
+      }
+      if (type != null && type.isGeospatial()) {
+        throw new IllegalArgumentException("Don't use this for geospatial types");
+      }
+
+      this.instance.typeKind = type == null ? EdmPrimitiveTypeKind.String : type;
+      this.instance.type = EdmPrimitiveTypeFactory.getNonGeoInstance(this.instance.typeKind);
+
+      return this;
+    }
+
+    @Override
+    public BuilderImpl setText(final String text) {
+      this.instance.text = text;
+      return this;
+    }
+
+    @Override
+    public BuilderImpl setValue(final Object value) {
+      this.instance.value = value;
+      return this;
+    }
+
+    @Override
+    public ODataPrimitiveValueImpl build() {
+      if (this.instance.text == null && this.instance.value == null) {
+        throw new IllegalArgumentException("Must provide either text or value");
+      }
+      if (this.instance.text != null && this.instance.value != null) {
+        throw new IllegalArgumentException("Cannot provide both text and value");
+      }
+
+      if (this.instance.type == null) {
+        setType(EdmPrimitiveTypeKind.String);
+      }
+
+      if (this.instance.text != null) {
+        final Class<?> returnType = this.instance.type.getDefaultType().isAssignableFrom(Calendar.class)
+                ? Timestamp.class : this.instance.type.getDefaultType();
+        try {
+          // TODO: when Edm is available, set facets when calling this method
+          this.instance.value = this.instance.type.valueOfString(
+                  this.instance.text, null, null, 40, 25, null, returnType);
+        } catch (EdmPrimitiveTypeException e) {
+          throw new IllegalArgumentException(e);
+        }
+      }
+      if (this.instance.value != null) {
+        try {
+          // TODO: when Edm is available, set facets when calling this method
+          this.instance.text = this.instance.type.valueToString(
+                  this.instance.value, null, null, 40, 25, null);
+        } catch (EdmPrimitiveTypeException e) {
+          throw new IllegalArgumentException(e);
+        }
+      }
+
+      return this.instance;
+    }
+  }
+
+  /**
+   * Type kind.
+   */
+  private EdmPrimitiveTypeKind typeKind;
+
+  /**
+   * Type.
+   */
+  private EdmPrimitiveType type;
+
+  /**
+   * Text value.
+   */
+  private String text;
+
+  /**
+   * Actual value.
+   */
+  private Object value;
+
+  @Override
+  public EdmPrimitiveTypeKind getTypeKind() {
+    return typeKind;
+  }
+
+  @Override
+  public EdmPrimitiveType getType() {
+    return type;
+  }
+
+  @Override
+  public Object toValue() {
+    return this.value;
+  }
+
+  @Override
+  public <T> T toCastValue(final Class<T> reference) throws EdmPrimitiveTypeException {
+    // TODO: when Edm is available, set facets when calling this method
+    return type.valueOfString(this.text, null, null, 40, 25, null, reference);
+  }
+
+  @Override
+  public String toString() {
+    return this.text;
+  }
+
+  @Override
+  public int hashCode() {
+    return HashCodeBuilder.reflectionHashCode(this);
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    return EqualsBuilder.reflectionEquals(this, obj);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
index b185d5d..2c2cdea 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
@@ -22,8 +22,8 @@ import java.io.StringWriter;
 import java.net.URI;
 import java.util.Iterator;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.Constants;
 import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.Constants;
 import org.apache.olingo.client.api.data.Entry;
 import org.apache.olingo.client.api.data.Feed;
 import org.apache.olingo.client.api.data.Link;
@@ -35,18 +35,15 @@ import org.apache.olingo.client.api.domain.ODataCollectionValue;
 import org.apache.olingo.client.api.domain.ODataComplexValue;
 import org.apache.olingo.client.api.domain.ODataEntity;
 import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataGeospatialValue;
 import org.apache.olingo.client.api.domain.ODataInlineEntity;
 import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
 import org.apache.olingo.client.api.domain.ODataLink;
 import org.apache.olingo.client.api.domain.ODataOperation;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
 import org.apache.olingo.client.api.domain.ODataProperty;
 import org.apache.olingo.client.api.domain.ODataServiceDocument;
 import org.apache.olingo.client.api.domain.ODataValue;
 import org.apache.olingo.client.api.format.ODataPubFormat;
 import org.apache.olingo.client.api.op.CommonODataBinder;
-import org.apache.olingo.client.api.utils.URIUtils;
 import org.apache.olingo.client.core.data.CollectionValueImpl;
 import org.apache.olingo.client.core.data.ComplexValueImpl;
 import org.apache.olingo.client.core.data.GeospatialValueImpl;
@@ -54,6 +51,7 @@ import org.apache.olingo.client.core.data.JSONPropertyImpl;
 import org.apache.olingo.client.core.data.LinkImpl;
 import org.apache.olingo.client.core.data.NullValueImpl;
 import org.apache.olingo.client.core.data.PrimitiveValueImpl;
+import org.apache.olingo.client.core.uri.URIUtils;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -216,11 +214,11 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
 
     if (setType) {
       if (property.hasPrimitiveValue()) {
-        propertyResource.setType(property.getPrimitiveValue().getTypeName());
+        propertyResource.setType(property.getPrimitiveValue().getType().toString());
       } else if (property.hasComplexValue()) {
-        propertyResource.setType(property.getComplexValue().getTypeName());
+        propertyResource.setType(property.getComplexValue().getType());
       } else if (property.hasCollectionValue()) {
-        propertyResource.setType(property.getCollectionValue().getTypeName());
+        propertyResource.setType(property.getCollectionValue().getType());
       }
     }
 
@@ -233,12 +231,9 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
     if (value == null) {
       valueResource = new NullValueImpl();
     } else if (value.isPrimitive()) {
-      final ODataPrimitiveValue _value = value.asPrimitive();
-      if (_value instanceof ODataGeospatialValue) {
-        valueResource = new GeospatialValueImpl(((ODataGeospatialValue) _value).getGeospatial());
-      } else {
-        valueResource = new PrimitiveValueImpl(_value.toString());
-      }
+      valueResource = new PrimitiveValueImpl(value.asPrimitive().toString());
+    } else if (value.isGeospatial()) {
+      valueResource = new GeospatialValueImpl(value.asGeospatial().toValue());
     } else if (value.isComplex()) {
       final ODataComplexValue _value = value.asComplex();
       valueResource = new ComplexValueImpl();
@@ -375,12 +370,14 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
     ODataValue value = null;
 
     if (resource.getValue().isSimple()) {
-      value = new ODataPrimitiveValue.Builder(client).setText(resource.getValue().asSimple().get()).
+      value = client.getPrimitiveValueBuilder().
+              setText(resource.getValue().asSimple().get()).
               setType(resource.getType() == null
                       ? null
                       : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
     } else if (resource.getValue().isGeospatial()) {
-      value = new ODataGeospatialValue.Builder(client).setValue(resource.getValue().asGeospatial().get()).
+      value = client.getGeospatialValueBuilder().
+              setValue(resource.getValue().asGeospatial().get()).
               setType(resource.getType() == null
                       || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().toString().equals(resource.getType())
                       || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().toString().equals(resource.getType())

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java
index 3104b8e..cc0b388 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java
@@ -25,6 +25,7 @@ import org.apache.olingo.client.api.domain.ODataCollectionValue;
 import org.apache.olingo.client.api.domain.ODataComplexValue;
 import org.apache.olingo.client.api.domain.ODataEntity;
 import org.apache.olingo.client.api.domain.ODataEntitySet;
+import org.apache.olingo.client.api.domain.ODataGeospatialValue;
 import org.apache.olingo.client.api.domain.ODataInlineEntity;
 import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
 import org.apache.olingo.client.api.domain.ODataLink;
@@ -42,45 +43,21 @@ public class ODataObjectFactoryImpl implements ODataObjectFactory {
     this.client = client;
   }
 
-  /**
-   * Instantiates a new entity set.
-   *
-   * @return entity set.
-   */
   @Override
   public ODataEntitySet newEntitySet() {
     return new ODataEntitySet();
   }
 
-  /**
-   * Instantiates a new entity set.
-   *
-   * @param next next link.
-   * @return entity set.
-   */
   @Override
   public ODataEntitySet newEntitySet(final URI next) {
     return new ODataEntitySet(next);
   }
 
-  /**
-   * Instantiates a new entity.
-   *
-   * @param name OData entity name.
-   * @return entity.
-   */
   @Override
   public ODataEntity newEntity(final String name) {
     return new ODataEntity(name);
   }
 
-  /**
-   * Instantiates a new entity.
-   *
-   * @param name OData entity name.
-   * @param link self link.
-   * @return entity.
-   */
   @Override
   public ODataEntity newEntity(final String name, final URI link) {
     final ODataEntity result = new ODataEntity(name);
@@ -88,14 +65,6 @@ public class ODataObjectFactoryImpl implements ODataObjectFactory {
     return result;
   }
 
-  /**
-   * Instantiates a new in-line entity set.
-   *
-   * @param name name.
-   * @param link edit link.
-   * @param entitySet entity set.
-   * @return in-line entity set.
-   */
   @Override
   public ODataInlineEntitySet newInlineEntitySet(final String name, final URI link,
           final ODataEntitySet entitySet) {
@@ -104,15 +73,6 @@ public class ODataObjectFactoryImpl implements ODataObjectFactory {
             link, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
   }
 
-  /**
-   * Instantiates a new in-line entity set.
-   *
-   * @param name name.
-   * @param baseURI base URI.
-   * @param href href.
-   * @param entitySet entity set.
-   * @return in-line entity set.
-   */
   @Override
   public ODataInlineEntitySet newInlineEntitySet(final String name, final URI baseURI, final String href,
           final ODataEntitySet entitySet) {
@@ -121,28 +81,11 @@ public class ODataObjectFactoryImpl implements ODataObjectFactory {
             baseURI, href, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
   }
 
-  /**
-   * Instantiates a new in-line entity.
-   *
-   * @param name name.
-   * @param link edit link.
-   * @param entity entity.
-   * @return in-line entity.
-   */
   @Override
   public ODataInlineEntity newInlineEntity(final String name, final URI link, final ODataEntity entity) {
     return new ODataInlineEntity(client.getServiceVersion(), link, ODataLinkType.ENTITY_NAVIGATION, name, entity);
   }
 
-  /**
-   * Instantiates a new in-line entity.
-   *
-   * @param name name.
-   * @param baseURI base URI.
-   * @param href href.
-   * @param entity entity.
-   * @return in-line entity.
-   */
   @Override
   public ODataInlineEntity newInlineEntity(final String name, final URI baseURI, final String href,
           final ODataEntity entity) {
@@ -151,145 +94,69 @@ public class ODataObjectFactoryImpl implements ODataObjectFactory {
             baseURI, href, ODataLinkType.ENTITY_NAVIGATION, name, entity);
   }
 
-  /**
-   * Instantiates a new entity navigation link.
-   *
-   * @param name name.
-   * @param link link.
-   * @return entity navigation link.
-   */
   @Override
   public ODataLink newEntityNavigationLink(final String name, final URI link) {
     return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
             setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
   }
 
-  /**
-   * Instantiates a new entity navigation link.
-   *
-   * @param name name.
-   * @param baseURI base URI.
-   * @param href href.
-   * @return entity navigation link.
-   */
   @Override
   public ODataLink newEntityNavigationLink(final String name, final URI baseURI, final String href) {
     return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
             setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
   }
 
-  /**
-   * Instantiates a new entity set navigation link.
-   *
-   * @param name name.
-   * @param link link.
-   * @return entity set navigation link.
-   */
   @Override
   public ODataLink newFeedNavigationLink(final String name, final URI link) {
     return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
             setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
   }
 
-  /**
-   * Instantiates a new entity set navigation link.
-   *
-   * @param name name.
-   * @param baseURI base URI.
-   * @param href href.
-   * @return entity set navigation link.
-   */
   @Override
   public ODataLink newFeedNavigationLink(final String name, final URI baseURI, final String href) {
     return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
             setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
   }
 
-  /**
-   * Instantiates a new association link.
-   *
-   * @param name name.
-   * @param link link.
-   * @return association link.
-   */
   @Override
   public ODataLink newAssociationLink(final String name, final URI link) {
     return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
             setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
   }
 
-  /**
-   * Instantiates a new association link.
-   *
-   * @param name name.
-   * @param baseURI base URI.
-   * @param href href.
-   * @return association link.
-   */
   @Override
   public ODataLink newAssociationLink(final String name, final URI baseURI, final String href) {
     return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
             setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
   }
 
-  /**
-   * Instantiates a new media-edit link.
-   *
-   * @param name name.
-   * @param link link.
-   * @return media-edit link.
-   */
   @Override
   public ODataLink newMediaEditLink(final String name, final URI link) {
     return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
             setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
   }
 
-  /**
-   * Instantiates a new media-edit link.
-   *
-   * @param name name.
-   * @param baseURI base URI.
-   * @param href href.
-   * @return media-edit link.
-   */
   @Override
   public ODataLink newMediaEditLink(final String name, final URI baseURI, final String href) {
     return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
             setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
   }
 
-  /**
-   * Instantiates a new primitive property.
-   *
-   * @param name name.
-   * @param value value.
-   * @return primitive property.
-   */
   @Override
   public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
     return new ODataProperty(name, value);
   }
 
-  /**
-   * Instantiates a new complex property.
-   *
-   * @param name name.
-   * @param value value.
-   * @return complex property.
-   */
+  @Override
+  public ODataProperty newPrimitiveProperty(final String name, final ODataGeospatialValue value) {
+    return new ODataProperty(name, value);
+  }
+
   @Override
   public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
     return new ODataProperty(name, value);
   }
 
-  /**
-   * Instantiates a new collection property.
-   *
-   * @param name name.
-   * @param value value.
-   * @return collection property.
-   */
   @Override
   public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
     return new ODataProperty(name, value);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
index 8812129..9951db2 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
@@ -22,7 +22,7 @@ import org.apache.olingo.client.api.data.ServiceDocument;
 import org.apache.olingo.client.api.data.ServiceDocumentItem;
 import org.apache.olingo.client.api.domain.ODataServiceDocument;
 import org.apache.olingo.client.api.op.v4.ODataBinder;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
 import org.apache.olingo.client.api.v4.ODataClient;
 import org.apache.olingo.client.core.op.impl.AbstractODataBinder;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
index 14f2704..2beecb3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
@@ -18,7 +18,6 @@
  */
 package org.apache.olingo.client.core.uri;
 
-import org.apache.olingo.client.api.utils.URIUtils;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java
index c7e2d6a..cef0349 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java
@@ -19,7 +19,6 @@
 package org.apache.olingo.client.core.uri;
 
 import org.apache.olingo.client.api.uri.FilterArg;
-import org.apache.olingo.client.api.utils.URIUtils;
 
 /**
  * Filter value literals; obtain instances via <tt>FilterArgFactory</tt>.

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
new file mode 100644
index 0000000..50245ff
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
@@ -0,0 +1,202 @@
+/*
+ * 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.uri;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URLEncoder;
+import java.sql.Timestamp;
+import java.text.DecimalFormat;
+import java.util.Calendar;
+import java.util.UUID;
+import javax.xml.datatype.Duration;
+import org.apache.commons.codec.binary.Hex;
+import org.apache.commons.io.IOUtils;
+import org.apache.http.entity.InputStreamEntity;
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTime;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmTime;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * URI utilities.
+ */
+public final class URIUtils {
+
+  /**
+   * Logger.
+   */
+  private static final Logger LOG = LoggerFactory.getLogger(URIUtils.class);
+
+  private URIUtils() {
+    // Empty private constructor for static utility classes
+  }
+
+  /**
+   * Build URI starting from the given base and href.
+   * <br/>
+   * If href is absolute or base is null then base will be ignored.
+   *
+   * @param base URI prefix.
+   * @param href URI suffix.
+   * @return built URI.
+   */
+  public static URI getURI(final String base, final String href) {
+    if (href == null) {
+      throw new IllegalArgumentException("Null link provided");
+    }
+
+    URI uri = URI.create(href);
+
+    if (!uri.isAbsolute() && base != null) {
+      uri = URI.create(base + "/" + href);
+    }
+
+    return uri.normalize();
+  }
+
+  /**
+   * Build URI starting from the given base and href.
+   * <br/>
+   * If href is absolute or base is null then base will be ignored.
+   *
+   * @param base URI prefix.
+   * @param href URI suffix.
+   * @return built URI.
+   */
+  public static URI getURI(final URI base, final URI href) {
+    if (href == null) {
+      throw new IllegalArgumentException("Null link provided");
+    }
+    return getURI(base, href.toASCIIString());
+  }
+
+  /**
+   * Build URI starting from the given base and href.
+   * <br/>
+   * If href is absolute or base is null then base will be ignored.
+   *
+   * @param base URI prefix.
+   * @param href URI suffix.
+   * @return built URI.
+   */
+  public static URI getURI(final URI base, final String href) {
+    if (href == null) {
+      throw new IllegalArgumentException("Null link provided");
+    }
+
+    URI uri = URI.create(href);
+
+    if (!uri.isAbsolute() && base != null) {
+      uri = URI.create(base.toASCIIString() + "/" + href);
+    }
+
+    return uri.normalize();
+  }
+
+  /**
+   * Gets function import URI segment.
+   *
+   * @param entityContainer entity container.
+   * @param functionImport function import.
+   * @return URI segment.
+   */
+  public static String rootFunctionImportURISegment(
+          final EdmEntityContainer entityContainer, final EdmFunctionImport functionImport) {
+
+    final StringBuilder result = new StringBuilder();
+    // TODO: https://issues.apache.org/jira/browse/OLINGO-209
+    // if (!entityContainer.isDefaultEntityContainer()) {
+    //  result.append(entityContainer.getName()).append('.');
+    // }
+    result.append(functionImport.getName());
+
+    return result.toString();
+  }
+
+  /**
+   * Turns primitive values into their respective URI representation.
+   *
+   * @param obj primitive value
+   * @return URI representation
+   */
+  public static String escape(final Object obj) {
+    String value;
+
+    try {
+      value = (obj instanceof UUID)
+              ? "guid'" + obj.toString() + "'"
+              : (obj instanceof byte[])
+              ? "X'" + Hex.encodeHexString((byte[]) obj) + "'"
+              : (obj instanceof Timestamp)
+              ? "datetime'" + URLEncoder.encode(EdmDateTime.getInstance().
+                      valueToString(obj, null, null, null, null, null), Constants.UTF8) + "'"
+              : (obj instanceof Calendar)
+              ? "datetimeoffset'" + URLEncoder.encode(EdmDateTimeOffset.getInstance().
+                      valueToString(obj, null, null, null, null, null), Constants.UTF8)
+              + "'"
+              : (obj instanceof Duration)
+              ? "time'" + URLEncoder.encode(EdmTime.getInstance().
+                      valueToString(obj, null, null, null, null, null), Constants.UTF8) + "'"
+              : (obj instanceof BigDecimal)
+              ? new DecimalFormat("#.#######################").format((BigDecimal) obj) + "M"
+              : (obj instanceof Double)
+              ? new DecimalFormat("#.#######################E0").format((Double) obj) + "D"
+              : (obj instanceof Float)
+              ? new DecimalFormat("#.#######E0").format((Float) obj) + "f"
+              : (obj instanceof Long)
+              ? ((Long) obj).toString() + "L"
+              : (obj instanceof String)
+              ? "'" + URLEncoder.encode((String) obj, Constants.UTF8) + "'"
+              : obj.toString();
+    } catch (Exception e) {
+      LOG.warn("While escaping '{}', using toString()", obj, e);
+      value = obj.toString();
+    }
+
+    return value;
+  }
+
+  public static InputStreamEntity buildInputStreamEntity(final CommonODataClient client, final InputStream input) {
+    InputStreamEntity entity;
+    if (client.getConfiguration().isUseChuncked()) {
+      entity = new InputStreamEntity(input, -1);
+    } else {
+      byte[] bytes = new byte[0];
+      try {
+        bytes = IOUtils.toByteArray(input);
+      } catch (IOException e) {
+        LOG.error("While reading input for not chunked encoding", e);
+      }
+
+      entity = new InputStreamEntity(new ByteArrayInputStream(bytes), bytes.length);
+    }
+    entity.setChunked(client.getConfiguration().isUseChuncked());
+
+    return entity;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.java
index ced9a6e..b541579 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.java
@@ -18,7 +18,7 @@
  */
 package org.apache.olingo.client.core.uri.v3;
 
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
 import java.util.Map;
 
 import org.apache.commons.lang3.StringUtils;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
index 5326602..df66603 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
@@ -18,13 +18,10 @@
  */
 package org.apache.olingo.client.core;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
 import java.io.File;
 import java.io.InputStream;
 import java.math.BigDecimal;
+import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
@@ -35,8 +32,8 @@ import org.apache.olingo.client.api.Constants;
 import org.apache.olingo.client.api.domain.ODataGeospatialValue;
 import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
 import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.ODataTimestamp;
 import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 import org.apache.olingo.commons.api.edm.geo.Geospatial;
@@ -48,6 +45,9 @@ import org.apache.olingo.commons.api.edm.geo.MultiPoint;
 import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
 import org.apache.olingo.commons.api.edm.geo.Point;
 import org.apache.olingo.commons.api.edm.geo.Polygon;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 public abstract class AbstractPrimitiveTest extends AbstractTest {
 
@@ -65,18 +65,9 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
   }
 
   protected ODataPrimitiveValue writePrimitiveValue(final ODataPrimitiveValue value) {
-    final ODataPrimitiveValue newValue;
-    final EdmPrimitiveTypeKind typeKind = EdmPrimitiveTypeKind.valueOfFQN(
-            getClient().getServiceVersion(), value.getTypeName());
-    if (typeKind.isGeospatial()) {
-      newValue = getClient().getGeospatialValueBuilder().
-              setType(EdmPrimitiveTypeKind.valueOfFQN(getVersion(), value.getTypeName())).
-              setValue(((ODataGeospatialValue) value).getGeospatial()).build();
-    } else {
-      newValue = getClient().getPrimitiveValueBuilder().
-              setType(EdmPrimitiveTypeKind.valueOfFQN(getClient().getServiceVersion(), value.getTypeName())).
-              setValue(value.toValue()).build();
-    }
+    final ODataPrimitiveValue newValue = getClient().getPrimitiveValueBuilder().
+            setType(value.getTypeKind()).
+            setValue(value.toValue()).build();
 
     final InputStream written = getClient().getWriter().writeProperty(
             getClient().getObjectFactory().newPrimitiveProperty(Constants.ELEM_PROPERTY, newValue),
@@ -97,69 +88,102 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
     final ODataPrimitiveValue value =
             readPrimitiveValue(getClass().getResourceAsStream(getFilename(entity, propertyName)));
 
-    final EdmPrimitiveTypeKind typeKind = EdmPrimitiveTypeKind.valueOfFQN(
-            getClient().getServiceVersion(), value.getTypeName());
-    if (typeKind.isGeospatial()) {
-      assertEquals(value.toValue(), writePrimitiveValue(value).toValue());
-    } else {
-      assertEquals(value.toString(), writePrimitiveValue(value).toString());
-    }
+    assertEquals(value.toString(), writePrimitiveValue(value).toString());
 
     return value;
   }
 
-  protected void int32(final String entity, final String propertyName, final int check) {
+  protected ODataGeospatialValue writeGeospatialValue(final ODataGeospatialValue value) {
+    final ODataGeospatialValue newValue = getClient().getGeospatialValueBuilder().
+            setType(value.getTypeKind()).
+            setValue(value.toValue()).
+            build();
+    final InputStream written = getClient().getWriter().writeProperty(
+            getClient().getObjectFactory().newPrimitiveProperty(Constants.ELEM_PROPERTY, newValue),
+            getFormat());
+    return readGeospatialValue(written);
+  }
+
+  protected ODataGeospatialValue readGeospatialValue(final InputStream input) {
+    final ODataProperty property = getClient().getReader().readProperty(input, getFormat());
+    assertNotNull(property);
+    assertTrue(property.hasGeospatialValue());
+    assertNotNull(property.getGeospatialValue());
+
+    return property.getGeospatialValue();
+  }
+
+  protected ODataGeospatialValue readGeospatialValue(final String entity, final String propertyName) {
+    final ODataGeospatialValue value =
+            readGeospatialValue(getClass().getResourceAsStream(getFilename(entity, propertyName)));
+
+    assertEquals(value.toValue(), writeGeospatialValue(value).toValue());
+
+    return value;
+  }
+
+  protected void int32(final String entity, final String propertyName, final int check)
+          throws EdmPrimitiveTypeException {
+
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(EdmPrimitiveTypeKind.Int32.toString(), opv.getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Int32, opv.getTypeKind());
 
-    final Integer value = opv.<Integer>toCastValue();
+    final Integer value = opv.toCastValue(Integer.class);
     assertNotNull(value);
     assertTrue(check == value);
   }
 
-  protected void string(final String entity, final String propertyName, final String check) {
+  protected void string(final String entity, final String propertyName, final String check)
+          throws EdmPrimitiveTypeException {
+
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(EdmPrimitiveTypeKind.String.toString(), opv.getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.String, opv.getTypeKind());
 
-    final String value = opv.<String>toCastValue();
+    final String value = opv.toCastValue(String.class);
     assertNotNull(value);
     assertEquals(check, value);
 
     assertEquals(opv, writePrimitiveValue(opv));
   }
 
-  protected void decimal(final String entity, final String propertyName, final BigDecimal check) {
+  protected void decimal(final String entity, final String propertyName, final BigDecimal check)
+          throws EdmPrimitiveTypeException {
+
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(EdmPrimitiveTypeKind.Decimal.toString(), opv.getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Decimal, opv.getTypeKind());
 
-    final BigDecimal value = opv.<BigDecimal>toCastValue();
+    final BigDecimal value = opv.toCastValue(BigDecimal.class);
     assertNotNull(value);
     assertTrue(check.equals(value));
   }
 
-  protected void datetime(final String entity, final String propertyName, final String check) {
+  protected void datetime(final String entity, final String propertyName, final String check)
+          throws EdmPrimitiveTypeException {
+
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(EdmPrimitiveTypeKind.DateTime.toString(), opv.getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.DateTime, opv.getTypeKind());
 
-    final ODataTimestamp value = opv.<ODataTimestamp>toCastValue();
+    final Timestamp value = opv.toCastValue(Timestamp.class);
     assertNotNull(value);
     assertEquals(check, opv.toString());
   }
 
-  protected void guid(final String entity, final String propertyName, final String check) {
+  protected void guid(final String entity, final String propertyName, final String check)
+          throws EdmPrimitiveTypeException {
+
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(EdmPrimitiveTypeKind.Guid.toString(), opv.getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Guid, opv.getTypeKind());
 
-    final UUID value = opv.<UUID>toCastValue();
+    final UUID value = opv.toCastValue(UUID.class);
     assertNotNull(value);
     assertEquals(check, opv.toString());
   }
 
-  protected void binary(final String entity, final String propertyName) {
+  protected void binary(final String entity, final String propertyName) throws EdmPrimitiveTypeException {
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(EdmPrimitiveTypeKind.Binary.toString(), opv.getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Binary, opv.getTypeKind());
 
-    final byte[] value = opv.<byte[]>toCastValue();
+    final byte[] value = opv.toCastValue(byte[].class);
     assertNotNull(value);
     assertTrue(value.length > 0);
     assertTrue(Base64.isBase64(opv.toString()));
@@ -178,10 +202,10 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
           final EdmPrimitiveTypeKind expectedType,
           final Dimension expectedDimension) {
 
-    final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(expectedType.toString(), opv.getTypeName());
+    final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+    assertEquals(expectedType, opv.getTypeKind());
 
-    final Point point = opv.<Point>toCastValue();
+    final Point point = opv.toCastValue(Point.class);
     assertNotNull(point);
     assertEquals(expectedDimension, point.getDimension());
 
@@ -209,10 +233,10 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
           final EdmPrimitiveTypeKind expectedType,
           final Dimension expectedDimension) {
 
-    final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(expectedType.toString(), opv.getTypeName());
+    final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+    assertEquals(expectedType, opv.getTypeKind());
 
-    final LineString lineString = opv.<LineString>toCastValue();
+    final LineString lineString = opv.toCastValue(LineString.class);
     assertNotNull(lineString);
     assertEquals(expectedDimension, lineString.getDimension());
 
@@ -226,10 +250,10 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
           final EdmPrimitiveTypeKind expectedType,
           final Dimension expectedDimension) {
 
-    final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(expectedType.toString(), opv.getTypeName());
+    final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+    assertEquals(expectedType, opv.getTypeKind());
 
-    final MultiPoint multiPoint = opv.<MultiPoint>toCastValue();
+    final MultiPoint multiPoint = opv.toCastValue(MultiPoint.class);
     assertNotNull(multiPoint);
     assertEquals(expectedDimension, multiPoint.getDimension());
 
@@ -253,10 +277,10 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
           final EdmPrimitiveTypeKind expectedType,
           final Dimension expectedDimension) {
 
-    final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(expectedType.toString(), opv.getTypeName());
+    final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+    assertEquals(expectedType, opv.getTypeKind());
 
-    final MultiLineString multiLine = opv.<MultiLineString>toCastValue();
+    final MultiLineString multiLine = opv.toCastValue(MultiLineString.class);
     assertNotNull(multiLine);
     assertEquals(expectedDimension, multiLine.getDimension());
 
@@ -308,10 +332,10 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
           final EdmPrimitiveTypeKind expectedType,
           final Dimension expectedDimension) {
 
-    final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(expectedType.toString(), opv.getTypeName());
+    final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+    assertEquals(expectedType, opv.getTypeKind());
 
-    final Polygon polygon = opv.<Polygon>toCastValue();
+    final Polygon polygon = opv.toCastValue(Polygon.class);
 
     assertNotNull(polygon);
     assertEquals(expectedDimension, polygon.getDimension());
@@ -328,10 +352,10 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
           final EdmPrimitiveTypeKind expectedType,
           final Dimension expectedDimension) {
 
-    final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(expectedType.toString(), opv.getTypeName());
+    final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+    assertEquals(expectedType, opv.getTypeKind());
 
-    final MultiPolygon multiPolygon = opv.<MultiPolygon>toCastValue();
+    final MultiPolygon multiPolygon = opv.toCastValue(MultiPolygon.class);
     assertNotNull(multiPolygon);
     assertEquals(expectedDimension, multiPolygon.getDimension());
 
@@ -351,10 +375,10 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
           final EdmPrimitiveTypeKind expectedType,
           final Dimension expectedDimension) {
 
-    final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(expectedType.toString(), opv.getTypeName());
+    final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+    assertEquals(expectedType, opv.getTypeKind());
 
-    final GeospatialCollection collection = opv.<GeospatialCollection>toCastValue();
+    final GeospatialCollection collection = opv.toCastValue(GeospatialCollection.class);
     assertNotNull(collection);
     assertEquals(expectedDimension, collection.getDimension());
 
@@ -380,10 +404,10 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
           final EdmPrimitiveTypeKind expectedType,
           final Dimension expectedDimension) {
 
-    final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(expectedType.toString(), opv.getTypeName());
+    final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+    assertEquals(expectedType, opv.getTypeKind());
 
-    final GeospatialCollection collection = opv.<GeospatialCollection>toCastValue();
+    final GeospatialCollection collection = opv.toCastValue(GeospatialCollection.class);
     assertNotNull(collection);
     assertEquals(expectedDimension, collection.getDimension());
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
index e9b97f2..a67f8b8 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
@@ -33,6 +33,7 @@ import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
 import org.apache.olingo.client.api.domain.ODataProperty;
 import org.apache.olingo.client.api.domain.ODataValue;
 import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 import org.junit.Test;
@@ -51,7 +52,7 @@ public abstract class AbstractPropertyTest extends AbstractTest {
             getVersion().name().toLowerCase() + File.separatorChar
             + "Customer_-10_CustomerId_value.txt");
 
-    final ODataValue value = getClient().getPrimitiveValueBuilder().
+    final ODataPrimitiveValue value = getClient().getPrimitiveValueBuilder().
             setType(EdmPrimitiveTypeKind.String).
             setText(IOUtils.toString(input)).
             build();
@@ -59,14 +60,14 @@ public abstract class AbstractPropertyTest extends AbstractTest {
     assertEquals("-10", value.toString());
   }
 
-  private ODataProperty primitive() throws IOException {
+  private ODataProperty primitive() throws IOException, EdmPrimitiveTypeException {
     final InputStream input = getClass().getResourceAsStream(
             getVersion().name().toLowerCase() + File.separatorChar
             + "Customer_-10_CustomerId." + getSuffix(getFormat()));
     final ODataProperty property = getClient().getReader().readProperty(input, getFormat());
     assertNotNull(property);
     assertTrue(property.hasPrimitiveValue());
-    assertTrue(-10 == property.getPrimitiveValue().<Integer>toCastValue());
+    assertTrue(-10 == property.getPrimitiveValue().toCastValue(Integer.class));
 
     ODataProperty comparable;
     final ODataProperty written = getClient().getReader().readProperty(
@@ -76,8 +77,7 @@ public abstract class AbstractPropertyTest extends AbstractTest {
     } else {
       // This is needed because type information gets lost with JSON serialization
       final ODataPrimitiveValue typedValue = getClient().getPrimitiveValueBuilder().
-              setType(EdmPrimitiveTypeKind.valueOfFQN(
-                              getClient().getServiceVersion(), property.getPrimitiveValue().getTypeName())).
+              setType(property.getPrimitiveValue().getTypeKind()).
               setText(written.getPrimitiveValue().toString()).
               build();
       comparable = getClient().getObjectFactory().newPrimitiveProperty(written.getName(), typedValue);
@@ -89,7 +89,7 @@ public abstract class AbstractPropertyTest extends AbstractTest {
   }
 
   @Test
-  public void readPrimitiveProperty() throws IOException {
+  public void readPrimitiveProperty() throws IOException, EdmPrimitiveTypeException {
     primitive();
   }
 
@@ -109,7 +109,7 @@ public abstract class AbstractPropertyTest extends AbstractTest {
       comparable = written;
     } else {
       // This is needed because type information gets lost with JSON serialization
-      final ODataComplexValue typedValue = new ODataComplexValue(property.getComplexValue().getTypeName());
+      final ODataComplexValue typedValue = new ODataComplexValue(property.getComplexValue().getType());
       for (final Iterator<ODataProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
         final ODataProperty prop = itor.next();
         typedValue.add(prop);
@@ -144,7 +144,7 @@ public abstract class AbstractPropertyTest extends AbstractTest {
     } else {
       // This is needed because type information gets lost with JSON serialization
       final ODataCollectionValue typedValue =
-              new ODataCollectionValue(property.getCollectionValue().getTypeName());
+              new ODataCollectionValue(property.getCollectionValue().getType());
       for (final Iterator<ODataValue> itor = written.getCollectionValue().iterator(); itor.hasNext();) {
         final ODataValue value = itor.next();
         if (value.isPrimitive()) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
index e87b877..1a30ef7 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
@@ -64,7 +64,7 @@ import org.apache.olingo.client.api.domain.ODataValue;
 import org.apache.olingo.client.api.format.ODataPubFormat;
 import org.apache.olingo.client.api.http.HttpMethod;
 import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
 import org.apache.olingo.client.core.data.AtomEntryImpl;
 import org.apache.olingo.client.core.data.JSONEntryImpl;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -198,8 +198,8 @@ public abstract class AbstractTestITCase {
       assertTrue("Found " + actual + " but expected " + original, found);
     } else {
       assertTrue("Primitive value for '" + propertyName + "' type mismatch: " + original.asPrimitive().
-              getTypeName() + "-" + actual.asPrimitive().getTypeName(),
-              original.asPrimitive().getTypeName().equals(actual.asPrimitive().getTypeName()));
+              getTypeKind() + "-" + actual.asPrimitive().getTypeKind(),
+              original.asPrimitive().getTypeKind().equals(actual.asPrimitive().getTypeKind()));
 
       assertEquals("Primitive value for '" + propertyName + "' mismatch: " + original.asPrimitive().toString()
               + "-" + actual.asPrimitive().toString(),

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
index 4527aa0..294d190 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
@@ -22,7 +22,6 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertFalse;
 
-import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
 import java.util.concurrent.ExecutionException;
@@ -95,7 +94,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
    */
   @Test
   @Ignore
-  public void createMediaEntity() throws InterruptedException, ExecutionException, IOException {
+  public void createMediaEntity() throws Exception {
     CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Car");
 
     final String TO_BE_UPDATED = "async buffered stream sample";
@@ -110,7 +109,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
     while (!futureCreateRes.isDone()) {
       Thread.sleep(1000L);
     }
-    
+
     final ODataMediaEntityCreateResponse createRes = futureCreateRes.get();
 
     assertEquals(201, createRes.getStatusCode());
@@ -120,8 +119,8 @@ public class AsyncTestITCase extends AbstractTestITCase {
     assertEquals(2, created.getProperties().size());
 
     final int id = "VIN".equals(created.getProperties().get(0).getName())
-            ? created.getProperties().get(0).getPrimitiveValue().<Integer>toCastValue()
-            : created.getProperties().get(1).getPrimitiveValue().<Integer>toCastValue();
+            ? created.getProperties().get(0).getPrimitiveValue().toCastValue(Integer.class)
+            : created.getProperties().get(1).getPrimitiveValue().toCastValue(Integer.class);
 
     builder = client.getURIBuilder(testStaticServiceRootURL).
             appendEntitySetSegment("Car").appendKeySegment(id).appendValueSegment();

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java
index bcdef88..455d376 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java
@@ -28,35 +28,33 @@ import org.apache.olingo.client.api.format.ODataValueFormat;
 import org.apache.olingo.client.api.uri.CommonURIBuilder;
 
 public class CountTestITCase extends AbstractTestITCase {
-    //counts the total number of customers
 
-    @Test
-    public void entityCount() {
-        CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
-                appendEntitySetSegment("Customer").count();
-        final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
-        req.setFormat(ODataValueFormat.TEXT);
-        try {
-            final ODataValue value = req.execute().getBody();
-            assertTrue(10 <= Integer.parseInt(value.toString()));
-        } catch (ODataClientErrorException e) {
-            LOG.error("Error code: {}", e.getStatusLine().getStatusCode(), e);
-        }
+  @Test
+  public void entityCount() {
+    CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+            appendEntitySetSegment("Customer").count();
+    final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
+    req.setFormat(ODataValueFormat.TEXT);
+    try {
+      final ODataValue value = req.execute().getBody();
+      assertTrue(10 <= Integer.parseInt(value.toString()));
+    } catch (ODataClientErrorException e) {
+      LOG.error("Error code: {}", e.getStatusLine().getStatusCode(), e);
     }
-    //returns 415 error for invalid header.
+  }
 
-    @Test
-    public void invalidAccept() {
-        final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
-                appendEntitySetSegment("Customer").count();
-        final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
-        req.setFormat(ODataValueFormat.TEXT);
-        req.setAccept("application/json;odata=fullmetadata");
-        try {
-            final ODataValue value = req.execute().getBody();
-            fail();
-        } catch (ODataClientErrorException e) {
-            assertEquals(415, e.getStatusLine().getStatusCode());
-        }
+  @Test
+  public void invalidAccept() {
+    final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+            appendEntitySetSegment("Customer").count();
+    final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
+    req.setFormat(ODataValueFormat.TEXT);
+    req.setAccept("application/json;odata=fullmetadata");
+    try {
+      final ODataValue value = req.execute().getBody();
+      fail();
+    } catch (ODataClientErrorException e) {
+      assertEquals(415, e.getStatusLine().getStatusCode());
     }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
index 465dc07..d16f060 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
@@ -47,7 +47,8 @@ import org.apache.olingo.client.api.domain.ODataProperty;
 import org.apache.olingo.client.api.format.ODataPubFormat;
 import org.apache.olingo.client.api.http.NoContentException;
 import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -182,14 +183,14 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
   }
 
   @Test
-  public void createWithFeedNavigationAsAtom() {
+  public void createWithFeedNavigationAsAtom() throws EdmPrimitiveTypeException {
     final ODataPubFormat format = ODataPubFormat.ATOM;
     final ODataEntity actual = createWithFeedNavigationLink(format, 7);
     cleanAfterCreate(format, actual, false, getServiceRoot());
   }
 
   @Test
-  public void createWithFeedNavigationAsJSON() {
+  public void createWithFeedNavigationAsJSON() throws EdmPrimitiveTypeException {
     // this needs to be full, otherwise there is no mean to recognize links
     final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
     final ODataEntity actual = createWithFeedNavigationLink(format, 8);
@@ -197,14 +198,14 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
   }
 
   @Test
-  public void createWithBackNavigationAsAtom() {
+  public void createWithBackNavigationAsAtom() throws EdmPrimitiveTypeException {
     final ODataPubFormat format = ODataPubFormat.ATOM;
     final ODataEntity actual = createWithBackNavigationLink(format, 9);
     cleanAfterCreate(format, actual, true, getServiceRoot());
   }
 
   @Test
-  public void createWithBackNavigationAsJSON() {
+  public void createWithBackNavigationAsJSON() throws EdmPrimitiveTypeException {
     // this needs to be full, otherwise there is no mean to recognize links
     final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
     final ODataEntity actual = createWithBackNavigationLink(format, 10);
@@ -275,7 +276,9 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
     }
   }
 
-  private ODataEntity createWithFeedNavigationLink(final ODataPubFormat format, final int id) {
+  private ODataEntity createWithFeedNavigationLink(final ODataPubFormat format, final int id)
+          throws EdmPrimitiveTypeException {
+
     final String sampleName = "Sample customer";
     final ODataEntity original = getSampleCustomerProfile(id, sampleName, false);
 
@@ -321,8 +324,8 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
     assertEquals(2, entitySet.getCount());
 
     for (ODataEntity entity : entitySet.getEntities()) {
-      final Integer key = entity.getProperty("OrderId").getPrimitiveValue().<Integer>toCastValue();
-      final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().<Integer>toCastValue();
+      final Integer key = entity.getProperty("OrderId").getPrimitiveValue().toCastValue(Integer.class);
+      final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class);
       assertTrue(keys.contains(key));
       assertEquals(Integer.valueOf(id), customerId);
       keys.remove(key);
@@ -374,7 +377,9 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
     return actual;
   }
 
-  private ODataEntity createWithBackNavigationLink(final ODataPubFormat format, final int id) {
+  private ODataEntity createWithBackNavigationLink(final ODataPubFormat format, final int id)
+          throws EdmPrimitiveTypeException {
+
     final String sampleName = "Sample customer";
 
     ODataEntity customer = getSampleCustomerProfile(id, sampleName, false);
@@ -405,8 +410,8 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
 
     customer = customerreq.execute().getBody();
 
-    assertEquals(
-            Integer.valueOf(id), customer.getProperty("CustomerId").getPrimitiveValue().<Integer>toCastValue());
+    assertEquals(Integer.valueOf(id),
+            customer.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class));
 
     final ODataEntitySetRequest orderreq = client.getRetrieveRequestFactory().getEntitySetRequest(
             URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString() + "/Orders"));
@@ -417,7 +422,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
 
     assertEquals(Integer.valueOf(id),
             orderres.getBody().getEntities().get(0).getProperty("OrderId").getPrimitiveValue().
-            <Integer>toCastValue());
+            toCastValue(Integer.class));
 
     final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(
             URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString() + "?$expand=Orders"));

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
index 02a74ae..6637346 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
@@ -39,6 +39,7 @@ import org.apache.olingo.client.api.domain.ODataProperty;
 import org.apache.olingo.client.api.format.ODataPubFormat;
 import org.apache.olingo.client.api.uri.CommonURIBuilder;
 import org.apache.olingo.client.core.op.impl.ResourceFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.junit.Test;
 
 /**
@@ -170,7 +171,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
     rawRequest(ODataPubFormat.JSON_FULL_METADATA);
   }
 
-  private void multiKey(final ODataPubFormat format) {
+  private void multiKey(final ODataPubFormat format) throws EdmPrimitiveTypeException {
     final LinkedHashMap<String, Object> multiKey = new LinkedHashMap<String, Object>();
     multiKey.put("FromUsername", "1");
     multiKey.put("MessageId", -10);
@@ -184,16 +185,16 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
     final ODataRetrieveResponse<ODataEntity> res = req.execute();
     final ODataEntity entity = res.getBody();
     assertNotNull(entity);
-    assertEquals("1", entity.getProperty("FromUsername").getPrimitiveValue().<String>toCastValue());
+    assertEquals("1", entity.getProperty("FromUsername").getPrimitiveValue().toCastValue(String.class));
   }
 
   @Test
-  public void multiKeyAsAtom() {
+  public void multiKeyAsAtom() throws EdmPrimitiveTypeException {
     multiKey(ODataPubFormat.ATOM);
   }
 
   @Test
-  public void multiKeyAsJSON() {
+  public void multiKeyAsJSON() throws EdmPrimitiveTypeException {
     multiKey(ODataPubFormat.JSON_FULL_METADATA);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
index 08c414f..35cc3d6 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
@@ -32,7 +32,7 @@ import org.apache.olingo.client.api.domain.ODataEntitySet;
 import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
 import org.apache.olingo.client.api.format.ODataPubFormat;
 import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
 import org.apache.olingo.client.core.op.impl.ResourceFactory;
 import static org.junit.Assert.assertNotNull;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
index 8399494..6e918e9 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
@@ -33,6 +33,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe
 import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
 import org.apache.olingo.client.api.domain.ODataEntity;
 import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
@@ -106,16 +107,16 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
   }
 
   @Test
-  public void patchLinkAsAtom() {
+  public void patchLinkAsAtom() throws EdmPrimitiveTypeException {
     patchLink(ODataPubFormat.ATOM);
   }
 
   @Test
-  public void patchLinkAsJSON() {
+  public void patchLinkAsJSON() throws EdmPrimitiveTypeException {
     patchLink(ODataPubFormat.JSON_FULL_METADATA);
   }
 
-  public void patchLink(final ODataPubFormat format) {
+  public void patchLink(final ODataPubFormat format) throws EdmPrimitiveTypeException {
     final URI uri = client.getURIBuilder(getServiceRoot()).
             appendEntitySetSegment("Customer").appendKeySegment(-10).build();
 
@@ -142,7 +143,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
     ODataEntity newInfo = req.execute().getBody();
 
     assertEquals(Integer.valueOf(12),
-            newInfo.getProperty("CustomerInfoId").getPrimitiveValue().<Integer>toCastValue());
+            newInfo.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class));
     // ---------------------------------------
 
     // ---------------------------------------
@@ -167,11 +168,13 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
     newInfo = req.execute().getBody();
 
     assertEquals(Integer.valueOf(11),
-            newInfo.getProperty("CustomerInfoId").getPrimitiveValue().<Integer>toCastValue());
+            newInfo.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class));
     // ---------------------------------------
   }
 
-  private ODataEntityUpdateRequest buildMultiKeyUpdateReq(final ODataPubFormat format) {
+  private ODataEntityUpdateRequest buildMultiKeyUpdateReq(final ODataPubFormat format)
+          throws EdmPrimitiveTypeException {
+
     final LinkedHashMap<String, Object> multiKey = new LinkedHashMap<String, Object>();
     multiKey.put("FromUsername", "1");
     multiKey.put("MessageId", -10);
@@ -180,7 +183,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
     message.getAssociationLinks().clear();
     message.getNavigationLinks().clear();
 
-    final boolean before = message.getProperty("IsRead").getPrimitiveValue().<Boolean>toCastValue();
+    final boolean before = message.getProperty("IsRead").getPrimitiveValue().toCastValue(Boolean.class);
     message.getProperties().remove(message.getProperty("IsRead"));
     message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("IsRead",
             client.getPrimitiveValueBuilder().setValue(!before).
@@ -189,23 +192,23 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
     return client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.MERGE, message);
   }
 
-  private void mergeMultiKey(final ODataPubFormat format) {
+  private void mergeMultiKey(final ODataPubFormat format) throws EdmPrimitiveTypeException {
     final ODataEntityUpdateResponse res = buildMultiKeyUpdateReq(format).execute();
     assertEquals(204, res.getStatusCode());
   }
 
   @Test
-  public void mergeMultiKeyAsAtom() {
+  public void mergeMultiKeyAsAtom() throws EdmPrimitiveTypeException {
     mergeMultiKey(ODataPubFormat.ATOM);
   }
 
   @Test
-  public void mergeMultiKeyAsJSON() {
+  public void mergeMultiKeyAsJSON() throws EdmPrimitiveTypeException {
     mergeMultiKey(ODataPubFormat.JSON_FULL_METADATA);
   }
 
   @Test
-  public void updateReturnContent() {
+  public void updateReturnContent() throws EdmPrimitiveTypeException {
     final ODataEntityUpdateRequest req = buildMultiKeyUpdateReq(client.getConfiguration().getDefaultPubFormat());
     req.setPrefer(ODataHeaderValues.preferReturnContent);
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
index e4b9212..a61b853 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
@@ -36,7 +36,7 @@ import org.apache.olingo.client.api.domain.ODataEntity;
 import org.apache.olingo.client.api.format.ODataPubFormat;
 import org.apache.olingo.client.api.http.HttpMethod;
 import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
 import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
 import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
 import org.apache.olingo.commons.api.edm.Edm;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
index a043430..33446cf 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
@@ -171,7 +171,7 @@ public class MediaEntityTestITCase extends AbstractTestITCase {
     Integer id = null;
     for (ODataProperty prop : created.getProperties()) {
       if ("VIN".equals(prop.getName())) {
-        id = prop.getPrimitiveValue().<Integer>toCastValue();
+        id = prop.getPrimitiveValue().toCastValue(Integer.class);
       }
     }
     assertNotNull(id);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
index b8ce3b4..a1a90f9 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
@@ -50,7 +50,8 @@ import org.apache.olingo.client.api.domain.ODataValue;
 import org.apache.olingo.client.api.format.ODataPubFormat;
 import org.apache.olingo.client.api.http.HttpClientException;
 import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 
 import org.junit.Test;
@@ -122,7 +123,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
   // create collection navigation link with ATOM
 
   @Test
-  public void createCollectionNavWithAtom() {
+  public void createCollectionNavWithAtom() throws EdmPrimitiveTypeException {
     final ODataPubFormat format = ODataPubFormat.ATOM;
     final String contentType = "application/atom+xml";
     final String prefer = "return-content";
@@ -132,7 +133,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
   // create collection navigation link with JSON
 
   @Test
-  public void createCollectionNavWithJSON() {
+  public void createCollectionNavWithJSON() throws EdmPrimitiveTypeException {
     final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
     final String contentType = "application/json;odata=fullmetadata";
     final String prefer = "return-content";
@@ -195,7 +196,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
   // create collection navigation link
 
   public ODataEntity createCollectionNavigation(final ODataPubFormat format, final int id,
-          final String contentType, final String prefer) {
+          final String contentType, final String prefer) throws EdmPrimitiveTypeException {
     {
       final String name = "Collection Navigation Key Customer";
       final ODataEntity original = getNewCustomer(id, name, false);
@@ -242,8 +243,8 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
       assertEquals(2, entitySet.getCount());
 
       for (ODataEntity entity : entitySet.getEntities()) {
-        final Integer key = entity.getProperty("OrderId").getPrimitiveValue().<Integer>toCastValue();
-        final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().<Integer>toCastValue();
+        final Integer key = entity.getProperty("OrderId").getPrimitiveValue().toCastValue(Integer.class);
+        final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class);
         assertTrue(navigationKeys.contains(key));
         assertEquals(Integer.valueOf(id), customerId);
         navigationKeys.remove(key);
@@ -511,7 +512,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
       assertTrue("Found " + actual + " and expected " + original, found);
     } else {
       assertTrue("Primitive value for '" + propertyName + "' type mismatch",
-              original.asPrimitive().getTypeName().equals(actual.asPrimitive().getTypeName()));
+              original.asPrimitive().getTypeKind() == actual.asPrimitive().getTypeKind());
 
       assertEquals("Primitive value for '" + propertyName + "' mismatch",
               original.asPrimitive().toString(), actual.asPrimitive().toString());

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
index c64d7bb..2d06ba0 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
@@ -69,17 +69,11 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
 
   private void read(final ODataPubFormat format) {
     ODataEntity row = readRow(format, "71f7d0dc-ede4-45eb-b421-555a2aa1e58f");
-    assertEquals(
-            EdmPrimitiveTypeKind.Double.toString(),
-            row.getProperty("Double").getPrimitiveValue().getTypeName());
-    assertEquals(
-            EdmPrimitiveTypeKind.Guid.toString(),
-            row.getProperty("Id").getPrimitiveValue().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Double, row.getProperty("Double").getPrimitiveValue().getTypeKind());
+    assertEquals(EdmPrimitiveTypeKind.Guid, row.getProperty("Id").getPrimitiveValue().getTypeKind());
 
     row = readRow(format, "672b8250-1e6e-4785-80cf-b94b572e42b3");
-    assertEquals(
-            EdmPrimitiveTypeKind.Decimal.toString(),
-            row.getProperty("Decimal").getPrimitiveValue().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Decimal, row.getProperty("Decimal").getPrimitiveValue().getTypeKind());
   }
 
   @Test
@@ -213,45 +207,45 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
 
     final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().
             getEntityCreateRequest(client.getURIBuilder(testStaticServiceRootURL).
-            appendEntitySetSegment("Row").build(), row);
+                    appendEntitySetSegment("Row").build(), row);
     createReq.setFormat(format);
     final ODataEntityCreateResponse createRes = createReq.execute();
     assertEquals(201, createRes.getStatusCode());
 
     row = readRow(format, guid.toString());
     assertNotNull(row);
-    assertEquals(EdmPrimitiveTypeKind.Guid.toString(),
-            row.getProperty("Id").getPrimitiveValue().getTypeName());
-    assertEquals(EdmPrimitiveTypeKind.String.toString(),
-            row.getProperty("aString").getPrimitiveValue().getTypeName());
-    assertEquals(EdmPrimitiveTypeKind.Boolean.toString(),
-            row.getProperty("aBoolean").getPrimitiveValue().getTypeName());
-    assertEquals(EdmPrimitiveTypeKind.Int64.toString(),
-            row.getProperty("aLong").getPrimitiveValue().getTypeName());
-    assertEquals(EdmPrimitiveTypeKind.Double.toString(),
-            row.getProperty("aDouble").getPrimitiveValue().getTypeName());
-    assertEquals(EdmPrimitiveTypeKind.SByte.toString(),
-            row.getProperty("aByte").getPrimitiveValue().getTypeName());
-    assertEquals(EdmPrimitiveTypeKind.DateTime.toString(),
-            row.getProperty("aDate").getPrimitiveValue().getTypeName());
-    assertEquals(EdmPrimitiveTypeKind.GeographyPoint.toString(),
-            row.getProperty("aPoint").getPrimitiveValue().getTypeName());
-    assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint.toString(),
-            row.getProperty("aMultiPoint").getPrimitiveValue().getTypeName());
-    assertEquals(EdmPrimitiveTypeKind.GeometryLineString.toString(),
-            row.getProperty("aLineString").getPrimitiveValue().getTypeName());
-    assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString.toString(),
-            row.getProperty("aMultiLineString").getPrimitiveValue().getTypeName());
-    assertEquals(EdmPrimitiveTypeKind.GeographyPolygon.toString(),
-            row.getProperty("aPolygon").getPrimitiveValue().getTypeName());
-    assertEquals(EdmPrimitiveTypeKind.GeographyMultiPolygon.toString(),
-            row.getProperty("aMultiPolygon").getPrimitiveValue().getTypeName());
-    assertEquals(EdmPrimitiveTypeKind.GeographyCollection.toString(),
-            row.getProperty("aCollection").getPrimitiveValue().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Guid,
+            row.getProperty("Id").getPrimitiveValue().getTypeKind());
+    assertEquals(EdmPrimitiveTypeKind.String,
+            row.getProperty("aString").getPrimitiveValue().getTypeKind());
+    assertEquals(EdmPrimitiveTypeKind.Boolean,
+            row.getProperty("aBoolean").getPrimitiveValue().getTypeKind());
+    assertEquals(EdmPrimitiveTypeKind.Int64,
+            row.getProperty("aLong").getPrimitiveValue().getTypeKind());
+    assertEquals(EdmPrimitiveTypeKind.Double,
+            row.getProperty("aDouble").getPrimitiveValue().getTypeKind());
+    assertEquals(EdmPrimitiveTypeKind.SByte,
+            row.getProperty("aByte").getPrimitiveValue().getTypeKind());
+    assertEquals(EdmPrimitiveTypeKind.DateTime,
+            row.getProperty("aDate").getPrimitiveValue().getTypeKind());
+    assertEquals(EdmPrimitiveTypeKind.GeographyPoint,
+            row.getProperty("aPoint").getPrimitiveValue().getTypeKind());
+    assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint,
+            row.getProperty("aMultiPoint").getPrimitiveValue().getTypeKind());
+    assertEquals(EdmPrimitiveTypeKind.GeometryLineString,
+            row.getProperty("aLineString").getPrimitiveValue().getTypeKind());
+    assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString,
+            row.getProperty("aMultiLineString").getPrimitiveValue().getTypeKind());
+    assertEquals(EdmPrimitiveTypeKind.GeographyPolygon,
+            row.getProperty("aPolygon").getPrimitiveValue().getTypeKind());
+    assertEquals(EdmPrimitiveTypeKind.GeographyMultiPolygon,
+            row.getProperty("aMultiPolygon").getPrimitiveValue().getTypeKind());
+    assertEquals(EdmPrimitiveTypeKind.GeographyCollection,
+            row.getProperty("aCollection").getPrimitiveValue().getTypeKind());
     assertEquals("Microsoft.Test.OData.Services.OpenTypesService.ContactDetails",
-            row.getProperty("aContact").getComplexValue().getTypeName());
-    assertEquals(EdmPrimitiveTypeKind.SByte.toString(),
-            row.getProperty("aContact").getComplexValue().get("SignedByte").getPrimitiveValue().getTypeName());
+            row.getProperty("aContact").getComplexValue().getType());
+    assertEquals(EdmPrimitiveTypeKind.SByte,
+            row.getProperty("aContact").getComplexValue().get("SignedByte").getPrimitiveValue().getTypeKind());
 
     final ODataDeleteResponse deleteRes = client.getCUDRequestFactory().getDeleteRequest(row.getEditLink()).
             execute();

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
index f7db133..d69fb68 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
@@ -25,7 +25,6 @@ import java.math.BigDecimal;
 import java.util.UUID;
 import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataDuration;
 import org.apache.olingo.client.api.domain.ODataEntity;
 import org.apache.olingo.client.api.format.ODataPubFormat;
 import org.junit.Test;
@@ -46,26 +45,16 @@ public class PrimitiveKeysTestITCase extends AbstractTestITCase {
   }
 
   private void readPrimitiveKeys(final ODataPubFormat format) {
-    // commented as per #115
-    //readEntity("EdmBinarySet", new byte[] {Byte.valueOf("2"), Byte.valueOf("3"), Byte.valueOf("4")}, format);
     readEntity("EdmBooleanSet", Boolean.TRUE, format);
     readEntity("EdmByteSet", 255, format);
     readEntity("EdmDecimalSet", new BigDecimal("79228162514264337593543950335"), format);
     readEntity("EdmDoubleSet", 1.7976931348623157E+308D, format);
-    readEntity("EdmSingleSet", 3.40282347E+38F, format);
+    readEntity("EdmSingleSet", 3.4028235E+38F, format);
     readEntity("EdmGuidSet", UUID.fromString("00000000-0000-0000-0000-000000000000"), format);
     readEntity("EdmInt16Set", 32767, format);
     readEntity("EdmInt32Set", -2147483648, format);
     readEntity("EdmInt64Set", 9223372036854775807L, format);
     readEntity("EdmStringSet", "$", format);
-    readEntity("EdmTimeSet", new ODataDuration("-P10675199DT2H48M5.4775808S"), format);
-    // commented as per #115
-    //readEntity("EdmDateTimeSet",
-    //        ODataTimestamp.parse(EdmSimpleType.DATE_TIME.pattern(), "0001-01-01T00:00:00"),
-    //        format);
-    //readEntity("EdmDateTimeOffsetSet",
-    //        ODataTimestamp.parse(EdmSimpleType.DATE_TIME_OFFSET.pattern(), "2013-08-14T13:33:46.1045905+02:00"),
-    //        format);
   }
 
   @Test


[09/11] [OLINGO-65] Implementation completed

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
index c39335f..56eb4fb 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
@@ -38,11 +38,11 @@ import org.apache.olingo.client.api.communication.response.ODataValueUpdateRespo
 import org.apache.olingo.client.api.domain.ODataCollectionValue;
 import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
 import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.ODataValue;
 import org.apache.olingo.client.api.format.ODataFormat;
 import org.apache.olingo.client.api.format.ODataValueFormat;
 import org.apache.olingo.client.api.http.HttpMethod;
 import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import static org.junit.Assert.assertNotNull;
 import org.junit.Test;
 
@@ -56,17 +56,17 @@ public class PropertyTestITCase extends AbstractTestITCase {
   }
 
   @Test
-  public void replacePropertyValue() throws IOException {
+  public void replacePropertyValue() throws Exception {
     updatePropertyValue(ODataValueFormat.TEXT, UpdateType.REPLACE);
   }
 
   @Test
-  public void replacePrimitivePropertyAsXML() throws IOException {
+  public void replacePrimitivePropertyAsXML() throws IOException, EdmPrimitiveTypeException {
     updatePrimitiveProperty(ODataFormat.XML);
   }
 
   @Test
-  public void replacePrimitivePropertyAsJSON() throws IOException {
+  public void replacePrimitivePropertyAsJSON() throws IOException, EdmPrimitiveTypeException {
     updatePrimitiveProperty(ODataFormat.JSON_FULL_METADATA);
   }
 
@@ -128,10 +128,10 @@ public class PropertyTestITCase extends AbstractTestITCase {
     final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
     req.setFormat(ODataValueFormat.TEXT);
 
-    final ODataRetrieveResponse<ODataValue> res = req.execute();
+    final ODataRetrieveResponse<ODataPrimitiveValue> res = req.execute();
     assertEquals(200, res.getStatusCode());
 
-    final ODataValue value = res.getBody();
+    final ODataPrimitiveValue value = res.getBody();
     debugODataValue(value, "Retrieved property");
 
     assertNotNull(value);
@@ -157,7 +157,9 @@ public class PropertyTestITCase extends AbstractTestITCase {
             execute();
   }
 
-  private void updatePropertyValue(final ODataValueFormat format, final UpdateType type) throws IOException {
+  private void updatePropertyValue(final ODataValueFormat format, final UpdateType type)
+          throws IOException, EdmPrimitiveTypeException {
+
     final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
             appendEntitySetSegment("Customer").appendKeySegment(-9).
             appendPropertySegment("PrimaryContactInfo").
@@ -168,13 +170,13 @@ public class PropertyTestITCase extends AbstractTestITCase {
     ODataValueRequest retrieveReq = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
     retrieveReq.setFormat(format);
 
-    ODataRetrieveResponse<ODataValue> retrieveRes = retrieveReq.execute();
+    ODataRetrieveResponse<ODataPrimitiveValue> retrieveRes = retrieveReq.execute();
     assertEquals(200, retrieveRes.getStatusCode());
 
-    ODataValue phoneNumber = retrieveRes.getBody();
+    ODataPrimitiveValue phoneNumber = retrieveRes.getBody();
     assertNotNull(phoneNumber);
 
-    final String oldMsg = phoneNumber.asPrimitive().<String>toCastValue();
+    final String oldMsg = phoneNumber.toCastValue(String.class);
     final String newMsg = "new msg (" + System.currentTimeMillis() + ")";
 
     assertNotEquals(newMsg, oldMsg);
@@ -197,7 +199,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
     phoneNumber = retrieveRes.getBody();
     assertNotNull(phoneNumber);
 
-    assertEquals(newMsg, phoneNumber.asPrimitive().<String>toCastValue());
+    assertEquals(newMsg, phoneNumber.asPrimitive().toCastValue(String.class));
   }
 
   private void updateComplexProperty(final ODataFormat format, final UpdateType type) throws IOException {
@@ -293,7 +295,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
     assertEquals(origSize + 1, alternativeNames.getCollectionValue().size());
   }
 
-  private void updatePrimitiveProperty(final ODataFormat format) throws IOException {
+  private void updatePrimitiveProperty(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
     final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
     uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(-9).
             appendPropertySegment("PrimaryContactInfo").
@@ -307,7 +309,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
 
     ODataProperty phoneNumber = retrieveRes.getBody();
 
-    final String oldMsg = phoneNumber.getPrimitiveValue().<String>toCastValue();
+    final String oldMsg = phoneNumber.getPrimitiveValue().toCastValue(String.class);
     final String newMsg = "new item " + System.currentTimeMillis();
 
     assertNotEquals(newMsg, oldMsg);
@@ -334,7 +336,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
     assertEquals(200, retrieveRes.getStatusCode());
 
     phoneNumber = retrieveRes.getBody();
-    assertEquals(newMsg, phoneNumber.getPrimitiveValue().<String>toCastValue());
+    assertEquals(newMsg, phoneNumber.getPrimitiveValue().toCastValue(String.class));
   }
 
   private void rawRequest(final ODataFormat format) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
index 3b47ef0..3501482 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
@@ -36,6 +36,7 @@ import org.apache.olingo.client.api.format.ODataPubFormat;
 import org.apache.olingo.client.api.uri.CommonURIBuilder;
 import org.apache.olingo.client.api.uri.v3.URIBuilder.InlineCount;
 import org.apache.olingo.client.core.data.AtomEntryImpl;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.junit.Test;
 
 /**
@@ -58,7 +59,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
    * @see org.apache.olingo.client.core.v3.FilterFactoryTest for more tests.
    */
   @Test
-  public void filterOrderby() {
+  public void filterOrderby() throws EdmPrimitiveTypeException {
     final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
             appendEntitySetSegment("Car").filter("(VIN lt 16)");
 
@@ -71,7 +72,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
     // 2. extract VIN values - sorted ASC by default
     final List<Integer> vinsASC = new ArrayList<Integer>(5);
     for (ODataEntity entity : feed.getEntities()) {
-      final Integer vin = entity.getProperty("VIN").getPrimitiveValue().<Integer>toCastValue();
+      final Integer vin = entity.getProperty("VIN").getPrimitiveValue().toCastValue(Integer.class);
       assertTrue(vin < 16);
       vinsASC.add(vin);
     }
@@ -85,7 +86,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
     // 4. extract again VIN value - now they were required to be sorted DESC
     final List<Integer> vinsDESC = new ArrayList<Integer>(5);
     for (ODataEntity entity : feed.getEntities()) {
-      vinsDESC.add(entity.getProperty("VIN").getPrimitiveValue().<Integer>toCastValue());
+      vinsDESC.add(entity.getProperty("VIN").getPrimitiveValue().toCastValue(Integer.class));
     }
 
     // 5. reverse vinsASC and expect to be equal to vinsDESC
@@ -131,7 +132,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
    * Test <tt>$skiptoken</tt>.
    */
   @Test
-  public void skiptoken() {
+  public void skiptoken() throws EdmPrimitiveTypeException {
     final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
     uriBuilder.appendEntitySetSegment("Customer").skipToken("-10");
 
@@ -141,7 +142,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
     assertEquals(2, feed.getEntities().size());
 
     for (ODataEntity entity : feed.getEntities()) {
-      assertTrue(entity.getProperty("CustomerId").getPrimitiveValue().<Integer>toCastValue() > -10);
+      assertTrue(entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class) > -10);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index 903adf8..0147fc0 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -88,9 +88,8 @@ public class EntityTest extends AbstractTest {
     for (ODataProperty property : entity.getProperties()) {
       if ("GeogMultiLine".equals(property.getName())) {
         found = true;
-        assertTrue(property.hasPrimitiveValue());
-        assertEquals(EdmPrimitiveTypeKind.GeographyMultiLineString.getFullQualifiedName().toString(),
-                property.getPrimitiveValue().getTypeName());
+        assertTrue(property.hasGeospatialValue());
+        assertEquals(EdmPrimitiveTypeKind.GeographyMultiLineString, property.getGeospatialValue().getTypeKind());
       }
     }
     assertTrue(found);
@@ -168,11 +167,10 @@ public class EntityTest extends AbstractTest {
     assertNotNull(entity);
 
     final ODataProperty geogCollection = entity.getProperty("GeogCollection");
-    assertEquals(EdmPrimitiveTypeKind.GeographyCollection.getFullQualifiedName().toString(),
-            geogCollection.getPrimitiveValue().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.GeographyCollection, geogCollection.getGeospatialValue().getTypeKind());
 
     int count = 0;
-    for (Geospatial g : geogCollection.getPrimitiveValue().<GeospatialCollection>toCastValue()) {
+    for (Geospatial g : geogCollection.getGeospatialValue().toCastValue(GeospatialCollection.class)) {
       assertNotNull(g);
       count++;
     }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
index c5e4aee..d950d2e 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
@@ -23,18 +23,19 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.math.BigDecimal;
+import java.sql.Timestamp;
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.Iterator;
 import java.util.List;
+import java.util.TimeZone;
 import java.util.UUID;
+import javax.xml.datatype.Duration;
 import org.apache.commons.codec.binary.Base64;
-import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.client.api.domain.ODataDuration;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataTimestamp;
 import org.apache.olingo.client.api.domain.ODataValue;
+import org.apache.olingo.client.api.v3.ODataClient;
 import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.geo.Geospatial;
 import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
@@ -44,6 +45,7 @@ import org.apache.olingo.commons.api.edm.geo.MultiPoint;
 import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
 import org.apache.olingo.commons.api.edm.geo.Point;
 import org.apache.olingo.commons.api.edm.geo.Polygon;
+
 import org.junit.Test;
 
 public class PrimitiveValueTest extends AbstractTest {
@@ -54,119 +56,129 @@ public class PrimitiveValueTest extends AbstractTest {
   }
 
   @Test
-  public void manageInt32() {
+  public void manageInt32() throws EdmPrimitiveTypeException {
     final int primitive = -10;
     ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int32).
             setValue(primitive).build();
-    assertEquals(EdmPrimitiveTypeKind.Int32.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
-    assertEquals(Integer.valueOf(primitive), value.asPrimitive().<Integer>toCastValue());
+    assertEquals(EdmPrimitiveTypeKind.Int32, value.asPrimitive().getTypeKind());
+    assertEquals(Integer.valueOf(primitive), value.asPrimitive().toCastValue(Integer.class));
 
     value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int32).setText("9").build();
-    assertEquals("9", value.asPrimitive().<Integer>toCastValue().toString());
+    assertEquals("9", value.asPrimitive().toCastValue(Integer.class).toString());
   }
 
   @Test
-  public void manageString() {
+  public void manageString() throws EdmPrimitiveTypeException {
     final String primitive = UUID.randomUUID().toString();
     ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
             setText(primitive).build();
-    assertEquals(EdmPrimitiveTypeKind.String.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.String, value.asPrimitive().getTypeKind());
     assertEquals(primitive, value.toString());
 
     value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
             setText("1126a28b-a4af-4bbd-bf0a-2b2c22635565").build();
-    assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().<String>toCastValue().toString());
+    assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().toCastValue(String.class).toString());
   }
 
   @Test
-  public void manageDecimal() {
+  public void manageDecimal() throws EdmPrimitiveTypeException {
     final BigDecimal primitive = new BigDecimal("-79228162514264337593543950335");
     ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
             setValue(primitive).build();
-    assertEquals(EdmPrimitiveTypeKind.Decimal.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
-    assertEquals(primitive, value.asPrimitive().<BigDecimal>toCastValue());
+    assertEquals(EdmPrimitiveTypeKind.Decimal, value.asPrimitive().getTypeKind());
+    assertEquals(primitive, value.asPrimitive().toCastValue(BigDecimal.class));
 
     value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
             setText("-79228162514264337593543950335").build();
-    assertEquals("-79228162514264337593543950335", value.asPrimitive().<BigDecimal>toCastValue().toString());
+    assertEquals("-79228162514264337593543950335", value.asPrimitive().toCastValue(BigDecimal.class).toString());
   }
 
   @Test
-  public void manageDateTime() {
-    // OData V3 only
-    final String primitive = "2013-01-10T06:27:51.1667673";
-    try {
-      new ODataPrimitiveValue.Builder(ODataClientFactory.getV4()).
-              setType(EdmPrimitiveTypeKind.DateTime).setText(primitive).build();
-      fail();
-    } catch (IllegalArgumentException iae) {
-      // ignore
-    }
-    final ODataValue value =
-            getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.DateTime).
-            setText(primitive).build();
-    assertEquals(EdmPrimitiveTypeKind.DateTime.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
-    // performed cast to improve the check
-    assertEquals(primitive, value.asPrimitive().<ODataTimestamp>toCastValue().toString());
+  public void manageDateTime() throws EdmPrimitiveTypeException {
+    final Calendar expected = Calendar.getInstance();
+    expected.clear();
+    expected.set(2013, 0, 10, 2, 0, 0);
+    expected.set(Calendar.MILLISECOND, 1667673);
+
+    final ODataValue value = getClient().getPrimitiveValueBuilder().
+            setType(EdmPrimitiveTypeKind.DateTime).setValue(expected).build();
+    assertEquals(EdmPrimitiveTypeKind.DateTime, value.asPrimitive().getTypeKind());
+
+    final Calendar actual = value.asPrimitive().toCastValue(Calendar.class);
+    assertEquals(expected.get(Calendar.YEAR), actual.get(Calendar.YEAR));
+    assertEquals(expected.get(Calendar.MONTH), actual.get(Calendar.MONTH));
+    assertEquals(expected.get(Calendar.DATE), actual.get(Calendar.DATE));
+    assertEquals(expected.get(Calendar.HOUR), actual.get(Calendar.HOUR));
+    assertEquals(expected.get(Calendar.MINUTE), actual.get(Calendar.MINUTE));
+    assertEquals(expected.get(Calendar.SECOND), actual.get(Calendar.SECOND));
+    assertEquals(expected.get(Calendar.MILLISECOND), actual.get(Calendar.MILLISECOND));
+
+    // Timestamp
+    final Timestamp timestamp = value.asPrimitive().toCastValue(Timestamp.class);
+    assertEquals(expected.get(Calendar.MILLISECOND), timestamp.getNanos());
+
+    assertEquals("2013-01-10T02:27:47.673", value.asPrimitive().toString());
   }
 
   @Test
-  public void manageTime() {
-    // OData V3 only
+  public void manageTime() throws EdmPrimitiveTypeException {
     final String primitive = "-P9DT51M10.5063807S";
-    try {
-      new ODataPrimitiveValue.Builder(ODataClientFactory.getV4()).
-              setType(EdmPrimitiveTypeKind.Time).setText(primitive).build();
-      fail();
-    } catch (IllegalArgumentException iae) {
-      // ignore
-    }
-
     final ODataValue value =
             getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Time).
             setText(primitive).build();
-    assertEquals(EdmPrimitiveTypeKind.Time.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Time, value.asPrimitive().getTypeKind());
     // performed cast to improve the check
-    assertEquals(primitive, value.asPrimitive().<ODataDuration>toCastValue().toString());
+    assertEquals(primitive, value.asPrimitive().toCastValue(Duration.class).toString());
   }
 
   @Test
-  public void manageDateTimeOffset() {
-    final String primitive = "2013-01-10T02:00:00";
+  public void manageDateTimeOffset() throws EdmPrimitiveTypeException {
+    final Calendar expected = Calendar.getInstance();
+    expected.clear();
+    expected.setTimeZone(TimeZone.getTimeZone("GMT"));
+    expected.set(2013, 0, 10, 2, 0, 0);
+
     final ODataValue value = getClient().getPrimitiveValueBuilder().
-            setType(EdmPrimitiveTypeKind.DateTimeOffset).setText(primitive).build();
-    assertEquals(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName().toString(), 
-            value.asPrimitive().getTypeName());
-    // performed cast to improve the check
-    assertEquals(primitive, value.asPrimitive().<ODataTimestamp>toCastValue().toString());
+            setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(expected).build();
+    assertEquals(EdmPrimitiveTypeKind.DateTimeOffset, value.asPrimitive().getTypeKind());
+
+    final Calendar actual = value.asPrimitive().toCastValue(Calendar.class);
+    assertEquals(expected.get(Calendar.YEAR), actual.get(Calendar.YEAR));
+    assertEquals(expected.get(Calendar.MONTH), actual.get(Calendar.MONTH));
+    assertEquals(expected.get(Calendar.DATE), actual.get(Calendar.DATE));
+    assertEquals(expected.get(Calendar.HOUR), actual.get(Calendar.HOUR));
+    assertEquals(expected.get(Calendar.MINUTE), actual.get(Calendar.MINUTE));
+    assertEquals(expected.get(Calendar.SECOND), actual.get(Calendar.SECOND));
+
+    assertEquals("2013-01-10T02:00:00Z", value.asPrimitive().toString());
   }
 
   @Test
-  public void manageGuid() {
+  public void manageGuid() throws EdmPrimitiveTypeException {
     final UUID primitive = UUID.fromString("1126a28b-a4af-4bbd-bf0a-2b2c22635565");
     ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
             setValue(primitive).build();
-    assertEquals(EdmPrimitiveTypeKind.Guid.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
-    assertEquals(primitive, value.asPrimitive().<UUID>toCastValue());
+    assertEquals(EdmPrimitiveTypeKind.Guid, value.asPrimitive().getTypeKind());
+    assertEquals(primitive, value.asPrimitive().toCastValue(UUID.class));
 
     value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
             setText("1126a28b-a4af-4bbd-bf0a-2b2c22635565").build();
-    assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().<UUID>toCastValue().toString());
+    assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().toCastValue(UUID.class).toString());
   }
 
   @Test
-  public void manageBinary() {
+  public void manageBinary() throws EdmPrimitiveTypeException {
     final byte[] primitive = UUID.randomUUID().toString().getBytes();
     ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Binary).
             setValue(primitive).build();
-    assertEquals(EdmPrimitiveTypeKind.Binary.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Binary, value.asPrimitive().getTypeKind());
     assertEquals(
             Base64.encodeBase64String(primitive),
-            Base64.encodeBase64String(value.asPrimitive().<byte[]>toCastValue()));
+            Base64.encodeBase64String(value.asPrimitive().toCastValue(byte[].class)));
 
     value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Binary).
             setText(Base64.encodeBase64String("primitive".getBytes())).build();
-    assertEquals("primitive", new String(value.asPrimitive().<byte[]>toCastValue()));
+    assertEquals("primitive", new String(value.asPrimitive().toCastValue(byte[].class)));
   }
 
   @Test
@@ -187,10 +199,11 @@ public class PrimitiveValueTest extends AbstractTest {
             getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
             setValue(primitive).
             build();
-    assertEquals(EdmPrimitiveTypeKind.GeographyPoint.getFullQualifiedName().toString(), 
-            value.asPrimitive().getTypeName());
-    assertEquals(Double.valueOf(primitive.getX()), Double.valueOf(value.asPrimitive().<Point>toCastValue().getX()));
-    assertEquals(Double.valueOf(primitive.getY()), Double.valueOf(value.asPrimitive().<Point>toCastValue().getY()));
+    assertEquals(EdmPrimitiveTypeKind.GeographyPoint, value.asGeospatial().getTypeKind());
+    assertEquals(Double.valueOf(primitive.getX()),
+            Double.valueOf(value.asGeospatial().toCastValue(Point.class).getX()));
+    assertEquals(Double.valueOf(primitive.getY()),
+            Double.valueOf(value.asGeospatial().toCastValue(Point.class).getY()));
   }
 
   @Test
@@ -220,10 +233,9 @@ public class PrimitiveValueTest extends AbstractTest {
 
     final ODataValue value = getClient().getGeospatialValueBuilder().
             setType(EdmPrimitiveTypeKind.GeographyLineString).setValue(primitive).build();
-    assertEquals(EdmPrimitiveTypeKind.GeographyLineString.getFullQualifiedName().toString(), 
-            value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.GeographyLineString, value.asGeospatial().getTypeKind());
 
-    final Iterator<Point> iter = value.asPrimitive().<LineString>toCastValue().iterator();
+    final Iterator<Point> iter = value.asGeospatial().toCastValue(LineString.class).iterator();
 
     // take the third one and check the point value ...
     iter.next();
@@ -246,10 +258,9 @@ public class PrimitiveValueTest extends AbstractTest {
 
     final ODataValue value = getClient().getGeospatialValueBuilder().
             setType(EdmPrimitiveTypeKind.GeometryMultiPoint).setValue(primitive).build();
-    assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint.getFullQualifiedName().toString(), 
-            value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint, value.asGeospatial().getTypeKind());
 
-    final Iterator<Point> iter = value.asPrimitive().<MultiPoint>toCastValue().iterator();
+    final Iterator<Point> iter = value.asGeospatial().toCastValue(MultiPoint.class).iterator();
     point = iter.next();
 
     assertEquals(Double.valueOf(points.get(0).getX()), Double.valueOf(point.getX()));
@@ -308,10 +319,9 @@ public class PrimitiveValueTest extends AbstractTest {
     final ODataValue value =
             getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
             setValue(primitive).build();
-    assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString.getFullQualifiedName().toString(), 
-            value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString, value.asGeospatial().getTypeKind());
 
-    final Iterator<LineString> lineIter = value.asPrimitive().<MultiLineString>toCastValue().iterator();
+    final Iterator<LineString> lineIter = value.asGeospatial().toCastValue(MultiLineString.class).iterator();
 
     // take the second line and check the third point value ...
     lineIter.next();
@@ -362,11 +372,10 @@ public class PrimitiveValueTest extends AbstractTest {
     final ODataValue value =
             getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
             setValue(primitive).build();
-    assertEquals(EdmPrimitiveTypeKind.GeographyPolygon.getFullQualifiedName().toString(), 
-            value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.GeographyPolygon, value.asGeospatial().getTypeKind());
 
-    assertTrue(value.asPrimitive().<Polygon>toCastValue().getInterior().isEmpty());
-    final Iterator<Point> iter = value.asPrimitive().<Polygon>toCastValue().getExterior().iterator();
+    assertTrue(value.asGeospatial().toCastValue(Polygon.class).getInterior().isEmpty());
+    final Iterator<Point> iter = value.asGeospatial().toCastValue(Polygon.class).getExterior().iterator();
 
     // take the third one ...
     iter.next();
@@ -469,10 +478,9 @@ public class PrimitiveValueTest extends AbstractTest {
     final ODataValue value =
             getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPolygon).
             setValue(primitive).build();
-    assertEquals(EdmPrimitiveTypeKind.GeometryMultiPolygon.getFullQualifiedName().toString(), 
-            value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.GeometryMultiPolygon, value.asGeospatial().getTypeKind());
 
-    final Iterator<Polygon> iter = value.asPrimitive().<MultiPolygon>toCastValue().iterator();
+    final Iterator<Polygon> iter = value.asGeospatial().toCastValue(MultiPolygon.class).iterator();
 
     // second one polygon
     iter.next();
@@ -516,10 +524,9 @@ public class PrimitiveValueTest extends AbstractTest {
     final ODataValue value =
             getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryCollection).
             setValue(primitive).build();
-    assertEquals(EdmPrimitiveTypeKind.GeometryCollection.getFullQualifiedName().toString(), 
-            value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.GeometryCollection, value.asGeospatial().getTypeKind());
 
-    final Iterator<Geospatial> iter = value.asPrimitive().<GeospatialCollection>toCastValue().iterator();
+    final Iterator<Geospatial> iter = value.asGeospatial().toCastValue(GeospatialCollection.class).iterator();
     iter.next();
     final Point collectedPoint = (Point) iter.next();
 
@@ -549,10 +556,9 @@ public class PrimitiveValueTest extends AbstractTest {
     final ODataValue value =
             getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
             setValue(primitive).build();
-    assertEquals(EdmPrimitiveTypeKind.GeographyCollection.getFullQualifiedName().toString(), 
-            value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.GeographyCollection, value.asGeospatial().getTypeKind());
 
-    final Iterator<Geospatial> iter = value.asPrimitive().<GeospatialCollection>toCastValue().iterator();
+    final Iterator<Geospatial> iter = value.asGeospatial().toCastValue(GeospatialCollection.class).iterator();
     iter.next();
     final Point collectedPoint = (Point) iter.next();
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
index d72861d..d879e5b 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
@@ -18,16 +18,13 @@
  */
 package org.apache.olingo.client.core.v4;
 
+import java.util.Calendar;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
 
 import org.apache.olingo.client.api.v4.ODataClient;
-import org.apache.olingo.client.api.domain.ODataDuration;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataTimestamp;
 import org.apache.olingo.client.api.domain.ODataValue;
 import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
@@ -39,40 +36,38 @@ public class PrimitiveValueTest extends AbstractTest {
   }
 
   @Test
-  public void manageTimeOfDay() {
-    // OData V4 only
-    final String primitive = "-P9DT51M12.5063807S";
-    try {
-      new ODataPrimitiveValue.Builder(ODataClientFactory.getV3()).
-              setType(EdmPrimitiveTypeKind.TimeOfDay).setText(primitive).build();
-      fail();
-    } catch (IllegalArgumentException iae) {
-      // ignore
-    }
+  public void manageTimeOfDay() throws EdmPrimitiveTypeException {
+    final Calendar expected = Calendar.getInstance();
+    expected.clear();
+    expected.set(2013, 0, 10, 21, 45, 17);
 
     final ODataValue value = getClient().getPrimitiveValueBuilder().
-            setType(EdmPrimitiveTypeKind.TimeOfDay).setText(primitive).build();
-    assertEquals(EdmPrimitiveTypeKind.TimeOfDay.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
-    // performed cast to improve the check
-    assertEquals(primitive, value.asPrimitive().<ODataDuration>toCastValue().toString());
+            setType(EdmPrimitiveTypeKind.TimeOfDay).setValue(expected).build();
+    assertEquals(EdmPrimitiveTypeKind.TimeOfDay, value.asPrimitive().getTypeKind());
+
+    final Calendar actual = value.asPrimitive().toCastValue(Calendar.class);
+    assertEquals(expected.get(Calendar.HOUR), actual.get(Calendar.HOUR));
+    assertEquals(expected.get(Calendar.MINUTE), actual.get(Calendar.MINUTE));
+    assertEquals(expected.get(Calendar.SECOND), actual.get(Calendar.SECOND));
+    
+    assertEquals("21:45:17", value.asPrimitive().toString());
   }
 
   @Test
-  public void manageDate() {
-    // OData V4 only
-    final String primitive = "2013-01-10";
-    try {
-      new ODataPrimitiveValue.Builder(ODataClientFactory.getV3()).
-              setType(EdmPrimitiveTypeKind.Date).setText(primitive).build();
-      fail();
-    } catch (IllegalArgumentException iae) {
-      // ignore
-    }
+  public void manageDate() throws EdmPrimitiveTypeException {
+    final Calendar expected = Calendar.getInstance();
+    expected.clear();
+    expected.set(2013, 0, 10);
 
     final ODataValue value = getClient().getPrimitiveValueBuilder().
-            setType(EdmPrimitiveTypeKind.Date).setText(primitive).build();
-    assertEquals(EdmPrimitiveTypeKind.Date.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
-    // performed cast to improve the check
-    assertEquals(primitive, value.asPrimitive().<ODataTimestamp>toCastValue().toString());
+            setType(EdmPrimitiveTypeKind.Date).setValue(expected).build();
+    assertEquals(EdmPrimitiveTypeKind.Date, value.asPrimitive().getTypeKind());
+
+    final Calendar actual = value.asPrimitive().toCastValue(Calendar.class);
+    assertEquals(expected.get(Calendar.YEAR), actual.get(Calendar.YEAR));
+    assertEquals(expected.get(Calendar.MONTH), actual.get(Calendar.MONTH));
+    assertEquals(expected.get(Calendar.DATE), actual.get(Calendar.DATE));
+
+    assertEquals("2013-01-10", value.asPrimitive().toString());
   }
 }


[02/11] [OLINGO-65] Geospatial types implemented, EdmStream mock implemented with URI as backend, V3 pruned types implemented, EdmSimpleTypeKind adapted, EdmSimpleTypeFactory introduces

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java
index 05807ee..c956789 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java
@@ -18,11 +18,10 @@
  */
 package org.apache.olingo.commons.core.edm.primitivetype;
 
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
 import org.junit.Test;
 
 public class UInt7Test extends PrimitiveTypeBaseTest {
@@ -30,6 +29,7 @@ public class UInt7Test extends PrimitiveTypeBaseTest {
   @Test
   public void compatibility() {
     assertTrue(Uint7.getInstance().isCompatible(Uint7.getInstance()));
-    assertFalse(Uint7.getInstance().isCompatible(EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance()));
+    assertFalse(Uint7.getInstance().isCompatible(
+            EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String)));
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
index faceb0e..9645d93 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
@@ -24,9 +24,10 @@ 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.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.core.edm.AbstractEdmEnumType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 import org.apache.olingo.server.api.edm.provider.EnumType;
 
 public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType {
@@ -39,10 +40,10 @@ public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType
     super(edm, enumName, enumType.isFlags());
 
     if (enumType.getUnderlyingType() == null) {
-      this.underlyingType = EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance();
+      this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32);
     } else {
-      this.underlyingType = EdmPrimitiveTypeKind.valueOf(
-              enumType.getUnderlyingType().getName()).getEdmPrimitiveTypeInstance();
+      this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(
+              EdmPrimitiveTypeKind.valueOf(enumType.getUnderlyingType().getName()));
       // TODO: Should we validate that the underlying type is of byte, sbyte, in16, int32 or int64?
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java
index 1c6fb0b..91b0cde 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java
@@ -21,10 +21,11 @@ package org.apache.olingo.server.core.edm.provider;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmException;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.core.edm.AbstractEdmTypeDefinition;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 import org.apache.olingo.server.api.edm.provider.TypeDefinition;
 
 public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements EdmTypeDefinition {
@@ -34,7 +35,7 @@ public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements
   private EdmPrimitiveType edmPrimitiveTypeInstance;
 
   public EdmTypeDefinitionImpl(final Edm edm, final FullQualifiedName typeDefinitionName,
-      final TypeDefinition typeDefinition) {
+          final TypeDefinition typeDefinition) {
 
     super(edm, typeDefinitionName);
     this.typeDefinition = typeDefinition;
@@ -44,8 +45,8 @@ public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements
   public EdmPrimitiveType getUnderlyingType() {
     if (edmPrimitiveTypeInstance == null) {
       try {
-        edmPrimitiveTypeInstance = EdmPrimitiveTypeKind.valueOf(
-            typeDefinition.getUnderlyingType().getName()).getEdmPrimitiveTypeInstance();
+        edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getNonGeoInstance(
+                EdmPrimitiveTypeKind.valueOf(typeDefinition.getUnderlyingType().getName()));
       } catch (IllegalArgumentException e) {
         throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e);
       }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java
index a5b81af..bb24c64 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java
@@ -18,17 +18,21 @@
  */
 package org.apache.olingo.server.core.uri;
 
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.EdmProperty;
 import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 import org.apache.olingo.server.api.uri.UriResourceKind;
 import org.apache.olingo.server.api.uri.UriResourceLambdaAll;
 import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
 import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
 
 public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements UriResourceLambdaAll {
+
   protected EdmProperty property;
+
   private String lambdaVariable;
+
   private ExpressionImpl expression;
 
   public UriResourceLambdaAllImpl() {
@@ -37,7 +41,7 @@ public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements Ur
 
   @Override
   public EdmType getType() {
-    return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
+    return EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean);
   }
 
   @Override
@@ -53,7 +57,9 @@ public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements Ur
   public UriResourceLambdaAllImpl setLamdaVariable(final String lambdaVariable) {
     this.lambdaVariable = lambdaVariable;
     return this;
-  };
+  }
+
+  ;
 
   @Override
   public Expression getExpression() {
@@ -63,7 +69,9 @@ public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements Ur
   public UriResourceLambdaAllImpl setExpression(final ExpressionImpl expression) {
     this.expression = expression;
     return this;
-  };
+  }
+
+  ;
 
   @Override
   public String toString() {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java
index 65b6a69..1e3143c 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java
@@ -18,17 +18,21 @@
  */
 package org.apache.olingo.server.core.uri;
 
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.EdmProperty;
 import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 import org.apache.olingo.server.api.uri.UriResourceKind;
 import org.apache.olingo.server.api.uri.UriResourceLambdaAny;
 import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
 import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
 
 public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements UriResourceLambdaAny {
+
   protected EdmProperty property;
+
   private String lambdaVariable;
+
   private ExpressionImpl expression;
 
   public UriResourceLambdaAnyImpl() {
@@ -37,7 +41,7 @@ public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements Ur
 
   @Override
   public EdmType getType() {
-    return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
+    return EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean);
   }
 
   @Override
@@ -53,7 +57,9 @@ public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements Ur
   public UriResourceLambdaAnyImpl setLamdaVariable(final String lambdaVariable) {
     this.lambdaVariable = lambdaVariable;
     return this;
-  };
+  }
+
+  ;
 
   @Override
   public Expression getExpression() {
@@ -68,5 +74,6 @@ public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements Ur
   @Override
   public String toString() {
     return "any";
-  };
+  }
+;
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
index e6a2256..7d9b0d1 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
@@ -54,7 +54,6 @@ import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.FormatOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.IdOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.LevelsOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.OrderByOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.SelectOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.SkipOptionImpl;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
index 4460760..c7d13cd 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
@@ -22,10 +22,6 @@ import java.util.Stack;
 
 import org.apache.olingo.commons.api.edm.EdmType;
 import org.apache.olingo.server.core.uri.UriInfoImpl;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathExtensionContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectItemContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectSegmentContext;
 import org.apache.olingo.server.core.uri.parser.UriParseTreeVisitor.TypeInformation;
 import org.apache.olingo.server.core.uri.queryoption.ExpandItemImpl;
 import org.apache.olingo.server.core.uri.queryoption.SelectItemImpl;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
index b3e5d69..47f5cce 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
@@ -23,7 +23,6 @@ import java.util.List;
 
 import org.antlr.v4.runtime.misc.ParseCancellationException;
 import org.antlr.v4.runtime.tree.ParseTree;
-import org.antlr.v4.runtime.tree.TerminalNodeImpl;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmAction;
 import org.apache.olingo.commons.api.edm.EdmActionImport;
@@ -36,12 +35,14 @@ import org.apache.olingo.commons.api.edm.EdmEnumType;
 import org.apache.olingo.commons.api.edm.EdmFunction;
 import org.apache.olingo.commons.api.edm.EdmFunctionImport;
 import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.EdmProperty;
 import org.apache.olingo.commons.api.edm.EdmSingleton;
 import org.apache.olingo.commons.api.edm.EdmStructuredType;
 import org.apache.olingo.commons.api.edm.EdmType;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 import org.apache.olingo.server.api.uri.UriInfoKind;
 import org.apache.olingo.server.api.uri.UriResource;
 import org.apache.olingo.server.api.uri.UriResourcePartTyped;
@@ -70,7 +71,6 @@ import org.apache.olingo.server.core.uri.UriResourceValueImpl;
 import org.apache.olingo.server.core.uri.UriResourceWithKeysImpl;
 import org.apache.olingo.server.core.uri.antlr.UriLexer;
 import org.apache.olingo.server.core.uri.antlr.UriParserBaseVisitor;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.AliasAndValueContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.AllEOFContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.AllExprContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.AltAddContext;
@@ -128,7 +128,6 @@ import org.apache.olingo.server.core.uri.antlr.UriParserParser.NamespaceContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.NaninfinityContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.NowMethodCallExprContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.NullruleContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.Number_in_jsonContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.OdataIdentifierContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.OrderByContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.OrderByEOFContext;
@@ -157,14 +156,11 @@ import org.apache.olingo.server.core.uri.antlr.UriParserParser.TopContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.TotalOffsetMinutesMethodCallExprContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.TotalsecondsMethodCallExprContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.TrimMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.UnaryContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.YearMethodCallExprContext;
-import org.apache.olingo.server.core.uri.queryoption.AliasQueryOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.CountOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.ExpandItemImpl;
 import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.FormatOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.LevelsOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.OrderByItemImpl;
 import org.apache.olingo.server.core.uri.queryoption.OrderByOptionImpl;
@@ -185,22 +181,22 @@ import org.apache.olingo.server.core.uri.queryoption.expression.TypeLiteralImpl;
 
 /**
  * UriVisitor
- * 
- * Converts the URI parse tree the generated by ANTLR into an internal representation
- * which maybe is given to the application.
- * While converting the tree is only validated against the EDM if necessary.
- * 
+ *
+ * Converts the URI parse tree the generated by ANTLR into an internal representation which maybe is given to the
+ * application. While converting the tree is only validated against the EDM if necessary.
+ *
  * Attention:
  * <li> This UriVisitor is at somes point more lax than the original ABNF
- * <li> It is more tolerable against additional white spaces
- * Currently not supported
+ * <li> It is more tolerable against additional white spaces Currently not supported
  * <li>Parsing the context of $metadata</li>
  * <li>Parsing $search</li>
  */
 public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
   public class TypeInformation {
+
     boolean isCollection;
+
     EdmType type;
 
     TypeInformation(final EdmType type, final boolean isCollection) {
@@ -213,11 +209,12 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   }
 
   public UriContext context = null;
+
   public Edm edm;
+
   public EdmEntityContainer edmEntityContainer;
 
   // --- class ---
-
   public UriParseTreeVisitor(final Edm edm, final UriContext context) {
     this.edm = edm;
     this.context = context;
@@ -281,8 +278,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   public UriResourceTypedImpl readResourcePathSegment(final PathSegmentContext ctx) {
 
     boolean checkFirst = false;
-    if (context.contextUriInfo.getLastResourcePart() == null ||
-        context.contextUriInfo.getLastResourcePart() instanceof UriResourceRootImpl) {
+    if (context.contextUriInfo.getLastResourcePart() == null
+            || context.contextUriInfo.getLastResourcePart() instanceof UriResourceRootImpl) {
       checkFirst = true;
     }
 
@@ -294,7 +291,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       EdmEntitySet edmEntitySet = edmEntityContainer.getEntitySet(odi);
       if (edmEntitySet != null) {
         UriResourceEntitySetImpl uriResource = new UriResourceEntitySetImpl()
-            .setEntitSet(edmEntitySet);
+                .setEntitSet(edmEntitySet);
         context.contextUriInfo.addResourcePart(uriResource);
         return null;
       }
@@ -303,7 +300,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       EdmSingleton edmSingleton = edmEntityContainer.getSingleton(odi);
       if (edmSingleton != null) {
         UriResourceSingletonImpl uriResource = new UriResourceSingletonImpl()
-            .setSingleton(edmSingleton);
+                .setSingleton(edmSingleton);
         context.contextUriInfo.addResourcePart(uriResource);
         return null;
       }
@@ -312,7 +309,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       EdmActionImport edmActionImport = edmEntityContainer.getActionImport(odi);
       if (edmActionImport != null) {
         UriResourceActionImpl uriResource = new UriResourceActionImpl()
-            .setActionImport(edmActionImport);
+                .setActionImport(edmActionImport);
         context.contextUriInfo.addResourcePart(uriResource);
         return null;
       }
@@ -331,7 +328,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
         ctx.vlNVO.remove(0);
 
         UriResourceFunctionImpl uriResource = new UriResourceFunctionImpl()
-            .setFunctionImport(edmFunctionImport, parameters);
+                .setFunctionImport(edmFunctionImport, parameters);
 
         // collect parameter names
         List<String> names = new ArrayList<String>();
@@ -347,7 +344,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
             tmp += (tmp.length() != 0 ? "," : "") + name;
           }
           throw wrap(new UriParserSemanticException("Function of functionimport '" + edmFunctionImport.getName()
-              + "' with parameters [" + tmp + "] not found"));
+                  + "' with parameters [" + tmp + "] not found"));
         }
 
         uriResource.setFunction(edmFunctionImport.getFunction(names));
@@ -362,7 +359,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
     if (lastResourcePart == null) {
       if (context.contextTypes.size() == 0) {
         throw wrap(new UriParserSemanticException("Resource part '" + odi + "' can only applied on typed "
-            + "resource parts"));
+                + "resource parts"));
       }
       source = context.contextTypes.peek();
     } else {
@@ -370,7 +367,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
       if (source.type == null) {
         throw wrap(new UriParserSemanticException("Resource part '" + odi + "' can only applied on typed "
-            + "resource parts"));
+                + "resource parts"));
       }
     }
 
@@ -389,7 +386,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
       if (!(source.type instanceof EdmStructuredType)) {
         throw wrap(new UriParserSemanticException("Can not parse'" + odi
-            + "'Previous path segment not a structural type."));
+                + "'Previous path segment not a structural type."));
       }
 
       EdmStructuredType structType = (EdmStructuredType) source.type;
@@ -397,27 +394,27 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       EdmElement property = structType.getProperty(odi);
       if (property == null) {
         throw wrap(new UriParserSemanticException("Property '" + odi + "' not found in type '"
-            + structType.getNamespace() + "." + structType.getName() + "'"));
+                + structType.getNamespace() + "." + structType.getName() + "'"));
       }
 
       if (property instanceof EdmProperty) {
         if (((EdmProperty) property).isPrimitive() == true) {
           // create simple property
           UriResourcePrimitivePropertyImpl simpleResource = new UriResourcePrimitivePropertyImpl()
-              .setProperty((EdmProperty) property);
+                  .setProperty((EdmProperty) property);
           context.contextUriInfo.addResourcePart(simpleResource);
           return null;
         } else {
           // create complex property
           UriResourceComplexPropertyImpl complexResource = new UriResourceComplexPropertyImpl()
-              .setProperty((EdmProperty) property);
+                  .setProperty((EdmProperty) property);
           context.contextUriInfo.addResourcePart(complexResource);
           return null;
         }
       } else if (property instanceof EdmNavigationProperty) {
         // create navigation property
         UriResourceNavigationPropertyImpl navigationResource = new UriResourceNavigationPropertyImpl()
-            .setNavigationProperty((EdmNavigationProperty) property);
+                .setNavigationProperty((EdmNavigationProperty) property);
         context.contextUriInfo.addResourcePart(navigationResource);
         return null;
       } else {
@@ -429,7 +426,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       FullQualifiedName fullFilterName = getFullNameFromContext(ctx.vNS, odi);
 
       // EdmType lastType = getLastType(lastTyped);
-
       if (source.type instanceof EdmEntityType) {
 
         EdmEntityType filterEntityType = edm.getEntityType(fullFilterName);
@@ -437,14 +433,14 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
           // is entity type cast
           if (!(filterEntityType.compatibleTo(source.type))) {
             throw wrap(new UriParserSemanticException(
-                "Entity typefilter not compatible to previous path segment: " + fullFilterName.toString()));
+                    "Entity typefilter not compatible to previous path segment: " + fullFilterName.toString()));
           }
 
           if (lastResourcePart == null) {
             // this may be the case if a member expression within a filter starts with a typeCast
             UriResourceStartingTypeFilterImpl uriResource = new UriResourceStartingTypeFilterImpl()
-                .setType(filterEntityType)
-                .setCollection(source.isCollection);
+                    .setType(filterEntityType)
+                    .setCollection(source.isCollection);
             if (source.isCollection) {
               uriResource.setCollectionTypeFilter(filterEntityType);
             } else {
@@ -460,17 +456,17 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
               if (lastPartWithKeys.isCollection() == false) {
                 if (lastPartWithKeys.getTypeFilterOnEntry() != null) {
-                  throw wrap(new UriParserSemanticException("Entry typefilters are not chainable, used '" +
-                      getName(filterEntityType) + "' behind '" +
-                      getName(lastPartWithKeys.getTypeFilterOnEntry()) + "'"));
+                  throw wrap(new UriParserSemanticException("Entry typefilters are not chainable, used '"
+                          + getName(filterEntityType) + "' behind '"
+                          + getName(lastPartWithKeys.getTypeFilterOnEntry()) + "'"));
                 }
                 lastPartWithKeys.setEntryTypeFilter(filterEntityType);
                 return null;
               } else {
                 if (lastPartWithKeys.getTypeFilterOnCollection() != null) {
-                  throw wrap(new UriParserSemanticException("Collection typefilters are not chainable, used '" +
-                      getName(filterEntityType) + "' behind '" +
-                      getName(lastPartWithKeys.getTypeFilterOnCollection()) + "'"));
+                  throw wrap(new UriParserSemanticException("Collection typefilters are not chainable, used '"
+                          + getName(filterEntityType) + "' behind '"
+                          + getName(lastPartWithKeys.getTypeFilterOnCollection()) + "'"));
                 }
                 lastPartWithKeys.setCollectionTypeFilter(filterEntityType);
                 return null;
@@ -478,16 +474,16 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
             } else if (lastResourcePart instanceof UriResourceTypedImpl) {
               UriResourceTypedImpl lastPartTyped = (UriResourceTypedImpl) lastResourcePart;
               if (lastPartTyped.getTypeFilter() != null) {
-                throw wrap(new UriParserSemanticException("Typefilters are not chainable, used '" +
-                    getName(filterEntityType) + "' behind '" +
-                    getName(lastPartTyped.getTypeFilter()) + "'"));
+                throw wrap(new UriParserSemanticException("Typefilters are not chainable, used '"
+                        + getName(filterEntityType) + "' behind '"
+                        + getName(lastPartTyped.getTypeFilter()) + "'"));
               }
 
               lastPartTyped.setTypeFilter(filterEntityType);
               return null;
             } else {
               throw wrap(new UriParserSemanticException("Path segment before '" + getName(filterEntityType)
-                  + "' not typed"));
+                      + "' not typed"));
             }
           }
         }
@@ -501,7 +497,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
           // is complex type cast
           if (!(filterComplexType.compatibleTo(source.type))) {
             throw wrap(new UriParserSemanticException(
-                "Complex typefilter '" + getName(source.type) + "'not compatible type of previous path segment '"
+                    "Complex typefilter '" + getName(source.type) + "'not compatible type of previous path segment '"
                     + getName(filterComplexType) + "'"));
           }
 
@@ -509,8 +505,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
           if (lastResourcePart == null) {
             // this may be the case if a member expression within a filter starts with a typeCast
             UriResourceStartingTypeFilterImpl uriResource = new UriResourceStartingTypeFilterImpl()
-                .setType(filterComplexType)
-                .setCollection(source.isCollection);
+                    .setType(filterComplexType)
+                    .setCollection(source.isCollection);
 
             if (source.isCollection) {
               uriResource.setCollectionTypeFilter(filterComplexType);
@@ -526,17 +522,17 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
               if (lastPartWithKeys.isCollection() == false) {
                 if (lastPartWithKeys.getTypeFilterOnEntry() != null) {
-                  throw wrap(new UriParserSemanticException("Entry typefilters are not chainable, used '" +
-                      getName(filterComplexType) + "' behind '" +
-                      getName(lastPartWithKeys.getTypeFilterOnEntry()) + "'"));
+                  throw wrap(new UriParserSemanticException("Entry typefilters are not chainable, used '"
+                          + getName(filterComplexType) + "' behind '"
+                          + getName(lastPartWithKeys.getTypeFilterOnEntry()) + "'"));
                 }
                 lastPartWithKeys.setEntryTypeFilter(filterComplexType);
                 return null;
               } else {
                 if (lastPartWithKeys.getTypeFilterOnCollection() != null) {
-                  throw wrap(new UriParserSemanticException("Collection typefilters are not chainable, used '" +
-                      getName(filterComplexType) + "' behind '" +
-                      getName(lastPartWithKeys.getTypeFilterOnCollection()) + "'"));
+                  throw wrap(new UriParserSemanticException("Collection typefilters are not chainable, used '"
+                          + getName(filterComplexType) + "' behind '"
+                          + getName(lastPartWithKeys.getTypeFilterOnCollection()) + "'"));
                 }
                 lastPartWithKeys.setCollectionTypeFilter(filterComplexType);
                 return null;
@@ -545,16 +541,16 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
             } else if (lastResourcePart instanceof UriResourceTypedImpl) {
               UriResourceTypedImpl lastPartTyped = (UriResourceTypedImpl) lastResourcePart;
               if (lastPartTyped.getTypeFilter() != null) {
-                throw wrap(new UriParserSemanticException("Typefilters are not chainable, used '" +
-                    getName(filterComplexType) + "' behind '" +
-                    getName(lastPartTyped.getTypeFilter()) + "'"));
+                throw wrap(new UriParserSemanticException("Typefilters are not chainable, used '"
+                        + getName(filterComplexType) + "' behind '"
+                        + getName(lastPartTyped.getTypeFilter()) + "'"));
               }
 
               lastPartTyped.setTypeFilter(filterComplexType);
               return null;
             } else {
               throw wrap(new UriParserSemanticException("Path segment before '" + getName(filterComplexType)
-                  + "' not typed"));
+                      + "' not typed"));
             }
           }
         }
@@ -574,7 +570,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       // do a check for bound functions (which requires a parameter list)
       if (ctx.vlNVO.size() == 0) {
         throw wrap(new UriParserSemanticException("Expected function parameters for '" + fullBindingTypeName.toString()
-            + "'"));
+                + "'"));
       }
 
       context.contextReadingFunctionParameters = true;
@@ -592,8 +588,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
       if (function != null) {
         UriResourceFunctionImpl pathInfoFunction = new UriResourceFunctionImpl()
-            .setFunction(function)
-            .setParameters(parameters);
+                .setFunction(function)
+                .setParameters(parameters);
         context.contextUriInfo.addResourcePart(pathInfoFunction);
 
         // mark parameters as consumed
@@ -606,8 +602,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
       if (function != null) {
         UriResourceFunctionImpl pathInfoFunction = new UriResourceFunctionImpl()
-            .setFunction(function)
-            .setParameters(parameters);
+                .setFunction(function)
+                .setParameters(parameters);
         context.contextUriInfo.addResourcePart(pathInfoFunction);
 
         // mark parameters as consumed
@@ -693,20 +689,20 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
     if (segments.size() == 0) {
       return null;
     }
-    
+
     UriResource segment = segments.get(0);
     if (segment instanceof UriResourceStartingTypeFilterImpl) {
       UriResourceStartingTypeFilterImpl startingTypeFilter = (UriResourceStartingTypeFilterImpl) segment;
-      
+
       EdmType type = null;
-      if (startingTypeFilter.getTypeFilterOnEntry()!= null) {
-         type =startingTypeFilter.getTypeFilterOnEntry();
-      } else if (startingTypeFilter.getTypeFilterOnCollection()!= null) {
-        type =startingTypeFilter.getTypeFilterOnCollection();
+      if (startingTypeFilter.getTypeFilterOnEntry() != null) {
+        type = startingTypeFilter.getTypeFilterOnEntry();
+      } else if (startingTypeFilter.getTypeFilterOnCollection() != null) {
+        type = startingTypeFilter.getTypeFilterOnCollection();
       } else {
-        type =startingTypeFilter.getType();
+        type = startingTypeFilter.getType();
       }
-      
+
       uriInfoImplpath.removeResourcePart(0);
       return type;
     }
@@ -785,7 +781,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
     // @SuppressWarnings("unchecked")
     // List<QueryOptionImpl> list = (List<QueryOptionImpl>) ctx.vEO.accept(this);
     // uriInfo.setQueryOptions(list);
-
     return null;
   }
 
@@ -882,9 +877,11 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
     String text = ctx.getText().toLowerCase();
 
     if (text.equals("false")) {
-      return new LiteralImpl().setText("false").setType(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance());
+      return new LiteralImpl().setText("false").setType(
+              EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean));
     }
-    return new LiteralImpl().setText("true").setType(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance());
+    return new LiteralImpl().setText("true").setType(
+            EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean));
   }
 
   @Override
@@ -924,9 +921,9 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       return type;
     }
 
-    if (fullName.getNamespace().equals("Edm")) {
-      EdmPrimitiveTypeKind typeKind = EdmPrimitiveTypeKind.valueOf(fullName.getName());
-      type = typeKind.getEdmPrimitiveTypeInstance();
+    if (fullName.getNamespace().equals(EdmPrimitiveType.EDM_NAMESPACE)) {
+      final EdmPrimitiveTypeKind typeKind = EdmPrimitiveTypeKind.valueOf(fullName.getName());
+      type = EdmPrimitiveTypeFactory.getInstance(typeKind);
       if (type != null) {
         return type;
       }
@@ -939,16 +936,16 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   @Override
   public ExpressionImpl visitCeilingMethodCallExpr(final CeilingMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.CEILING)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.CEILING)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   @Override
   public ExpressionImpl visitConcatMethodCallExpr(final ConcatMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.CONCAT)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this))
-        .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+            .setMethod(MethodKind.CONCAT)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+            .addParameter((ExpressionImpl) ctx.vE2.accept(this));
   }
 
   @Override
@@ -1001,9 +998,9 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   @Override
   public ExpressionImpl visitContainsMethodCallExpr(final ContainsMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.CONTAINS)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this))
-        .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+            .setMethod(MethodKind.CONTAINS)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+            .addParameter((ExpressionImpl) ctx.vE2.accept(this));
   }
 
   @Override
@@ -1021,31 +1018,31 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   @Override
   public Object visitDateMethodCallExpr(final DateMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.DATE)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.DATE)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   @Override
   public ExpressionImpl visitDayMethodCallExpr(final DayMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.DAY)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.DAY)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   @Override
   public ExpressionImpl visitGeoDistanceMethodCallExpr(final GeoDistanceMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.GEODISTANCE)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this))
-        .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+            .setMethod(MethodKind.GEODISTANCE)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+            .addParameter((ExpressionImpl) ctx.vE2.accept(this));
   }
 
   @Override
   public Object visitEndsWithMethodCallExpr(final EndsWithMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.ENDSWITH)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this))
-        .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+            .setMethod(MethodKind.ENDSWITH)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+            .addParameter((ExpressionImpl) ctx.vE2.accept(this));
   }
 
   @Override
@@ -1127,7 +1124,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
     ExpandItemImpl expandItem = new ExpandItemImpl();
 
     // UriResourceItImpl pathInfoIT = new UriResourceItImpl();
-
     context.contextUriInfo.getLastResourcePart();
 
     // save context
@@ -1143,7 +1139,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
     EdmType startType = this.removeUriResourceStartingTypeFilterImpl(context.contextUriInfo);
     expandItem.setResourcePath(context.contextUriInfo);
-    if ( startType != null) {
+    if (startType != null) {
       expandItem.setTypeFilter(startType);
     }
 
@@ -1223,37 +1219,37 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   @Override
   public ExpressionImpl visitFloorMethodCallExpr(final FloorMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.FLOOR)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.FLOOR)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   @Override
   public ExpressionImpl visitFractionalsecondsMethodCallExpr(final FractionalsecondsMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.FRACTIONALSECONDS)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.FRACTIONALSECONDS)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   @Override
   public ExpressionImpl visitGeoLengthMethodCallExpr(final GeoLengthMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.GEOLENGTH)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.GEOLENGTH)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   @Override
   public ExpressionImpl visitHourMethodCallExpr(final HourMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.HOUR)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.HOUR)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   @Override
   public ExpressionImpl visitIndexOfMethodCallExpr(final IndexOfMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.INDEXOF)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this))
-        .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+            .setMethod(MethodKind.INDEXOF)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+            .addParameter((ExpressionImpl) ctx.vE2.accept(this));
   }
 
   @Override
@@ -1268,9 +1264,9 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   @Override
   public ExpressionImpl visitGeoIntersectsMethodCallExpr(final GeoIntersectsMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.GEOINTERSECTS)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this))
-        .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+            .setMethod(MethodKind.GEOINTERSECTS)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+            .addParameter((ExpressionImpl) ctx.vE2.accept(this));
   }
 
   @Override
@@ -1295,8 +1291,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   @Override
   public ExpressionImpl visitLengthMethodCallExpr(final LengthMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.LENGTH)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.LENGTH)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   @Override
@@ -1308,11 +1304,10 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
     if (text.equals("max")) {
       levels.setMax();
-    } else    {
+    } else {
       levels.setValue(Integer.parseInt(text));
     }
     levels.setText(text);
-    
 
     return levels;
 
@@ -1321,7 +1316,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   @Override
   public ExpressionImpl visitMaxDateTimeMethodCallExpr(final MaxDateTimeMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.MAXDATETIME);
+            .setMethod(MethodKind.MAXDATETIME);
   }
 
   @Override
@@ -1372,21 +1367,21 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   @Override
   public ExpressionImpl visitMinDateTimeMethodCallExpr(final MinDateTimeMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.MINDATETIME);
+            .setMethod(MethodKind.MINDATETIME);
   }
 
   @Override
   public ExpressionImpl visitMinuteMethodCallExpr(final MinuteMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.MINUTE)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.MINUTE)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   @Override
   public ExpressionImpl visitMonthMethodCallExpr(final MonthMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.MONTH)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.MONTH)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   @Override
@@ -1424,7 +1419,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       // There are more keys defined in the EDM, but only one is written in the URI. This is allowed only if
       // referential constrains are defined on this navigation property which can be used to will up all required
       // key.
-
       // for using referential constrains the last resource part must be a navigation property
       if (!(context.contextUriInfo.getLastResourcePart() instanceof UriResourceNavigationPropertyImpl)) {
         throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
@@ -1499,7 +1493,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       }
 
       // if not, check if the missing key predicates can be satisfied with help of the defined referential constrains
-
       // for using referential constrains the last resource part must be a navigation property
       if (!(context.contextUriInfo.getLastResourcePart() instanceof UriResourceNavigationPropertyImpl)) {
         throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
@@ -1557,14 +1550,15 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   }
 
   @Override
-  public Object visitNaninfinity(NaninfinityContext ctx) {
-    return new LiteralImpl().setType(EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance()).setText(ctx.getText());
+  public Object visitNaninfinity(final NaninfinityContext ctx) {
+    return new LiteralImpl().setType(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal)).
+            setText(ctx.getText());
   }
 
   @Override
   public ExpressionImpl visitNowMethodCallExpr(final NowMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.NOW);
+            .setMethod(MethodKind.NOW);
   }
 
   @Override
@@ -1636,7 +1630,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
         @SuppressWarnings("unchecked")
         List<UriParameterImpl> list = (List<UriParameterImpl>) ctx.vlNVO.get(0).accept(this);
         ((UriResourceWithKeysImpl) pathInfoSegment)
-            .setKeyPredicates(list);
+                .setKeyPredicates(list);
       } else {
         throw wrap(new UriParserSemanticException("Key properties not allowed"));
         // throw UriSemanticError.addKrepredicatesNotAllowed();
@@ -1664,10 +1658,10 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   public Object visitPrimitiveLiteral(final PrimitiveLiteralContext ctx) {
     ParseTree child1 = ctx.children.get(0);
 
-    if (child1 instanceof EnumLitContext ||
-        child1 instanceof BooleanNonCaseContext ||
-        child1 instanceof NullruleContext ||
-        child1 instanceof NaninfinityContext) {
+    if (child1 instanceof EnumLitContext
+            || child1 instanceof BooleanNonCaseContext
+            || child1 instanceof NullruleContext
+            || child1 instanceof NaninfinityContext) {
       return child1.accept(this);
     }
     return new LiteralImpl().setText(ctx.getText());
@@ -1699,7 +1693,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
    * return contextUriInfo;
    * }
    */
-
   @Override
   public Object visitRootExpr(final RootExprContext ctx) {
 
@@ -1731,22 +1724,22 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
     }
     return new MemberImpl()
-        .setResourcePath(uriInfoImplpath);
+            .setResourcePath(uriInfoImplpath);
 
   }
 
   @Override
   public ExpressionImpl visitRoundMethodCallExpr(final RoundMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.ROUND)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.ROUND)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   @Override
   public ExpressionImpl visitSecondMethodCallExpr(final SecondMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.SECOND)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.SECOND)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   @Override
@@ -1808,8 +1801,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       } else {
         UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath();
         UriResource last = uriInfo.getLastResourcePart();
-        
-        prevType = getTypeInformation( last).type;
+
+        prevType = getTypeInformation(last).type;
         if (prevType == null) {
           throw wrap(new UriParserSemanticException("prev segement not typed"));
         }
@@ -2025,9 +2018,9 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   @Override
   public ExpressionImpl visitStartsWithMethodCallExpr(final StartsWithMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.STARTSWITH)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this))
-        .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+            .setMethod(MethodKind.STARTSWITH)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+            .addParameter((ExpressionImpl) ctx.vE2.accept(this));
   }
 
   @Override
@@ -2048,8 +2041,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   @Override
   public ExpressionImpl visitTimeMethodCallExpr(final TimeMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.TIME)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.TIME)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   @Override
@@ -2064,44 +2057,43 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   @Override
   public ExpressionImpl visitToLowerMethodCallExpr(final ToLowerMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.TOLOWER)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.TOLOWER)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   @Override
   public ExpressionImpl visitTotalOffsetMinutesMethodCallExpr(final TotalOffsetMinutesMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.TOTALOFFSETMINUTES)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.TOTALOFFSETMINUTES)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   @Override
   public ExpressionImpl visitTotalsecondsMethodCallExpr(final TotalsecondsMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.TOTALSECONDS)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.TOTALSECONDS)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   @Override
   public ExpressionImpl visitToUpperMethodCallExpr(final ToUpperMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.TOUPPER)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.TOUPPER)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   @Override
   public ExpressionImpl visitTrimMethodCallExpr(final TrimMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.TRIM)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.TRIM)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
-
   @Override
   public ExpressionImpl visitYearMethodCallExpr(final YearMethodCallExprContext ctx) {
     return new MethodImpl()
-        .setMethod(MethodKind.YEAR)
-        .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+            .setMethod(MethodKind.YEAR)
+            .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
   private ParseCancellationException wrap(final UriParserException uriParserException) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandItemImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandItemImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandItemImpl.java
index 0fa3314..cd4d18d 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandItemImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandItemImpl.java
@@ -33,7 +33,6 @@ import org.apache.olingo.server.api.uri.queryoption.SelectOption;
 import org.apache.olingo.server.api.uri.queryoption.SkipOption;
 import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
 import org.apache.olingo.server.api.uri.queryoption.TopOption;
-import org.apache.olingo.server.core.uri.queryoption.expression.MemberImpl;
 
 public class ExpandItemImpl implements ExpandItem {
   private LevelsExpandOption levelsExpandOption;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
index 11e610e..366b73c 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
@@ -32,20 +32,19 @@ import java.util.List;
 import org.apache.olingo.commons.api.edm.EdmComplexType;
 import org.apache.olingo.commons.api.edm.EdmElement;
 import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
 import org.apache.olingo.server.api.edm.provider.ComplexType;
 import org.apache.olingo.server.api.edm.provider.EdmProvider;
 import org.apache.olingo.server.api.edm.provider.NavigationProperty;
 import org.apache.olingo.server.api.edm.provider.Property;
-import org.apache.olingo.server.core.edm.provider.EdmComplexTypeImpl;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
 import org.junit.Before;
 import org.junit.Test;
 
 public class EdmComplexTypeImplTest {
 
   private EdmComplexType baseType;
+
   private EdmComplexType type;
 
   @Before
@@ -60,7 +59,7 @@ public class EdmComplexTypeImplTest {
     List<NavigationProperty> baseNavigationProperties = new ArrayList<NavigationProperty>();
     baseNavigationProperties.add(new NavigationProperty().setName("nav1"));
     baseComplexType.setName("BaseTypeName").setAbstract(false).setOpenType(false).setProperties(baseProperties)
-        .setNavigationProperties(baseNavigationProperties);
+            .setNavigationProperties(baseNavigationProperties);
     when(provider.getComplexType(baseName)).thenReturn(baseComplexType);
 
     baseType = EdmComplexTypeImpl.getInstance(edm, baseName, baseComplexType);
@@ -72,7 +71,7 @@ public class EdmComplexTypeImplTest {
     List<NavigationProperty> navigationProperties = new ArrayList<NavigationProperty>();
     navigationProperties.add(new NavigationProperty().setName("nav2"));
     complexType.setName("BaseTypeName").setAbstract(false).setOpenType(false).setProperties(properties)
-        .setNavigationProperties(navigationProperties);
+            .setNavigationProperties(navigationProperties);
     when(provider.getComplexType(name)).thenReturn(complexType);
 
     type = EdmComplexTypeImpl.getInstance(edm, name, complexType);
@@ -156,8 +155,8 @@ public class EdmComplexTypeImplTest {
     EdmProvider provider = mock(EdmProvider.class);
     EdmProviderImpl edm = new EdmProviderImpl(provider);
     FullQualifiedName typeWithNonexistingBaseTypeName = new FullQualifiedName("namespace", "typeName");
-    ComplexType complexTypeForNonexistingBaseType =
-        new ComplexType().setBaseType(new FullQualifiedName("wrong", "wrong"));
+    ComplexType complexTypeForNonexistingBaseType
+            = new ComplexType().setBaseType(new FullQualifiedName("wrong", "wrong"));
     complexTypeForNonexistingBaseType.setName("typeName");
     when(provider.getComplexType(typeWithNonexistingBaseTypeName)).thenReturn(complexTypeForNonexistingBaseType);
     EdmComplexTypeImpl.getInstance(edm, typeWithNonexistingBaseTypeName, complexTypeForNonexistingBaseType);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
index 6bcc6bd..9e4a947 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
@@ -34,24 +34,24 @@ import org.apache.olingo.commons.api.edm.EdmElement;
 import org.apache.olingo.commons.api.edm.EdmEntityType;
 import org.apache.olingo.commons.api.edm.EdmException;
 import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.EdmProperty;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
 import org.apache.olingo.server.api.edm.provider.ComplexType;
 import org.apache.olingo.server.api.edm.provider.EdmProvider;
 import org.apache.olingo.server.api.edm.provider.EntityType;
 import org.apache.olingo.server.api.edm.provider.NavigationProperty;
 import org.apache.olingo.server.api.edm.provider.Property;
 import org.apache.olingo.server.api.edm.provider.PropertyRef;
-import org.apache.olingo.server.core.edm.provider.EdmEntityTypeImpl;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
 import org.junit.Before;
 import org.junit.Test;
 
 public class EdmEntityTypeImplTest {
 
   private EdmEntityType baseType;
+
   private EdmEntityType typeWithBaseType;
+
   private EdmEntityType typeWithComplexKey;
 
   @Before
@@ -96,21 +96,21 @@ public class EdmEntityTypeImplTest {
     typeWithComplexKeyProvider.setName(typeWithComplexKeyName.getName());
     List<Property> typeWithComplexKeyProperties = new ArrayList<Property>();
     typeWithComplexKeyProperties.add(new Property().setName("Id").setType(
-        EdmPrimitiveTypeKind.String.getFullQualifiedName()));
+            EdmPrimitiveTypeKind.String.getFullQualifiedName()));
 
     List<Property> complexTypeProperties = new ArrayList<Property>();
     complexTypeProperties.add(new Property().setName("ComplexPropName").setType(
-        EdmPrimitiveTypeKind.String.getFullQualifiedName()));
+            EdmPrimitiveTypeKind.String.getFullQualifiedName()));
     FullQualifiedName complexTypeName = new FullQualifiedName("namespace", "complexTypeName");
     when(provider.getComplexType(complexTypeName)).thenReturn(
-        new ComplexType().setName("complexTypeName").setProperties(complexTypeProperties));
+            new ComplexType().setName("complexTypeName").setProperties(complexTypeProperties));
 
     typeWithComplexKeyProperties.add(new Property().setName("Comp").setType(complexTypeName));
     typeWithComplexKeyProvider.setProperties(typeWithComplexKeyProperties);
     List<PropertyRef> keyForTypeWithComplexKey = new ArrayList<PropertyRef>();
     keyForTypeWithComplexKey.add(new PropertyRef().setPropertyName("Id"));
     keyForTypeWithComplexKey.add(new PropertyRef().setPropertyName("ComplexPropName").setAlias("alias").setPath(
-        "Comp/ComplexPropName"));
+            "Comp/ComplexPropName"));
     typeWithComplexKeyProvider.setKey(keyForTypeWithComplexKey);
     when(provider.getEntityType(typeWithComplexKeyName)).thenReturn(typeWithComplexKeyProvider);
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
index 748bbc2..e58edb7 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
@@ -29,13 +29,12 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 import org.apache.olingo.server.api.edm.provider.EnumMember;
 import org.apache.olingo.server.api.edm.provider.EnumType;
-import org.apache.olingo.server.core.edm.provider.EdmEnumTypeImpl;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
 import org.junit.Test;
 
 public class EdmEnumTest extends PrimitiveTypeBaseTest {
@@ -66,7 +65,7 @@ public class EdmEnumTest extends PrimitiveTypeBaseTest {
 //    when(member2.getName()).thenReturn("second");
 //    when(member2.getValue()).thenReturn("64");
 //    instance = new EdmEnumImpl("namespace", "name",
-//        EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance(),
+//        EdmPrimitiveTypeKind.SByte),
 //        Arrays.asList(member1, member2),
 //        true);
   }
@@ -106,7 +105,7 @@ public class EdmEnumTest extends PrimitiveTypeBaseTest {
 
   @Test
   public void underlyingType() throws Exception {
-    assertEquals(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance(), instance.getUnderlyingType());
+    assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte), instance.getUnderlyingType());
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
index 4f4b302..b77f7e9 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
@@ -30,17 +30,15 @@ import java.util.Collections;
 import org.apache.olingo.commons.api.edm.EdmEntityContainer;
 import org.apache.olingo.commons.api.edm.EdmFunction;
 import org.apache.olingo.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 import org.apache.olingo.server.api.edm.provider.EdmProvider;
 import org.apache.olingo.server.api.edm.provider.EntityContainerInfo;
 import org.apache.olingo.server.api.edm.provider.Function;
 import org.apache.olingo.server.api.edm.provider.FunctionImport;
 import org.apache.olingo.server.api.edm.provider.Parameter;
 import org.apache.olingo.server.api.edm.provider.ReturnType;
-import org.apache.olingo.server.core.edm.provider.EdmEntityContainerImpl;
-import org.apache.olingo.server.core.edm.provider.EdmFunctionImportImpl;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
 import org.junit.Test;
 
 public class EdmFunctionImportImplTest {
@@ -52,11 +50,11 @@ public class EdmFunctionImportImplTest {
 
     final FullQualifiedName functionName = new FullQualifiedName("ns", "function");
     final Function functionProvider = new Function()
-        .setName(functionName.getName())
-        .setParameters(Collections.<Parameter> emptyList())
-        .setBound(false)
-        .setComposable(false)
-        .setReturnType(new ReturnType().setType(EdmPrimitiveTypeKind.Boolean.getFullQualifiedName()));
+            .setName(functionName.getName())
+            .setParameters(Collections.<Parameter>emptyList())
+            .setBound(false)
+            .setComposable(false)
+            .setReturnType(new ReturnType().setType(EdmPrimitiveTypeKind.Boolean.getFullQualifiedName()));
     when(provider.getFunctions(functionName)).thenReturn(Arrays.asList(functionProvider));
 
     final FullQualifiedName containerName = new FullQualifiedName("ns", "container");
@@ -66,21 +64,22 @@ public class EdmFunctionImportImplTest {
 
     final String functionImportName = "functionImport";
     final FunctionImport functionImportProvider = new FunctionImport()
-        .setName(functionImportName)
-        .setFunction(functionName)
-        .setIncludeInServiceDocument(true);
+            .setName(functionImportName)
+            .setFunction(functionName)
+            .setIncludeInServiceDocument(true);
     when(provider.getFunctionImport(containerName, functionImportName)).thenReturn(functionImportProvider);
 
-    final EdmFunctionImport functionImport =
-        new EdmFunctionImportImpl(edm, entityContainer, functionImportProvider);
+    final EdmFunctionImport functionImport
+            = new EdmFunctionImportImpl(edm, entityContainer, functionImportProvider);
     assertEquals(functionImportName, entityContainer.getFunctionImport(functionImportName).getName());
     assertEquals("functionImport", functionImport.getName());
-    final EdmFunction function = functionImport.getFunction(Collections.<String> emptyList());
+    final EdmFunction function = functionImport.getFunction(Collections.<String>emptyList());
     assertEquals(functionName.getNamespace(), function.getNamespace());
     assertEquals(functionName.getName(), function.getName());
     assertFalse(function.isBound());
     assertFalse(function.isComposable());
-    assertEquals(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance(), function.getReturnType().getType());
+    assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean),
+            function.getReturnType().getType());
     assertEquals(entityContainer, functionImport.getEntityContainer());
     assertNull(functionImport.getReturnedEntitySet());
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java
index d446145..52a377e 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java
@@ -27,17 +27,15 @@ import static org.mockito.Mockito.when;
 import org.apache.olingo.commons.api.edm.EdmException;
 import org.apache.olingo.commons.api.edm.EdmParameter;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.EdmType;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
 import org.apache.olingo.server.api.edm.provider.ComplexType;
 import org.apache.olingo.server.api.edm.provider.EdmProvider;
 import org.apache.olingo.server.api.edm.provider.EnumType;
 import org.apache.olingo.server.api.edm.provider.Parameter;
 import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-import org.apache.olingo.server.core.edm.provider.EdmParameterImpl;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
 import org.junit.Test;
 
 public class EdmParameterImplTest {
@@ -139,4 +137,4 @@ public class EdmParameterImplTest {
     parameter.getType();
   }
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java
index fca16d8..11d2d09 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java
@@ -28,18 +28,16 @@ import static org.mockito.Mockito.when;
 
 import org.apache.olingo.commons.api.edm.EdmException;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.EdmProperty;
 import org.apache.olingo.commons.api.edm.EdmType;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
 import org.apache.olingo.server.api.edm.provider.ComplexType;
 import org.apache.olingo.server.api.edm.provider.EdmProvider;
 import org.apache.olingo.server.api.edm.provider.EnumType;
 import org.apache.olingo.server.api.edm.provider.Property;
 import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-import org.apache.olingo.server.core.edm.provider.EdmPropertyImpl;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
 import org.junit.Test;
 
 public class EdmPropertyImplTest {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
index 5cb9a67..bd028ba 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
@@ -29,14 +29,13 @@ import org.apache.olingo.commons.api.edm.EdmComplexType;
 import org.apache.olingo.commons.api.edm.EdmEntityType;
 import org.apache.olingo.commons.api.edm.EdmEnumType;
 import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.EdmReturnType;
 import org.apache.olingo.commons.api.edm.EdmType;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 import org.apache.olingo.server.api.edm.provider.ReturnType;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
-import org.apache.olingo.server.core.edm.provider.EdmReturnTypeImpl;
 import org.junit.Test;
 
 public class EdmReturnTypeImplTest {
@@ -47,7 +46,7 @@ public class EdmReturnTypeImplTest {
 
     EdmReturnType typeImpl = new EdmReturnTypeImpl(mock(EdmProviderImpl.class), providerType);
 
-    assertEquals(EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance(), typeImpl.getType());
+    assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String), typeImpl.getType());
     assertFalse(typeImpl.isCollection());
 
     assertNull(typeImpl.getPrecision());
@@ -62,7 +61,7 @@ public class EdmReturnTypeImplTest {
 
     EdmReturnType typeImpl = new EdmReturnTypeImpl(mock(EdmProviderImpl.class), providerType);
 
-    assertEquals(EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance(), typeImpl.getType());
+    assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String), typeImpl.getType());
     assertTrue(typeImpl.isCollection());
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
index 9b57bdb..260e77a 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
@@ -24,31 +24,30 @@ import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.mock;
 
 import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
-import org.apache.olingo.server.core.edm.provider.EdmTypeDefinitionImpl;
 import org.junit.Test;
 
 public class EdmTypeDefinitionImplTest {
 
   @Test
   public void typeDefOnStringNoFacets() throws Exception {
-    FullQualifiedName typeDefName = new FullQualifiedName("namespace", "name");
-    TypeDefinition providerTypeDef =
-        new TypeDefinition().setName("typeDef").setUnderlyingType(new FullQualifiedName("Edm", "String"));
-    EdmTypeDefinition typeDefImpl =
-        new EdmTypeDefinitionImpl(mock(EdmProviderImpl.class), typeDefName, providerTypeDef);
+    final FullQualifiedName typeDefName = new FullQualifiedName("namespace", "name");
+    final TypeDefinition providerTypeDef= 
+            new TypeDefinition().setName("typeDef").setUnderlyingType(new FullQualifiedName("Edm", "String"));
+    final EdmTypeDefinition typeDefImpl = 
+            new EdmTypeDefinitionImpl(mock(EdmProviderImpl.class), typeDefName, providerTypeDef);
 
     assertEquals("name", typeDefImpl.getName());
     assertEquals("namespace", typeDefImpl.getNamespace());
     assertEquals(String.class, typeDefImpl.getDefaultType());
     assertEquals(EdmTypeKind.DEFINITION, typeDefImpl.getKind());
-    assertEquals(EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance(), typeDefImpl.getUnderlyingType());
-    assertTrue(typeDefImpl.isCompatible(EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance()));
+    assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String), typeDefImpl.getUnderlyingType());
+    assertTrue(typeDefImpl.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String)));
 
     // String validation
     assertEquals("'StringValue'", typeDefImpl.toUriLiteral("StringValue"));
@@ -67,8 +66,8 @@ public class EdmTypeDefinitionImplTest {
   @Test(expected = EdmException.class)
   public void invalidTypeResultsInEdmException() throws Exception {
     FullQualifiedName typeDefName = new FullQualifiedName("namespace", "name");
-    TypeDefinition providerTypeDef =
-        new TypeDefinition().setName("typeDef").setUnderlyingType(new FullQualifiedName("wrong", "wrong"));
+    TypeDefinition providerTypeDef
+            = new TypeDefinition().setName("typeDef").setUnderlyingType(new FullQualifiedName("wrong", "wrong"));
     EdmTypeDefinitionImpl def = new EdmTypeDefinitionImpl(mock(EdmProviderImpl.class), typeDefName, providerTypeDef);
     def.getUnderlyingType();
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechProvider.java
index 741ca3c..7590e71 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechProvider.java
@@ -23,9 +23,9 @@ import java.util.Arrays;
 import java.util.List;
 
 import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.edm.Target;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
 import org.apache.olingo.server.api.edm.provider.Action;
 import org.apache.olingo.server.api.edm.provider.ActionImport;
 import org.apache.olingo.server.api.edm.provider.AliasInfo;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
index d03345e..f2408ff 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
@@ -32,9 +32,10 @@ import org.apache.olingo.commons.api.edm.EdmEntityType;
 import org.apache.olingo.commons.api.edm.EdmFunction;
 import org.apache.olingo.commons.api.edm.EdmFunctionImport;
 import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.EdmProperty;
 import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 import org.apache.olingo.server.api.uri.UriResourceKind;
 import org.apache.olingo.server.core.edm.provider.EdmComplexTypeImpl;
 import org.apache.olingo.server.core.edm.provider.EdmEntitySetImpl;
@@ -42,30 +43,12 @@ import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
 import org.apache.olingo.server.core.edm.provider.EdmSingletonImpl;
 import org.apache.olingo.server.core.testutil.EdmTechProvider;
 import org.apache.olingo.server.core.testutil.EdmTechTestProvider;
-import org.apache.olingo.server.core.uri.UriParameterImpl;
-import org.apache.olingo.server.core.uri.UriResourceActionImpl;
-import org.apache.olingo.server.core.uri.UriResourceComplexPropertyImpl;
-import org.apache.olingo.server.core.uri.UriResourceCountImpl;
-import org.apache.olingo.server.core.uri.UriResourceEntitySetImpl;
-import org.apache.olingo.server.core.uri.UriResourceFunctionImpl;
-import org.apache.olingo.server.core.uri.UriResourceItImpl;
-import org.apache.olingo.server.core.uri.UriResourceLambdaAllImpl;
-import org.apache.olingo.server.core.uri.UriResourceLambdaAnyImpl;
-import org.apache.olingo.server.core.uri.UriResourceLambdaVarImpl;
-import org.apache.olingo.server.core.uri.UriResourceNavigationPropertyImpl;
-import org.apache.olingo.server.core.uri.UriResourcePrimitivePropertyImpl;
-import org.apache.olingo.server.core.uri.UriResourceRefImpl;
-import org.apache.olingo.server.core.uri.UriResourceRootImpl;
-import org.apache.olingo.server.core.uri.UriResourceSingletonImpl;
-import org.apache.olingo.server.core.uri.UriResourceStartingTypeFilterImpl;
-import org.apache.olingo.server.core.uri.UriResourceTypedImpl;
-import org.apache.olingo.server.core.uri.UriResourceValueImpl;
-import org.apache.olingo.server.core.uri.UriResourceWithKeysImpl;
 import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
 import org.apache.olingo.server.core.uri.queryoption.expression.LiteralImpl;
 import org.junit.Test;
 
 public class UriResourceImplTest {
+
   Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
 
   @Test
@@ -119,7 +102,7 @@ public class UriResourceImplTest {
     assertEquals(false, impl.isCollection());
     assertEquals(expression, impl.getExpression());
     assertEquals("A", impl.getLambdaVariable());
-    assertEquals(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance(), impl.getType());
+    assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean), impl.getType());
     assertEquals("all", impl.toString());
   }
 
@@ -135,7 +118,7 @@ public class UriResourceImplTest {
     assertEquals(false, impl.isCollection());
     assertEquals(expression, impl.getExpression());
     assertEquals("A", impl.getLamdaVariable());
-    assertEquals(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance(), impl.getType());
+    assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean), impl.getType());
     assertEquals("any", impl.toString());
   }
 
@@ -155,8 +138,8 @@ public class UriResourceImplTest {
     assertEquals(property.getType(), impl.getComplexType());
     impl.getComplexType();
 
-    EdmComplexTypeImpl complexTypeImplType =
-        (EdmComplexTypeImpl) edm.getComplexType(EdmTechProvider.nameCTBasePrimCompNav);
+    EdmComplexTypeImpl complexTypeImplType
+            = (EdmComplexTypeImpl) edm.getComplexType(EdmTechProvider.nameCTBasePrimCompNav);
 
     impl.setTypeFilter(complexTypeImplType);
     assertEquals(complexTypeImplType, impl.getTypeFilter());
@@ -216,15 +199,14 @@ public class UriResourceImplTest {
 
     // function
     EdmFunction function = (EdmFunction) edm.getEntityContainer(null).getFunctionImport("FINRTInt16")
-        .getFunction(new ArrayList<String>());
+            .getFunction(new ArrayList<String>());
     assertNotNull(function);
     impl.setFunction(function);
-    
 
     assertEquals(function, impl.getFunction());
     assertEquals("UFNRTInt16", impl.toString());
     assertEquals(function.getReturnType().getType(), impl.getType());
-    assertEquals(false,impl.isParameterListFilled());
+    assertEquals(false, impl.isParameterListFilled());
 
     // function import
     impl = new UriResourceFunctionImpl();
@@ -247,12 +229,13 @@ public class UriResourceImplTest {
     assertEquals(false, impl.isCollection());
 
     assertEquals(parameter, impl.getParameters().get(0));
-    assertEquals(true,impl.isParameterListFilled());
+    assertEquals(true, impl.isParameterListFilled());
   }
 
   @Test
   public void testUriResourceImplKeyPred() {
     class Mock extends UriResourceWithKeysImpl {
+
       EdmType type;
 
       public Mock() {
@@ -299,7 +282,7 @@ public class UriResourceImplTest {
     assertEquals(entityTypeBaseEntry, impl.getTypeFilterOnEntry());
     assertEquals("mock", impl.toString(false));
     assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav/()com.sap.odata.test1.ETTwoBaseTwoKeyNav",
-        impl.toString(true));
+            impl.toString(true));
 
     // set entry
     impl = new Mock();
@@ -330,6 +313,7 @@ public class UriResourceImplTest {
   @Test
   public void testUriResourceImplTyped() {
     class Mock extends UriResourceTypedImpl {
+
       EdmType type;
 
       public Mock() {
@@ -498,7 +482,6 @@ public class UriResourceImplTest {
     assertEquals(true, impl.isCollection());
   }
 
-  
   @Test
   public void testUriResourceStartingTypeFilterImpl() {
     UriResourceStartingTypeFilterImpl impl = new UriResourceStartingTypeFilterImpl();

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java
index 21df8bb..2062c86 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java
@@ -35,7 +35,6 @@ import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.OrderByOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.QueryOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.SelectOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.expression.MemberImpl;
 
 public class ExpandValidator implements Validator {
   private Edm edm;


[05/11] [OLINGO-65] Geospatial types implemented, EdmStream mock implemented with URI as backend, V3 pruned types implemented, EdmSimpleTypeKind adapted, EdmSimpleTypeFactory introduces

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
index 1e92bab..eebfef3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
@@ -24,19 +24,28 @@ import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-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.data.GeoUtils;
+import org.apache.olingo.client.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
 
 class JSONGeoValueDeserializer {
 
-  private Point point(final Iterator<JsonNode> itor, final ODataJClientEdmPrimitiveType type, final String crs) {
+  private final ODataServiceVersion version;
+
+  public JSONGeoValueDeserializer(final ODataServiceVersion version) {
+    this.version = version;
+  }
+
+  private Point point(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final String crs) {
     Point point = null;
 
     if (itor.hasNext()) {
@@ -48,7 +57,7 @@ class JSONGeoValueDeserializer {
     return point;
   }
 
-  private MultiPoint multipoint(final Iterator<JsonNode> itor, final ODataJClientEdmPrimitiveType type,
+  private MultiPoint multipoint(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
           final String crs) {
 
     MultiPoint multiPoint = null;
@@ -67,7 +76,7 @@ class JSONGeoValueDeserializer {
     return multiPoint;
   }
 
-  private LineString lineString(final Iterator<JsonNode> itor, final ODataJClientEdmPrimitiveType type,
+  private LineString lineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
           final String crs) {
 
     LineString lineString = null;
@@ -86,7 +95,7 @@ class JSONGeoValueDeserializer {
     return lineString;
   }
 
-  private MultiLineString multiLineString(final Iterator<JsonNode> itor, final ODataJClientEdmPrimitiveType type,
+  private MultiLineString multiLineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
           final String crs) {
 
     MultiLineString multiLineString = null;
@@ -105,7 +114,7 @@ class JSONGeoValueDeserializer {
     return multiLineString;
   }
 
-  private Polygon polygon(final Iterator<JsonNode> itor, final ODataJClientEdmPrimitiveType type,
+  private Polygon polygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
           final String crs) {
 
     List<Point> extPoints = null;
@@ -135,7 +144,7 @@ class JSONGeoValueDeserializer {
     return new Polygon(GeoUtils.getDimension(type), crs, intPoints, extPoints);
   }
 
-  private MultiPolygon multiPolygon(final Iterator<JsonNode> itor, final ODataJClientEdmPrimitiveType type,
+  private MultiPolygon multiPolygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
           final String crs) {
 
     MultiPolygon multiPolygon = null;
@@ -154,7 +163,7 @@ class JSONGeoValueDeserializer {
     return multiPolygon;
   }
 
-  private GeospatialCollection collection(final Iterator<JsonNode> itor, final ODataJClientEdmPrimitiveType type,
+  private GeospatialCollection collection(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
           final String crs) {
 
     GeospatialCollection collection = null;
@@ -166,16 +175,16 @@ class JSONGeoValueDeserializer {
         final JsonNode geo = itor.next();
         final String collItemType = geo.get(Constants.ATTR_TYPE).asText();
         final String callAsType;
-        if (ODataJClientEdmPrimitiveType.GeographyCollection.name().equals(collItemType)
-                || ODataJClientEdmPrimitiveType.GeometryCollection.name().equals(collItemType)) {
+        if (EdmPrimitiveTypeKind.GeographyCollection.name().equals(collItemType)
+                || EdmPrimitiveTypeKind.GeometryCollection.name().equals(collItemType)) {
 
           callAsType = collItemType;
         } else {
-          callAsType = (type == ODataJClientEdmPrimitiveType.GeographyCollection ? "Geography" : "Geometry")
+          callAsType = (type == EdmPrimitiveTypeKind.GeographyCollection ? "Geography" : "Geometry")
                   + collItemType;
         }
 
-        geospatials.add(deserialize(geo, ODataJClientEdmPrimitiveType.valueOf(callAsType)));
+        geospatials.add(deserialize(geo, new EdmTypeInfo.Builder().setTypeExpression(callAsType).build()));
       }
 
       collection = new GeospatialCollection(GeoUtils.getDimension(type), crs, geospatials);
@@ -186,9 +195,10 @@ class JSONGeoValueDeserializer {
     return collection;
   }
 
-  public Geospatial deserialize(final JsonNode node, final ODataJClientEdmPrimitiveType type) {
-    final ODataJClientEdmPrimitiveType actualType;
-    if ((type == ODataJClientEdmPrimitiveType.Geography || type == ODataJClientEdmPrimitiveType.Geometry)
+  public Geospatial deserialize(final JsonNode node, final EdmTypeInfo typeInfo) {
+    final EdmPrimitiveTypeKind actualType;
+    if ((typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geography
+            || typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geometry)
             && node.has(Constants.ATTR_TYPE)) {
 
       String nodeType = node.get(Constants.ATTR_TYPE).asText();
@@ -196,9 +206,9 @@ class JSONGeoValueDeserializer {
         final int yIdx = nodeType.indexOf('y');
         nodeType = nodeType.substring(yIdx + 1);
       }
-      actualType = ODataJClientEdmPrimitiveType.fromValue(type.toString() + nodeType);
+      actualType = EdmPrimitiveTypeKind.valueOfFQN(version, typeInfo.getFullQualifiedName().toString() + nodeType);
     } else {
-      actualType = type;
+      actualType = typeInfo.getPrimitiveTypeKind();
     }
 
     final Iterator<JsonNode> cooItor = node.has(Constants.JSON_COORDINATES)
@@ -214,37 +224,37 @@ class JSONGeoValueDeserializer {
     switch (actualType) {
       case GeographyPoint:
       case GeometryPoint:
-        value = point(cooItor, type, crs);
+        value = point(cooItor, actualType, crs);
         break;
 
       case GeographyMultiPoint:
       case GeometryMultiPoint:
-        value = multipoint(cooItor, type, crs);
+        value = multipoint(cooItor, actualType, crs);
         break;
 
       case GeographyLineString:
       case GeometryLineString:
-        value = lineString(cooItor, type, crs);
+        value = lineString(cooItor, actualType, crs);
         break;
 
       case GeographyMultiLineString:
       case GeometryMultiLineString:
-        value = multiLineString(cooItor, type, crs);
+        value = multiLineString(cooItor, actualType, crs);
         break;
 
       case GeographyPolygon:
       case GeometryPolygon:
-        value = polygon(cooItor, type, crs);
+        value = polygon(cooItor, actualType, crs);
         break;
 
       case GeographyMultiPolygon:
       case GeometryMultiPolygon:
-        value = multiPolygon(cooItor, type, crs);
+        value = multiPolygon(cooItor, actualType, crs);
         break;
 
       case GeographyCollection:
       case GeometryCollection:
-        value = collection(node.get(Constants.JSON_GEOMETRIES).elements(), type, crs);
+        value = collection(node.get(Constants.JSON_GEOMETRIES).elements(), actualType, crs);
         break;
 
       default:

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
index 207ded6..2e692ae 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
@@ -22,16 +22,16 @@ import com.fasterxml.jackson.core.JsonGenerator;
 import java.io.IOException;
 import java.util.Iterator;
 import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.geospatial.ComposedGeospatial;
-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.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.ComposedGeospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
 
 class JSONGeoValueSerializer {
 
@@ -106,17 +106,17 @@ class JSONGeoValueSerializer {
   }
 
   public void serialize(final JsonGenerator jgen, final Geospatial value) throws IOException {
-    if (value.getEdmSimpleType().equals(ODataJClientEdmPrimitiveType.GeographyCollection)
-            || value.getEdmSimpleType().equals(ODataJClientEdmPrimitiveType.GeometryCollection)) {
+    if (value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeographyCollection)
+            || value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeometryCollection)) {
 
-      jgen.writeStringField(Constants.ATTR_TYPE, ODataJClientEdmPrimitiveType.GeometryCollection.name());
+      jgen.writeStringField(Constants.ATTR_TYPE, EdmPrimitiveTypeKind.GeometryCollection.name());
     } else {
-      final int yIdx = value.getEdmSimpleType().name().indexOf('y');
-      final String itemType = value.getEdmSimpleType().name().substring(yIdx + 1);
+      final int yIdx = value.getEdmPrimitiveTypeKind().name().indexOf('y');
+      final String itemType = value.getEdmPrimitiveTypeKind().name().substring(yIdx + 1);
       jgen.writeStringField(Constants.ATTR_TYPE, itemType);
     }
 
-    switch (value.getEdmSimpleType()) {
+    switch (value.getEdmPrimitiveTypeKind()) {
       case GeographyPoint:
       case GeometryPoint:
         jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
index da6f0fd..948a930 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
@@ -56,15 +56,19 @@ import org.apache.olingo.commons.api.edm.EdmSchema;
 import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 import org.apache.olingo.commons.core.edm.AbstractEdmImpl;
 
 public class EdmClientImpl extends AbstractEdmImpl {
 
+  private final ODataServiceVersion version;
+
   private final XMLMetadata xmlMetadata;
 
   private final EdmServiceMetadata serviceMetadata;
 
-  public EdmClientImpl(final XMLMetadata xmlMetadata) {
+  public EdmClientImpl(final ODataServiceVersion version, final XMLMetadata xmlMetadata) {
+    this.version = version;
     this.xmlMetadata = xmlMetadata;
     this.serviceMetadata = AbstractEdmServiceMetadataImpl.getInstance(xmlMetadata);
   }
@@ -115,7 +119,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
     if (schema != null) {
       final EnumType xmlEnumType = schema.getEnumType(enumName.getName());
       if (xmlEnumType != null) {
-        result = new EdmEnumTypeImpl(this, enumName, xmlEnumType);
+        result = new EdmEnumTypeImpl(version, this, enumName, xmlEnumType);
       }
     }
 
@@ -131,7 +135,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
       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);
+        result = new EdmTypeDefinitionImpl(version, this, typeDefinitionName, xmlTypeDefinition);
       }
     } else {
       throw new UnsupportedInV3Exception();
@@ -378,7 +382,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
   protected List<EdmSchema> createSchemas() {
     final List<EdmSchema> schemas = new ArrayList<EdmSchema>();
     for (Schema schema : xmlMetadata.getSchemas()) {
-      schemas.add(new EdmSchemaImpl(this, xmlMetadata, schema));
+      schemas.add(new EdmSchemaImpl(version, this, xmlMetadata, schema));
     }
     return schemas;
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/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
index 10a1b2e..05cfa27 100644
--- 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
@@ -27,7 +27,6 @@ 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;
@@ -37,6 +36,9 @@ import java.util.List;
 import java.util.Map;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 
 public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType {
 
@@ -54,14 +56,16 @@ public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType
 
   private final Map<String, EdmMember> members;
 
-  public EdmEnumTypeImpl(final Edm edm, final FullQualifiedName fqn, final EnumType xmlEnumType) {
+  public EdmEnumTypeImpl(final ODataServiceVersion version, final Edm edm, final FullQualifiedName fqn,
+          final EnumType xmlEnumType) {
+
     super(edm, fqn, xmlEnumType.isFlags());
 
     if (xmlEnumType.getUnderlyingType() == null) {
-      this.underlyingType = EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance();
+      this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32);
     } else {
-      this.underlyingType = EdmPrimitiveTypeKind.valueOfFQN(xmlEnumType.getUnderlyingType()).
-              getEdmPrimitiveTypeInstance();
+      this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(
+              EdmPrimitiveTypeKind.valueOfFQN(version, xmlEnumType.getUnderlyingType()));
       if (!ArrayUtils.contains(VALID_UNDERLYING_TYPES, this.underlyingType.getKind())) {
         throw new EdmException("Not allowed as underlying type: " + this.underlyingType.getKind());
       }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
index 58c9496..ffe41cd 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
@@ -41,18 +41,25 @@ import org.apache.olingo.commons.api.edm.EdmEnumType;
 import org.apache.olingo.commons.api.edm.EdmFunction;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 import org.apache.olingo.commons.core.edm.AbstractEdmSchemaImpl;
 
 public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
 
+  private final ODataServiceVersion version;
+
   private final Edm edm;
 
   private final XMLMetadata xmlMetadata;
 
   private final Schema schema;
 
-  public EdmSchemaImpl(Edm edm, XMLMetadata xmlMetadata, Schema schema) {
+  public EdmSchemaImpl(final ODataServiceVersion version, final Edm edm,
+          final XMLMetadata xmlMetadata, final Schema schema) {
+
     super(schema.getNamespace(), schema.getAlias());
+
+    this.version = version;
     this.edm = edm;
     this.xmlMetadata = xmlMetadata;
     this.schema = schema;
@@ -77,7 +84,8 @@ public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
               ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).getTypeDefinitions();
       if (providerTypeDefinitions != null) {
         for (TypeDefinition def : providerTypeDefinitions) {
-          typeDefinitions.add(new EdmTypeDefinitionImpl(edm, new FullQualifiedName("namespace", def.getName()), def));
+          typeDefinitions.add(
+                  new EdmTypeDefinitionImpl(version, edm, new FullQualifiedName("namespace", def.getName()), def));
         }
       }
     }
@@ -90,7 +98,8 @@ public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
     final List<EnumType> providerEnumTypes = schema.getEnumTypes();
     if (providerEnumTypes != null) {
       for (EnumType enumType : providerEnumTypes) {
-        enumTypes.add(new EdmEnumTypeImpl(edm, new FullQualifiedName(namespace, enumType.getName()), enumType));
+        enumTypes.add(
+                new EdmEnumTypeImpl(version, edm, new FullQualifiedName(namespace, enumType.getName()), enumType));
       }
     }
     return enumTypes;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java
index cf2ad47..199d61e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java
@@ -22,10 +22,12 @@ import org.apache.olingo.client.api.edm.xml.v4.TypeDefinition;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmException;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 import org.apache.olingo.commons.core.edm.AbstractEdmTypeDefinition;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 
 public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements EdmTypeDefinition {
 
@@ -33,14 +35,14 @@ public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements
 
   private EdmPrimitiveType edmPrimitiveTypeInstance;
 
-  public EdmTypeDefinitionImpl(final Edm edm, final FullQualifiedName typeDefinitionName,
-          final TypeDefinition typeDefinition) {
+  public EdmTypeDefinitionImpl(final ODataServiceVersion version, final Edm edm,
+          final FullQualifiedName typeDefinitionName, final TypeDefinition typeDefinition) {
 
     super(edm, typeDefinitionName);
     this.typeDefinition = typeDefinition;
     try {
-      edmPrimitiveTypeInstance = EdmPrimitiveTypeKind.valueOfFQN(typeDefinition.getUnderlyingType()).
-              getEdmPrimitiveTypeInstance();
+      this.edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getNonGeoInstance(
+              EdmPrimitiveTypeKind.valueOfFQN(version, typeDefinition.getUnderlyingType()));
     } catch (IllegalArgumentException e) {
       throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e);
     }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
index 3ed86dc..461e829 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
@@ -18,15 +18,13 @@
  */
 package org.apache.olingo.client.core.edm;
 
-import org.apache.commons.lang3.NotImplementedException;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmComplexType;
 import org.apache.olingo.commons.api.edm.EdmEntityType;
 import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -72,9 +70,7 @@ public class EdmTypeInfo {
 
   private final FullQualifiedName fullQualifiedName;
 
-  private EdmPrimitiveType primitiveType;
-
-  private final boolean geospatialType;
+  private EdmPrimitiveTypeKind primitiveType;
 
   private EdmEnumType enumType;
 
@@ -114,14 +110,10 @@ public class EdmTypeInfo {
     this.fullQualifiedName = new FullQualifiedName(namespace, typeName);
 
     try {
-      this.primitiveType = EdmPrimitiveTypeKind.valueOf(this.fullQualifiedName.getName()).
-              getEdmPrimitiveTypeInstance();
+      this.primitiveType = EdmPrimitiveTypeKind.valueOf(this.fullQualifiedName.getName());
     } catch (IllegalArgumentException e) {
       LOG.debug("{} does not appear to refer to an Edm primitive type", this.fullQualifiedName);
     }
-    // TODO - OLINGO-65 implement Geospatial types!
-    this.geospatialType = this.fullQualifiedName.getNamespace().equals(EdmPrimitiveType.EDM_NAMESPACE)
-            && this.fullQualifiedName.getName().startsWith("Geo");
     if (this.primitiveType == null && this.edm != null) {
       this.enumType = this.edm.getEnumType(this.fullQualifiedName);
       if (this.enumType == null) {
@@ -146,21 +138,13 @@ public class EdmTypeInfo {
   }
 
   public boolean isPrimitiveType() {
-    return this.primitiveType != null || isGeospatialType();
+    return this.primitiveType != null;
   }
 
-  public EdmPrimitiveType getPrimitiveType() {
+  public EdmPrimitiveTypeKind getPrimitiveTypeKind() {
     return primitiveType;
   }
 
-  public boolean isGeospatialType() {
-    return geospatialType;
-  }
-
-  public Object getGeospatialType() {
-    throw new NotImplementedException("Geospatial types missing");
-  }
-
   public boolean isEnumType() {
     return this.enumType != null;
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
index 69a278f..b185d5d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
@@ -38,7 +38,6 @@ import org.apache.olingo.client.api.domain.ODataEntitySet;
 import org.apache.olingo.client.api.domain.ODataGeospatialValue;
 import org.apache.olingo.client.api.domain.ODataInlineEntity;
 import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
 import org.apache.olingo.client.api.domain.ODataLink;
 import org.apache.olingo.client.api.domain.ODataOperation;
 import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
@@ -55,6 +54,7 @@ import org.apache.olingo.client.core.data.JSONPropertyImpl;
 import org.apache.olingo.client.core.data.LinkImpl;
 import org.apache.olingo.client.core.data.NullValueImpl;
 import org.apache.olingo.client.core.data.PrimitiveValueImpl;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -378,14 +378,14 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
       value = new ODataPrimitiveValue.Builder(client).setText(resource.getValue().asSimple().get()).
               setType(resource.getType() == null
                       ? null
-                      : ODataJClientEdmPrimitiveType.fromValue(resource.getType())).build();
+                      : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
     } else if (resource.getValue().isGeospatial()) {
       value = new ODataGeospatialValue.Builder(client).setValue(resource.getValue().asGeospatial().get()).
               setType(resource.getType() == null
-                      || ODataJClientEdmPrimitiveType.Geography.toString().equals(resource.getType())
-                      || ODataJClientEdmPrimitiveType.Geometry.toString().equals(resource.getType())
+                      || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().toString().equals(resource.getType())
+                      || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().toString().equals(resource.getType())
                       ? null
-                      : ODataJClientEdmPrimitiveType.fromValue(resource.getType())).build();
+                      : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
     } else if (resource.getValue().isComplex()) {
       value = new ODataComplexValue(resource.getType());
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
index cfe08ec..596e8fd 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
@@ -26,7 +26,6 @@ import org.apache.olingo.client.api.data.Property;
 import org.apache.olingo.client.api.domain.ODataEntity;
 import org.apache.olingo.client.api.domain.ODataEntitySet;
 import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
 import org.apache.olingo.client.api.domain.ODataProperty;
 import org.apache.olingo.client.api.domain.ODataServiceDocument;
 import org.apache.olingo.client.api.domain.ODataValue;
@@ -35,6 +34,7 @@ import org.apache.olingo.client.api.format.ODataFormat;
 import org.apache.olingo.client.api.format.ODataPubFormat;
 import org.apache.olingo.client.api.format.ODataValueFormat;
 import org.apache.olingo.client.api.op.CommonODataReader;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -91,7 +91,7 @@ public abstract class AbstractODataReader implements CommonODataReader {
       } else if (ODataValue.class.isAssignableFrom(reference)) {
         res = client.getPrimitiveValueBuilder().
                 setType(ODataValueFormat.fromString(format) == ODataValueFormat.TEXT
-                        ? ODataJClientEdmPrimitiveType.String : ODataJClientEdmPrimitiveType.Stream).
+                        ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
                 setText(IOUtils.toString(src)).
                 build();
       } else if (XMLMetadata.class.isAssignableFrom(reference)) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
index 54e4ad0..6649a39 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
@@ -40,7 +40,7 @@ public class ODataReaderImpl extends AbstractODataReader implements ODataReader
 
   @Override
   public Edm readMetadata(final InputStream input) {
-    return new EdmClientImpl(client.getDeserializer().toMetadata(input));
+    return new EdmClientImpl(client.getServiceVersion(), client.getDeserializer().toMetadata(input));
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
index 5a64d63..8324cca 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
@@ -38,7 +38,7 @@ public class ODataReaderImpl extends AbstractODataReader implements ODataReader
 
   @Override
   public Edm readMetadata(final InputStream input) {
-    return new EdmClientImpl(client.getDeserializer().toMetadata(input));
+    return new EdmClientImpl(client.getServiceVersion(), client.getDeserializer().toMetadata(input));
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
index a40da38..5326602 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
@@ -32,22 +32,22 @@ import java.util.List;
 import java.util.UUID;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
 import org.apache.olingo.client.api.domain.ODataGeospatialValue;
 import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
 import org.apache.olingo.client.api.domain.ODataProperty;
 import org.apache.olingo.client.api.domain.ODataTimestamp;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial.Dimension;
-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.format.ODataFormat;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
 
 public abstract class AbstractPrimitiveTest extends AbstractTest {
 
@@ -66,13 +66,15 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
 
   protected ODataPrimitiveValue writePrimitiveValue(final ODataPrimitiveValue value) {
     final ODataPrimitiveValue newValue;
-    if (ODataJClientEdmPrimitiveType.isGeospatial(value.getTypeName())) {
+    final EdmPrimitiveTypeKind typeKind = EdmPrimitiveTypeKind.valueOfFQN(
+            getClient().getServiceVersion(), value.getTypeName());
+    if (typeKind.isGeospatial()) {
       newValue = getClient().getGeospatialValueBuilder().
-              setType(ODataJClientEdmPrimitiveType.fromValue(value.getTypeName())).
+              setType(EdmPrimitiveTypeKind.valueOfFQN(getVersion(), value.getTypeName())).
               setValue(((ODataGeospatialValue) value).getGeospatial()).build();
     } else {
       newValue = getClient().getPrimitiveValueBuilder().
-              setType(ODataJClientEdmPrimitiveType.fromValue(value.getTypeName())).
+              setType(EdmPrimitiveTypeKind.valueOfFQN(getClient().getServiceVersion(), value.getTypeName())).
               setValue(value.toValue()).build();
     }
 
@@ -95,7 +97,9 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
     final ODataPrimitiveValue value =
             readPrimitiveValue(getClass().getResourceAsStream(getFilename(entity, propertyName)));
 
-    if (ODataJClientEdmPrimitiveType.isGeospatial(value.getTypeName())) {
+    final EdmPrimitiveTypeKind typeKind = EdmPrimitiveTypeKind.valueOfFQN(
+            getClient().getServiceVersion(), value.getTypeName());
+    if (typeKind.isGeospatial()) {
       assertEquals(value.toValue(), writePrimitiveValue(value).toValue());
     } else {
       assertEquals(value.toString(), writePrimitiveValue(value).toString());
@@ -106,7 +110,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
 
   protected void int32(final String entity, final String propertyName, final int check) {
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(ODataJClientEdmPrimitiveType.Int32.toString(), opv.getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Int32.toString(), opv.getTypeName());
 
     final Integer value = opv.<Integer>toCastValue();
     assertNotNull(value);
@@ -115,7 +119,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
 
   protected void string(final String entity, final String propertyName, final String check) {
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(ODataJClientEdmPrimitiveType.String.toString(), opv.getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.String.toString(), opv.getTypeName());
 
     final String value = opv.<String>toCastValue();
     assertNotNull(value);
@@ -126,7 +130,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
 
   protected void decimal(final String entity, final String propertyName, final BigDecimal check) {
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(ODataJClientEdmPrimitiveType.Decimal.toString(), opv.getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Decimal.toString(), opv.getTypeName());
 
     final BigDecimal value = opv.<BigDecimal>toCastValue();
     assertNotNull(value);
@@ -135,7 +139,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
 
   protected void datetime(final String entity, final String propertyName, final String check) {
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(ODataJClientEdmPrimitiveType.DateTime.toString(), opv.getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.DateTime.toString(), opv.getTypeName());
 
     final ODataTimestamp value = opv.<ODataTimestamp>toCastValue();
     assertNotNull(value);
@@ -144,7 +148,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
 
   protected void guid(final String entity, final String propertyName, final String check) {
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(ODataJClientEdmPrimitiveType.Guid.toString(), opv.getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Guid.toString(), opv.getTypeName());
 
     final UUID value = opv.<UUID>toCastValue();
     assertNotNull(value);
@@ -153,7 +157,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
 
   protected void binary(final String entity, final String propertyName) {
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
-    assertEquals(ODataJClientEdmPrimitiveType.Binary.toString(), opv.getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Binary.toString(), opv.getTypeName());
 
     final byte[] value = opv.<byte[]>toCastValue();
     assertNotNull(value);
@@ -171,7 +175,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
           final String entity,
           final String propertyName,
           final Point expectedValues,
-          final ODataJClientEdmPrimitiveType expectedType,
+          final EdmPrimitiveTypeKind expectedType,
           final Dimension expectedDimension) {
 
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -202,7 +206,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
           final String entity,
           final String propertyName,
           final List<Point> check,
-          final ODataJClientEdmPrimitiveType expectedType,
+          final EdmPrimitiveTypeKind expectedType,
           final Dimension expectedDimension) {
 
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -219,7 +223,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
           final String entity,
           final String propertyName,
           final List<Point> check,
-          final ODataJClientEdmPrimitiveType expectedType,
+          final EdmPrimitiveTypeKind expectedType,
           final Dimension expectedDimension) {
 
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -246,7 +250,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
           final String entity,
           final String propertyName,
           final List<List<Point>> check,
-          final ODataJClientEdmPrimitiveType expectedType,
+          final EdmPrimitiveTypeKind expectedType,
           final Dimension expectedDimension) {
 
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -301,7 +305,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
           final String propertyName,
           final List<Point> checkInterior,
           final List<Point> checkExterior,
-          final ODataJClientEdmPrimitiveType expectedType,
+          final EdmPrimitiveTypeKind expectedType,
           final Dimension expectedDimension) {
 
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -321,7 +325,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
           final String propertyName,
           final List<List<Point>> checkInterior,
           final List<List<Point>> checkExterior,
-          final ODataJClientEdmPrimitiveType expectedType,
+          final EdmPrimitiveTypeKind expectedType,
           final Dimension expectedDimension) {
 
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -344,7 +348,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
   protected void geomCollection(
           final String entity,
           final String propertyName,
-          final ODataJClientEdmPrimitiveType expectedType,
+          final EdmPrimitiveTypeKind expectedType,
           final Dimension expectedDimension) {
 
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -373,7 +377,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
   protected void geogCollection(
           final String entity,
           final String propertyName,
-          final ODataJClientEdmPrimitiveType expectedType,
+          final EdmPrimitiveTypeKind expectedType,
           final Dimension expectedDimension) {
 
     final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
index 48e17e7..e9b97f2 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
@@ -27,13 +27,13 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.Iterator;
 import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
 import org.apache.olingo.client.api.domain.ODataCollectionValue;
 import org.apache.olingo.client.api.domain.ODataComplexValue;
 import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
 import org.apache.olingo.client.api.domain.ODataProperty;
 import org.apache.olingo.client.api.domain.ODataValue;
 import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 import org.junit.Test;
 
@@ -52,7 +52,7 @@ public abstract class AbstractPropertyTest extends AbstractTest {
             + "Customer_-10_CustomerId_value.txt");
 
     final ODataValue value = getClient().getPrimitiveValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.String).
+            setType(EdmPrimitiveTypeKind.String).
             setText(IOUtils.toString(input)).
             build();
     assertNotNull(value);
@@ -76,7 +76,8 @@ public abstract class AbstractPropertyTest extends AbstractTest {
     } else {
       // This is needed because type information gets lost with JSON serialization
       final ODataPrimitiveValue typedValue = getClient().getPrimitiveValueBuilder().
-              setType(ODataJClientEdmPrimitiveType.fromValue(property.getPrimitiveValue().getTypeName())).
+              setType(EdmPrimitiveTypeKind.valueOfFQN(
+                              getClient().getServiceVersion(), property.getPrimitiveValue().getTypeName())).
               setText(written.getPrimitiveValue().toString()).
               build();
       comparable = getClient().getObjectFactory().newPrimitiveProperty(written.getName(), typedValue);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
index 589affa..e87b877 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
@@ -58,7 +58,6 @@ import org.apache.olingo.client.api.domain.ODataEntity;
 import org.apache.olingo.client.api.domain.ODataEntitySet;
 import org.apache.olingo.client.api.domain.ODataInlineEntity;
 import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
 import org.apache.olingo.client.api.domain.ODataLink;
 import org.apache.olingo.client.api.domain.ODataProperty;
 import org.apache.olingo.client.api.domain.ODataValue;
@@ -68,6 +67,7 @@ import org.apache.olingo.client.api.uri.CommonURIBuilder;
 import org.apache.olingo.client.api.utils.URIUtils;
 import org.apache.olingo.client.core.data.AtomEntryImpl;
 import org.apache.olingo.client.core.data.JSONEntryImpl;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.BeforeClass;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -214,7 +214,7 @@ public abstract class AbstractTestITCase {
 
     entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Information",
             getClient().getPrimitiveValueBuilder().setText(sampleinfo).setType(
-                    ODataJClientEdmPrimitiveType.String).build()));
+                    EdmPrimitiveTypeKind.String).build()));
 
     return entity;
   }
@@ -228,12 +228,12 @@ public abstract class AbstractTestITCase {
     // add name attribute
     entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Name",
             getClient().getPrimitiveValueBuilder().setText(sampleName).setType(
-                    ODataJClientEdmPrimitiveType.String).build()));
+                    EdmPrimitiveTypeKind.String).build()));
 
     // add key attribute
     entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("CustomerId",
             getClient().getPrimitiveValueBuilder().setText(String.valueOf(id)).setType(
-                    ODataJClientEdmPrimitiveType.Int32).build()));
+                    EdmPrimitiveTypeKind.Int32).build()));
 
     // add BackupContactInfo attribute (collection)
     final ODataCollectionValue backupContactInfoValue = new ODataCollectionValue(
@@ -249,13 +249,13 @@ public abstract class AbstractTestITCase {
     // add BackupContactInfo.ContactDetails.AlternativeNames attribute (collection)
     final ODataCollectionValue altNamesValue = new ODataCollectionValue("Collection(Edm.String)");
     altNamesValue.add(getClient().getPrimitiveValueBuilder().
-            setText("myname").setType(ODataJClientEdmPrimitiveType.String).build());
+            setText("myname").setType(EdmPrimitiveTypeKind.String).build());
     contactDetails.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
 
     // add BackupContactInfo.ContactDetails.EmailBag attribute (collection)
     final ODataCollectionValue emailBagValue = new ODataCollectionValue("Collection(Edm.String)");
     emailBagValue.add(getClient().getPrimitiveValueBuilder().
-            setText("myname@mydomain.com").setType(ODataJClientEdmPrimitiveType.String).build());
+            setText("myname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
     contactDetails.add(getClient().getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
 
     // add BackupContactInfo.ContactDetails.ContactAlias attribute (complex)
@@ -266,7 +266,7 @@ public abstract class AbstractTestITCase {
     // add BackupContactInfo.ContactDetails.ContactAlias.AlternativeNames attribute (collection)
     final ODataCollectionValue aliasAltNamesValue = new ODataCollectionValue("Collection(Edm.String)");
     aliasAltNamesValue.add(getClient().getPrimitiveValueBuilder().
-            setText("myAlternativeName").setType(ODataJClientEdmPrimitiveType.String).build());
+            setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
     contactAliasValue.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
 
     if (withInlineInfo) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
index 0d7bac2..465dc07 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
@@ -42,13 +42,13 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
 import org.apache.olingo.client.api.domain.ODataEntity;
 import org.apache.olingo.client.api.domain.ODataEntitySet;
 import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
 import org.apache.olingo.client.api.domain.ODataLink;
 import org.apache.olingo.client.api.domain.ODataProperty;
 import org.apache.olingo.client.api.format.ODataPubFormat;
 import org.apache.olingo.client.api.http.NoContentException;
 import org.apache.olingo.client.api.uri.CommonURIBuilder;
 import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -288,10 +288,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
               client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
 
       order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
-              client.getPrimitiveValueBuilder().setValue(key).setType(ODataJClientEdmPrimitiveType.Int32)
+              client.getPrimitiveValueBuilder().setValue(key).setType(EdmPrimitiveTypeKind.Int32)
               .build()));
       order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
-              client.getPrimitiveValueBuilder().setValue(id).setType(ODataJClientEdmPrimitiveType.Int32)
+              client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32)
               .build()));
 
       final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
@@ -383,9 +383,9 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
     ODataEntity order = client.getObjectFactory().newEntity(
             "Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
     order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
-            client.getPrimitiveValueBuilder().setValue(id).setType(ODataJClientEdmPrimitiveType.Int32).build()));
+            client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32).build()));
     order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
-            client.getPrimitiveValueBuilder().setValue(id).setType(ODataJClientEdmPrimitiveType.Int32).build()));
+            client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32).build()));
 
     order.addLink(client.getObjectFactory().newEntityNavigationLink(
             "Customer", URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString())));
@@ -442,22 +442,22 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
 
     message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("MessageId",
             client.getPrimitiveValueBuilder().setValue(1000).
-            setType(ODataJClientEdmPrimitiveType.Int32).build()));
+            setType(EdmPrimitiveTypeKind.Int32).build()));
     message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("FromUsername",
             client.getPrimitiveValueBuilder().setValue("1").
-            setType(ODataJClientEdmPrimitiveType.String).build()));
+            setType(EdmPrimitiveTypeKind.String).build()));
     message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("ToUsername",
             client.getPrimitiveValueBuilder().setValue("xlodhxzzusxecbzptxlfxprneoxkn").
-            setType(ODataJClientEdmPrimitiveType.String).build()));
+            setType(EdmPrimitiveTypeKind.String).build()));
     message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Subject",
             client.getPrimitiveValueBuilder().setValue("Test subject").
-            setType(ODataJClientEdmPrimitiveType.String).build()));
+            setType(EdmPrimitiveTypeKind.String).build()));
     message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Body",
             client.getPrimitiveValueBuilder().setValue("Test body").
-            setType(ODataJClientEdmPrimitiveType.String).build()));
+            setType(EdmPrimitiveTypeKind.String).build()));
     message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("IsRead",
             client.getPrimitiveValueBuilder().setValue(false).
-            setType(ODataJClientEdmPrimitiveType.Boolean).build()));
+            setType(EdmPrimitiveTypeKind.Boolean).build()));
 
     final CommonURIBuilder<?> builder =
             client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Message");

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
index 7717226..8399494 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
@@ -32,8 +32,8 @@ import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateR
 import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
 import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
 import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
 import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 /**
@@ -184,7 +184,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
     message.getProperties().remove(message.getProperty("IsRead"));
     message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("IsRead",
             client.getPrimitiveValueBuilder().setValue(!before).
-            setType(ODataJClientEdmPrimitiveType.Boolean).build()));
+            setType(EdmPrimitiveTypeKind.Boolean).build()));
 
     return client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.MERGE, message);
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
index 6b23f14..b8ce3b4 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
@@ -44,7 +44,6 @@ import org.apache.olingo.client.api.domain.ODataEntity;
 import org.apache.olingo.client.api.domain.ODataEntitySet;
 import org.apache.olingo.client.api.domain.ODataInlineEntity;
 import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
 import org.apache.olingo.client.api.domain.ODataLink;
 import org.apache.olingo.client.api.domain.ODataProperty;
 import org.apache.olingo.client.api.domain.ODataValue;
@@ -52,6 +51,7 @@ import org.apache.olingo.client.api.format.ODataPubFormat;
 import org.apache.olingo.client.api.http.HttpClientException;
 import org.apache.olingo.client.api.uri.CommonURIBuilder;
 import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 
 import org.junit.Test;
 
@@ -209,9 +209,9 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
                 client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
 
         orderEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
-                client.getPrimitiveValueBuilder().setValue(key).setType(ODataJClientEdmPrimitiveType.Int32).build()));
+                client.getPrimitiveValueBuilder().setValue(key).setType(EdmPrimitiveTypeKind.Int32).build()));
         orderEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
-                client.getPrimitiveValueBuilder().setValue(id).setType(ODataJClientEdmPrimitiveType.Int32).build()));
+                client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32).build()));
 
         final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
                 client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Order").build(),
@@ -267,13 +267,13 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
 
     // add name attribute
     entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Name",
-            client.getPrimitiveValueBuilder().setText(name).setType(ODataJClientEdmPrimitiveType.String).build()));
+            client.getPrimitiveValueBuilder().setText(name).setType(EdmPrimitiveTypeKind.String).build()));
 
     // add key attribute
     if (id != 0) {
       entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
               client.getPrimitiveValueBuilder().setText(String.valueOf(id)).
-              setType(ODataJClientEdmPrimitiveType.Int32).build()));
+              setType(EdmPrimitiveTypeKind.Int32).build()));
     }
     final ODataCollectionValue backupContactInfoValue = new ODataCollectionValue(
             "Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
@@ -285,12 +285,12 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
 
     final ODataCollectionValue altNamesValue = new ODataCollectionValue("Collection(Edm.String)");
     altNamesValue.add(client.getPrimitiveValueBuilder().
-            setText("My Alternative name").setType(ODataJClientEdmPrimitiveType.String).build());
+            setText("My Alternative name").setType(EdmPrimitiveTypeKind.String).build());
     contactDetails.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
 
     final ODataCollectionValue emailBagValue = new ODataCollectionValue("Collection(Edm.String)");
     emailBagValue.add(client.getPrimitiveValueBuilder().
-            setText("altname@mydomain.com").setType(ODataJClientEdmPrimitiveType.String).build());
+            setText("altname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
     contactDetails.add(client.getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
 
     final ODataComplexValue contactAliasValue = new ODataComplexValue(
@@ -299,17 +299,17 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
 
     final ODataCollectionValue aliasAltNamesValue = new ODataCollectionValue("Collection(Edm.String)");
     aliasAltNamesValue.add(client.getPrimitiveValueBuilder().
-            setText("myAlternativeName").setType(ODataJClientEdmPrimitiveType.String).build());
+            setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
     contactAliasValue.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
 
     final ODataComplexValue homePhone = new ODataComplexValue(
             "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone");
     homePhone.add(client.getObjectFactory().newPrimitiveProperty("PhoneNumber",
             client.getPrimitiveValueBuilder().setText("8437568356834568").
-            setType(ODataJClientEdmPrimitiveType.String).build()));
+            setType(EdmPrimitiveTypeKind.String).build()));
     homePhone.add(client.getObjectFactory().newPrimitiveProperty("Extension",
             client.getPrimitiveValueBuilder().setText("124365426534621534423ttrf").
-            setType(ODataJClientEdmPrimitiveType.String).
+            setType(EdmPrimitiveTypeKind.String).
             build()));
     contactDetails.add(client.getObjectFactory().newComplexProperty("HomePhone", homePhone));
 
@@ -372,7 +372,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
     entity.setMediaEntity(true);
 
     entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Information",
-            client.getPrimitiveValueBuilder().setText(info).setType(ODataJClientEdmPrimitiveType.String).build()));
+            client.getPrimitiveValueBuilder().setText(info).setType(EdmPrimitiveTypeKind.String).build()));
     return entity;
   }
   // validate newly created entities

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
index 7718317..c64d7bb 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
@@ -30,19 +30,19 @@ import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
 import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
 import org.apache.olingo.client.api.domain.ODataComplexValue;
 import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-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.format.ODataPubFormat;
 import org.apache.olingo.client.api.uri.CommonURIBuilder;
 import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -70,15 +70,15 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
   private void read(final ODataPubFormat format) {
     ODataEntity row = readRow(format, "71f7d0dc-ede4-45eb-b421-555a2aa1e58f");
     assertEquals(
-            ODataJClientEdmPrimitiveType.Double.toString(),
+            EdmPrimitiveTypeKind.Double.toString(),
             row.getProperty("Double").getPrimitiveValue().getTypeName());
     assertEquals(
-            ODataJClientEdmPrimitiveType.Guid.toString(),
+            EdmPrimitiveTypeKind.Guid.toString(),
             row.getProperty("Id").getPrimitiveValue().getTypeName());
 
     row = readRow(format, "672b8250-1e6e-4785-80cf-b94b572e42b3");
     assertEquals(
-            ODataJClientEdmPrimitiveType.Decimal.toString(),
+            EdmPrimitiveTypeKind.Decimal.toString(),
             row.getProperty("Decimal").getPrimitiveValue().getTypeName());
   }
 
@@ -99,50 +99,50 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
 
     ODataEntity row = client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.OpenTypesService.Row");
     row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Id",
-            client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Guid).setValue(guid).
+            client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).setValue(guid).
             build()));
     row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aString",
-            client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.String).setValue("string").
+            client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).setValue("string").
             build()));
     row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aBoolean",
-            client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Boolean).setValue(true).
+            client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Boolean).setValue(true).
             build()));
     row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aLong",
-            client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Int64).setValue(15L).
+            client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int64).setValue(15L).
             build()));
     row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aDouble",
-            client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Double).setValue(1.5D).
+            client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Double).setValue(1.5D).
             build()));
     row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aByte",
-            client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.SByte).setValue(Byte.MAX_VALUE).
+            client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).
             build()));
     row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aDate",
-            client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.DateTime).setValue(new Date()).
+            client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.DateTime).setValue(new Date()).
             build()));
 
     final Point point = new Point(Geospatial.Dimension.GEOGRAPHY, null);
     point.setX(1.2);
     point.setY(2.1);
     row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aPoint",
-            client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyPoint).
+            client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
             setValue(point).build()));
     final List<Point> points = new ArrayList<Point>();
     points.add(point);
     points.add(point);
     final MultiPoint multipoint = new MultiPoint(Geospatial.Dimension.GEOMETRY, null, points);
     row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiPoint",
-            client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryMultiPoint).
+            client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPoint).
             setValue(multipoint).build()));
     final LineString lineString = new LineString(Geospatial.Dimension.GEOMETRY, null, points);
     row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aLineString",
-            client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryLineString).
+            client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryLineString).
             setValue(lineString).build()));
     final List<LineString> lineStrings = new ArrayList<LineString>();
     lineStrings.add(lineString);
     lineStrings.add(lineString);
     final MultiLineString multiLineString = new MultiLineString(Geospatial.Dimension.GEOGRAPHY, null, lineStrings);
     row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiLineString",
-            client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryMultiLineString).
+            client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
             setValue(multiLineString).build()));
     final Point otherPoint = new Point(Geospatial.Dimension.GEOGRAPHY, null);
     otherPoint.setX(3.4);
@@ -152,14 +152,14 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
     points.add(point);
     final Polygon polygon = new Polygon(Geospatial.Dimension.GEOGRAPHY, null, points, points);
     row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aPolygon",
-            client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyPolygon).
+            client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
             setValue(polygon).build()));
     final List<Polygon> polygons = new ArrayList<Polygon>();
     polygons.add(polygon);
     polygons.add(polygon);
     final MultiPolygon multiPolygon = new MultiPolygon(Geospatial.Dimension.GEOGRAPHY, null, polygons);
     row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiPolygon",
-            client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyMultiPolygon).
+            client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyMultiPolygon).
             setValue(multiPolygon).build()));
     final List<Geospatial> geospatials = new ArrayList<Geospatial>();
     geospatials.add(otherPoint);
@@ -168,47 +168,47 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
     geospatials.add(multiPolygon);
     final GeospatialCollection geoColl = new GeospatialCollection(Geospatial.Dimension.GEOGRAPHY, null, geospatials);
     row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aCollection",
-            client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyCollection).
+            client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
             setValue(geoColl).build()));
 
     final ODataComplexValue contactDetails =
             new ODataComplexValue("Microsoft.Test.OData.Services.OpenTypesService.ContactDetails");
     contactDetails.add(client.getObjectFactory().newPrimitiveProperty("FirstContacted",
             client.getPrimitiveValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.Binary).setValue("text".getBytes()).build()));
+            setType(EdmPrimitiveTypeKind.Binary).setValue("text".getBytes()).build()));
     contactDetails.add(client.getObjectFactory().newPrimitiveProperty("LastContacted",
             client.getPrimitiveValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.DateTimeOffset).setText("2001-04-05T05:05:05.001+00:01").build()));
+            setType(EdmPrimitiveTypeKind.DateTimeOffset).setText("2001-04-05T05:05:05.001+00:01").build()));
     contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Contacted",
             client.getPrimitiveValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.DateTime).setText("2001-04-05T05:05:04.001").build()));
+            setType(EdmPrimitiveTypeKind.DateTime).setText("2001-04-05T05:05:04.001").build()));
     contactDetails.add(client.getObjectFactory().newPrimitiveProperty("GUID",
             client.getPrimitiveValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.Guid).setValue(UUID.randomUUID()).build()));
+            setType(EdmPrimitiveTypeKind.Guid).setValue(UUID.randomUUID()).build()));
     contactDetails.add(client.getObjectFactory().newPrimitiveProperty("PreferedContactTime",
             client.getPrimitiveValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.Time).setText("-P9DT51M10.5063807S").build()));
+            setType(EdmPrimitiveTypeKind.Time).setText("-P9DT51M10.5063807S").build()));
     contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Byte",
             client.getPrimitiveValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.Byte).setValue(Integer.valueOf(241)).build()));
+            setType(EdmPrimitiveTypeKind.Byte).setValue(Integer.valueOf(241)).build()));
     contactDetails.add(client.getObjectFactory().newPrimitiveProperty("SignedByte",
             client.getPrimitiveValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.SByte).setValue(Byte.MAX_VALUE).build()));
+            setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).build()));
     contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Double",
             client.getPrimitiveValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.Double).setValue(Double.MAX_VALUE).build()));
+            setType(EdmPrimitiveTypeKind.Double).setValue(Double.MAX_VALUE).build()));
     contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Single",
             client.getPrimitiveValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.Single).setValue(Float.MAX_VALUE).build()));
+            setType(EdmPrimitiveTypeKind.Single).setValue(Float.MAX_VALUE).build()));
     contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Short",
             client.getPrimitiveValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.Int16).setValue(Short.MAX_VALUE).build()));
+            setType(EdmPrimitiveTypeKind.Int16).setValue(Short.MAX_VALUE).build()));
     contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Int",
             client.getPrimitiveValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.Int32).setValue(Integer.MAX_VALUE).build()));
+            setType(EdmPrimitiveTypeKind.Int32).setValue(Integer.MAX_VALUE).build()));
     contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Long",
             client.getPrimitiveValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.Int64).setValue(Long.MAX_VALUE).build()));
+            setType(EdmPrimitiveTypeKind.Int64).setValue(Long.MAX_VALUE).build()));
     row.getProperties().add(client.getObjectFactory().newComplexProperty("aContact", contactDetails));
 
     final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().
@@ -220,37 +220,37 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
 
     row = readRow(format, guid.toString());
     assertNotNull(row);
-    assertEquals(ODataJClientEdmPrimitiveType.Guid.toString(),
+    assertEquals(EdmPrimitiveTypeKind.Guid.toString(),
             row.getProperty("Id").getPrimitiveValue().getTypeName());
-    assertEquals(ODataJClientEdmPrimitiveType.String.toString(),
+    assertEquals(EdmPrimitiveTypeKind.String.toString(),
             row.getProperty("aString").getPrimitiveValue().getTypeName());
-    assertEquals(ODataJClientEdmPrimitiveType.Boolean.toString(),
+    assertEquals(EdmPrimitiveTypeKind.Boolean.toString(),
             row.getProperty("aBoolean").getPrimitiveValue().getTypeName());
-    assertEquals(ODataJClientEdmPrimitiveType.Int64.toString(),
+    assertEquals(EdmPrimitiveTypeKind.Int64.toString(),
             row.getProperty("aLong").getPrimitiveValue().getTypeName());
-    assertEquals(ODataJClientEdmPrimitiveType.Double.toString(),
+    assertEquals(EdmPrimitiveTypeKind.Double.toString(),
             row.getProperty("aDouble").getPrimitiveValue().getTypeName());
-    assertEquals(ODataJClientEdmPrimitiveType.SByte.toString(),
+    assertEquals(EdmPrimitiveTypeKind.SByte.toString(),
             row.getProperty("aByte").getPrimitiveValue().getTypeName());
-    assertEquals(ODataJClientEdmPrimitiveType.DateTime.toString(),
+    assertEquals(EdmPrimitiveTypeKind.DateTime.toString(),
             row.getProperty("aDate").getPrimitiveValue().getTypeName());
-    assertEquals(ODataJClientEdmPrimitiveType.GeographyPoint.toString(),
+    assertEquals(EdmPrimitiveTypeKind.GeographyPoint.toString(),
             row.getProperty("aPoint").getPrimitiveValue().getTypeName());
-    assertEquals(ODataJClientEdmPrimitiveType.GeometryMultiPoint.toString(),
+    assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint.toString(),
             row.getProperty("aMultiPoint").getPrimitiveValue().getTypeName());
-    assertEquals(ODataJClientEdmPrimitiveType.GeometryLineString.toString(),
+    assertEquals(EdmPrimitiveTypeKind.GeometryLineString.toString(),
             row.getProperty("aLineString").getPrimitiveValue().getTypeName());
-    assertEquals(ODataJClientEdmPrimitiveType.GeometryMultiLineString.toString(),
+    assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString.toString(),
             row.getProperty("aMultiLineString").getPrimitiveValue().getTypeName());
-    assertEquals(ODataJClientEdmPrimitiveType.GeographyPolygon.toString(),
+    assertEquals(EdmPrimitiveTypeKind.GeographyPolygon.toString(),
             row.getProperty("aPolygon").getPrimitiveValue().getTypeName());
-    assertEquals(ODataJClientEdmPrimitiveType.GeographyMultiPolygon.toString(),
+    assertEquals(EdmPrimitiveTypeKind.GeographyMultiPolygon.toString(),
             row.getProperty("aMultiPolygon").getPrimitiveValue().getTypeName());
-    assertEquals(ODataJClientEdmPrimitiveType.GeographyCollection.toString(),
+    assertEquals(EdmPrimitiveTypeKind.GeographyCollection.toString(),
             row.getProperty("aCollection").getPrimitiveValue().getTypeName());
     assertEquals("Microsoft.Test.OData.Services.OpenTypesService.ContactDetails",
             row.getProperty("aContact").getComplexValue().getTypeName());
-    assertEquals(ODataJClientEdmPrimitiveType.SByte.toString(),
+    assertEquals(EdmPrimitiveTypeKind.SByte.toString(),
             row.getProperty("aContact").getComplexValue().get("SignedByte").getPrimitiveValue().getTypeName());
 
     final ODataDeleteResponse deleteRes = client.getCUDRequestFactory().getDeleteRequest(row.getEditLink()).

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index 8559d4f..903adf8 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -25,14 +25,14 @@ import static org.junit.Assert.assertTrue;
 import java.io.InputStream;
 import org.apache.olingo.client.api.v3.ODataClient;
 import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
 import org.apache.olingo.client.api.domain.ODataLink;
 import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
 import org.apache.olingo.client.api.format.ODataPubFormat;
 import org.apache.olingo.client.core.AbstractTest;
 import org.apache.olingo.client.core.op.impl.ResourceFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
 import org.junit.Test;
 
 public class EntityTest extends AbstractTest {
@@ -89,7 +89,7 @@ public class EntityTest extends AbstractTest {
       if ("GeogMultiLine".equals(property.getName())) {
         found = true;
         assertTrue(property.hasPrimitiveValue());
-        assertEquals(ODataJClientEdmPrimitiveType.GeographyMultiLineString.toString(),
+        assertEquals(EdmPrimitiveTypeKind.GeographyMultiLineString.getFullQualifiedName().toString(),
                 property.getPrimitiveValue().getTypeName());
       }
     }
@@ -168,7 +168,7 @@ public class EntityTest extends AbstractTest {
     assertNotNull(entity);
 
     final ODataProperty geogCollection = entity.getProperty("GeogCollection");
-    assertEquals(ODataJClientEdmPrimitiveType.GeographyCollection.toString(),
+    assertEquals(EdmPrimitiveTypeKind.GeographyCollection.getFullQualifiedName().toString(),
             geogCollection.getPrimitiveValue().getTypeName());
 
     int count = 0;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
index fea25ca..5dca101 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
@@ -49,8 +49,9 @@ import org.apache.olingo.commons.api.edm.EdmEntityType;
 import org.apache.olingo.commons.api.edm.EdmFunction;
 import org.apache.olingo.commons.api.edm.EdmFunctionImport;
 import org.apache.olingo.commons.api.edm.EdmFunctionImportInfo;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 import org.junit.Test;
 
 public class MetadataTest extends AbstractTest {
@@ -133,7 +134,7 @@ public class MetadataTest extends AbstractTest {
             new FullQualifiedName("Microsoft.Test.OData.Services.AstoriaDefaultService", "ProductReview"));
     assertNotNull(entity);
     assertFalse(entity.getPropertyNames().isEmpty());
-    assertEquals(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance(),
+    assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32),
             entity.getProperty("ProductId").getType());
 
     assertFalse(entity.getKeyPropertyRefs().isEmpty());
@@ -150,7 +151,7 @@ public class MetadataTest extends AbstractTest {
     for (EdmActionImportInfo info : metadata.getServiceMetadata().getActionImportInfos()) {
       actionImports.add(info.getActionImportName());
     }
-    final Set<String> expectedAI = new HashSet<String>(Arrays.asList(new String[]{
+    final Set<String> expectedAI = new HashSet<String>(Arrays.asList(new String[] {
       "ResetDataSource",
       "IncreaseSalaries",
       "Sack",
@@ -162,7 +163,7 @@ public class MetadataTest extends AbstractTest {
     for (EdmFunctionImportInfo info : metadata.getServiceMetadata().getFunctionImportInfos()) {
       functionImports.add(info.getFunctionImportName());
     }
-    final Set<String> expectedFI = new HashSet<String>(Arrays.asList(new String[]{
+    final Set<String> expectedFI = new HashSet<String>(Arrays.asList(new String[] {
       "GetPrimitiveString",
       "GetSpecificCustomer",
       "GetCustomerCount",
@@ -177,7 +178,7 @@ public class MetadataTest extends AbstractTest {
 
     final EdmFunctionImport getArgumentPlusOne = container.getFunctionImport("GetArgumentPlusOne");
     assertNotNull(getArgumentPlusOne);
-    assertEquals(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance(),
+    assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32),
             getArgumentPlusOne.getFunction(null).getReturnType().getType());
 
     final EdmActionImport resetDataSource = container.getActionImport("ResetDataSource");
@@ -191,7 +192,7 @@ public class MetadataTest extends AbstractTest {
     final EdmFunction getComputer = metadata.getFunction(
             new FullQualifiedName(container.getNamespace(), "GetComputer"),
             new FullQualifiedName(container.getNamespace(), computer.getName()),
-            Boolean.FALSE, Arrays.asList(new String[]{"computer"}));
+            Boolean.FALSE, Arrays.asList(new String[] {"computer"}));
     assertNotNull(getComputer);
     assertEquals(computer, getComputer.getParameter("computer").getType());
     assertEquals(computer, getComputer.getReturnType().getType());


[04/11] [OLINGO-65] Geospatial types implemented, EdmStream mock implemented with URI as backend, V3 pruned types implemented, EdmSimpleTypeKind adapted, EdmSimpleTypeFactory introduces

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
index 641fafa..c5e4aee 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
@@ -29,21 +29,21 @@ import java.util.List;
 import java.util.UUID;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
 import org.apache.olingo.client.api.domain.ODataDuration;
 import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
 import org.apache.olingo.client.api.domain.ODataTimestamp;
 import org.apache.olingo.client.api.domain.ODataValue;
-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.core.AbstractTest;
 import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
 import org.junit.Test;
 
 public class PrimitiveValueTest extends AbstractTest {
@@ -56,24 +56,24 @@ public class PrimitiveValueTest extends AbstractTest {
   @Test
   public void manageInt32() {
     final int primitive = -10;
-    ODataValue value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Int32).
+    ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int32).
             setValue(primitive).build();
-    assertEquals(ODataJClientEdmPrimitiveType.Int32.toString(), value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Int32.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
     assertEquals(Integer.valueOf(primitive), value.asPrimitive().<Integer>toCastValue());
 
-    value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Int32).setText("9").build();
+    value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int32).setText("9").build();
     assertEquals("9", value.asPrimitive().<Integer>toCastValue().toString());
   }
 
   @Test
   public void manageString() {
     final String primitive = UUID.randomUUID().toString();
-    ODataValue value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.String).
+    ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
             setText(primitive).build();
-    assertEquals(ODataJClientEdmPrimitiveType.String.toString(), value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.String.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
     assertEquals(primitive, value.toString());
 
-    value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.String).
+    value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
             setText("1126a28b-a4af-4bbd-bf0a-2b2c22635565").build();
     assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().<String>toCastValue().toString());
   }
@@ -81,12 +81,12 @@ public class PrimitiveValueTest extends AbstractTest {
   @Test
   public void manageDecimal() {
     final BigDecimal primitive = new BigDecimal("-79228162514264337593543950335");
-    ODataValue value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Decimal).
+    ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
             setValue(primitive).build();
-    assertEquals(ODataJClientEdmPrimitiveType.Decimal.toString(), value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Decimal.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
     assertEquals(primitive, value.asPrimitive().<BigDecimal>toCastValue());
 
-    value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Decimal).
+    value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
             setText("-79228162514264337593543950335").build();
     assertEquals("-79228162514264337593543950335", value.asPrimitive().<BigDecimal>toCastValue().toString());
   }
@@ -97,15 +97,15 @@ public class PrimitiveValueTest extends AbstractTest {
     final String primitive = "2013-01-10T06:27:51.1667673";
     try {
       new ODataPrimitiveValue.Builder(ODataClientFactory.getV4()).
-              setType(ODataJClientEdmPrimitiveType.DateTime).setText(primitive).build();
+              setType(EdmPrimitiveTypeKind.DateTime).setText(primitive).build();
       fail();
     } catch (IllegalArgumentException iae) {
       // ignore
     }
     final ODataValue value =
-            getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.DateTime).
+            getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.DateTime).
             setText(primitive).build();
-    assertEquals(ODataJClientEdmPrimitiveType.DateTime.toString(), value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.DateTime.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
     // performed cast to improve the check
     assertEquals(primitive, value.asPrimitive().<ODataTimestamp>toCastValue().toString());
   }
@@ -116,16 +116,16 @@ public class PrimitiveValueTest extends AbstractTest {
     final String primitive = "-P9DT51M10.5063807S";
     try {
       new ODataPrimitiveValue.Builder(ODataClientFactory.getV4()).
-              setType(ODataJClientEdmPrimitiveType.Time).setText(primitive).build();
+              setType(EdmPrimitiveTypeKind.Time).setText(primitive).build();
       fail();
     } catch (IllegalArgumentException iae) {
       // ignore
     }
 
     final ODataValue value =
-            getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Time).
+            getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Time).
             setText(primitive).build();
-    assertEquals(ODataJClientEdmPrimitiveType.Time.toString(), value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Time.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
     // performed cast to improve the check
     assertEquals(primitive, value.asPrimitive().<ODataDuration>toCastValue().toString());
   }
@@ -134,8 +134,9 @@ public class PrimitiveValueTest extends AbstractTest {
   public void manageDateTimeOffset() {
     final String primitive = "2013-01-10T02:00:00";
     final ODataValue value = getClient().getPrimitiveValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.DateTimeOffset).setText(primitive).build();
-    assertEquals(ODataJClientEdmPrimitiveType.DateTimeOffset.toString(), value.asPrimitive().getTypeName());
+            setType(EdmPrimitiveTypeKind.DateTimeOffset).setText(primitive).build();
+    assertEquals(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName().toString(), 
+            value.asPrimitive().getTypeName());
     // performed cast to improve the check
     assertEquals(primitive, value.asPrimitive().<ODataTimestamp>toCastValue().toString());
   }
@@ -143,12 +144,12 @@ public class PrimitiveValueTest extends AbstractTest {
   @Test
   public void manageGuid() {
     final UUID primitive = UUID.fromString("1126a28b-a4af-4bbd-bf0a-2b2c22635565");
-    ODataValue value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Guid).
+    ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
             setValue(primitive).build();
-    assertEquals(ODataJClientEdmPrimitiveType.Guid.toString(), value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Guid.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
     assertEquals(primitive, value.asPrimitive().<UUID>toCastValue());
 
-    value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Guid).
+    value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
             setText("1126a28b-a4af-4bbd-bf0a-2b2c22635565").build();
     assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().<UUID>toCastValue().toString());
   }
@@ -156,14 +157,14 @@ public class PrimitiveValueTest extends AbstractTest {
   @Test
   public void manageBinary() {
     final byte[] primitive = UUID.randomUUID().toString().getBytes();
-    ODataValue value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Binary).
+    ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Binary).
             setValue(primitive).build();
-    assertEquals(ODataJClientEdmPrimitiveType.Binary.toString(), value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.Binary.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
     assertEquals(
             Base64.encodeBase64String(primitive),
             Base64.encodeBase64String(value.asPrimitive().<byte[]>toCastValue()));
 
-    value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Binary).
+    value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Binary).
             setText(Base64.encodeBase64String("primitive".getBytes())).build();
     assertEquals("primitive", new String(value.asPrimitive().<byte[]>toCastValue()));
   }
@@ -175,7 +176,7 @@ public class PrimitiveValueTest extends AbstractTest {
     primitive.setY(173.334);
 
     try {
-      getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyPoint).
+      getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
               setValue(primitive).build();
       fail();
     } catch (IllegalArgumentException iae) {
@@ -183,10 +184,11 @@ public class PrimitiveValueTest extends AbstractTest {
     }
 
     final ODataValue value =
-            getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyPoint).
+            getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
             setValue(primitive).
             build();
-    assertEquals(ODataJClientEdmPrimitiveType.GeographyPoint.toString(), value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.GeographyPoint.getFullQualifiedName().toString(), 
+            value.asPrimitive().getTypeName());
     assertEquals(Double.valueOf(primitive.getX()), Double.valueOf(value.asPrimitive().<Point>toCastValue().getX()));
     assertEquals(Double.valueOf(primitive.getY()), Double.valueOf(value.asPrimitive().<Point>toCastValue().getY()));
   }
@@ -217,8 +219,9 @@ public class PrimitiveValueTest extends AbstractTest {
     final LineString primitive = new LineString(Geospatial.Dimension.GEOGRAPHY, null, points);
 
     final ODataValue value = getClient().getGeospatialValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.GeographyLineString).setValue(primitive).build();
-    assertEquals(ODataJClientEdmPrimitiveType.GeographyLineString.toString(), value.asPrimitive().getTypeName());
+            setType(EdmPrimitiveTypeKind.GeographyLineString).setValue(primitive).build();
+    assertEquals(EdmPrimitiveTypeKind.GeographyLineString.getFullQualifiedName().toString(), 
+            value.asPrimitive().getTypeName());
 
     final Iterator<Point> iter = value.asPrimitive().<LineString>toCastValue().iterator();
 
@@ -242,8 +245,9 @@ public class PrimitiveValueTest extends AbstractTest {
     final MultiPoint primitive = new MultiPoint(Geospatial.Dimension.GEOMETRY, null, points);
 
     final ODataValue value = getClient().getGeospatialValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.GeometryMultiPoint).setValue(primitive).build();
-    assertEquals(ODataJClientEdmPrimitiveType.GeometryMultiPoint.toString(), value.asPrimitive().getTypeName());
+            setType(EdmPrimitiveTypeKind.GeometryMultiPoint).setValue(primitive).build();
+    assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint.getFullQualifiedName().toString(), 
+            value.asPrimitive().getTypeName());
 
     final Iterator<Point> iter = value.asPrimitive().<MultiPoint>toCastValue().iterator();
     point = iter.next();
@@ -302,9 +306,10 @@ public class PrimitiveValueTest extends AbstractTest {
     final MultiLineString primitive = new MultiLineString(Geospatial.Dimension.GEOMETRY, null, lines);
 
     final ODataValue value =
-            getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryMultiLineString).
+            getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
             setValue(primitive).build();
-    assertEquals(ODataJClientEdmPrimitiveType.GeometryMultiLineString.toString(), value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString.getFullQualifiedName().toString(), 
+            value.asPrimitive().getTypeName());
 
     final Iterator<LineString> lineIter = value.asPrimitive().<MultiLineString>toCastValue().iterator();
 
@@ -355,9 +360,10 @@ public class PrimitiveValueTest extends AbstractTest {
     final Polygon primitive = new Polygon(Geospatial.Dimension.GEOGRAPHY, null, interior, exterior);
 
     final ODataValue value =
-            getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyPolygon).
+            getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
             setValue(primitive).build();
-    assertEquals(ODataJClientEdmPrimitiveType.GeographyPolygon.toString(), value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.GeographyPolygon.getFullQualifiedName().toString(), 
+            value.asPrimitive().getTypeName());
 
     assertTrue(value.asPrimitive().<Polygon>toCastValue().getInterior().isEmpty());
     final Iterator<Point> iter = value.asPrimitive().<Polygon>toCastValue().getExterior().iterator();
@@ -461,9 +467,10 @@ public class PrimitiveValueTest extends AbstractTest {
     final MultiPolygon primitive = new MultiPolygon(Geospatial.Dimension.GEOMETRY, null, polygons);
 
     final ODataValue value =
-            getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryMultiPolygon).
+            getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPolygon).
             setValue(primitive).build();
-    assertEquals(ODataJClientEdmPrimitiveType.GeometryMultiPolygon.toString(), value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.GeometryMultiPolygon.getFullQualifiedName().toString(), 
+            value.asPrimitive().getTypeName());
 
     final Iterator<Polygon> iter = value.asPrimitive().<MultiPolygon>toCastValue().iterator();
 
@@ -507,9 +514,10 @@ public class PrimitiveValueTest extends AbstractTest {
     final GeospatialCollection primitive = new GeospatialCollection(Geospatial.Dimension.GEOMETRY, null, collection);
 
     final ODataValue value =
-            getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryCollection).
+            getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryCollection).
             setValue(primitive).build();
-    assertEquals(ODataJClientEdmPrimitiveType.GeometryCollection.toString(), value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.GeometryCollection.getFullQualifiedName().toString(), 
+            value.asPrimitive().getTypeName());
 
     final Iterator<Geospatial> iter = value.asPrimitive().<GeospatialCollection>toCastValue().iterator();
     iter.next();
@@ -539,9 +547,10 @@ public class PrimitiveValueTest extends AbstractTest {
     final GeospatialCollection primitive = new GeospatialCollection(Geospatial.Dimension.GEOGRAPHY, null, collection);
 
     final ODataValue value =
-            getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyCollection).
+            getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
             setValue(primitive).build();
-    assertEquals(ODataJClientEdmPrimitiveType.GeographyCollection.toString(), value.asPrimitive().getTypeName());
+    assertEquals(EdmPrimitiveTypeKind.GeographyCollection.getFullQualifiedName().toString(), 
+            value.asPrimitive().getTypeName());
 
     final Iterator<Geospatial> iter = value.asPrimitive().<GeospatialCollection>toCastValue().iterator();
     iter.next();

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
index 3d74f7b..fd2a696 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
@@ -27,6 +27,7 @@ import org.apache.olingo.client.core.edm.EdmEnumTypeImpl;
 import org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl;
 import org.apache.olingo.commons.api.edm.EdmEnumType;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 
 import static org.junit.Assert.assertEquals;
 
@@ -49,7 +50,7 @@ public class FilterFactoryTest extends AbstractTest {
 
   @Test
   public void has() {
-    final EdmEnumType pattern = new EdmEnumTypeImpl(
+    final EdmEnumType pattern = new EdmEnumTypeImpl(ODataServiceVersion.V40,
             null, new FullQualifiedName("Sales", "Pattern"), new EnumTypeImpl());
     final URIFilter filter = getFilterFactory().has(getFilterArgFactory().property("style"), pattern, "Yellow");
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
index afeba92..fb2ba5c 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
@@ -50,9 +50,10 @@ import org.apache.olingo.commons.api.edm.EdmEnumType;
 import org.apache.olingo.commons.api.edm.EdmFunction;
 import org.apache.olingo.commons.api.edm.EdmFunctionImport;
 import org.apache.olingo.commons.api.edm.EdmFunctionImportInfo;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 import org.junit.Test;
 
 public class MetadataTest extends AbstractTest {
@@ -82,7 +83,7 @@ public class MetadataTest extends AbstractTest {
     assertNotNull(responseStatus);
     assertTrue(responseStatus.getNavigationPropertyNames().isEmpty());
     assertEquals("Recipient", responseStatus.getBaseType().getName());
-    assertEquals(EdmPrimitiveTypeKind.DateTimeOffset.getEdmPrimitiveTypeInstance(),
+    assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset),
             responseStatus.getProperty("Time").getType());
 
     // 3. Entity
@@ -106,8 +107,8 @@ public class MetadataTest extends AbstractTest {
     assertNotNull(move);
     assertTrue(move.isBound());
     assertEquals(2, move.getParameterNames().size());
-    assertEquals(
-            EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance(), move.getParameter("DestinationId").getType());
+    assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String),
+            move.getParameter("DestinationId").getType());
 
     // 5. EntityContainer
     final EdmEntityContainer container = edm.getEntityContainer(

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
index c146fee..d72861d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
@@ -22,13 +22,13 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
 import org.apache.olingo.client.api.v4.ODataClient;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
 import org.apache.olingo.client.api.domain.ODataDuration;
 import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
 import org.apache.olingo.client.api.domain.ODataTimestamp;
 import org.apache.olingo.client.api.domain.ODataValue;
 import org.apache.olingo.client.core.AbstractTest;
 import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class PrimitiveValueTest extends AbstractTest {
@@ -44,15 +44,15 @@ public class PrimitiveValueTest extends AbstractTest {
     final String primitive = "-P9DT51M12.5063807S";
     try {
       new ODataPrimitiveValue.Builder(ODataClientFactory.getV3()).
-              setType(ODataJClientEdmPrimitiveType.TimeOfDay).setText(primitive).build();
+              setType(EdmPrimitiveTypeKind.TimeOfDay).setText(primitive).build();
       fail();
     } catch (IllegalArgumentException iae) {
       // ignore
     }
 
     final ODataValue value = getClient().getPrimitiveValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.TimeOfDay).setText(primitive).build();
-    assertEquals(ODataJClientEdmPrimitiveType.TimeOfDay.toString(), value.asPrimitive().getTypeName());
+            setType(EdmPrimitiveTypeKind.TimeOfDay).setText(primitive).build();
+    assertEquals(EdmPrimitiveTypeKind.TimeOfDay.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
     // performed cast to improve the check
     assertEquals(primitive, value.asPrimitive().<ODataDuration>toCastValue().toString());
   }
@@ -63,15 +63,15 @@ public class PrimitiveValueTest extends AbstractTest {
     final String primitive = "2013-01-10";
     try {
       new ODataPrimitiveValue.Builder(ODataClientFactory.getV3()).
-              setType(ODataJClientEdmPrimitiveType.Date).setText(primitive).build();
+              setType(EdmPrimitiveTypeKind.Date).setText(primitive).build();
       fail();
     } catch (IllegalArgumentException iae) {
       // ignore
     }
 
     final ODataValue value = getClient().getPrimitiveValueBuilder().
-            setType(ODataJClientEdmPrimitiveType.Date).setText(primitive).build();
-    assertEquals(ODataJClientEdmPrimitiveType.Date.toString(), value.asPrimitive().getTypeName());
+            setType(EdmPrimitiveTypeKind.Date).setText(primitive).build();
+    assertEquals(EdmPrimitiveTypeKind.Date.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
     // performed cast to improve the check
     assertEquals(primitive, value.asPrimitive().<ODataTimestamp>toCastValue().toString());
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-api/pom.xml
----------------------------------------------------------------------
diff --git a/lib/commons-api/pom.xml b/lib/commons-api/pom.xml
index 42c42b4..e398eaa 100644
--- a/lib/commons-api/pom.xml
+++ b/lib/commons-api/pom.xml
@@ -33,4 +33,12 @@
     <version>0.1.0-SNAPSHOT</version>
     <relativePath>..</relativePath>
   </parent>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+    </dependency>
+  </dependencies>
+    
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.java
new file mode 100644
index 0000000..898b6b2
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.edm;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+
+public interface EdmGeospatialType extends EdmType {
+
+  String EDM_NAMESPACE = EdmPrimitiveType.EDM_NAMESPACE;
+
+  /**
+   * Returns the Java type for this EDM geospatial type.
+   *
+   * @return the geospatial Java type
+   */
+  Class<? extends Geospatial> getJavaType();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java
new file mode 100644
index 0000000..069d9e5
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.edm;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public enum EdmPrimitiveTypeKind {
+
+  Binary,
+  Boolean,
+  Byte,
+  SByte,
+  Date(new ODataServiceVersion[] {ODataServiceVersion.V40}),
+  DateTime(new ODataServiceVersion[] {ODataServiceVersion.V30}),
+  DateTimeOffset,
+  Time(new ODataServiceVersion[] {ODataServiceVersion.V30}),
+  TimeOfDay(new ODataServiceVersion[] {ODataServiceVersion.V40}),
+  Duration(new ODataServiceVersion[] {ODataServiceVersion.V40}),
+  Decimal,
+  Single,
+  Double,
+  Guid,
+  Int16,
+  Int32,
+  Int64,
+  String,
+  Stream,
+  Geography,
+  GeographyPoint,
+  GeographyLineString,
+  GeographyPolygon,
+  GeographyMultiPoint,
+  GeographyMultiLineString,
+  GeographyMultiPolygon,
+  GeographyCollection,
+  Geometry,
+  GeometryPoint,
+  GeometryLineString,
+  GeometryPolygon,
+  GeometryMultiPoint,
+  GeometryMultiLineString,
+  GeometryMultiPolygon,
+  GeometryCollection;
+
+  private final List<ODataServiceVersion> versions;
+
+  EdmPrimitiveTypeKind() {
+    this.versions = Collections.unmodifiableList(
+            Arrays.asList(new ODataServiceVersion[] {ODataServiceVersion.V30, ODataServiceVersion.V40}));
+  }
+
+  EdmPrimitiveTypeKind(final ODataServiceVersion[] versions) {
+    this.versions = Collections.unmodifiableList(Arrays.asList(versions.clone()));
+  }
+
+  public List<ODataServiceVersion> getSupportedVersions() {
+    return this.versions;
+  }
+
+  /**
+   * Checks if is a geospatial type.
+   *
+   * @return <tt>true</tt> if is geospatial type; <tt>false</tt> otherwise.
+   */
+  public boolean isGeospatial() {
+    return name().startsWith("Geo");
+  }
+
+  /**
+   * Returns the {@link FullQualifiedName} for this type kind.
+   *
+   * @return {@link FullQualifiedName}
+   */
+  public FullQualifiedName getFullQualifiedName() {
+    return new FullQualifiedName(EdmPrimitiveType.EDM_NAMESPACE, toString());
+  }
+
+  public static EdmPrimitiveTypeKind valueOf(final ODataServiceVersion version, final String name) {
+    final EdmPrimitiveTypeKind kind = valueOf(name);
+    if (!kind.versions.contains(version)) {
+      throw new IllegalArgumentException(kind + " not allowed in " + version);
+    }
+    return kind;
+  }
+
+  /**
+   * Gets <tt>EdmPrimitiveTypeKind</tt> from a full-qualified type name, for the given OData protocol version.
+   *
+   * @param version OData protocol version.
+   * @param fqn full-qualified type name.
+   * @return <tt>EdmPrimitiveTypeKind</tt> object.
+   */
+  public static EdmPrimitiveTypeKind valueOfFQN(final ODataServiceVersion version, final FullQualifiedName fqn) {
+    return valueOfFQN(version, fqn.toString());
+  }
+
+  /**
+   * Gets <tt>EdmPrimitiveTypeKind</tt> from a full type expression (as <tt>Edm.Int32</tt>), for the given OData
+   * protocol version.
+   *
+   * @param version OData protocol version.
+   * @param fqn string value type.
+   * @return <tt>EdmPrimitiveTypeKind</tt> object.
+   */
+  public static EdmPrimitiveTypeKind valueOfFQN(final ODataServiceVersion version, final String fqn) {
+    if (version == null) {
+      throw new IllegalArgumentException("No OData protocol version provided");
+    }
+    if (!fqn.startsWith(EdmPrimitiveType.EDM_NAMESPACE + ".")) {
+      throw new IllegalArgumentException(fqn + " does not look like an Edm primitive type");
+    }
+
+    final EdmPrimitiveTypeKind kind = valueOf(fqn.substring(4));
+    if (!kind.versions.contains(version)) {
+      throw new IllegalArgumentException(kind + " not allowed in " + version);
+    }
+    return kind;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java
new file mode 100644
index 0000000..82a13fe
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.edm.geo;
+
+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 crs crs.
+   * @param geospatials geospatials info.
+   */
+  protected ComposedGeospatial(final Dimension dimension, final Type type, final String crs,
+          final List<T> geospatials) {
+
+    super(dimension, type, crs);
+    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/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java
new file mode 100644
index 0000000..62de5ec
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.edm.geo;
+
+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.commons.api.edm.EdmPrimitiveTypeKind;
+
+/**
+ * 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;
+
+  protected String crs;
+
+  /**
+   * 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, final String crs) {
+    this.dimension = dimension;
+    this.type = type;
+    this.crs = crs;
+  }
+
+  /**
+   * Gets dimension.
+   *
+   * @return dimension.
+   * @see Dimension
+   */
+  public Dimension getDimension() {
+    return dimension;
+  }
+
+  /**
+   * Gets type.
+   *
+   * @return type.
+   * @see Type
+   */
+  public Type getType() {
+    return type;
+  }
+
+  /**
+   * Gets CRS.
+   *
+   * @return CRS
+   */
+  public String getCrs() {
+    return crs;
+  }
+
+  /**
+   * 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 EdmPrimitiveTypeKind getEdmPrimitiveTypeKind();
+
+  /**
+   * {@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/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java
new file mode 100644
index 0000000..b3e3f9f
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/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.commons.api.edm.geo;
+
+import java.util.List;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+/**
+ * Wrapper for a collection of geospatials info.
+ */
+public class GeospatialCollection extends ComposedGeospatial<Geospatial> {
+
+  private static final long serialVersionUID = -9181547636133878977L;
+
+  /**
+   * Constructor.
+   *
+   * @param dimension dimension.
+   * @param crs crs.
+   * @param geospatials geospatials info.
+   */
+  public GeospatialCollection(final Dimension dimension, final String crs, final List<Geospatial> geospatials) {
+    super(dimension, Type.GEOSPATIALCOLLECTION, crs, geospatials);
+  }
+
+  @Override
+  public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
+    return dimension == Dimension.GEOGRAPHY
+           ? EdmPrimitiveTypeKind.GeographyCollection
+           : EdmPrimitiveTypeKind.GeometryCollection;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java
new file mode 100644
index 0000000..297a962
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.edm.geo;
+
+import java.util.List;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+public class LineString extends ComposedGeospatial<Point> {
+
+  private static final long serialVersionUID = 3207958185407535907L;
+
+  public LineString(final Dimension dimension, final String crs, final List<Point> points) {
+    super(dimension, Type.LINESTRING, crs, points);
+  }
+
+  @Override
+  public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
+    return dimension == Dimension.GEOGRAPHY
+           ? EdmPrimitiveTypeKind.GeographyLineString
+           : EdmPrimitiveTypeKind.GeometryLineString;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java
new file mode 100644
index 0000000..2f98d63
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/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.commons.api.edm.geo;
+
+import java.util.List;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+public class MultiLineString extends ComposedGeospatial<LineString> {
+
+  private static final long serialVersionUID = -5042414471218124125L;
+
+  public MultiLineString(final Dimension dimension, final String crs, final List<LineString> lineStrings) {
+    super(dimension, Type.MULTILINESTRING, crs, lineStrings);
+  }
+
+  @Override
+  public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
+    return dimension == Dimension.GEOGRAPHY
+           ? EdmPrimitiveTypeKind.GeographyMultiLineString
+           : EdmPrimitiveTypeKind.GeometryMultiLineString;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java
new file mode 100644
index 0000000..999f24b
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/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.commons.api.edm.geo;
+
+import java.util.List;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+public class MultiPoint extends ComposedGeospatial<Point> {
+
+  private static final long serialVersionUID = 4951011255142116129L;
+
+  public MultiPoint(final Dimension dimension, final String crs, final List<Point> points) {
+    super(dimension, Type.MULTIPOINT, crs, points);
+  }
+
+  @Override
+  public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
+    return dimension == Dimension.GEOGRAPHY
+           ? EdmPrimitiveTypeKind.GeographyMultiPoint
+           : EdmPrimitiveTypeKind.GeometryMultiPoint;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java
new file mode 100644
index 0000000..fd0fdae
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.edm.geo;
+
+import java.util.List;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+public class MultiPolygon extends ComposedGeospatial<Polygon> {
+
+  private static final long serialVersionUID = -160184788048512883L;
+
+  public MultiPolygon(final Dimension dimension, final String crs, final List<Polygon> polygons) {
+    super(dimension, Type.MULTIPOLYGON, crs, polygons);
+  }
+
+  @Override
+  public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
+    return dimension == Dimension.GEOGRAPHY
+           ? EdmPrimitiveTypeKind.GeographyMultiPolygon
+           : EdmPrimitiveTypeKind.GeometryMultiPolygon;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java
new file mode 100644
index 0000000..a9e0c39
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/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.commons.api.edm.geo;
+
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+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, final String crs) {
+    super(dimension, Type.POINT, crs);
+  }
+
+  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 EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
+    return dimension == Dimension.GEOGRAPHY
+           ? EdmPrimitiveTypeKind.GeographyPoint
+           : EdmPrimitiveTypeKind.GeometryPoint;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java
new file mode 100644
index 0000000..2501d4e
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/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.commons.api.edm.geo;
+
+import java.util.List;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+/**
+ * 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 crs crs.
+   * @param interior interior points.
+   * @param exterior exterior points.
+   */
+  public Polygon(final Dimension dimension, final String crs, final List<Point> interior, final List<Point> exterior) {
+    super(dimension, Type.POLYGON, crs);
+    this.interior = new MultiPoint(dimension, crs, interior);
+    this.exterior = new MultiPoint(dimension, crs, 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 EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
+    return dimension == Dimension.GEOGRAPHY
+           ? EdmPrimitiveTypeKind.GeographyPolygon
+           : EdmPrimitiveTypeKind.GeometryPolygon;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java
index b1d551b..09bd8ce 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java
@@ -23,9 +23,10 @@ import org.apache.olingo.commons.api.edm.EdmException;
 import org.apache.olingo.commons.api.edm.EdmMapping;
 import org.apache.olingo.commons.api.edm.EdmParameter;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.EdmType;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 
 public abstract class AbstractEdmParameter extends EdmElementImpl implements EdmParameter {
 
@@ -43,7 +44,7 @@ public abstract class AbstractEdmParameter extends EdmElementImpl implements Edm
     if (typeImpl == null) {
       if (EdmPrimitiveType.EDM_NAMESPACE.equals(paramType.getNamespace())) {
         try {
-          typeImpl = EdmPrimitiveTypeKind.valueOf(paramType.getName()).getEdmPrimitiveTypeInstance();
+          typeImpl = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.valueOf(paramType.getName()));
         } catch (IllegalArgumentException e) {
           throw new EdmException("Cannot find type with name: " + paramType, e);
         }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java
index 11e0365..c54239f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java
@@ -21,10 +21,11 @@ package org.apache.olingo.commons.core.edm;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmException;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.EdmProperty;
 import org.apache.olingo.commons.api.edm.EdmType;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 
 public abstract class AbstractEdmProperty extends EdmElementImpl implements EdmProperty {
 
@@ -47,7 +48,7 @@ public abstract class AbstractEdmProperty extends EdmElementImpl implements EdmP
       final FullQualifiedName typeName = getTypeFQN();
       if (isPrimitive()) {
         try {
-          propertyType = EdmPrimitiveTypeKind.valueOf(typeName.getName()).getEdmPrimitiveTypeInstance();
+          propertyType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.valueOf(typeName.getName()));
         } catch (IllegalArgumentException e) {
           throw new EdmException("Cannot find type with name: " + typeName, e);
         }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java
index a6a6a84..532f666 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java
@@ -21,10 +21,11 @@ package org.apache.olingo.commons.core.edm;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmException;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.EdmReturnType;
 import org.apache.olingo.commons.api.edm.EdmType;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 
 public abstract class AbstractEdmReturnType implements EdmReturnType {
 
@@ -44,7 +45,7 @@ public abstract class AbstractEdmReturnType implements EdmReturnType {
     if (typeImpl == null) {
       if (EdmPrimitiveType.EDM_NAMESPACE.equals(typeName.getNamespace())) {
         try {
-          typeImpl = EdmPrimitiveTypeKind.valueOf(typeName.getName()).getEdmPrimitiveTypeInstance();
+          typeImpl = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.valueOf(typeName.getName()));
         } catch (IllegalArgumentException e) {
           throw new EdmException("Cannot find type with name: " + typeName, e);
         }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.java
new file mode 100644
index 0000000..8e5cb6f
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.EdmGeospatialType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+
+public abstract class AbstractEdmGeospatialType<T extends Geospatial> implements EdmGeospatialType {
+
+  private final Class<T> reference;
+
+  protected final Dimension dimension;
+
+  protected final Type type;
+
+  protected AbstractEdmGeospatialType(final Class<T> reference, final Dimension dimension, final Type type) {
+    this.reference = reference;
+    this.dimension = dimension;
+    this.type = type;
+  }
+
+  @Override
+  public Class<? extends Geospatial> getJavaType() {
+    return reference;
+  }
+
+  @Override
+  public String getNamespace() {
+    return EDM_NAMESPACE;
+  }
+
+  @Override
+  public String getName() {
+    return getClass().getSimpleName().substring(3);
+  }
+
+  @Override
+  public EdmTypeKind getKind() {
+    return EdmTypeKind.PRIMITIVE;
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    return this == obj || obj != null && getClass() == obj.getClass();
+  }
+
+  @Override
+  public int hashCode() {
+    return getClass().hashCode();
+  }
+
+  @Override
+  public String toString() {
+    return new FullQualifiedName(getNamespace(), getName()).getFullQualifiedNameAsString();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDate.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDate.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDate.java
index 5f141c0..9aa660e 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDate.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDate.java
@@ -64,10 +64,11 @@ public final class EdmDate extends SingletonPrimitiveType {
     try {
       return EdmDateTimeOffset.convertDateTime(dateTimeValue, returnType);
     } catch (final IllegalArgumentException e) {
-      throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value), e");
+      throw new EdmPrimitiveTypeException(
+              "EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
     } catch (final ClassCastException e) {
       throw new EdmPrimitiveTypeException(
-              "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType), e");
+              "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)", e);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java
new file mode 100644
index 0000000..e061388
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java
@@ -0,0 +1,124 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+
+/**
+ * Implementation of the EDM primitive type DateTime.
+ */
+public final class EdmDateTime extends SingletonPrimitiveType {
+
+  public static final ThreadLocal<SimpleDateFormat> DATE_FORMAT = new ThreadLocal<SimpleDateFormat>() {
+    @Override
+    protected SimpleDateFormat initialValue() {
+      return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+    }
+  };
+
+  private static final EdmDateTime INSTANCE = new EdmDateTime();
+
+  public static EdmDateTime getInstance() {
+    return INSTANCE;
+  }
+
+  @Override
+  public Class<?> getDefaultType() {
+    return Calendar.class;
+  }
+
+  @Override
+  protected <T> T internalValueOfString(final String value,
+          final Boolean isNullable, final Integer maxLength, final Integer precision,
+          final Integer scale, final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+    Calendar calendar = null;
+    Timestamp timestamp = null;
+
+    final String[] dateParts = value.split("\\.");
+    try {
+      final Date date = DATE_FORMAT.get().parse(dateParts[0]);
+      if (dateParts.length > 1) {
+        int idx = dateParts[1].indexOf('+');
+        if (idx == -1) {
+          idx = dateParts[1].indexOf('-');
+        }
+        if (idx == -1) {
+          calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+          calendar.setTime(date);
+
+          timestamp = new Timestamp(calendar.getTimeInMillis());
+          timestamp.setNanos(Integer.parseInt(dateParts[1]));
+        } else {
+          calendar = Calendar.getInstance(TimeZone.getTimeZone(dateParts[1].substring(idx)));
+          calendar.setTime(date);
+
+          timestamp = new Timestamp(calendar.getTimeInMillis());
+          timestamp.setNanos(Integer.parseInt(dateParts[1].substring(0, idx)));
+        }
+      } else {
+        timestamp = new Timestamp(date.getTime());
+      }
+    } catch (Exception e) {
+      throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
+    }
+
+    if (returnType.isAssignableFrom(Calendar.class)) {
+      return returnType.cast(calendar);
+    } else if (returnType.isAssignableFrom(Timestamp.class)) {
+      return returnType.cast(timestamp);
+    } else {
+      throw new EdmPrimitiveTypeException(
+              "EdmPrimitiveTypeException.LITERAL_UNCONVERTIBLE_TO_VALUE_TYPE.addContent(value, returnType)");
+    }
+  }
+
+  @Override
+  protected <T> String internalValueToString(final T value,
+          final Boolean isNullable, final Integer maxLength, final Integer precision,
+          final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+    if (value instanceof Calendar) {
+      final Calendar calendar = (Calendar) value;
+
+      final StringBuilder formatted = new StringBuilder().append(DATE_FORMAT.get().format(calendar.getTime()));
+      formatted.append(calendar.getTimeZone());
+
+      return formatted.toString();
+    } else if (value instanceof Timestamp) {
+      final Timestamp timestamp = (Timestamp) value;
+
+      final StringBuilder formatted = new StringBuilder().append(DATE_FORMAT.get().format(timestamp));
+      if (timestamp.getNanos() > 0) {
+        formatted.append('.').append(String.valueOf(timestamp.getNanos()));
+      }
+
+      return formatted.toString();
+    } else {
+      throw new EdmPrimitiveTypeException(
+              "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+    }
+  }
+}

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

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java
new file mode 100644
index 0000000..aab7210
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyCollection extends AbstractEdmGeospatialType<Point> {
+
+  private static final EdmGeographyCollection INSTANCE = new EdmGeographyCollection();
+
+  public static EdmGeographyCollection getInstance() {
+    return INSTANCE;
+  }
+
+  public EdmGeographyCollection() {
+    super(Point.class, Dimension.GEOGRAPHY, Type.GEOSPATIALCOLLECTION);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java
new file mode 100644
index 0000000..23c92cc
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyLineString extends AbstractEdmGeospatialType<Point> {
+
+  private static final EdmGeographyLineString INSTANCE = new EdmGeographyLineString();
+
+  public static EdmGeographyLineString getInstance() {
+    return INSTANCE;
+  }
+
+  public EdmGeographyLineString() {
+    super(Point.class, Dimension.GEOGRAPHY, Type.LINESTRING);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java
new file mode 100644
index 0000000..9b5901d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyMultiLineString extends AbstractEdmGeospatialType<Point> {
+
+  private static final EdmGeographyMultiLineString INSTANCE = new EdmGeographyMultiLineString();
+
+  public static EdmGeographyMultiLineString getInstance() {
+    return INSTANCE;
+  }
+
+  public EdmGeographyMultiLineString() {
+    super(Point.class, Dimension.GEOGRAPHY, Type.MULTILINESTRING);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
new file mode 100644
index 0000000..db66041
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyMultiPoint extends AbstractEdmGeospatialType<Point> {
+
+  private static final EdmGeographyMultiPoint INSTANCE = new EdmGeographyMultiPoint();
+
+  public static EdmGeographyMultiPoint getInstance() {
+    return INSTANCE;
+  }
+
+  public EdmGeographyMultiPoint() {
+    super(Point.class, Dimension.GEOGRAPHY, Type.MULTIPOINT);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java
new file mode 100644
index 0000000..4b53a30
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyMultiPolygon extends AbstractEdmGeospatialType<Point> {
+
+  private static final EdmGeographyMultiPolygon INSTANCE = new EdmGeographyMultiPolygon();
+
+  public static EdmGeographyMultiPolygon getInstance() {
+    return INSTANCE;
+  }
+
+  public EdmGeographyMultiPolygon() {
+    super(Point.class, Dimension.GEOGRAPHY, Type.MULTIPOLYGON);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java
new file mode 100644
index 0000000..61abce3
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyPoint extends AbstractEdmGeospatialType<Point> {
+
+  private static final EdmGeographyPoint INSTANCE = new EdmGeographyPoint();
+
+  public static EdmGeographyPoint getInstance() {
+    return INSTANCE;
+  }
+
+  public EdmGeographyPoint() {
+    super(Point.class, Dimension.GEOGRAPHY, Type.POINT);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java
new file mode 100644
index 0000000..a7a1a6c
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyPolygon extends AbstractEdmGeospatialType<Point> {
+
+  private static final EdmGeographyPolygon INSTANCE = new EdmGeographyPolygon();
+
+  public static EdmGeographyPolygon getInstance() {
+    return INSTANCE;
+  }
+
+  public EdmGeographyPolygon() {
+    super(Point.class, Dimension.GEOGRAPHY, Type.POLYGON);
+  }
+
+}


[06/11] git commit: [OLINGO-65] Geospatial types implemented, EdmStream mock implemented with URI as backend, V3 pruned types implemented, EdmSimpleTypeKind adapted, EdmSimpleTypeFactory introduces

Posted by il...@apache.org.
[OLINGO-65] Geospatial types implemented, EdmStream mock implemented with URI as backend, V3 pruned types implemented, EdmSimpleTypeKind adapted, EdmSimpleTypeFactory introduces


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

Branch: refs/heads/olingo200
Commit: 559698d4dbb14dd8085f0b829fa980f01abdf139
Parents: bab0362
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Mar 21 11:51:11 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Mar 21 11:51:11 2014 +0100

----------------------------------------------------------------------
 lib/client-api/pom.xml                          |   4 -
 .../apache/olingo/client/api/data/GeoUtils.java |  90 ++++++
 .../olingo/client/api/data/GeospatialValue.java |   2 +-
 .../client/api/domain/ODataGeospatialValue.java |   9 +-
 .../domain/ODataJClientEdmPrimitiveType.java    |  45 +--
 .../client/api/domain/ODataPrimitiveValue.java  | 108 +++++--
 .../client/api/domain/ODataTimestamp.java       |  23 +-
 .../domain/geospatial/ComposedGeospatial.java   |  78 -----
 .../api/domain/geospatial/Geospatial.java       | 169 -----------
 .../domain/geospatial/GeospatialCollection.java |  49 ---
 .../api/domain/geospatial/LineString.java       |  39 ---
 .../api/domain/geospatial/MultiLineString.java  |  39 ---
 .../api/domain/geospatial/MultiPoint.java       |  39 ---
 .../api/domain/geospatial/MultiPolygon.java     |  39 ---
 .../client/api/domain/geospatial/Point.java     |  77 -----
 .../client/api/domain/geospatial/Polygon.java   |  74 -----
 .../olingo/client/api/utils/GeoUtils.java       |  90 ------
 .../cud/ODataValueUpdateRequestImpl.java        |   4 +-
 .../request/retrieve/ODataValueRequestImpl.java |   4 +-
 .../core/data/AbstractJsonDeserializer.java     |  43 +--
 .../core/data/AbstractJsonSerializer.java       |  22 +-
 .../core/data/AtomGeoValueDeserializer.java     |  35 +--
 .../core/data/AtomGeoValueSerializer.java       |  18 +-
 .../core/data/AtomPropertyDeserializer.java     |   4 +-
 .../olingo/client/core/data/GeoUtils.java       |  90 ------
 .../client/core/data/GeospatialValueImpl.java   |   2 +-
 .../core/data/JSONGeoValueDeserializer.java     |  74 +++--
 .../core/data/JSONGeoValueSerializer.java       |  32 +-
 .../olingo/client/core/edm/EdmClientImpl.java   |  12 +-
 .../olingo/client/core/edm/EdmEnumTypeImpl.java |  14 +-
 .../olingo/client/core/edm/EdmSchemaImpl.java   |  15 +-
 .../client/core/edm/EdmTypeDefinitionImpl.java  |  12 +-
 .../olingo/client/core/edm/EdmTypeInfo.java     |  26 +-
 .../core/op/impl/AbstractODataBinder.java       |  10 +-
 .../core/op/impl/AbstractODataReader.java       |   4 +-
 .../client/core/op/impl/v3/ODataReaderImpl.java |   2 +-
 .../client/core/op/impl/v4/ODataReaderImpl.java |   2 +-
 .../client/core/AbstractPrimitiveTest.java      |  60 ++--
 .../client/core/AbstractPropertyTest.java       |   7 +-
 .../client/core/it/AbstractTestITCase.java      |  14 +-
 .../core/it/v3/EntityCreateTestITCase.java      |  22 +-
 .../core/it/v3/EntityUpdateTestITCase.java      |   4 +-
 .../it/v3/NavigationLinkCreateTestITCase.java   |  22 +-
 .../client/core/it/v3/OpenTypeTestITCase.java   | 106 +++----
 .../olingo/client/core/v3/EntityTest.java       |  10 +-
 .../olingo/client/core/v3/MetadataTest.java     |  13 +-
 .../client/core/v3/PrimitiveValueTest.java      | 107 ++++---
 .../client/core/v4/FilterFactoryTest.java       |   3 +-
 .../olingo/client/core/v4/MetadataTest.java     |   9 +-
 .../client/core/v4/PrimitiveValueTest.java      |  14 +-
 lib/commons-api/pom.xml                         |   8 +
 .../commons/api/edm/EdmGeospatialType.java      |  34 +++
 .../commons/api/edm/EdmPrimitiveTypeKind.java   | 139 +++++++++
 .../commons/api/edm/geo/ComposedGeospatial.java |  78 +++++
 .../olingo/commons/api/edm/geo/Geospatial.java  | 169 +++++++++++
 .../api/edm/geo/GeospatialCollection.java       |  48 +++
 .../olingo/commons/api/edm/geo/LineString.java  |  38 +++
 .../commons/api/edm/geo/MultiLineString.java    |  39 +++
 .../olingo/commons/api/edm/geo/MultiPoint.java  |  39 +++
 .../commons/api/edm/geo/MultiPolygon.java       |  38 +++
 .../olingo/commons/api/edm/geo/Point.java       |  77 +++++
 .../olingo/commons/api/edm/geo/Polygon.java     |  73 +++++
 .../commons/core/edm/AbstractEdmParameter.java  |   5 +-
 .../commons/core/edm/AbstractEdmProperty.java   |   5 +-
 .../commons/core/edm/AbstractEdmReturnType.java |   5 +-
 .../AbstractEdmGeospatialType.java              |  76 +++++
 .../commons/core/edm/primitivetype/EdmDate.java |   5 +-
 .../core/edm/primitivetype/EdmDateTime.java     | 124 ++++++++
 .../core/edm/primitivetype/EdmGeography.java    |  36 +++
 .../primitivetype/EdmGeographyCollection.java   |  37 +++
 .../primitivetype/EdmGeographyLineString.java   |  37 +++
 .../EdmGeographyMultiLineString.java            |  37 +++
 .../primitivetype/EdmGeographyMultiPoint.java   |  37 +++
 .../primitivetype/EdmGeographyMultiPolygon.java |  37 +++
 .../edm/primitivetype/EdmGeographyPoint.java    |  37 +++
 .../edm/primitivetype/EdmGeographyPolygon.java  |  37 +++
 .../core/edm/primitivetype/EdmGeometry.java     |  36 +++
 .../primitivetype/EdmGeometryCollection.java    |  37 +++
 .../primitivetype/EdmGeometryLineString.java    |  37 +++
 .../EdmGeometryMultiLineString.java             |  37 +++
 .../primitivetype/EdmGeometryMultiPoint.java    |  37 +++
 .../primitivetype/EdmGeometryMultiPolygon.java  |  37 +++
 .../edm/primitivetype/EdmGeometryPoint.java     |  37 +++
 .../edm/primitivetype/EdmGeometryPolygon.java   |  37 +++
 .../commons/core/edm/primitivetype/EdmNull.java |  75 -----
 .../primitivetype/EdmPrimitiveTypeFactory.java  | 138 +++++++++
 .../edm/primitivetype/EdmPrimitiveTypeKind.java |  95 ------
 .../core/edm/primitivetype/EdmStream.java       |  88 ++++++
 .../commons/core/edm/primitivetype/EdmTime.java |  77 +++++
 .../primitivetype/CommonPrimitiveTypeTest.java  | 191 ++++++------
 .../core/edm/primitivetype/EdmBinaryTest.java   |  30 +-
 .../core/edm/primitivetype/EdmBooleanTest.java  |   4 +-
 .../core/edm/primitivetype/EdmByteTest.java     |   5 +-
 .../core/edm/primitivetype/EdmDateTest.java     |   4 +-
 .../primitivetype/EdmDateTimeOffsetTest.java    |   4 +-
 .../core/edm/primitivetype/EdmDecimalTest.java  |  19 +-
 .../core/edm/primitivetype/EdmDoubleTest.java   |  17 +-
 .../core/edm/primitivetype/EdmDurationTest.java |   4 +-
 .../core/edm/primitivetype/EdmGuidTest.java     |   4 +-
 .../core/edm/primitivetype/EdmInt16Test.java    |   9 +-
 .../core/edm/primitivetype/EdmInt32Test.java    |  11 +-
 .../core/edm/primitivetype/EdmInt64Test.java    |  13 +-
 .../core/edm/primitivetype/EdmNullTest.java     |  24 +-
 .../core/edm/primitivetype/EdmSByteTest.java    |   5 +-
 .../core/edm/primitivetype/EdmSingleTest.java   |  15 +-
 .../core/edm/primitivetype/EdmStringTest.java   |   4 +-
 .../edm/primitivetype/EdmTimeOfDayTest.java     |   4 +-
 .../core/edm/primitivetype/UInt7Test.java       |   6 +-
 .../core/edm/provider/EdmEnumTypeImpl.java      |   9 +-
 .../edm/provider/EdmTypeDefinitionImpl.java     |   9 +-
 .../core/uri/UriResourceLambdaAllImpl.java      |  16 +-
 .../core/uri/UriResourceLambdaAnyImpl.java      |  15 +-
 .../olingo/server/core/uri/parser/Parser.java   |   1 -
 .../server/core/uri/parser/UriContext.java      |   4 -
 .../core/uri/parser/UriParseTreeVisitor.java    | 302 +++++++++----------
 .../core/uri/queryoption/ExpandItemImpl.java    |   1 -
 .../edm/provider/EdmComplexTypeImplTest.java    |  13 +-
 .../edm/provider/EdmEntityTypeImplTest.java     |  14 +-
 .../server/core/edm/provider/EdmEnumTest.java   |   9 +-
 .../edm/provider/EdmFunctionImportImplTest.java |  31 +-
 .../core/edm/provider/EdmParameterImplTest.java |   6 +-
 .../core/edm/provider/EdmPropertyImplTest.java  |   4 +-
 .../edm/provider/EdmReturnTypeImplTest.java     |   9 +-
 .../edm/provider/EdmTypeDefinitionImplTest.java |  23 +-
 .../server/core/testutil/EdmTechProvider.java   |   2 +-
 .../server/core/uri/UriResourceImplTest.java    |  43 +--
 .../core/uri/testutil/ExpandValidator.java      |   1 -
 .../core/uri/testutil/ResourceValidator.java    |   1 -
 128 files changed, 2916 insertions(+), 1823 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-api/pom.xml
----------------------------------------------------------------------
diff --git a/lib/client-api/pom.xml b/lib/client-api/pom.xml
index e506a97..eb3f9e3 100644
--- a/lib/client-api/pom.xml
+++ b/lib/client-api/pom.xml
@@ -46,10 +46,6 @@
       <artifactId>commons-io</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-lang3</artifactId>
-    </dependency>
-    <dependency>
       <groupId>org.apache.httpcomponents</groupId>
       <artifactId>httpclient</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeoUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeoUtils.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeoUtils.java
new file mode 100644
index 0000000..083b4e0
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeoUtils.java
@@ -0,0 +1,90 @@
+/*
+ * 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.data;
+
+import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+
+public final class GeoUtils {
+
+  private GeoUtils() {
+    // Empty private constructor for static utility classes       
+  }
+
+  public static Geospatial.Dimension getDimension(final EdmPrimitiveTypeKind type) {
+    Geospatial.Dimension dimension;
+
+    switch (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;
+  }
+
+  public static EdmPrimitiveTypeKind getType(final Geospatial.Dimension dimension, final String elementName) {
+    EdmPrimitiveTypeKind type = null;
+
+    if (Constants.ELEM_POINT.equals(elementName)) {
+      type = dimension == Geospatial.Dimension.GEOGRAPHY
+              ? EdmPrimitiveTypeKind.GeographyPoint
+              : EdmPrimitiveTypeKind.GeometryPoint;
+    } else if (Constants.ELEM_MULTIPOINT.equals(elementName)) {
+      type = dimension == Geospatial.Dimension.GEOGRAPHY
+              ? EdmPrimitiveTypeKind.GeographyMultiPoint
+              : EdmPrimitiveTypeKind.GeometryMultiPoint;
+    } else if (Constants.ELEM_LINESTRING.equals(elementName)) {
+      type = dimension == Geospatial.Dimension.GEOGRAPHY
+              ? EdmPrimitiveTypeKind.GeographyLineString
+              : EdmPrimitiveTypeKind.GeometryLineString;
+    } else if (Constants.ELEM_MULTILINESTRING.equals(elementName)) {
+      type = dimension == Geospatial.Dimension.GEOGRAPHY
+              ? EdmPrimitiveTypeKind.GeographyMultiLineString
+              : EdmPrimitiveTypeKind.GeometryMultiLineString;
+    } else if (Constants.ELEM_POLYGON.equals(elementName)) {
+      type = dimension == Geospatial.Dimension.GEOGRAPHY
+              ? EdmPrimitiveTypeKind.GeographyPolygon
+              : EdmPrimitiveTypeKind.GeometryPolygon;
+    } else if (Constants.ELEM_MULTIPOLYGON.equals(elementName)) {
+      type = dimension == Geospatial.Dimension.GEOGRAPHY
+              ? EdmPrimitiveTypeKind.GeographyMultiPolygon
+              : EdmPrimitiveTypeKind.GeometryMultiPolygon;
+    } else if (Constants.ELEM_GEOCOLLECTION.equals(elementName)
+            || Constants.ELEM_GEOMEMBERS.equals(elementName)) {
+
+      type = dimension == Geospatial.Dimension.GEOGRAPHY
+              ? EdmPrimitiveTypeKind.GeographyCollection
+              : EdmPrimitiveTypeKind.GeometryCollection;
+    }
+
+    return type;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java
index b0deea4..c5d4d2a 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java
@@ -18,7 +18,7 @@
  */
 package org.apache.olingo.client.api.data;
 
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
 
 public interface GeospatialValue extends Value {
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/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
index 93c4cfb..bd96587 100644
--- 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
@@ -19,7 +19,8 @@
 package org.apache.olingo.client.api.domain;
 
 import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
 
 public class ODataGeospatialValue extends ODataPrimitiveValue {
 
@@ -57,7 +58,7 @@ public class ODataGeospatialValue extends ODataPrimitiveValue {
      * @param type type.
      * @return the current builder.
      */
-    public Builder setType(final ODataJClientEdmPrimitiveType type) {
+    public Builder setType(final EdmPrimitiveTypeKind type) {
       isSupported(type);
 
       if (type != null && !type.isGeospatial()) {
@@ -65,7 +66,7 @@ public class ODataGeospatialValue extends ODataPrimitiveValue {
                 "Use " + ODataPrimitiveValue.class.getSimpleName() + " for non-geospatial types");
       }
 
-      if (type == ODataJClientEdmPrimitiveType.Geography || type == ODataJClientEdmPrimitiveType.Geometry) {
+      if (type == EdmPrimitiveTypeKind.Geography || type == EdmPrimitiveTypeKind.Geometry) {
         throw new IllegalArgumentException(
                 type + " is not an instantiable type. "
                 + "An entity can declare a property to be of type Geometry. "
@@ -86,7 +87,7 @@ public class ODataGeospatialValue extends ODataPrimitiveValue {
         throw new IllegalArgumentException("No Geospatial value provided");
       }
       if (this.ogv.type == null) {
-        this.ogv.type = ((Geospatial) this.ogv.value).getEdmSimpleType();
+        this.ogv.type = ((Geospatial) this.ogv.value).getEdmPrimitiveTypeKind();
       }
 
       return this.ogv;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java
index 4b1decc..5ea5edf 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java
@@ -22,15 +22,15 @@ import java.math.BigDecimal;
 import java.net.URI;
 import java.util.UUID;
 
-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.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
 
 /**
  * Represent the primitive types of the Entity Data Model (EDM).
@@ -72,11 +72,11 @@ public enum ODataJClientEdmPrimitiveType {
   /**
    * A 64-bit value expressed as Coordinated Universal Time (UTC).
    */
-  DateTime(new ODataServiceVersion[]{ODataServiceVersion.V30}, ODataTimestamp.class, "yyyy-MM-dd'T'HH:mm:ss"),
+  DateTime(new ODataServiceVersion[] {ODataServiceVersion.V30}, ODataTimestamp.class, "yyyy-MM-dd'T'HH:mm:ss"),
   /**
    * Date without a time-zone offset.
    */
-  Date(new ODataServiceVersion[]{ODataServiceVersion.V40}, ODataTimestamp.class, "yyyy-MM-dd"),
+  Date(new ODataServiceVersion[] {ODataServiceVersion.V40}, ODataTimestamp.class, "yyyy-MM-dd"),
   /**
    * Date and time as an Offset in minutes from GMT.
    */
@@ -84,15 +84,15 @@ public enum ODataJClientEdmPrimitiveType {
   /**
    * The time of day with values ranging from 0:00:00.x to 23:59:59.y, where x and y depend upon the precision.
    */
-  Time(new ODataServiceVersion[]{ODataServiceVersion.V30}, ODataDuration.class),
+  Time(new ODataServiceVersion[] {ODataServiceVersion.V30}, ODataDuration.class),
   /**
    * The time of day with values ranging from 0:00:00.x to 23:59:59.y, where x and y depend upon the precision.
    */
-  TimeOfDay(new ODataServiceVersion[]{ODataServiceVersion.V40}, ODataDuration.class),
+  TimeOfDay(new ODataServiceVersion[] {ODataServiceVersion.V40}, ODataDuration.class),
   /**
    * Signed duration in days, hours, minutes, and (sub)seconds.
    */
-  Duration(new ODataServiceVersion[]{ODataServiceVersion.V40}, ODataDuration.class),
+  Duration(new ODataServiceVersion[] {ODataServiceVersion.V40}, ODataDuration.class),
   /**
    * Numeric values with fixed precision and scale.
    */
@@ -257,25 +257,6 @@ public enum ODataJClientEdmPrimitiveType {
   }
 
   /**
-   * Gets <tt>EdmSimpleType</tt> from object instance.
-   *
-   * @param workingVersion OData version.
-   * @param obj object.
-   * @return <tt>EdmSimpleType</tt> object.
-   */
-  public static ODataJClientEdmPrimitiveType fromObject(final ODataServiceVersion workingVersion, final Object obj) {
-    for (ODataJClientEdmPrimitiveType edmSimpleType : ODataJClientEdmPrimitiveType.values()) {
-      if (edmSimpleType.javaType().equals(obj.getClass())) {
-        return edmSimpleType == DateTimeOffset || edmSimpleType == DateTime || edmSimpleType == Date
-                ? ((ODataTimestamp) obj).isOffset()
-                ? DateTimeOffset : workingVersion == ODataServiceVersion.V30 ? DateTime : Date
-                : edmSimpleType;
-      }
-    }
-    throw new IllegalArgumentException(obj.getClass().getSimpleName() + " is not a simple type");
-  }
-
-  /**
    * Gets namespace.
    *
    * @return namespace.

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/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
index df69d1f..21d8562 100644
--- 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
@@ -28,9 +28,8 @@ 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.CommonODataClient;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 
 /**
  * OData primitive property value.
@@ -50,8 +49,8 @@ public class ODataPrimitiveValue extends ODataValue {
       this.client = client;
     }
 
-    public AbstractBuilder isSupported(final ODataJClientEdmPrimitiveType type) {
-      if (type != null && !ArrayUtils.contains(type.getSupportedVersions(), client.getServiceVersion())) {
+    public AbstractBuilder isSupported(final EdmPrimitiveTypeKind type) {
+      if (type != null && !type.getSupportedVersions().contains(client.getServiceVersion())) {
         throw new IllegalArgumentException(String.format(
                 "Type %s not supported by the current OData working version", type.toString()));
       }
@@ -103,12 +102,12 @@ public class ODataPrimitiveValue extends ODataValue {
      * @param type type.
      * @return the current builder.
      */
-    public Builder setType(final ODataJClientEdmPrimitiveType type) {
+    public Builder setType(final EdmPrimitiveTypeKind type) {
       isSupported(type);
 
-      if (type == ODataJClientEdmPrimitiveType.Stream) {
+      if (type == EdmPrimitiveTypeKind.Stream) {
         throw new IllegalArgumentException(String.format(
-                "Cannot build a primitive value for %s", ODataJClientEdmPrimitiveType.Stream.toString()));
+                "Cannot build a primitive value for %s", EdmPrimitiveTypeKind.Stream.toString()));
       }
 
       this.opv.type = type;
@@ -129,7 +128,7 @@ public class ODataPrimitiveValue extends ODataValue {
       }
 
       if (this.opv.type == null) {
-        this.opv.type = ODataJClientEdmPrimitiveType.String;
+        this.opv.type = EdmPrimitiveTypeKind.String;
       }
 
       if (this.opv.type.isGeospatial()) {
@@ -147,7 +146,7 @@ public class ODataPrimitiveValue extends ODataValue {
         this.opv.value = new ODataDuration((Duration) this.opv.value);
       }
 
-      if (this.opv.value != null && !this.opv.type.javaType().isAssignableFrom(this.opv.value.getClass())) {
+      if (this.opv.value != null && !this.opv.getJavaType().isAssignableFrom(this.opv.value.getClass())) {
         throw new IllegalArgumentException("Provided value is not compatible with " + this.opv.type.toString());
       }
 
@@ -177,7 +176,7 @@ public class ODataPrimitiveValue extends ODataValue {
   /**
    * Value type.
    */
-  protected ODataJClientEdmPrimitiveType type;
+  protected EdmPrimitiveTypeKind type;
 
   /**
    * Protected constructor, need to use the builder to instantiate this class.
@@ -189,15 +188,82 @@ public class ODataPrimitiveValue extends ODataValue {
     this.client = client;
   }
 
+  private Class<?> getJavaType() {
+    Class<?> javaType = null;
+
+    switch (this.type) {
+      case Binary:
+        javaType = byte[].class;
+        break;
+
+      case SByte:
+        javaType = Byte.class;
+        break;
+
+      case Boolean:
+        javaType = Boolean.class;
+        break;
+
+      case Date:
+      case DateTime:
+      case DateTimeOffset:
+        javaType = ODataTimestamp.class;
+        break;
+
+      case Time:
+      case TimeOfDay:
+        javaType = ODataDuration.class;
+        break;
+
+      case Decimal:
+        javaType = BigDecimal.class;
+        break;
+
+      case Single:
+        javaType = Float.class;
+        break;
+
+      case Double:
+        javaType = Double.class;
+        break;
+
+      case Guid:
+        javaType = UUID.class;
+        break;
+
+      case Int16:
+        javaType = Short.class;
+        break;
+
+      case Byte:
+      case Int32:
+        javaType = Integer.class;
+        break;
+
+      case Int64:
+        javaType = Long.class;
+        break;
+
+      case Stream:
+        javaType = URI.class;
+        break;
+
+      case String:
+        javaType = String.class;
+        break;
+
+      default:
+        javaType = this.value.getClass();
+    }
+
+    return javaType;
+  }
+
   /**
    * 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;
@@ -267,10 +333,6 @@ public class ODataPrimitiveValue extends ODataValue {
    */
   private void formatValue() {
     switch (this.type) {
-      case Null:
-        this.text = StringUtils.EMPTY;
-        break;
-
       case Binary:
         this.text = Base64.encodeBase64String(this.<byte[]>toCastValue());
         break;
@@ -295,15 +357,15 @@ public class ODataPrimitiveValue extends ODataValue {
         break;
 
       case Decimal:
-        this.text = new DecimalFormat(this.type.pattern()).format(this.<BigDecimal>toCastValue());
+        this.text = new DecimalFormat("#.#######################").format(this.<BigDecimal>toCastValue());
         break;
 
       case Single:
-        this.text = new DecimalFormat(this.type.pattern()).format(this.<Float>toCastValue());
+        this.text = new DecimalFormat("#.#######E0").format(this.<Float>toCastValue());
         break;
 
       case Double:
-        this.text = new DecimalFormat(this.type.pattern()).format(this.<Double>toCastValue());
+        this.text = new DecimalFormat("#.#######################E0").format(this.<Double>toCastValue());
         break;
 
       case Guid:
@@ -341,7 +403,7 @@ public class ODataPrimitiveValue extends ODataValue {
    * @return type name.
    */
   public String getTypeName() {
-    return type.toString();
+    return type.getFullQualifiedName().toString();
   }
 
   /**
@@ -369,6 +431,6 @@ public class ODataPrimitiveValue extends ODataValue {
    */
   @SuppressWarnings("unchecked")
   public <T> T toCastValue() {
-    return (T) type.javaType().cast(toValue());
+    return (T) getJavaType().cast(toValue());
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/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
index a1f3e3d..3f3eb9c 100644
--- 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
@@ -25,6 +25,7 @@ import java.util.Date;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 
 /**
  * Helper class for handling datetime and datetime-offset primitive values.
@@ -41,17 +42,25 @@ public final class ODataTimestamp implements Serializable {
 
   private final boolean offset;
 
-  public static ODataTimestamp getInstance(final ODataJClientEdmPrimitiveType type, final Timestamp timestamp) {
-    return new ODataTimestamp(new SimpleDateFormat(type.pattern()),
-            new Date(timestamp.getTime()), timestamp.getNanos(), type == ODataJClientEdmPrimitiveType.DateTimeOffset);
+  private static String getPattern(final EdmPrimitiveTypeKind type) {
+    return type == EdmPrimitiveTypeKind.DateTime
+            ? "yyyy-MM-dd'T'HH:mm:ss"
+            : type == EdmPrimitiveTypeKind.Date
+            ? "yyyy-MM-dd"
+            : "yyyy-MM-dd'T'HH:mm:ss";
   }
 
-  public static ODataTimestamp parse(final ODataJClientEdmPrimitiveType type, final String input) {
+  public static ODataTimestamp getInstance(final EdmPrimitiveTypeKind type, final Timestamp timestamp) {
+    return new ODataTimestamp(new SimpleDateFormat(getPattern(type)),
+            new Date(timestamp.getTime()), timestamp.getNanos(), type == EdmPrimitiveTypeKind.DateTimeOffset);
+  }
+
+  public static ODataTimestamp parse(final EdmPrimitiveTypeKind type, final String input) {
     final ODataTimestamp instance;
 
     final String[] dateParts = input.split("\\.");
-    final SimpleDateFormat sdf = new SimpleDateFormat(type.pattern());
-    final boolean isOffset = type == ODataJClientEdmPrimitiveType.DateTimeOffset;
+    final SimpleDateFormat sdf = new SimpleDateFormat(getPattern(type));
+    final boolean isOffset = type == EdmPrimitiveTypeKind.DateTimeOffset;
 
     try {
       final Date date = sdf.parse(dateParts[0]);
@@ -70,7 +79,7 @@ public final class ODataTimestamp implements Serializable {
         instance = new ODataTimestamp(sdf, date, isOffset);
       }
     } catch (Exception e) {
-      throw new IllegalArgumentException("Cannot parse " + type.pattern(), e);
+      throw new IllegalArgumentException("Cannot parse " + getPattern(type), e);
     }
 
     return instance;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/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
deleted file mode 100644
index 2ef65e8..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/ComposedGeospatial.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.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 crs crs.
-   * @param geospatials geospatials info.
-   */
-  protected ComposedGeospatial(final Dimension dimension, final Type type, final String crs,
-          final List<T> geospatials) {
-
-    super(dimension, type, crs);
-    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/559698d4/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
deleted file mode 100644
index 44e9558..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Geospatial.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.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.ODataJClientEdmPrimitiveType;
-
-/**
- * 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;
-
-  protected String crs;
-
-  /**
-   * 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, final String crs) {
-    this.dimension = dimension;
-    this.type = type;
-    this.crs = crs;
-  }
-
-  /**
-   * Gets dimension.
-   *
-   * @return dimension.
-   * @see Dimension
-   */
-  public Dimension getDimension() {
-    return dimension;
-  }
-
-  /**
-   * Gets type.
-   *
-   * @return type.
-   * @see Type
-   */
-  public Type getType() {
-    return type;
-  }
-
-  /**
-   * Gets CRS.
-   *
-   * @return CRS
-   */
-  public String getCrs() {
-    return crs;
-  }
-
-  /**
-   * 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 ODataJClientEdmPrimitiveType 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/559698d4/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
deleted file mode 100644
index 6409212..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/GeospatialCollection.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.domain.geospatial;
-
-import java.util.List;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-
-/**
- * Wrapper for a collection of geospatials info.
- */
-public class GeospatialCollection extends ComposedGeospatial<Geospatial> {
-
-  private static final long serialVersionUID = -9181547636133878977L;
-
-  /**
-   * Constructor.
-   *
-   * @param dimension dimension.
-   * @param crs crs.
-   * @param geospatials geospatials info.
-   */
-  public GeospatialCollection(final Dimension dimension, final String crs, final List<Geospatial> geospatials) {
-    super(dimension, Type.GEOSPATIALCOLLECTION, crs, geospatials);
-  }
-
-  @Override
-  public ODataJClientEdmPrimitiveType getEdmSimpleType() {
-    return dimension == Dimension.GEOGRAPHY
-            ? ODataJClientEdmPrimitiveType.GeographyCollection
-            : ODataJClientEdmPrimitiveType.GeometryCollection;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/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
deleted file mode 100644
index 474b578..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/LineString.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.domain.geospatial;
-
-import java.util.List;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-
-public class LineString extends ComposedGeospatial<Point> {
-
-  private static final long serialVersionUID = 3207958185407535907L;
-
-  public LineString(final Dimension dimension, final String crs, final List<Point> points) {
-    super(dimension, Type.LINESTRING, crs, points);
-  }
-
-  @Override
-  public ODataJClientEdmPrimitiveType getEdmSimpleType() {
-    return dimension == Dimension.GEOGRAPHY
-            ? ODataJClientEdmPrimitiveType.GeographyLineString
-            : ODataJClientEdmPrimitiveType.GeometryLineString;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/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
deleted file mode 100644
index 3eb0466..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiLineString.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.domain.geospatial;
-
-import java.util.List;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-
-public class MultiLineString extends ComposedGeospatial<LineString> {
-
-  private static final long serialVersionUID = -5042414471218124125L;
-
-  public MultiLineString(final Dimension dimension, final String crs, final List<LineString> lineStrings) {
-    super(dimension, Type.MULTILINESTRING, crs, lineStrings);
-  }
-
-  @Override
-  public ODataJClientEdmPrimitiveType getEdmSimpleType() {
-    return dimension == Dimension.GEOGRAPHY
-            ? ODataJClientEdmPrimitiveType.GeographyMultiLineString
-            : ODataJClientEdmPrimitiveType.GeometryMultiLineString;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/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
deleted file mode 100644
index 8ea16b9..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPoint.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.domain.geospatial;
-
-import java.util.List;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-
-public class MultiPoint extends ComposedGeospatial<Point> {
-
-  private static final long serialVersionUID = 4951011255142116129L;
-
-  public MultiPoint(final Dimension dimension, final String crs, final List<Point> points) {
-    super(dimension, Type.MULTIPOINT, crs, points);
-  }
-
-  @Override
-  public ODataJClientEdmPrimitiveType getEdmSimpleType() {
-    return dimension == Dimension.GEOGRAPHY
-            ? ODataJClientEdmPrimitiveType.GeographyMultiPoint
-            : ODataJClientEdmPrimitiveType.GeometryMultiPoint;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/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
deleted file mode 100644
index ed55b92..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPolygon.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.domain.geospatial;
-
-import java.util.List;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-
-public class MultiPolygon extends ComposedGeospatial<Polygon> {
-
-  private static final long serialVersionUID = -160184788048512883L;
-
-  public MultiPolygon(final Dimension dimension, final String crs, final List<Polygon> polygons) {
-    super(dimension, Type.MULTIPOLYGON, crs, polygons);
-  }
-
-  @Override
-  public ODataJClientEdmPrimitiveType getEdmSimpleType() {
-    return dimension == Dimension.GEOGRAPHY
-            ? ODataJClientEdmPrimitiveType.GeographyMultiPolygon
-            : ODataJClientEdmPrimitiveType.GeometryMultiPolygon;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/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
deleted file mode 100644
index 63b9166..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Point.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.domain.geospatial;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-
-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, final String crs) {
-    super(dimension, Type.POINT, crs);
-  }
-
-  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 ODataJClientEdmPrimitiveType getEdmSimpleType() {
-    return dimension == Dimension.GEOGRAPHY
-            ? ODataJClientEdmPrimitiveType.GeographyPoint
-            : ODataJClientEdmPrimitiveType.GeometryPoint;
-  }
-}

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

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/GeoUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/GeoUtils.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/GeoUtils.java
deleted file mode 100644
index c4270fe..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/GeoUtils.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.utils;
-
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-
-public final class GeoUtils {
-
-  private GeoUtils() {
-    // Empty private constructor for static utility classes       
-  }
-
-  public static Geospatial.Dimension getDimension(final ODataJClientEdmPrimitiveType type) {
-    Geospatial.Dimension dimension;
-
-    switch (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;
-  }
-
-  public static ODataJClientEdmPrimitiveType getType(final Geospatial.Dimension dimension, final String elementName) {
-    ODataJClientEdmPrimitiveType type = null;
-
-    if (Constants.ELEM_POINT.equals(elementName)) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? ODataJClientEdmPrimitiveType.GeographyPoint
-              : ODataJClientEdmPrimitiveType.GeometryPoint;
-    } else if (Constants.ELEM_MULTIPOINT.equals(elementName)) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? ODataJClientEdmPrimitiveType.GeographyMultiPoint
-              : ODataJClientEdmPrimitiveType.GeometryMultiPoint;
-    } else if (Constants.ELEM_LINESTRING.equals(elementName)) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? ODataJClientEdmPrimitiveType.GeographyLineString
-              : ODataJClientEdmPrimitiveType.GeometryLineString;
-    } else if (Constants.ELEM_MULTILINESTRING.equals(elementName)) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? ODataJClientEdmPrimitiveType.GeographyMultiLineString
-              : ODataJClientEdmPrimitiveType.GeometryMultiLineString;
-    } else if (Constants.ELEM_POLYGON.equals(elementName)) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? ODataJClientEdmPrimitiveType.GeographyPolygon
-              : ODataJClientEdmPrimitiveType.GeometryPolygon;
-    } else if (Constants.ELEM_MULTIPOLYGON.equals(elementName)) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? ODataJClientEdmPrimitiveType.GeographyMultiPolygon
-              : ODataJClientEdmPrimitiveType.GeometryMultiPolygon;
-    } else if (Constants.ELEM_GEOCOLLECTION.equals(elementName)
-            || Constants.ELEM_GEOMEMBERS.equals(elementName)) {
-
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? ODataJClientEdmPrimitiveType.GeographyCollection
-              : ODataJClientEdmPrimitiveType.GeometryCollection;
-    }
-
-    return type;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
index 53e0c05..af0eba6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
@@ -29,7 +29,6 @@ import org.apache.olingo.client.api.CommonODataClient;
 import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
 import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest;
 import org.apache.olingo.client.api.communication.response.ODataValueUpdateResponse;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
 import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
 import org.apache.olingo.client.api.domain.ODataValue;
 import org.apache.olingo.client.api.format.ODataValueFormat;
@@ -38,6 +37,7 @@ import org.apache.olingo.client.api.http.HttpMethod;
 import org.apache.olingo.client.api.utils.URIUtils;
 import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
 import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 
 /**
  * This class implements an OData update entity property value request.
@@ -125,7 +125,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
         try {
           value = new ODataPrimitiveValue.Builder(odataClient).
                   setType(format == ODataValueFormat.TEXT
-                  ? ODataJClientEdmPrimitiveType.String : ODataJClientEdmPrimitiveType.Stream).
+                          ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
                   setText(IOUtils.toString(getRawResponse())).
                   build();
         } catch (IOException e) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
index 964ec42..7a2ef0c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
@@ -26,11 +26,11 @@ import org.apache.http.client.HttpClient;
 import org.apache.olingo.client.api.CommonODataClient;
 import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
 import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
 import org.apache.olingo.client.api.domain.ODataValue;
 import org.apache.olingo.client.api.format.ODataValueFormat;
 import org.apache.olingo.client.api.http.HttpClientException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 
 /**
  * This class implements an OData entity property value query request.
@@ -93,7 +93,7 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataVal
         try {
           value = new ODataPrimitiveValue.Builder(odataClient).
                   setType(format == ODataValueFormat.TEXT
-                  ? ODataJClientEdmPrimitiveType.String : ODataJClientEdmPrimitiveType.Stream).
+                          ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
                   setText(IOUtils.toString(getRawResponse())).
                   build();
         } catch (IOException e) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
index d353c07..74b29fb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
@@ -27,23 +27,30 @@ import org.apache.olingo.client.api.Constants;
 import org.apache.olingo.client.api.data.CollectionValue;
 import org.apache.olingo.client.api.data.ComplexValue;
 import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.ODataJClientEdmType;
 import org.apache.olingo.client.api.domain.ODataPropertyType;
+import org.apache.olingo.client.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 
 abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
 
-  private final JSONGeoValueDeserializer geoDeserializer = new JSONGeoValueDeserializer();
+  private JSONGeoValueDeserializer geoDeserializer;
 
-  protected ODataJClientEdmPrimitiveType getPrimitiveType(final JsonNode node) {
-    ODataJClientEdmPrimitiveType result = ODataJClientEdmPrimitiveType.String;
+  private JSONGeoValueDeserializer getGeoDeserializer() {
+    if (geoDeserializer == null) {
+      geoDeserializer = new JSONGeoValueDeserializer(client.getServiceVersion());
+    }
+    return geoDeserializer;
+  }
+
+  protected EdmPrimitiveTypeKind getPrimitiveType(final JsonNode node) {
+    EdmPrimitiveTypeKind result = EdmPrimitiveTypeKind.String;
 
     if (node.isIntegralNumber()) {
-      result = ODataJClientEdmPrimitiveType.Int32;
+      result = EdmPrimitiveTypeKind.Int32;
     } else if (node.isBoolean()) {
-      result = ODataJClientEdmPrimitiveType.Boolean;
+      result = EdmPrimitiveTypeKind.Boolean;
     } else if (node.isFloatingPointNumber()) {
-      result = ODataJClientEdmPrimitiveType.Double;
+      result = EdmPrimitiveTypeKind.Double;
     }
 
     return result;
@@ -65,16 +72,14 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
     return type;
   }
 
-  private Value fromPrimitive(final JsonNode node, final ODataJClientEdmType typeInfo) {
+  private Value fromPrimitive(final JsonNode node, final EdmTypeInfo typeInfo) {
     Value value = null;
 
     if (node.isNull()) {
       value = new NullValueImpl();
     } else {
-      if (typeInfo != null && typeInfo.isGeospatialType()) {
-        final ODataJClientEdmPrimitiveType geoType = ODataJClientEdmPrimitiveType.fromValue(typeInfo.getBaseType());
-
-        value = new GeospatialValueImpl(this.geoDeserializer.deserialize(node, geoType));
+      if (typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
+        value = new GeospatialValueImpl(getGeoDeserializer().deserialize(node, typeInfo));
       } else {
         value = new PrimitiveValueImpl(node.asText());
       }
@@ -106,12 +111,12 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
     return value;
   }
 
-  private CollectionValue fromCollection(final Iterator<JsonNode> nodeItor, final ODataJClientEdmType typeInfo) {
+  private CollectionValue fromCollection(final Iterator<JsonNode> nodeItor, final EdmTypeInfo typeInfo) {
     final CollectionValueImpl value = new CollectionValueImpl();
 
-    final ODataJClientEdmType type = typeInfo == null
+    final EdmTypeInfo type = typeInfo == null
             ? null
-            : new ODataJClientEdmType(typeInfo.getBaseType());
+            : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
 
     while (nodeItor.hasNext()) {
       final JsonNode child = nodeItor.next();
@@ -130,9 +135,9 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
   }
 
   protected void value(final JSONPropertyImpl property, final JsonNode node) {
-    final ODataJClientEdmType typeInfo = StringUtils.isBlank(property.getType())
+    final EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
             ? null
-            : new ODataJClientEdmType(property.getType());
+            : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
 
     final ODataPropertyType propType = typeInfo == null
             ? guessPropertyType(node)
@@ -157,7 +162,7 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
 
       case PRIMITIVE:
         if (property.getType() == null) {
-          property.setType(getPrimitiveType(node).toString());
+          property.setType(getPrimitiveType(node).getFullQualifiedName().toString());
         }
         property.setValue(fromPrimitive(node, typeInfo));
         break;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java
index 3398ed9..7427845 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java
@@ -26,15 +26,15 @@ import org.apache.commons.lang3.math.NumberUtils;
 import org.apache.olingo.client.api.data.CollectionValue;
 import org.apache.olingo.client.api.data.Property;
 import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.ODataJClientEdmType;
+import org.apache.olingo.client.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 
 abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
 
-  private static final ODataJClientEdmPrimitiveType[] NUMBER_TYPES = {
-    ODataJClientEdmPrimitiveType.Byte, ODataJClientEdmPrimitiveType.SByte,
-    ODataJClientEdmPrimitiveType.Single, ODataJClientEdmPrimitiveType.Double,
-    ODataJClientEdmPrimitiveType.Int16, ODataJClientEdmPrimitiveType.Int32, ODataJClientEdmPrimitiveType.Int64
+  private static final EdmPrimitiveTypeKind[] NUMBER_TYPES = {
+    EdmPrimitiveTypeKind.Byte, EdmPrimitiveTypeKind.SByte,
+    EdmPrimitiveTypeKind.Single, EdmPrimitiveTypeKind.Double,
+    EdmPrimitiveTypeKind.Int16, EdmPrimitiveTypeKind.Int32, EdmPrimitiveTypeKind.Int64
   };
 
   private final JSONGeoValueSerializer geoSerializer = new JSONGeoValueSerializer();
@@ -50,20 +50,20 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
   }
 
   private void value(final JsonGenerator jgen, final String type, final Value value) throws IOException {
-    final ODataJClientEdmType typeInfo = type == null
+    final EdmTypeInfo typeInfo = type == null
             ? null
-            : new ODataJClientEdmType(type);
+            : new EdmTypeInfo.Builder().setTypeExpression(type).build();
 
     if (value.isNull()) {
       jgen.writeNull();
     } else if (value.isSimple()) {
       final boolean isNumber = typeInfo == null
               ? NumberUtils.isNumber(value.asSimple().get())
-              : ArrayUtils.contains(NUMBER_TYPES, typeInfo.getPrimitiveType());
+              : ArrayUtils.contains(NUMBER_TYPES, typeInfo.getPrimitiveTypeKind());
       final boolean isBoolean = typeInfo == null
               ? (value.asSimple().get().equalsIgnoreCase(Boolean.TRUE.toString())
               || value.asSimple().get().equalsIgnoreCase(Boolean.FALSE.toString()))
-              : typeInfo.getPrimitiveType() == ODataJClientEdmPrimitiveType.Boolean;
+              : typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Boolean;
 
       if (isNumber) {
         jgen.writeNumber(value.asSimple().get());
@@ -77,7 +77,7 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
       geoSerializer.serialize(jgen, value.asGeospatial().get());
       jgen.writeEndObject();
     } else if (value.isCollection()) {
-      collection(jgen, typeInfo == null ? null : typeInfo.getBaseType(), value.asCollection());
+      collection(jgen, typeInfo == null ? null : typeInfo.getFullQualifiedName().toString(), value.asCollection());
     } else if (value.isComplex()) {
       jgen.writeStartObject();
       for (Property property : value.asComplex().get()) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
index e733d2a..20dd164 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
@@ -28,20 +28,21 @@ import javax.xml.stream.events.StartElement;
 import javax.xml.stream.events.XMLEvent;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-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.data.GeoUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
 
 class AtomGeoValueDeserializer {
 
   private List<Point> points(final XMLEventReader reader, final StartElement start,
-          final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+          final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
 
     final List<Point> result = new ArrayList<Point>();
 
@@ -67,7 +68,7 @@ class AtomGeoValueDeserializer {
   }
 
   private MultiPoint multipoint(final XMLEventReader reader, final StartElement start,
-          final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+          final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
 
     List<Point> points = Collections.<Point>emptyList();
 
@@ -88,13 +89,13 @@ class AtomGeoValueDeserializer {
   }
 
   private LineString lineString(final XMLEventReader reader, final StartElement start,
-          final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+          final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
 
     return new LineString(GeoUtils.getDimension(type), crs, points(reader, start, type, null));
   }
 
   private Polygon polygon(final XMLEventReader reader, final StartElement start,
-          final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+          final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
 
     List<Point> extPoints = null;
     List<Point> intPoints = null;
@@ -121,7 +122,7 @@ class AtomGeoValueDeserializer {
   }
 
   private MultiLineString multiLineString(final XMLEventReader reader, final StartElement start,
-          final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+          final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
 
     final List<LineString> lineStrings = new ArrayList<LineString>();
 
@@ -142,7 +143,7 @@ class AtomGeoValueDeserializer {
   }
 
   private MultiPolygon multiPolygon(final XMLEventReader reader, final StartElement start,
-          final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+          final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
 
     final List<Polygon> polygons = new ArrayList<Polygon>();
 
@@ -163,7 +164,7 @@ class AtomGeoValueDeserializer {
   }
 
   private GeospatialCollection collection(final XMLEventReader reader, final StartElement start,
-          final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+          final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
 
     final List<Geospatial> geospatials = new ArrayList<Geospatial>();
 
@@ -196,7 +197,7 @@ class AtomGeoValueDeserializer {
   }
 
   public Geospatial deserialize(final XMLEventReader reader, final StartElement start,
-          final ODataJClientEdmPrimitiveType type) throws XMLStreamException {
+          final EdmPrimitiveTypeKind type) throws XMLStreamException {
 
     String crs = null;
     final Attribute srsName = start.getAttributeByName(Constants.QNAME_ATTR_SRSNAME);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
index 409ff99..2d69ef7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
@@ -25,14 +25,14 @@ import java.util.Iterator;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 import org.apache.olingo.client.api.Constants;
-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.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
 
 class AtomGeoValueSerializer {
 
@@ -126,7 +126,7 @@ class AtomGeoValueSerializer {
   }
 
   public void serialize(final XMLStreamWriter writer, final Geospatial value) throws XMLStreamException {
-    switch (value.getEdmSimpleType()) {
+    switch (value.getEdmPrimitiveTypeKind()) {
       case GeographyPoint:
       case GeometryPoint:
         writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POINT, Constants.NS_GML);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
index 9a24e38..00e6ac7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
@@ -28,9 +28,9 @@ import org.apache.olingo.client.api.Constants;
 import org.apache.olingo.client.api.data.CollectionValue;
 import org.apache.olingo.client.api.data.ComplexValue;
 import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
 import org.apache.olingo.client.api.domain.ODataJClientEdmType;
 import org.apache.olingo.client.api.domain.ODataPropertyType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 
 class AtomPropertyDeserializer extends AbstractAtomDealer {
@@ -53,7 +53,7 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
 
       if (event.isStartElement()) {
         if (typeInfo != null && typeInfo.isGeospatialType()) {
-          final ODataJClientEdmPrimitiveType geoType = ODataJClientEdmPrimitiveType.fromValue(typeInfo.getBaseType());
+          final EdmPrimitiveTypeKind geoType = EdmPrimitiveTypeKind.valueOfFQN(version, typeInfo.getBaseType());
           value = new GeospatialValueImpl(this.geoDeserializer.deserialize(reader, event.asStartElement(), geoType));
         }
       }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeoUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeoUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeoUtils.java
deleted file mode 100644
index e0574be..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeoUtils.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.data;
-
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-
-public final class GeoUtils {
-
-  private GeoUtils() {
-    // Empty private constructor for static utility classes       
-  }
-
-  public static Geospatial.Dimension getDimension(final ODataJClientEdmPrimitiveType type) {
-    Geospatial.Dimension dimension;
-
-    switch (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;
-  }
-
-  public static ODataJClientEdmPrimitiveType getType(final Geospatial.Dimension dimension, final String elementName) {
-    ODataJClientEdmPrimitiveType type = null;
-
-    if (Constants.ELEM_POINT.equals(elementName)) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? ODataJClientEdmPrimitiveType.GeographyPoint
-              : ODataJClientEdmPrimitiveType.GeometryPoint;
-    } else if (Constants.ELEM_MULTIPOINT.equals(elementName)) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? ODataJClientEdmPrimitiveType.GeographyMultiPoint
-              : ODataJClientEdmPrimitiveType.GeometryMultiPoint;
-    } else if (Constants.ELEM_LINESTRING.equals(elementName)) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? ODataJClientEdmPrimitiveType.GeographyLineString
-              : ODataJClientEdmPrimitiveType.GeometryLineString;
-    } else if (Constants.ELEM_MULTILINESTRING.equals(elementName)) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? ODataJClientEdmPrimitiveType.GeographyMultiLineString
-              : ODataJClientEdmPrimitiveType.GeometryMultiLineString;
-    } else if (Constants.ELEM_POLYGON.equals(elementName)) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? ODataJClientEdmPrimitiveType.GeographyPolygon
-              : ODataJClientEdmPrimitiveType.GeometryPolygon;
-    } else if (Constants.ELEM_MULTIPOLYGON.equals(elementName)) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? ODataJClientEdmPrimitiveType.GeographyMultiPolygon
-              : ODataJClientEdmPrimitiveType.GeometryMultiPolygon;
-    } else if (Constants.ELEM_GEOCOLLECTION.equals(elementName)
-            || Constants.ELEM_GEOMEMBERS.equals(elementName)) {
-
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? ODataJClientEdmPrimitiveType.GeographyCollection
-              : ODataJClientEdmPrimitiveType.GeometryCollection;
-    }
-
-    return type;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java
index 040b4f8..fdb0f44 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java
@@ -19,7 +19,7 @@
 package org.apache.olingo.client.core.data;
 
 import org.apache.olingo.client.api.data.GeospatialValue;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
 
 public class GeospatialValueImpl extends AbstractValue implements GeospatialValue {
 


[03/11] [OLINGO-65] Geospatial types implemented, EdmStream mock implemented with URI as backend, V3 pruned types implemented, EdmSimpleTypeKind adapted, EdmSimpleTypeFactory introduces

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java
new file mode 100644
index 0000000..2f16e24
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+
+public final class EdmGeometry extends AbstractEdmGeospatialType<Geospatial> {
+
+  private static final EdmGeometry INSTANCE = new EdmGeometry();
+
+  public static EdmGeometry getInstance() {
+    return INSTANCE;
+  }
+
+  public EdmGeometry() {
+    super(Geospatial.class, Dimension.GEOMETRY, null);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
new file mode 100644
index 0000000..12c6c01
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryCollection extends AbstractEdmGeospatialType<Point> {
+
+  private static final EdmGeometryCollection INSTANCE = new EdmGeometryCollection();
+
+  public static EdmGeometryCollection getInstance() {
+    return INSTANCE;
+  }
+
+  public EdmGeometryCollection() {
+    super(Point.class, Dimension.GEOMETRY, Type.GEOSPATIALCOLLECTION);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java
new file mode 100644
index 0000000..db8cfb0
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryLineString extends AbstractEdmGeospatialType<Point> {
+
+  private static final EdmGeometryLineString INSTANCE = new EdmGeometryLineString();
+
+  public static EdmGeometryLineString getInstance() {
+    return INSTANCE;
+  }
+
+  public EdmGeometryLineString() {
+    super(Point.class, Dimension.GEOMETRY, Type.LINESTRING);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java
new file mode 100644
index 0000000..7bf89e6
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryMultiLineString extends AbstractEdmGeospatialType<Point> {
+
+  private static final EdmGeometryMultiLineString INSTANCE = new EdmGeometryMultiLineString();
+
+  public static EdmGeometryMultiLineString getInstance() {
+    return INSTANCE;
+  }
+
+  public EdmGeometryMultiLineString() {
+    super(Point.class, Dimension.GEOMETRY, Type.MULTILINESTRING);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java
new file mode 100644
index 0000000..9311d8d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryMultiPoint extends AbstractEdmGeospatialType<Point> {
+
+  private static final EdmGeometryMultiPoint INSTANCE = new EdmGeometryMultiPoint();
+
+  public static EdmGeometryMultiPoint getInstance() {
+    return INSTANCE;
+  }
+
+  public EdmGeometryMultiPoint() {
+    super(Point.class, Dimension.GEOMETRY, Type.MULTIPOINT);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java
new file mode 100644
index 0000000..f64ed87
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryMultiPolygon extends AbstractEdmGeospatialType<Point> {
+
+  private static final EdmGeometryMultiPolygon INSTANCE = new EdmGeometryMultiPolygon();
+
+  public static EdmGeometryMultiPolygon getInstance() {
+    return INSTANCE;
+  }
+
+  public EdmGeometryMultiPolygon() {
+    super(Point.class, Dimension.GEOMETRY, Type.MULTIPOLYGON);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java
new file mode 100644
index 0000000..ba8e5d2
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryPoint extends AbstractEdmGeospatialType<Point> {
+
+  private static final EdmGeometryPoint INSTANCE = new EdmGeometryPoint();
+
+  public static EdmGeometryPoint getInstance() {
+    return INSTANCE;
+  }
+
+  public EdmGeometryPoint() {
+    super(Point.class, Dimension.GEOMETRY, Type.POINT);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java
new file mode 100644
index 0000000..12f8cf1
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryPolygon extends AbstractEdmGeospatialType<Point> {
+
+  private static final EdmGeometryPolygon INSTANCE = new EdmGeometryPolygon();
+
+  public static EdmGeometryPolygon getInstance() {
+    return INSTANCE;
+  }
+
+  public EdmGeometryPolygon() {
+    super(Point.class, Dimension.GEOMETRY, Type.POLYGON);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNull.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNull.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNull.java
deleted file mode 100644
index 57b1218..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNull.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.commons.core.edm.primitivetype;
-
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-
-//TODO: Is this class still necessary?
-/**
- * Implementation of the simple type Null.
- */
-public final class EdmNull extends SingletonPrimitiveType {
-
-  private static final EdmNull INSTANCE = new EdmNull();
-
-  public static EdmNull getInstance() {
-    return INSTANCE;
-  }
-
-  @Override
-  public boolean equals(final Object obj) {
-    return this == obj || obj == null;
-  }
-
-  @Override
-  public int hashCode() {
-    return 0;
-  }
-
-  @Override
-  public Class<?> getDefaultType() {
-    return null;
-  }
-
-  @Override
-  protected <T> T internalValueOfString(final String value,
-          final Boolean isNullable, final Integer maxLength, final Integer precision,
-          final Integer scale, final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException {
-
-    return null;
-  }
-
-  @Override
-  protected <T> String internalValueToString(final T value,
-          final Boolean isNullable, final Integer maxLength, final Integer precision,
-          final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
-
-    return null;
-  }
-
-  @Override
-  public String toUriLiteral(final String literal) {
-    return "null";
-  }
-
-  @Override
-  public String fromUriLiteral(final String literal) throws EdmPrimitiveTypeException {
-    return null;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java
new file mode 100644
index 0000000..83a257d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.EdmGeospatialType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmType;
+
+public final class EdmPrimitiveTypeFactory {
+
+  public static EdmType getInstance(final EdmPrimitiveTypeKind kind) {
+    return kind.isGeospatial()
+           ? getGeoInstance(kind)
+           : getNonGeoInstance(kind);
+  }
+
+  /**
+   * Returns an instance for the provided {@link EdmPrimitiveTypeKind} in the form of {@link EdmPrimitiveType} (for
+   * non-geospatial types).
+   *
+   * @param kind EdmPrimitiveTypeKind
+   * @return {@link EdmPrimitiveType} instance
+   */
+  public static EdmPrimitiveType getNonGeoInstance(final EdmPrimitiveTypeKind kind) {
+    switch (kind) {
+      case Binary:
+        return EdmBinary.getInstance();
+      case Boolean:
+        return EdmBoolean.getInstance();
+      case Byte:
+        return EdmByte.getInstance();
+      case SByte:
+        return EdmSByte.getInstance();
+      case Date:
+        return EdmDate.getInstance();
+      case DateTime:
+        return EdmDateTime.getInstance();
+      case DateTimeOffset:
+        return EdmDateTimeOffset.getInstance();
+      case Time:
+        return EdmTime.getInstance();
+      case TimeOfDay:
+        return EdmTimeOfDay.getInstance();
+      case Duration:
+        return EdmDuration.getInstance();
+      case Decimal:
+        return EdmDecimal.getInstance();
+      case Single:
+        return EdmSingle.getInstance();
+      case Double:
+        return EdmDouble.getInstance();
+      case Guid:
+        return EdmGuid.getInstance();
+      case Int16:
+        return EdmInt16.getInstance();
+      case Int32:
+        return EdmInt32.getInstance();
+      case Int64:
+        return EdmInt64.getInstance();
+      case String:
+        return EdmString.getInstance();
+      case Stream:
+        return EdmStream.getInstance();
+
+      default:
+        throw new IllegalArgumentException("Wrong type: " + kind);
+    }
+  }
+
+  /**
+   * Returns an instance for the provided {@link EdmPrimitiveTypeKind} in the form of {@link EdmGeospatialType}.
+   *
+   * @param kind EdmPrimitiveTypeKind
+   * @return {@link EdmGeospatialType} instance
+   */
+  public static EdmGeospatialType getGeoInstance(final EdmPrimitiveTypeKind kind) {
+    switch (kind) {
+      case Geography:
+        return EdmGeography.getInstance();
+      case GeographyPoint:
+        return EdmGeographyPoint.getInstance();
+      case GeographyLineString:
+        return EdmGeographyLineString.getInstance();
+      case GeographyPolygon:
+        return EdmGeographyPolygon.getInstance();
+      case GeographyMultiPoint:
+        return EdmGeographyMultiPoint.getInstance();
+      case GeographyMultiLineString:
+        return EdmGeographyMultiLineString.getInstance();
+      case GeographyMultiPolygon:
+        return EdmGeographyMultiPolygon.getInstance();
+      case GeographyCollection:
+        return EdmGeographyCollection.getInstance();
+      case Geometry:
+        return EdmGeometry.getInstance();
+      case GeometryPoint:
+        return EdmGeometry.getInstance();
+      case GeometryLineString:
+        return EdmGeometryLineString.getInstance();
+      case GeometryPolygon:
+        return EdmGeometryPolygon.getInstance();
+      case GeometryMultiPoint:
+        return EdmGeometryMultiPoint.getInstance();
+      case GeometryMultiLineString:
+        return EdmGeographyMultiLineString.getInstance();
+      case GeometryMultiPolygon:
+        return EdmGeometryMultiPolygon.getInstance();
+      case GeometryCollection:
+        return EdmGeometryCollection.getInstance();
+
+      default:
+        throw new IllegalArgumentException("Wrong type: " + kind);
+
+    }
+  }
+
+  private EdmPrimitiveTypeFactory() {
+    // empty constructor for static utility class
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeKind.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeKind.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeKind.java
deleted file mode 100644
index e368607..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeKind.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.commons.core.edm.primitivetype;
-
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-//TODO: Should we delete this typekind and use a facade?
-public enum EdmPrimitiveTypeKind {
-
-  Binary, Boolean, Byte, Date, DateTimeOffset, Decimal, Double, Duration, Guid,
-  Int16, Int32, Int64, SByte, Single, String, TimeOfDay;
-
-  /**
-   * Returns the {@link FullQualifiedName} for this type kind.
-   *
-   * @return {@link FullQualifiedName}
-   */
-  public FullQualifiedName getFullQualifiedName() {
-    return new FullQualifiedName(EdmPrimitiveType.EDM_NAMESPACE, toString());
-  }
-
-  /**
-   * Returns an instance for this {@link EdmPrimitiveTypeKind} in the form of {@link EdmPrimitiveType}.
-   *
-   * @return {@link EdmPrimitiveType} instance
-   */
-  public EdmPrimitiveType getEdmPrimitiveTypeInstance() {
-    switch (this) {
-      case Binary:
-        return EdmBinary.getInstance();
-      case Boolean:
-        return EdmBoolean.getInstance();
-      case Byte:
-        return EdmByte.getInstance();
-      case Date:
-        return EdmDate.getInstance();
-      case DateTimeOffset:
-        return EdmDateTimeOffset.getInstance();
-      case Decimal:
-        return EdmDecimal.getInstance();
-      case Double:
-        return EdmDouble.getInstance();
-      case Duration:
-        return EdmDuration.getInstance();
-      case Guid:
-        return EdmGuid.getInstance();
-      case Int16:
-        return EdmInt16.getInstance();
-      case Int32:
-        return EdmInt32.getInstance();
-      case Int64:
-        return EdmInt64.getInstance();
-      case SByte:
-        return EdmSByte.getInstance();
-      case Single:
-        return EdmSingle.getInstance();
-      case String:
-        return EdmString.getInstance();
-      case TimeOfDay:
-        return EdmTimeOfDay.getInstance();
-      default:
-        throw new RuntimeException("Wrong type:" + this);
-    }
-  }
-
-  /**
-   * Gets <tt>EdmPrimitiveTypeKind</tt> from a full string (e.g. 'Edm.Int32').
-   *
-   * @param value string value type.
-   * @return <tt>EdmPrimitiveTypeKind</tt> object.
-   */
-  public static EdmPrimitiveTypeKind valueOfFQN(final String value) {
-    if (!value.startsWith(EdmPrimitiveType.EDM_NAMESPACE + ".")) {
-      throw new IllegalArgumentException(value + " does not look like an Edm primitive type");
-    }
-    return valueOf(value.substring(4));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStream.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStream.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStream.java
new file mode 100644
index 0000000..75b6291
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStream.java
@@ -0,0 +1,88 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+
+/**
+ * Implementation of the EDM primitive type Stream as URI.
+ */
+public final class EdmStream extends SingletonPrimitiveType {
+
+  private static final EdmStream INSTANCE = new EdmStream();
+
+  public static EdmStream getInstance() {
+    return INSTANCE;
+  }
+
+  @Override
+  public Class<?> getDefaultType() {
+    return URI.class;
+  }
+
+  @Override
+  public boolean validate(final String value, final Boolean isNullable, final Integer maxLength,
+          final Integer precision, final Integer scale, final Boolean isUnicode) {
+
+    if (value == null) {
+      return isNullable == null || isNullable;
+    }
+
+    try {
+      new URI(value);
+      return true;
+    } catch (Exception e) {
+      return false;
+    }
+  }
+
+  @Override
+  protected <T> T internalValueOfString(final String value,
+          final Boolean isNullable, final Integer maxLength, final Integer precision,
+          final Integer scale, final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+    URI stream = null;
+    try {
+      stream = new URI(value);
+    } catch (Exception e) {
+      throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
+    }
+
+    if (returnType.isAssignableFrom(URI.class)) {
+      return returnType.cast(stream);
+    } else {
+      throw new EdmPrimitiveTypeException(
+              "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+    }
+  }
+
+  @Override
+  protected <T> String internalValueToString(final T value,
+          final Boolean isNullable, final Integer maxLength, final Integer precision,
+          final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+    if (value instanceof URI) {
+      return ((URI) value).toASCIIString();
+    } else {
+      throw new EdmPrimitiveTypeException(
+              "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java
new file mode 100644
index 0000000..75e80cf
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.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.commons.core.edm.primitivetype;
+
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.Duration;
+
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+
+/**
+ * Implementation of the EDM primitive type Time.
+ */
+public final class EdmTime extends SingletonPrimitiveType {
+
+  private static final EdmTime INSTANCE = new EdmTime();
+
+  public static EdmTime getInstance() {
+    return INSTANCE;
+  }
+
+  @Override
+  public Class<?> getDefaultType() {
+    return Duration.class;
+  }
+
+  @Override
+  protected <T> T internalValueOfString(final String value,
+          final Boolean isNullable, final Integer maxLength, final Integer precision,
+          final Integer scale, final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+    Duration duration = null;
+    try {
+      final DatatypeFactory dtFactory = DatatypeFactory.newInstance();
+      duration = dtFactory.newDuration(value);
+    } catch (Exception e) {
+      throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
+    }
+
+    if (returnType.isAssignableFrom(Duration.class)) {
+      return returnType.cast(duration);
+    } else {
+      throw new EdmPrimitiveTypeException(
+              "EdmPrimitiveTypeException.LITERAL_UNCONVERTIBLE_TO_VALUE_TYPE.addContent(value, returnType)");
+    }
+  }
+
+  @Override
+  protected <T> String internalValueToString(final T value,
+          final Boolean isNullable, final Integer maxLength, final Integer precision,
+          final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+    if (value instanceof Duration) {
+      final Duration duration = (Duration) value;
+      return duration.toString();
+    } else {
+      throw new EdmPrimitiveTypeException(
+              "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+    }
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java
index 18b0dc6..dba916b 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java
@@ -28,10 +28,9 @@ import java.util.Calendar;
 import java.util.UUID;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmType;
 import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmNull;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
 import org.junit.Test;
 
 public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest {
@@ -40,9 +39,11 @@ public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest {
   public void nameSpace() throws Exception {
     assertEquals(EdmPrimitiveType.SYSTEM_NAMESPACE, Uint7.getInstance().getNamespace());
 
-    assertEquals(EdmPrimitiveType.EDM_NAMESPACE, EdmNull.getInstance().getNamespace());
+    assertEquals(EdmPrimitiveType.EDM_NAMESPACE, EdmInt32.getInstance().getNamespace());
     for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
-      final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
+      final EdmType instance = kind.isGeospatial()
+                               ? EdmPrimitiveTypeFactory.getGeoInstance(kind)
+                               : EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
       assertEquals(EdmPrimitiveType.EDM_NAMESPACE, instance.getNamespace());
     }
   }
@@ -51,29 +52,33 @@ public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest {
   public void names() throws Exception {
     assertEquals("Uint7", Uint7.getInstance().getName());
 
-    assertEquals("Null", EdmNull.getInstance().getName());
-    assertEquals("Binary", EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance().getName());
-    assertEquals("Boolean", EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance().getName());
-    assertEquals("Byte", EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance().getName());
-    assertEquals("Date", EdmPrimitiveTypeKind.Date.getEdmPrimitiveTypeInstance().getName());
-    assertEquals("DateTimeOffset", EdmPrimitiveTypeKind.DateTimeOffset.getEdmPrimitiveTypeInstance().getName());
-    assertEquals("Decimal", EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance().getName());
-    assertEquals("Double", EdmPrimitiveTypeKind.Double.getEdmPrimitiveTypeInstance().getName());
-    assertEquals("Duration", EdmPrimitiveTypeKind.Duration.getEdmPrimitiveTypeInstance().getName());
-    assertEquals("Guid", EdmPrimitiveTypeKind.Guid.getEdmPrimitiveTypeInstance().getName());
-    assertEquals("Int16", EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance().getName());
-    assertEquals("Int32", EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance().getName());
-    assertEquals("Int64", EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance().getName());
-    assertEquals("SByte", EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance().getName());
-    assertEquals("Single", EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance().getName());
-    assertEquals("String", EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance().getName());
-    assertEquals("TimeOfDay", EdmPrimitiveTypeKind.TimeOfDay.getEdmPrimitiveTypeInstance().getName());
+    assertEquals("Binary", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).getName());
+    assertEquals("Boolean", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean).getName());
+    assertEquals("Byte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte).getName());
+    assertEquals("Date", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date).getName());
+    assertEquals("DateTimeOffset",
+            EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset).getName());
+    assertEquals("Decimal", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).getName());
+    assertEquals("Double", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double).getName());
+    assertEquals("Duration", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration).getName());
+    assertEquals("Guid", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid).getName());
+    assertEquals("Int16", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16).getName());
+    assertEquals("Int32", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32).getName());
+    assertEquals("Int64", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64).getName());
+    assertEquals("SByte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte).getName());
+    assertEquals("Single", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single).getName());
+    assertEquals("String", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String).getName());
+    assertEquals("TimeOfDay", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay).getName());
   }
 
   @Test
   public void kind() throws Exception {
     for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
-      assertEquals(EdmTypeKind.PRIMITIVE, kind.getEdmPrimitiveTypeInstance().getKind());
+      if (kind.isGeospatial()) {
+        assertEquals(EdmTypeKind.PRIMITIVE, EdmPrimitiveTypeFactory.getGeoInstance(kind).getKind());
+      } else {
+        assertEquals(EdmTypeKind.PRIMITIVE, EdmPrimitiveTypeFactory.getNonGeoInstance(kind).getKind());
+      }
     }
   }
 
@@ -81,95 +86,113 @@ public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest {
   public void toStringAll() throws Exception {
     assertEquals("System.Uint7", Uint7.getInstance().toString());
 
-    assertEquals("Edm.Null", EdmNull.getInstance().toString());
-    assertEquals("Edm.Binary", EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance().toString());
-    assertEquals("Edm.Boolean", EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance().toString());
-    assertEquals("Edm.Byte", EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance().toString());
-    assertEquals("Edm.Date", EdmPrimitiveTypeKind.Date.getEdmPrimitiveTypeInstance().toString());
-    assertEquals("Edm.DateTimeOffset", EdmPrimitiveTypeKind.DateTimeOffset.getEdmPrimitiveTypeInstance().toString());
-    assertEquals("Edm.Decimal", EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance().toString());
-    assertEquals("Edm.Double", EdmPrimitiveTypeKind.Double.getEdmPrimitiveTypeInstance().toString());
-    assertEquals("Edm.Duration", EdmPrimitiveTypeKind.Duration.getEdmPrimitiveTypeInstance().toString());
-    assertEquals("Edm.Guid", EdmPrimitiveTypeKind.Guid.getEdmPrimitiveTypeInstance().toString());
-    assertEquals("Edm.Int16", EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance().toString());
-    assertEquals("Edm.Int32", EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance().toString());
-    assertEquals("Edm.Int64", EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance().toString());
-    assertEquals("Edm.SByte", EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance().toString());
-    assertEquals("Edm.Single", EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance().toString());
-    assertEquals("Edm.String", EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance().toString());
-    assertEquals("Edm.TimeOfDay", EdmPrimitiveTypeKind.TimeOfDay.getEdmPrimitiveTypeInstance().toString());
+    assertEquals("Edm.Binary", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).toString());
+    assertEquals("Edm.Boolean", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean).toString());
+    assertEquals("Edm.Byte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte).toString());
+    assertEquals("Edm.Date", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date).toString());
+    assertEquals("Edm.DateTimeOffset",
+            EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset).toString());
+    assertEquals("Edm.Decimal", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).toString());
+    assertEquals("Edm.Double", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double).toString());
+    assertEquals("Edm.Duration", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration).toString());
+    assertEquals("Edm.Guid", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid).toString());
+    assertEquals("Edm.Int16", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16).toString());
+    assertEquals("Edm.Int32", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32).toString());
+    assertEquals("Edm.Int64", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64).toString());
+    assertEquals("Edm.SByte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte).toString());
+    assertEquals("Edm.Single", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single).toString());
+    assertEquals("Edm.String", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String).toString());
+    assertEquals("Edm.TimeOfDay", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay).toString());
 
     for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
-      final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
-      assertEquals(instance.toString(), kind.getFullQualifiedName().toString());
+      if (!kind.isGeospatial()) {
+        final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+        assertEquals(instance.toString(), kind.getFullQualifiedName().toString());
+      }
     }
   }
 
   @Test
   public void compatibility() {
     for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
-      final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
-      assertTrue(instance.isCompatible(instance));
-      assertFalse(instance.isCompatible(
-          (kind == EdmPrimitiveTypeKind.String ? EdmPrimitiveTypeKind.Binary : EdmPrimitiveTypeKind.String)
-              .getEdmPrimitiveTypeInstance()));
+      if (!kind.isGeospatial()) {
+        final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+        assertTrue(instance.isCompatible(instance));
+        assertFalse(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(
+                (kind == EdmPrimitiveTypeKind.String ? EdmPrimitiveTypeKind.Binary : EdmPrimitiveTypeKind.String))));
+      }
     }
   }
 
   @Test
   public void defaultType() throws Exception {
     assertEquals(Byte.class, Uint7.getInstance().getDefaultType());
-    assertNull(EdmNull.getInstance().getDefaultType());
-
-    assertEquals(byte[].class, EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance().getDefaultType());
-    assertEquals(Boolean.class, EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance().getDefaultType());
-    assertEquals(Short.class, EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance().getDefaultType());
-    assertEquals(Calendar.class, EdmPrimitiveTypeKind.Date.getEdmPrimitiveTypeInstance().getDefaultType());
-    assertEquals(Calendar.class, EdmPrimitiveTypeKind.DateTimeOffset.getEdmPrimitiveTypeInstance().getDefaultType());
-    assertEquals(BigDecimal.class, EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance().getDefaultType());
-    assertEquals(Double.class, EdmPrimitiveTypeKind.Double.getEdmPrimitiveTypeInstance().getDefaultType());
-    assertEquals(BigDecimal.class, EdmPrimitiveTypeKind.Duration.getEdmPrimitiveTypeInstance().getDefaultType());
-    assertEquals(UUID.class, EdmPrimitiveTypeKind.Guid.getEdmPrimitiveTypeInstance().getDefaultType());
-    assertEquals(Short.class, EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance().getDefaultType());
-    assertEquals(Integer.class, EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance().getDefaultType());
-    assertEquals(Long.class, EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance().getDefaultType());
-    assertEquals(Byte.class, EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance().getDefaultType());
-    assertEquals(Float.class, EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance().getDefaultType());
-    assertEquals(String.class, EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance().getDefaultType());
-    assertEquals(Calendar.class, EdmPrimitiveTypeKind.TimeOfDay.getEdmPrimitiveTypeInstance().getDefaultType());
+
+    assertEquals(byte[].class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).getDefaultType());
+    assertEquals(Boolean.class,
+            EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean).getDefaultType());
+    assertEquals(Short.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte).getDefaultType());
+    assertEquals(Calendar.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date).getDefaultType());
+    assertEquals(Calendar.class,
+            EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset).getDefaultType());
+    assertEquals(BigDecimal.class,
+            EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).getDefaultType());
+    assertEquals(Double.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double).getDefaultType());
+    assertEquals(BigDecimal.class,
+            EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration).getDefaultType());
+    assertEquals(UUID.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid).getDefaultType());
+    assertEquals(Short.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16).getDefaultType());
+    assertEquals(Integer.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32).getDefaultType());
+    assertEquals(Long.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64).getDefaultType());
+    assertEquals(Byte.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte).getDefaultType());
+    assertEquals(Float.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single).getDefaultType());
+    assertEquals(String.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String).getDefaultType());
+    assertEquals(Calendar.class,
+            EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay).getDefaultType());
   }
 
   @Test
   public void validate() throws Exception {
     for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
-      final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
-      assertTrue(instance.validate(null, null, null, null, null, null));
-      assertTrue(instance.validate(null, true, null, null, null, null));
-      assertFalse(instance.validate(null, false, null, null, null, null));
-      assertFalse(instance.validate("ä", null, null, null, null, false));
-      if (kind != EdmPrimitiveTypeKind.String && kind != EdmPrimitiveTypeKind.Binary) {
-        assertFalse(instance.validate("", null, null, null, null, null));
-      }
-      if (kind != EdmPrimitiveTypeKind.String) {
-        assertFalse(instance.validate("ä", null, null, null, null, null));
+      if (!kind.isGeospatial()) {
+        final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+        assertTrue(instance.validate(null, null, null, null, null, null));
+        assertTrue(instance.validate(null, true, null, null, null, null));
+        assertFalse(instance.validate(null, false, null, null, null, null));
+        if (kind != EdmPrimitiveTypeKind.Stream) {
+          assertFalse(instance.validate("ä", null, null, null, null, false));
+        }
+        if (kind != EdmPrimitiveTypeKind.String && kind != EdmPrimitiveTypeKind.Binary
+            && kind != EdmPrimitiveTypeKind.Stream) {
+
+          assertFalse(instance.validate("", null, null, null, null, null));
+        }
+        if (kind != EdmPrimitiveTypeKind.String && kind != EdmPrimitiveTypeKind.Stream) {
+          assertFalse(instance.validate("ä", null, null, null, null, null));
+        }
       }
     }
 
-    assertTrue(EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance().validate("abcd", null, 3, null, null, null));
-    assertFalse(EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance().validate("abcd", null, 2, null, null, null));
+    assertTrue(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).
+            validate("abcd", null, 3, null, null, null));
+    assertFalse(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).
+            validate("abcd", null, 2, null, null, null));
 
-    assertTrue(EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance().validate("1", null, null, null, null,
-        null));
-    assertFalse(EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance().validate("1.2", null, null, null, 0, null));
+    assertTrue(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).
+            validate("1", null, null, null, null, null));
+    assertFalse(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).
+            validate("1.2", null, null, null, 0, null));
   }
 
   @Test
   public void uriLiteral() throws Exception {
     for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
-      final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
-      assertEquals("test", instance.fromUriLiteral(instance.toUriLiteral("test")));
-      assertNull(instance.toUriLiteral(null));
-      assertNull(instance.fromUriLiteral(null));
+      if (!kind.isGeospatial()) {
+        final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+        assertEquals("test", instance.fromUriLiteral(instance.toUriLiteral("test")));
+        assertNull(instance.toUriLiteral(null));
+        assertNull(instance.fromUriLiteral(null));
+      }
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java
index 39fd38c..c3ff01c 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java
@@ -25,12 +25,12 @@ import static org.junit.Assert.assertTrue;
 import java.util.Arrays;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class EdmBinaryTest extends PrimitiveTypeBaseTest {
 
-  private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance();
+  private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary);
 
   @Test
   public void validate() throws Exception {
@@ -64,14 +64,14 @@ public class EdmBinaryTest extends PrimitiveTypeBaseTest {
 
   @Test
   public void valueToString() throws Exception {
-    final byte[] binary = new byte[] { (byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF };
+    final byte[] binary = new byte[]{(byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF};
 
     assertEquals("qrvM3e7_", instance.valueToString(binary, null, null, null, null, null));
 
     assertEquals("qrvM3e7_", instance.valueToString(binary, null, 6, null, null, null));
     assertEquals("qrvM3e7_", instance.valueToString(binary, null, Integer.MAX_VALUE, null, null, null));
 
-    assertEquals("qg", instance.valueToString(new Byte[] { new Byte((byte) 170) }, null, null, null, null, null));
+    assertEquals("qg", instance.valueToString(new Byte[]{new Byte((byte) 170)}, null, null, null, null, null));
 
     expectFacetsErrorInValueToString(instance, binary, null, 3, null, null, null);
 
@@ -80,23 +80,23 @@ public class EdmBinaryTest extends PrimitiveTypeBaseTest {
 
   @Test
   public void valueOfString() throws Exception {
-    final byte[] binary = new byte[] { (byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF };
+    final byte[] binary = new byte[]{(byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF};
 
     assertTrue(Arrays.equals(binary, instance.valueOfString("qrvM3e7_", null, null, null, null, null, byte[].class)));
-    assertTrue(Arrays.equals(new Byte[] { binary[0], binary[1], binary[2] }, instance.valueOfString("qrvM", null, null,
-        null, null, null, Byte[].class)));
+    assertTrue(Arrays.equals(new Byte[]{binary[0], binary[1], binary[2]}, instance.valueOfString("qrvM", null, null,
+            null, null, null, Byte[].class)));
 
     assertTrue(Arrays.equals(binary, instance.valueOfString("qrvM3e7_", null, 6, null, null, null, byte[].class)));
-    assertTrue(Arrays.equals(new byte[] { 42 }, instance.valueOfString("Kg==", null, 1, null, null, null,
-        byte[].class)));
-    assertTrue(Arrays.equals(new byte[] { 42 }, instance.valueOfString("Kg", null, 1, null, null, null,
-        byte[].class)));
-    assertTrue(Arrays.equals(new byte[] { 1, 2 }, instance.valueOfString("AQI=", null, 2, null, null, null,
-        byte[].class)));
+    assertTrue(Arrays.equals(new byte[]{42}, instance.valueOfString("Kg==", null, 1, null, null, null,
+            byte[].class)));
+    assertTrue(Arrays.equals(new byte[]{42}, instance.valueOfString("Kg", null, 1, null, null, null,
+            byte[].class)));
+    assertTrue(Arrays.equals(new byte[]{1, 2}, instance.valueOfString("AQI=", null, 2, null, null, null,
+            byte[].class)));
     assertTrue(Arrays.equals(binary, instance.valueOfString("qrvM3e7_", null, 6, null, null, null,
-        byte[].class)));
+            byte[].class)));
     assertTrue(Arrays.equals(binary, instance.valueOfString("qrvM3e7_", null, Integer.MAX_VALUE, null, null, null,
-        byte[].class)));
+            byte[].class)));
 
     expectFacetsErrorInValueOfString(instance, "qrvM3e7_", null, 3, null, null, null);
     expectContentErrorInValueOfString(instance, "@");

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java
index 1abca66..d1e6580 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java
@@ -21,12 +21,12 @@ package org.apache.olingo.commons.core.edm.primitivetype;
 import static org.junit.Assert.assertEquals;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class EdmBooleanTest extends PrimitiveTypeBaseTest {
 
-  private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
+  private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean);
 
   @Test
   public void toUriLiteral() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java
index ddf819f..c560c39 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java
@@ -24,13 +24,12 @@ import static org.junit.Assert.assertTrue;
 import java.math.BigInteger;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class EdmByteTest extends PrimitiveTypeBaseTest {
 
-  private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance();
+  private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte);
 
   @Test
   public void compatibility() {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java
index 3d966bc..6cc3d19 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java
@@ -25,12 +25,12 @@ import java.util.Date;
 import java.util.TimeZone;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class EdmDateTest extends PrimitiveTypeBaseTest {
 
-  private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Date.getEdmPrimitiveTypeInstance();
+  private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date);
 
   @Test
   public void toUriLiteral() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java
index f92fbec..bcc0123 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java
@@ -26,12 +26,12 @@ import java.util.Date;
 import java.util.TimeZone;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class EdmDateTimeOffsetTest extends PrimitiveTypeBaseTest {
 
-  final EdmPrimitiveType instance = EdmPrimitiveTypeKind.DateTimeOffset.getEdmPrimitiveTypeInstance();
+  final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset);
 
   @Test
   public void toUriLiteral() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java
index 9f987a7..35917af 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java
@@ -25,24 +25,23 @@ import java.math.BigDecimal;
 import java.math.BigInteger;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class EdmDecimalTest extends PrimitiveTypeBaseTest {
 
-  private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance();
+  private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal);
 
   @Test
   public void compatibility() {
     assertTrue(instance.isCompatible(Uint7.getInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Double.getEdmPrimitiveTypeInstance()));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double)));
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java
index abb3a6b..57403ce 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java
@@ -25,23 +25,22 @@ import java.math.BigDecimal;
 import java.math.BigInteger;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class EdmDoubleTest extends PrimitiveTypeBaseTest {
 
-  private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Double.getEdmPrimitiveTypeInstance();
+  private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double);
 
   @Test
   public void compatibility() {
     assertTrue(instance.isCompatible(Uint7.getInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance()));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single)));
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java
index 7b97f7e..85745b4 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java
@@ -24,12 +24,12 @@ import java.math.BigDecimal;
 import java.math.BigInteger;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class EdmDurationTest extends PrimitiveTypeBaseTest {
 
-  private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Duration.getEdmPrimitiveTypeInstance();
+  private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration);
 
   @Test
   public void toUriLiteral() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java
index c6d73ca..f69eddc 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java
@@ -23,12 +23,12 @@ import static org.junit.Assert.assertEquals;
 import java.util.UUID;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class EdmGuidTest extends PrimitiveTypeBaseTest {
 
-  private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Guid.getEdmPrimitiveTypeInstance();
+  private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid);
 
   @Test
   public void toUriLiteral() {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java
index 458e1d4..55c12bb 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java
@@ -24,19 +24,18 @@ import static org.junit.Assert.assertTrue;
 import java.math.BigInteger;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class EdmInt16Test extends PrimitiveTypeBaseTest {
 
-  final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance();
+  final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16);
 
   @Test
   public void testInt16Compatibility() {
     assertTrue(instance.isCompatible(Uint7.getInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java
index f0ada7e..e3410d7 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java
@@ -24,20 +24,19 @@ import static org.junit.Assert.assertTrue;
 import java.math.BigInteger;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class EdmInt32Test extends PrimitiveTypeBaseTest {
 
-  private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance();
+  private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32);
 
   @Test
   public void compatibility() {
     assertTrue(instance.isCompatible(Uint7.getInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance()));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java
index d704770..f45ab49 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java
@@ -24,21 +24,20 @@ import static org.junit.Assert.assertTrue;
 import java.math.BigInteger;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class EdmInt64Test extends PrimitiveTypeBaseTest {
 
-  private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance();
+  private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64);
 
   @Test
   public void compatibility() {
     assertTrue(instance.isCompatible(Uint7.getInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance()));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32)));
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java
index 3a9daaf..5450be8 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java
@@ -21,7 +21,7 @@ package org.apache.olingo.commons.core.edm.primitivetype;
 import static org.junit.Assert.assertNull;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class EdmNullTest extends PrimitiveTypeBaseTest {
@@ -29,22 +29,26 @@ public class EdmNullTest extends PrimitiveTypeBaseTest {
   @Test
   public void checkNull() throws Exception {
     for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
-      final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
-      assertNull(instance.valueToString(null, null, null, null, null, null));
-      assertNull(instance.valueToString(null, true, null, null, null, null));
+      if (!kind.isGeospatial()) {
+        final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+        assertNull(instance.valueToString(null, null, null, null, null, null));
+        assertNull(instance.valueToString(null, true, null, null, null, null));
 
-      expectNullErrorInValueToString(instance);
+        expectNullErrorInValueToString(instance);
+      }
     }
   }
 
   @Test
   public void checkValueOfNull() throws Exception {
     for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
-      final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
-      assertNull(instance.valueOfString(null, null, null, null, null, null, instance.getDefaultType()));
-      assertNull(instance.valueOfString(null, true, null, null, null, null, instance.getDefaultType()));
+      if (!kind.isGeospatial()) {
+        final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+        assertNull(instance.valueOfString(null, null, null, null, null, null, instance.getDefaultType()));
+        assertNull(instance.valueOfString(null, true, null, null, null, null, instance.getDefaultType()));
 
-      expectNullErrorInValueOfString(instance);
+        expectNullErrorInValueOfString(instance);
+      }
     }
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java
index 0ebb342..88835e9 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java
@@ -24,13 +24,12 @@ import static org.junit.Assert.assertTrue;
 import java.math.BigInteger;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class EdmSByteTest extends PrimitiveTypeBaseTest {
 
-  private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance();
+  private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte);
 
   @Test
   public void compatibility() {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java
index 67847c7..9e90f22 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java
@@ -25,22 +25,21 @@ import java.math.BigDecimal;
 import java.math.BigInteger;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class EdmSingleTest extends PrimitiveTypeBaseTest {
 
-  private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance();
+  private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single);
 
   @Test
   public void compatibility() {
     assertTrue(instance.isCompatible(Uint7.getInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance()));
-    assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance()));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32)));
+    assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64)));
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java
index 993c943..bba0f91 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java
@@ -21,12 +21,12 @@ package org.apache.olingo.commons.core.edm.primitivetype;
 import static org.junit.Assert.assertEquals;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class EdmStringTest extends PrimitiveTypeBaseTest {
 
-  private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance();
+  private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String);
 
   @Test
   public void toUriLiteral() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java
index 8979df9..ee9b2b8 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java
@@ -24,12 +24,12 @@ import java.util.Calendar;
 import java.util.TimeZone;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.junit.Test;
 
 public class EdmTimeOfDayTest extends PrimitiveTypeBaseTest {
 
-  private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.TimeOfDay.getEdmPrimitiveTypeInstance();
+  private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay);
 
   @Test
   public void toUriLiteral() throws Exception {


[08/11] git commit: [OLINGO-214] Using Timestamp consistently for both V4 and V3 datetime types

Posted by il...@apache.org.
[OLINGO-214] Using Timestamp consistently for both V4 and V3 datetime types


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

Branch: refs/heads/olingo200
Commit: 130a49fed20c32a4f4d8272919e9bae4c9427d55
Parents: 5a15155
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 22 16:11:36 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 22 16:11:36 2014 +0100

----------------------------------------------------------------------
 .../core/edm/primitivetype/EdmDateTime.java     | 89 +++++++++++---------
 .../edm/primitivetype/EdmDateTimeOffset.java    | 68 +++++++++++++--
 .../core/edm/primitivetype/EdmTimeOfDay.java    | 45 ++++++++--
 3 files changed, 147 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/130a49fe/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java
index e061388..af2793b 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java
@@ -54,37 +54,43 @@ public final class EdmDateTime extends SingletonPrimitiveType {
           final Boolean isNullable, final Integer maxLength, final Integer precision,
           final Integer scale, final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException {
 
-    Calendar calendar = null;
-    Timestamp timestamp = null;
-
     final String[] dateParts = value.split("\\.");
+
+    final Date date;
     try {
-      final Date date = DATE_FORMAT.get().parse(dateParts[0]);
-      if (dateParts.length > 1) {
-        int idx = dateParts[1].indexOf('+');
-        if (idx == -1) {
-          idx = dateParts[1].indexOf('-');
-        }
-        if (idx == -1) {
-          calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
-          calendar.setTime(date);
-
-          timestamp = new Timestamp(calendar.getTimeInMillis());
-          timestamp.setNanos(Integer.parseInt(dateParts[1]));
-        } else {
-          calendar = Calendar.getInstance(TimeZone.getTimeZone(dateParts[1].substring(idx)));
-          calendar.setTime(date);
-
-          timestamp = new Timestamp(calendar.getTimeInMillis());
-          timestamp.setNanos(Integer.parseInt(dateParts[1].substring(0, idx)));
-        }
-      } else {
-        timestamp = new Timestamp(date.getTime());
-      }
+      date = DATE_FORMAT.get().parse(dateParts[0]);
     } catch (Exception e) {
       throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
     }
 
+    TimeZone timezone = null;
+    Integer fractionalSecs = null;
+    if (dateParts.length > 1) {
+      int idx = dateParts[1].indexOf('+');
+      if (idx == -1) {
+        idx = dateParts[1].indexOf('-');
+      }
+      if (idx == -1) {
+        fractionalSecs = Integer.parseInt(dateParts[1]);
+      } else {
+        timezone = TimeZone.getTimeZone(dateParts[1].substring(idx));
+        fractionalSecs = Integer.parseInt(dateParts[1].substring(0, idx));
+      }
+    }
+
+    if (fractionalSecs != null && String.valueOf(fractionalSecs).length() > (precision == null ? 0 : precision)) {
+      throw new EdmPrimitiveTypeException(
+              "EdmPrimitiveTypeException.LITERAL_FACETS_NOT_MATCHED.addContent(value, facets)");
+    }
+
+    final Calendar calendar = timezone == null ? Calendar.getInstance() : Calendar.getInstance(timezone);
+    calendar.setTime(date);
+    final Timestamp timestamp = new Timestamp(date.getTime());
+    if (fractionalSecs != null) {
+      calendar.set(Calendar.MILLISECOND, fractionalSecs);
+      timestamp.setNanos(fractionalSecs);
+    }
+
     if (returnType.isAssignableFrom(Calendar.class)) {
       return returnType.cast(calendar);
     } else if (returnType.isAssignableFrom(Timestamp.class)) {
@@ -100,25 +106,32 @@ public final class EdmDateTime extends SingletonPrimitiveType {
           final Boolean isNullable, final Integer maxLength, final Integer precision,
           final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
 
+    Date date = null;
+    Integer fractionalSecs = null;
     if (value instanceof Calendar) {
       final Calendar calendar = (Calendar) value;
-
-      final StringBuilder formatted = new StringBuilder().append(DATE_FORMAT.get().format(calendar.getTime()));
-      formatted.append(calendar.getTimeZone());
-
-      return formatted.toString();
-    } else if (value instanceof Timestamp) {
+      date = calendar.getTime();
+      fractionalSecs = calendar.get(Calendar.MILLISECOND);
+    }
+    if (value instanceof Timestamp) {
       final Timestamp timestamp = (Timestamp) value;
+      date = new Date(timestamp.getTime());
+      fractionalSecs = timestamp.getNanos();
+    }
 
-      final StringBuilder formatted = new StringBuilder().append(DATE_FORMAT.get().format(timestamp));
-      if (timestamp.getNanos() > 0) {
-        formatted.append('.').append(String.valueOf(timestamp.getNanos()));
-      }
+    final StringBuilder result = new StringBuilder().append(DATE_FORMAT.get().format(date));
 
-      return formatted.toString();
-    } else {
+    try {
+      if (value instanceof Timestamp) {
+        EdmDateTimeOffset.appendFractionalSeconds(result, fractionalSecs, precision);
+      } else {
+        EdmDateTimeOffset.appendMilliseconds(result, fractionalSecs, precision);
+      }
+    } catch (final IllegalArgumentException e) {
       throw new EdmPrimitiveTypeException(
-              "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+              "EdmPrimitiveTypeException.VALUE_FACETS_NOT_MATCHED.addContent(value, facets)", e);
     }
+
+    return result.toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/130a49fe/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffset.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffset.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffset.java
index 7a511d6..f1b707f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffset.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffset.java
@@ -18,6 +18,7 @@
  */
 package org.apache.olingo.commons.core.edm.primitivetype;
 
+import java.sql.Timestamp;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.TimeZone;
@@ -33,7 +34,7 @@ public final class EdmDateTimeOffset extends SingletonPrimitiveType {
 
   private static final Pattern PATTERN = Pattern.compile(
           "(-?\\p{Digit}{4,})-(\\p{Digit}{2})-(\\p{Digit}{2})"
-          + "T(\\p{Digit}{2}):(\\p{Digit}{2})(?::(\\p{Digit}{2})(\\.(\\p{Digit}{0,3}?)0*)?)?"
+          + "T(\\p{Digit}{2}):(\\p{Digit}{2})(?::(\\p{Digit}{2})(\\.(\\p{Digit}{0,12}?)0*)?)?"
           + "(Z|([-+]\\p{Digit}{2}:\\p{Digit}{2}))?");
 
   private static final EdmDateTimeOffset INSTANCE = new EdmDateTimeOffset();
@@ -74,6 +75,10 @@ public final class EdmDateTimeOffset extends SingletonPrimitiveType {
             Byte.parseByte(matcher.group(5)),
             matcher.group(6) == null ? 0 : Byte.parseByte(matcher.group(6)));
 
+    // cloning the original Calendar instance to avoid vanishing the Calendar value check - triggered by any
+    // get method - empowered by the convertDateTime() method below
+    final Timestamp timestamp = new Timestamp(((Calendar) dateTimeValue.clone()).getTimeInMillis());
+
     if (matcher.group(7) != null) {
       if (matcher.group(7).length() == 1 || matcher.group(7).length() > 13) {
         throw new EdmPrimitiveTypeException(
@@ -84,18 +89,28 @@ public final class EdmDateTimeOffset extends SingletonPrimitiveType {
         throw new EdmPrimitiveTypeException(
                 "EdmPrimitiveTypeException.LITERAL_FACETS_NOT_MATCHED.addContent(value, facets)");
       }
-      final String milliSeconds = decimals + "000".substring(decimals.length());
+      final String milliSeconds = decimals.length() > 3
+                                  ? decimals.substring(0, 3)
+                                  : decimals + "000".substring(decimals.length());
       dateTimeValue.set(Calendar.MILLISECOND, Short.parseShort(milliSeconds));
+
+      if (!decimals.isEmpty()) {
+        timestamp.setNanos(Integer.parseInt(decimals));
+      }
+    }
+
+    if (returnType.isAssignableFrom(Timestamp.class)) {
+      return returnType.cast(timestamp);
     }
 
     try {
       return convertDateTime(dateTimeValue, returnType);
     } catch (final IllegalArgumentException e) {
       throw new EdmPrimitiveTypeException(
-              "EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value), e");
+              "EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
     } catch (final ClassCastException e) {
       throw new EdmPrimitiveTypeException(
-              "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType), e");
+              "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)", e);
     }
   }
 
@@ -138,9 +153,19 @@ public final class EdmDateTimeOffset extends SingletonPrimitiveType {
           final Boolean isNullable, final Integer maxLength, final Integer precision,
           final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
 
-    final Calendar dateTimeValue = createDateTime(value);
+    final Calendar dateTimeValue;
+    final int fractionalSecs;
+    if (value instanceof Timestamp) {
+      final Calendar tmp = Calendar.getInstance();
+      tmp.setTimeInMillis(((Timestamp) value).getTime());
+      dateTimeValue = createDateTime(tmp);
+      fractionalSecs = ((Timestamp) value).getNanos();
+    } else {
+      dateTimeValue = createDateTime(value);
+      fractionalSecs = dateTimeValue.get(Calendar.MILLISECOND);
+    }
 
-    final StringBuilder result = new StringBuilder(23); // 23 characters are enough for millisecond precision.
+    final StringBuilder result = new StringBuilder();
     final int year = dateTimeValue.get(Calendar.YEAR);
     appendTwoDigits(result, year / 100);
     appendTwoDigits(result, year % 100);
@@ -156,10 +181,14 @@ public final class EdmDateTimeOffset extends SingletonPrimitiveType {
     appendTwoDigits(result, dateTimeValue.get(Calendar.SECOND));
 
     try {
-      appendMilliseconds(result, dateTimeValue.get(Calendar.MILLISECOND), precision);
+      if (value instanceof Timestamp) {
+        appendFractionalSeconds(result, fractionalSecs, precision);
+      } else {
+        appendMilliseconds(result, fractionalSecs, precision);
+      }
     } catch (final IllegalArgumentException e) {
       throw new EdmPrimitiveTypeException(
-              "EdmPrimitiveTypeException.VALUE_FACETS_NOT_MATCHED.addContent(value, facets), e");
+              "EdmPrimitiveTypeException.VALUE_FACETS_NOT_MATCHED.addContent(value, facets)", e);
     }
 
     final int offsetInMinutes = (dateTimeValue.get(Calendar.ZONE_OFFSET)
@@ -218,8 +247,9 @@ public final class EdmDateTimeOffset extends SingletonPrimitiveType {
    * @param result a {@link StringBuilder}
    * @param milliseconds an integer that must satisfy <code>0 &lt;= milliseconds &lt;= 999</code>
    * @param precision the upper limit for decimal digits (optional, defaults to zero)
+   * @throws IllegalArgumentException if precision is not met
    */
-  protected static void appendMilliseconds(final StringBuilder result, final long milliseconds,
+  protected static void appendMilliseconds(final StringBuilder result, final int milliseconds,
           final Integer precision) throws IllegalArgumentException {
     final int digits = milliseconds % 1000 == 0 ? 0 : milliseconds % 100 == 0 ? 1 : milliseconds % 10 == 0 ? 2 : 3;
     if (digits > 0) {
@@ -236,4 +266,24 @@ public final class EdmDateTimeOffset extends SingletonPrimitiveType {
       }
     }
   }
+
+  /**
+   * Appends the given fractional seconds to the given string builder.
+   *
+   * @param result a {@link StringBuilder}
+   * @param fractionalSeconds fractional seconds
+   * @param precision the upper limit for decimal digits (optional, defaults to zero)
+   * @throws IllegalArgumentException if precision is not met
+   */
+  protected static void appendFractionalSeconds(final StringBuilder result, final int fractionalSeconds,
+          final Integer precision) throws IllegalArgumentException {
+
+    if (fractionalSeconds > 0) {
+      if (precision == null || precision < String.valueOf(fractionalSeconds).length()) {
+        throw new IllegalArgumentException();
+      }
+
+      result.append('.').append(fractionalSeconds);
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/130a49fe/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDay.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDay.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDay.java
index 7d8cf9e..2003b09 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDay.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDay.java
@@ -18,6 +18,7 @@
  */
 package org.apache.olingo.commons.core.edm.primitivetype;
 
+import java.sql.Timestamp;
 import java.util.Calendar;
 import java.util.TimeZone;
 import java.util.regex.Matcher;
@@ -28,7 +29,7 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 public final class EdmTimeOfDay extends SingletonPrimitiveType {
 
   private static final Pattern PATTERN = Pattern.compile(
-          "(\\p{Digit}{2}):(\\p{Digit}{2})(?::(\\p{Digit}{2})(\\.(\\p{Digit}{0,3}?)0*)?)?");
+          "(\\p{Digit}{2}):(\\p{Digit}{2})(?::(\\p{Digit}{2})(\\.(\\p{Digit}{0,}?)0*)?)?");
 
   private static final EdmTimeOfDay INSTANCE = new EdmTimeOfDay();
 
@@ -57,6 +58,10 @@ public final class EdmTimeOfDay extends SingletonPrimitiveType {
     dateTimeValue.set(Calendar.MINUTE, Byte.parseByte(matcher.group(2)));
     dateTimeValue.set(Calendar.SECOND, matcher.group(3) == null ? 0 : Byte.parseByte(matcher.group(3)));
 
+    // cloning the original Calendar instance to avoid vanishing the Calendar value check - triggered by any
+    // get method - empowered by the convertDateTime() method below
+    final Timestamp timestamp = new Timestamp(((Calendar) dateTimeValue.clone()).getTimeInMillis());
+
     if (matcher.group(4) != null) {
       if (matcher.group(4).length() == 1 || matcher.group(4).length() > 13) {
         throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)");
@@ -66,18 +71,28 @@ public final class EdmTimeOfDay extends SingletonPrimitiveType {
         throw new EdmPrimitiveTypeException(
                 "EdmPrimitiveTypeException.LITERAL_FACETS_NOT_MATCHED.addContent(value, facets)");
       }
-      final String milliSeconds = decimals + "000".substring(decimals.length());
+      final String milliSeconds = decimals.length() > 3
+                                  ? decimals.substring(0, 3)
+                                  : decimals + "000".substring(decimals.length());
       dateTimeValue.set(Calendar.MILLISECOND, Short.parseShort(milliSeconds));
+
+      if (!decimals.isEmpty()) {
+        timestamp.setNanos(Integer.parseInt(decimals));
+      }
+    }
+
+    if (returnType.isAssignableFrom(Timestamp.class)) {
+      return returnType.cast(timestamp);
     }
 
     try {
       return EdmDateTimeOffset.convertDateTime(dateTimeValue, returnType);
     } catch (final IllegalArgumentException e) {
       throw new EdmPrimitiveTypeException(
-              "EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value), e");
+              "EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
     } catch (final ClassCastException e) {
       throw new EdmPrimitiveTypeException(
-              "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType), e");
+              "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)", e);
     }
   }
 
@@ -86,9 +101,19 @@ public final class EdmTimeOfDay extends SingletonPrimitiveType {
           final Boolean isNullable, final Integer maxLength, final Integer precision,
           final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
 
-    final Calendar dateTimeValue = EdmDateTimeOffset.createDateTime(value);
+    final Calendar dateTimeValue;
+    final int fractionalSecs;
+    if (value instanceof Timestamp) {
+      final Calendar tmp = Calendar.getInstance();
+      tmp.setTimeInMillis(((Timestamp) value).getTime());
+      dateTimeValue = EdmDateTimeOffset.createDateTime(tmp);
+      fractionalSecs = ((Timestamp) value).getNanos();
+    } else {
+      dateTimeValue = EdmDateTimeOffset.createDateTime(value);
+      fractionalSecs = dateTimeValue.get(Calendar.MILLISECOND);
+    }
 
-    final StringBuilder result = new StringBuilder(8); // Eight characters are enough for "normal" times.
+    final StringBuilder result = new StringBuilder();
     EdmDateTimeOffset.appendTwoDigits(result, dateTimeValue.get(Calendar.HOUR_OF_DAY));
     result.append(':');
     EdmDateTimeOffset.appendTwoDigits(result, dateTimeValue.get(Calendar.MINUTE));
@@ -96,10 +121,14 @@ public final class EdmTimeOfDay extends SingletonPrimitiveType {
     EdmDateTimeOffset.appendTwoDigits(result, dateTimeValue.get(Calendar.SECOND));
 
     try {
-      EdmDateTimeOffset.appendMilliseconds(result, dateTimeValue.get(Calendar.MILLISECOND), precision);
+      if (value instanceof Timestamp) {
+        EdmDateTimeOffset.appendFractionalSeconds(result, fractionalSecs, precision);
+      } else {
+        EdmDateTimeOffset.appendMilliseconds(result, fractionalSecs, precision);
+      }
     } catch (final IllegalArgumentException e) {
       throw new EdmPrimitiveTypeException(
-              "EdmPrimitiveTypeException.VALUE_FACETS_NOT_MATCHED.addContent(value, facets), e");
+              "EdmPrimitiveTypeException.VALUE_FACETS_NOT_MATCHED.addContent(value, facets)", e);
     }
 
     return result.toString();


[07/11] git commit: [OLINGO-65] Former ODataJClient's main type management classes removed

Posted by il...@apache.org.
[OLINGO-65] Former ODataJClient's main type management classes removed


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

Branch: refs/heads/olingo200
Commit: 5a15155ca9311e9af847bab5d9ee2c49fe2f153a
Parents: 559698d
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Mar 21 13:17:37 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Mar 21 13:17:37 2014 +0100

----------------------------------------------------------------------
 .../olingo/client/api/CommonODataClient.java    |   2 +-
 .../invoke/CommonInvokeRequestFactory.java      |  19 +-
 .../request/invoke/v3/InvokeRequestFactory.java |   3 +-
 .../request/invoke/v4/InvokeRequestFactory.java |   3 +-
 .../domain/ODataJClientEdmPrimitiveType.java    | 271 -------------------
 .../client/api/domain/ODataJClientEdmType.java  | 252 -----------------
 .../olingo/client/api/utils/URIUtils.java       |   7 +-
 .../invoke/AbstractInvokeRequestFactory.java    |  22 +-
 .../invoke/v3/InvokeRequestFactoryImpl.java     |  76 ++++--
 .../invoke/v4/InvokeRequestFactoryImpl.java     |  18 +-
 .../core/data/AtomPropertyDeserializer.java     |  24 +-
 11 files changed, 95 insertions(+), 602 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/5a15155c/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
index d0aef17..1ad480a 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
@@ -70,7 +70,7 @@ public interface CommonODataClient {
 
   CommonStreamedRequestFactory getStreamedRequestFactory();
 
-  CommonInvokeRequestFactory<?> getInvokeRequestFactory();
+  CommonInvokeRequestFactory getInvokeRequestFactory();
 
   CommonBatchRequestFactory getBatchRequestFactory();
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/5a15155c/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java
index 8449798..e7104bc 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java
@@ -20,39 +20,42 @@ package org.apache.olingo.client.api.communication.request.invoke;
 
 import java.io.Serializable;
 import java.net.URI;
-import java.util.Map;
+import java.util.LinkedHashMap;
 import org.apache.olingo.client.api.domain.ODataInvokeResult;
 import org.apache.olingo.client.api.domain.ODataValue;
-import org.apache.olingo.client.api.edm.xml.CommonFunctionImport;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
 
 /**
  * OData request factory class.
  */
-public interface CommonInvokeRequestFactory<FI extends CommonFunctionImport> extends Serializable {
+public interface CommonInvokeRequestFactory extends Serializable {
 
   /**
    * Gets an invoke request instance.
    *
    * @param <RES> OData domain object result, derived from return type defined in the function import
    * @param uri URI that identifies the function import
-   * @param metadata Edm metadata
+   * @param edm Edm metadata
+   * @param container Entity container
    * @param functionImport function import to be invoked
    * @return new ODataInvokeRequest instance.
    */
   <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
-          URI uri, XMLMetadata metadata, FI functionImport);
+          URI uri, Edm edm, FullQualifiedName container, String functionImport);
 
   /**
    * Gets an invoke request instance.
    *
    * @param <RES> OData domain object result, derived from return type defined in the function import
    * @param uri URI that identifies the function import
-   * @param metadata Edm metadata
+   * @param edm Edm metadata
+   * @param container Entity container
    * @param functionImport function import to be invoked
    * @param parameters parameters to pass to function import invocation
    * @return new ODataInvokeRequest instance.
    */
   <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
-          URI uri, XMLMetadata metadata, FI functionImport, Map<String, ODataValue> parameters);
+          URI uri, Edm edm, FullQualifiedName container, String functionImport,
+          LinkedHashMap<String, ODataValue> parameters);
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/5a15155c/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v3/InvokeRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v3/InvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v3/InvokeRequestFactory.java
index 12d5b24..476678e 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v3/InvokeRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v3/InvokeRequestFactory.java
@@ -19,7 +19,6 @@
 package org.apache.olingo.client.api.communication.request.invoke.v3;
 
 import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
-import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
 
-public interface InvokeRequestFactory extends CommonInvokeRequestFactory<FunctionImport> {
+public interface InvokeRequestFactory extends CommonInvokeRequestFactory {
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/5a15155c/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v4/InvokeRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v4/InvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v4/InvokeRequestFactory.java
index c2f194d..c9278f4 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v4/InvokeRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v4/InvokeRequestFactory.java
@@ -19,7 +19,6 @@
 package org.apache.olingo.client.api.communication.request.invoke.v4;
 
 import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
-import org.apache.olingo.client.api.edm.xml.v4.FunctionImport;
 
-public interface InvokeRequestFactory extends CommonInvokeRequestFactory<FunctionImport> {
+public interface InvokeRequestFactory extends CommonInvokeRequestFactory {
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/5a15155c/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java
deleted file mode 100644
index 5ea5edf..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.domain;
-
-import java.math.BigDecimal;
-import java.net.URI;
-import java.util.UUID;
-
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
-import org.apache.olingo.commons.api.edm.geo.LineString;
-import org.apache.olingo.commons.api.edm.geo.MultiLineString;
-import org.apache.olingo.commons.api.edm.geo.MultiPoint;
-import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
-import org.apache.olingo.commons.api.edm.geo.Point;
-import org.apache.olingo.commons.api.edm.geo.Polygon;
-
-/**
- * Represent the primitive types of the Entity Data Model (EDM).
- *
- * @see http://dl.windowsazure.com/javadoc/com/microsoft/windowsazure/services/table/models/EdmType.html
- * <p>
- * For an overview of the available EDM primitive data types and names, see the <a
- * href="http://www.odata.org/developers/protocols/overview#AbstractTypeSystem">Primitive Data Types</a> section of the
- * <a href="http://www.odata.org/developers/protocols/overview">OData Protocol Overview</a>.
- * </p>
- * <p>
- * The Abstract Type System used to define the primitive types supported by OData is defined in detail in <a
- * href="http://msdn.microsoft.com/en-us/library/dd541474.aspx">[MC-CSDL] (section 2.2.1).</a>
- * </p>
- * TODO: MERGE / REMOVE (OLINGO-65)!
- */
-public enum ODataJClientEdmPrimitiveType {
-
-  /**
-   * The absence of a value.
-   */
-  Null(Void.class),
-  /**
-   * An array of bytes.
-   */
-  Binary(byte[].class),
-  /**
-   * A Boolean value.
-   */
-  Boolean(Boolean.class),
-  /**
-   * Unsigned 8-bit integer value.
-   */
-  Byte(Integer.class),
-  /**
-   * A signed 8-bit integer value.
-   */
-  SByte(Byte.class),
-  /**
-   * A 64-bit value expressed as Coordinated Universal Time (UTC).
-   */
-  DateTime(new ODataServiceVersion[] {ODataServiceVersion.V30}, ODataTimestamp.class, "yyyy-MM-dd'T'HH:mm:ss"),
-  /**
-   * Date without a time-zone offset.
-   */
-  Date(new ODataServiceVersion[] {ODataServiceVersion.V40}, ODataTimestamp.class, "yyyy-MM-dd"),
-  /**
-   * Date and time as an Offset in minutes from GMT.
-   */
-  DateTimeOffset(ODataTimestamp.class, "yyyy-MM-dd'T'HH:mm:ss"),
-  /**
-   * The time of day with values ranging from 0:00:00.x to 23:59:59.y, where x and y depend upon the precision.
-   */
-  Time(new ODataServiceVersion[] {ODataServiceVersion.V30}, ODataDuration.class),
-  /**
-   * The time of day with values ranging from 0:00:00.x to 23:59:59.y, where x and y depend upon the precision.
-   */
-  TimeOfDay(new ODataServiceVersion[] {ODataServiceVersion.V40}, ODataDuration.class),
-  /**
-   * Signed duration in days, hours, minutes, and (sub)seconds.
-   */
-  Duration(new ODataServiceVersion[] {ODataServiceVersion.V40}, ODataDuration.class),
-  /**
-   * Numeric values with fixed precision and scale.
-   */
-  Decimal(BigDecimal.class, "#.#######################"),
-  /**
-   * A floating point number with 7 digits precision.
-   */
-  Single(Float.class, "#.#######E0"),
-  /**
-   * A 64-bit double-precision floating point value.
-   */
-  Double(Double.class, "#.#######################E0"),
-  // --- Geospatial ---
-  Geography(Geospatial.class),
-  GeographyPoint(Point.class),
-  GeographyLineString(LineString.class),
-  GeographyPolygon(Polygon.class),
-  GeographyMultiPoint(MultiPoint.class),
-  GeographyMultiLineString(MultiLineString.class),
-  GeographyMultiPolygon(MultiPolygon.class),
-  GeographyCollection(GeospatialCollection.class),
-  Geometry(Geospatial.class),
-  GeometryPoint(Point.class),
-  GeometryLineString(LineString.class),
-  GeometryPolygon(Polygon.class),
-  GeometryMultiPoint(MultiPoint.class),
-  GeometryMultiLineString(MultiLineString.class),
-  GeometryMultiPolygon(MultiPolygon.class),
-  GeometryCollection(GeospatialCollection.class),
-  /**
-   * A 128-bit globally unique identifier.
-   */
-  Guid(UUID.class),
-  /**
-   * A 16-bit integer value.
-   */
-  Int16(Short.class),
-  /**
-   * A 32-bit integer value.
-   */
-  Int32(Integer.class),
-  /**
-   * A 64-bit integer value.
-   */
-  Int64(Long.class),
-  /**
-   * A UTF-16-encoded value. String values may be up to 64 KB in size.
-   */
-  String(String.class),
-  /**
-   * Resource stream (for media entities).
-   */
-  Stream(URI.class);
-
-  private final Class<?> clazz;
-
-  private final String pattern;
-
-  private final ODataServiceVersion[] versions;
-
-  /**
-   * Constructor (all OData versions).
-   *
-   * @param clazz type.
-   */
-  ODataJClientEdmPrimitiveType(final Class<?> clazz) {
-    this(ODataServiceVersion.values(), clazz, null);
-  }
-
-  /**
-   * Constructor.
-   *
-   * @param versions supported OData versions.
-   * @param clazz type.
-   */
-  ODataJClientEdmPrimitiveType(final ODataServiceVersion[] versions, final Class<?> clazz) {
-    this(versions, clazz, null);
-  }
-
-  /**
-   * Constructor (all OData versions).
-   *
-   * @param clazz type.
-   * @param pattern pattern.
-   */
-  ODataJClientEdmPrimitiveType(final Class<?> clazz, final String pattern) {
-    this(ODataServiceVersion.values(), clazz, pattern);
-  }
-
-  /**
-   * Constructor.
-   *
-   * @param versions supported OData versions.
-   * @param clazz type.
-   * @param pattern pattern.
-   */
-  ODataJClientEdmPrimitiveType(final ODataServiceVersion[] versions, final Class<?> clazz, final String pattern) {
-    this.clazz = clazz;
-    this.pattern = pattern;
-    this.versions = versions.clone();
-  }
-
-  /**
-   * Gets pattern.
-   *
-   * @return pattern.
-   */
-  public String pattern() {
-    return pattern;
-  }
-
-  /**
-   * Gets corresponding java type.
-   *
-   * @return java type.
-   */
-  public Class<?> javaType() {
-    return this.clazz;
-  }
-
-  /**
-   * {@inheritDoc }
-   */
-  @Override
-  public String toString() {
-    return namespace() + "." + name();
-  }
-
-  /**
-   * Checks if is a geospatial type.
-   *
-   * @return <tt>true</tt> if is geospatial type; <tt>false</tt> otherwise.
-   */
-  public boolean isGeospatial() {
-    return name().startsWith("Geo");
-  }
-
-  /**
-   * Checks if the given type is a geospatial type.
-   *
-   * @param type type.
-   * @return <tt>true</tt> if is geospatial type; <tt>false</tt> otherwise.
-   */
-  public static boolean isGeospatial(final String type) {
-    return type != null && type.startsWith(namespace() + ".Geo");
-  }
-
-  /**
-   * Gets <tt>EdmSimpleType</tt> from string.
-   *
-   * @param value string value type.
-   * @return <tt>EdmSimpleType</tt> object.
-   */
-  public static ODataJClientEdmPrimitiveType fromValue(final String value) {
-    final String noNsValue = value.substring(4);
-    for (ODataJClientEdmPrimitiveType edmSimpleType : ODataJClientEdmPrimitiveType.values()) {
-      if (edmSimpleType.name().equals(noNsValue)) {
-        return edmSimpleType;
-      }
-    }
-    throw new IllegalArgumentException(value);
-  }
-
-  /**
-   * Gets namespace.
-   *
-   * @return namespace.
-   */
-  public static String namespace() {
-    return "Edm";
-  }
-
-  public ODataServiceVersion[] getSupportedVersions() {
-    return versions.clone();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/5a15155c/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmType.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmType.java
deleted file mode 100644
index 7fcfad6..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmType.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.domain;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.edm.xml.ComplexType;
-import org.apache.olingo.client.api.edm.xml.EntityType;
-import org.apache.olingo.client.api.edm.xml.EnumType;
-import org.apache.olingo.client.api.edm.xml.Schema;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-
-/**
- * Parse type information from metadata into semantic data. TODO: REMOVE! (OLINGO-165)
- */
-public class ODataJClientEdmType {
-
-  private final String typeExpression;
-
-  private final String baseType;
-
-  private final String namespaceOrAlias;
-
-  private boolean collection;
-
-  private ODataJClientEdmPrimitiveType primitiveType;
-
-  private EnumType enumType;
-
-  private ComplexType complexType;
-
-  private EntityType entityType;
-
-  /**
-   * Constructor.
-   *
-   * @param typeExpression type expression.
-   */
-  public ODataJClientEdmType(final String typeExpression) {
-    this(null, typeExpression);
-  }
-
-  /**
-   * Constructor.
-   *
-   * @param metadata metadata.
-   * @param typeExpression type expression.
-   */
-  public ODataJClientEdmType(final XMLMetadata metadata, final String typeExpression) {
-    this.typeExpression = typeExpression;
-
-    final int collectionStartIdx = typeExpression.indexOf("Collection(");
-    final int collectionEndIdx = typeExpression.lastIndexOf(')');
-    if (collectionStartIdx == -1) {
-      baseType = typeExpression;
-    } else {
-      if (collectionEndIdx == -1) {
-        throw new IllegalArgumentException("Malformed type: " + typeExpression);
-      }
-
-      this.collection = true;
-      baseType = typeExpression.substring(collectionStartIdx + 11, collectionEndIdx);
-    }
-
-    final int lastDotIdx = baseType.lastIndexOf('.');
-    if (lastDotIdx == -1) {
-      throw new IllegalArgumentException("Cannot find namespace or alias in " + typeExpression);
-    }
-    namespaceOrAlias = baseType.substring(0, lastDotIdx);
-    final String typeName = baseType.substring(lastDotIdx + 1);
-    if (StringUtils.isBlank(typeName)) {
-      throw new IllegalArgumentException("Null or empty type name in " + typeExpression);
-    }
-
-    if (namespaceOrAlias.equals(ODataJClientEdmPrimitiveType.namespace())) {
-      this.primitiveType = ODataJClientEdmPrimitiveType.fromValue(
-              ODataJClientEdmPrimitiveType.namespace() + "." + typeName);
-    } else if (metadata != null) {
-      if (!metadata.isNsOrAlias(namespaceOrAlias)) {
-        throw new IllegalArgumentException("Illegal namespace or alias: " + namespaceOrAlias);
-      }
-      final Schema schema = metadata.getSchema(namespaceOrAlias);
-
-      for (EnumType type : schema.getEnumTypes()) {
-        if (typeName.equals(type.getName())) {
-          this.enumType = type;
-        }
-      }
-      if (this.enumType == null) {
-        for (ComplexType type : schema.getComplexTypes()) {
-          if (typeName.equals(type.getName())) {
-            this.complexType = type;
-          }
-        }
-        if (this.complexType == null) {
-          for (EntityType type : schema.getEntityTypes()) {
-            if (typeName.equals(type.getName())) {
-              this.entityType = type;
-            }
-          }
-        }
-      }
-
-      if (!isPrimitiveType() && !isEnumType() && !isComplexType() && !isEntityType()) {
-        throw new IllegalArgumentException("Could not parse type information out of " + typeExpression);
-      }
-    }
-  }
-
-  /**
-   * Checks if is a collection.
-   *
-   * @return 'TRUE' if is a collection; 'FALSE' otherwise.
-   */
-  public final boolean isCollection() {
-    return this.collection;
-  }
-
-  /**
-   * Checks if is a simple type.
-   *
-   * @return 'TRUE' if is a simple type; 'FALSE' otherwise.
-   */
-  public final boolean isPrimitiveType() {
-    return this.primitiveType != null;
-  }
-
-  public boolean isGeospatialType() {
-    return isPrimitiveType() && this.primitiveType.isGeospatial();
-  }
-
-  /**
-   * Gets type as a simple type.
-   *
-   * @return simple type. An <tt>EdmTypeNotFoundException</tt> will be raised if it is not a simple type.
-   */
-  public final ODataJClientEdmPrimitiveType getPrimitiveType() {
-    if (!isPrimitiveType()) {
-      throw new IllegalArgumentException("Cannot find Primitive in " + this.typeExpression);
-    }
-
-    return this.primitiveType;
-  }
-
-  /**
-   * Checks if is an enum type.
-   *
-   * @return 'TRUE' if is an enum type; 'FALSE' otherwise.
-   */
-  public final boolean isEnumType() {
-    return this.enumType != null;
-  }
-
-  /**
-   * Gets type as enum type.
-   *
-   * @return enum type. An <tt>EdmTypeNotFoundException</tt> will be raised if it is not an enum type.
-   */
-  public final EnumType getEnumType() {
-    if (!isEnumType()) {
-      throw new IllegalArgumentException("Cannot find Enum in " + this.typeExpression);
-    }
-
-    return this.enumType;
-  }
-
-  /**
-   * Checks if is a complex type.
-   *
-   * @return 'TRUE' if is a complex type; 'FALSE' otherwise.
-   */
-  public final boolean isComplexType() {
-    return this.complexType != null;
-  }
-
-  /**
-   * Gets type as complex type.
-   *
-   * @return complex type. An <tt>EdmTypeNotFoundException</tt> will be raised if it is not a complex type.
-   */
-  public final ComplexType getComplexType() {
-    if (!isComplexType()) {
-      throw new IllegalArgumentException("Cannot find Complex in " + this.typeExpression);
-    }
-
-    return this.complexType;
-  }
-
-  /**
-   * Checks if is an entity type.
-   *
-   * @return 'TRUE' if is an entity type; 'FALSE' otherwise.
-   */
-  public final boolean isEntityType() {
-    return this.entityType != null;
-  }
-
-  /**
-   * Gets type as entity type.
-   *
-   * @return entity type. An <tt>EdmTypeNotFoundException</tt> will be raised if it is not an entity type.
-   */
-  public final EntityType getEntityType() {
-    if (!isEntityType()) {
-      throw new IllegalArgumentException("Cannot find Entity in " + this.typeExpression);
-    }
-
-    return this.entityType;
-  }
-
-  /**
-   * Gets base type.
-   *
-   * @return base type.
-   */
-  public String getBaseType() {
-    return baseType;
-  }
-
-  /**
-   * Gets type expression.
-   *
-   * @return type expression.
-   */
-  public String getTypeExpression() {
-    return typeExpression;
-  }
-
-  /**
-   * Gets namespace or alias retrieved from the provided type expression.
-   *
-   * @return namespace or alias.
-   */
-  public String getNamespaceOrAlias() {
-    return namespaceOrAlias;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/5a15155c/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
index 3885ead..9ba47da 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
@@ -32,7 +32,6 @@ import org.apache.commons.io.IOUtils;
 import org.apache.http.entity.InputStreamEntity;
 import org.apache.olingo.client.api.Constants;
 import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
 import org.apache.olingo.client.api.domain.ODataDuration;
 import org.apache.olingo.client.api.domain.ODataTimestamp;
 import org.apache.olingo.commons.api.edm.EdmEntityContainer;
@@ -158,11 +157,11 @@ public final class URIUtils {
               : (obj instanceof ODataDuration)
               ? "time'" + ((ODataDuration) obj).toString() + "'"
               : (obj instanceof BigDecimal)
-              ? new DecimalFormat(ODataJClientEdmPrimitiveType.Decimal.pattern()).format((BigDecimal) obj) + "M"
+              ? new DecimalFormat("#.#######################").format((BigDecimal) obj) + "M"
               : (obj instanceof Double)
-              ? new DecimalFormat(ODataJClientEdmPrimitiveType.Double.pattern()).format((Double) obj) + "D"
+              ? new DecimalFormat("#.#######################E0").format((Double) obj) + "D"
               : (obj instanceof Float)
-              ? new DecimalFormat(ODataJClientEdmPrimitiveType.Single.pattern()).format((Float) obj) + "f"
+              ? new DecimalFormat("#.#######E0").format((Float) obj) + "f"
               : (obj instanceof Long)
               ? ((Long) obj).toString() + "L"
               : (obj instanceof String)

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/5a15155c/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java
index 64aa550..a9c6dfc 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java
@@ -19,17 +19,14 @@
 package org.apache.olingo.client.core.communication.request.invoke;
 
 import java.net.URI;
-import java.util.Map;
 import org.apache.olingo.client.api.CommonODataClient;
 import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
 import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
 import org.apache.olingo.client.api.domain.ODataInvokeResult;
-import org.apache.olingo.client.api.domain.ODataValue;
-import org.apache.olingo.client.api.edm.xml.CommonFunctionImport;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
 
-public abstract class AbstractInvokeRequestFactory<FI extends CommonFunctionImport>
-        implements CommonInvokeRequestFactory<FI> {
+public abstract class AbstractInvokeRequestFactory implements CommonInvokeRequestFactory {
 
   private static final long serialVersionUID = -906760270085197249L;
 
@@ -40,13 +37,10 @@ public abstract class AbstractInvokeRequestFactory<FI extends CommonFunctionImpo
   }
 
   @Override
-  public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
-          final URI uri,
-          final XMLMetadata metadata,
-          final FI functionImport,
-          final Map<String, ODataValue> parameters) {
-    final ODataInvokeRequest<RES> result = getInvokeRequest(uri, metadata, functionImport);
-    result.setParameters(parameters);
-    return result;
+  public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(final URI uri, final Edm edm,
+          final FullQualifiedName container, final String functionImport) {
+
+    return getInvokeRequest(uri, edm, container, functionImport, null);
   }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/5a15155c/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
index e387b2e..f5cb270 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
@@ -19,7 +19,8 @@
 package org.apache.olingo.client.core.communication.request.invoke.v3;
 
 import java.net.URI;
-import org.apache.commons.lang3.StringUtils;
+import java.util.LinkedHashMap;
+import java.util.List;
 import org.apache.olingo.client.api.v3.ODataClient;
 import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
 import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
@@ -27,16 +28,22 @@ import org.apache.olingo.client.api.communication.request.invoke.v3.InvokeReques
 import org.apache.olingo.client.api.domain.ODataEntity;
 import org.apache.olingo.client.api.domain.ODataEntitySet;
 import org.apache.olingo.client.api.domain.ODataInvokeResult;
-import org.apache.olingo.client.api.domain.ODataJClientEdmType;
 import org.apache.olingo.client.api.domain.ODataProperty;
-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.domain.ODataValue;
 import org.apache.olingo.client.api.http.HttpMethod;
 import org.apache.olingo.client.core.communication.request.invoke.AbstractInvokeRequestFactory;
 import org.apache.olingo.client.core.communication.request.invoke.ODataInvokeRequestImpl;
+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;
+import org.apache.olingo.commons.api.edm.EdmFunction;
+import org.apache.olingo.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.commons.api.edm.EdmReturnType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
 
-public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory<FunctionImport>
-        implements InvokeRequestFactory {
+public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory implements InvokeRequestFactory {
 
   private static final long serialVersionUID = -659256862901915496L;
 
@@ -44,40 +51,53 @@ public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory<Funct
     super(client);
   }
 
-  /**
-   * {@inheritDoc}
-   */
   @Override
-  @SuppressWarnings("unchecked")
-  public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
-          final URI uri,
-          final XMLMetadata metadata,
-          final FunctionImport functionImport) {
+  public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(final URI uri, final Edm edm,
+          final FullQualifiedName container, final String functionImport,
+          final LinkedHashMap<String, ODataValue> parameters) {
+
+    final EdmEntityContainer edmContainer = edm.getEntityContainer(container);
+    if (edmContainer == null) {
+      throw new IllegalArgumentException("Could not find container " + container.toString());
+    }
+
+    final HttpMethod method;
+    final EdmReturnType returnType;
+    final EdmFunctionImport edmFunctionImport = edmContainer.getFunctionImport(functionImport);
+    final EdmActionImport edmActionImport = edmContainer.getActionImport(functionImport);
+    if (edmFunctionImport == null && edmActionImport == null) {
+      throw new IllegalArgumentException("Could not find function import " + functionImport
+              + " in the given container");
+    } else if (edmFunctionImport == null) {
+      final EdmAction action = edmActionImport.getAction();
+      if (action == null) {
+        throw new IllegalArgumentException("Could not find function import " + functionImport
+                + " in the given container");
+      }
 
-    HttpMethod method = null;
-    if (HttpMethod.GET.name().equals(functionImport.getHttpMethod())) {
-      method = HttpMethod.GET;
-    } else if (HttpMethod.POST.name().equals(functionImport.getHttpMethod())) {
       method = HttpMethod.POST;
-    } else if (functionImport.getHttpMethod() == null) {
-      if (functionImport.isSideEffecting()) {
-        method = HttpMethod.POST;
-      } else {
-        method = HttpMethod.GET;
+      returnType = action.getReturnType();
+    } else {
+      final EdmFunction function = edmFunctionImport.getFunction(
+              parameters == null ? null : (List<String>) parameters.keySet());
+      if (function == null) {
+        throw new IllegalArgumentException("Could not find function import " + functionImport
+                + " in the given container");
       }
+
+      method = HttpMethod.GET;
+      returnType = function.getReturnType();
     }
 
     ODataInvokeRequest<RES> result;
-    if (StringUtils.isBlank(functionImport.getReturnType())) {
+    if (returnType == null) {
       result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataNoContent>(
               client, ODataNoContent.class, method, uri);
     } else {
-      final ODataJClientEdmType returnType = new ODataJClientEdmType(metadata, functionImport.getReturnType());
-
-      if (returnType.isCollection() && returnType.isEntityType()) {
+      if (returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) {
         result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataEntitySet>(
                 client, ODataEntitySet.class, method, uri);
-      } else if (!returnType.isCollection() && returnType.isEntityType()) {
+      } else if (!returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) {
         result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataEntity>(
                 client, ODataEntity.class, method, uri);
       } else {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/5a15155c/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java
index ab35401..0e7f4b1 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java
@@ -19,16 +19,18 @@
 package org.apache.olingo.client.core.communication.request.invoke.v4;
 
 import java.net.URI;
+import java.util.LinkedHashMap;
+import org.apache.commons.lang3.NotImplementedException;
 import org.apache.olingo.client.api.v4.ODataClient;
 import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
 import org.apache.olingo.client.api.communication.request.invoke.v4.InvokeRequestFactory;
 import org.apache.olingo.client.api.domain.ODataInvokeResult;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-import org.apache.olingo.client.api.edm.xml.v4.FunctionImport;
+import org.apache.olingo.client.api.domain.ODataValue;
 import org.apache.olingo.client.core.communication.request.invoke.AbstractInvokeRequestFactory;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
 
-public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory<FunctionImport>
-        implements InvokeRequestFactory {
+public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory implements InvokeRequestFactory {
 
   private static final long serialVersionUID = 8452737360003104372L;
 
@@ -37,8 +39,10 @@ public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory<Funct
   }
 
   @Override
-  public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
-          final URI uri, final XMLMetadata metadata, final FunctionImport functionImport) {
-    throw new UnsupportedOperationException("Not supported yet.");
+  public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(final URI uri, final Edm edm,
+          final FullQualifiedName container, final String functionImport,
+          final LinkedHashMap<String, ODataValue> parameters) {
+
+    throw new NotImplementedException("Not available yet.");
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/5a15155c/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
index 00e6ac7..9780e12 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
@@ -28,8 +28,8 @@ import org.apache.olingo.client.api.Constants;
 import org.apache.olingo.client.api.data.CollectionValue;
 import org.apache.olingo.client.api.data.ComplexValue;
 import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.client.api.domain.ODataJClientEdmType;
 import org.apache.olingo.client.api.domain.ODataPropertyType;
+import org.apache.olingo.client.core.edm.EdmTypeInfo;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 
@@ -43,7 +43,7 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
   }
 
   private Value fromPrimitive(final XMLEventReader reader, final StartElement start,
-          final ODataJClientEdmType typeInfo) throws XMLStreamException {
+          final EdmTypeInfo typeInfo) throws XMLStreamException {
 
     Value value = null;
 
@@ -52,14 +52,15 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
       final XMLEvent event = reader.nextEvent();
 
       if (event.isStartElement()) {
-        if (typeInfo != null && typeInfo.isGeospatialType()) {
-          final EdmPrimitiveTypeKind geoType = EdmPrimitiveTypeKind.valueOfFQN(version, typeInfo.getBaseType());
+        if (typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
+          final EdmPrimitiveTypeKind geoType = EdmPrimitiveTypeKind.valueOfFQN(
+                  version, typeInfo.getFullQualifiedName().toString());
           value = new GeospatialValueImpl(this.geoDeserializer.deserialize(reader, event.asStartElement(), geoType));
         }
       }
 
       if (event.isCharacters() && !event.asCharacters().isWhiteSpace()
-              && (typeInfo == null || !typeInfo.isGeospatialType())) {
+              && (typeInfo == null || !typeInfo.getPrimitiveTypeKind().isGeospatial())) {
 
         value = new PrimitiveValueImpl(event.asCharacters().getData());
       }
@@ -94,13 +95,13 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
   }
 
   private CollectionValue fromCollection(final XMLEventReader reader, final StartElement start,
-          final ODataJClientEdmType typeInfo) throws XMLStreamException {
+          final EdmTypeInfo typeInfo) throws XMLStreamException {
 
     final CollectionValueImpl value = new CollectionValueImpl();
 
-    final ODataJClientEdmType type = typeInfo == null
+    final EdmTypeInfo type = typeInfo == null
             ? null
-            : new ODataJClientEdmType(typeInfo.getBaseType());
+            : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
 
     boolean foundEndProperty = false;
     while (reader.hasNext() && !foundEndProperty) {
@@ -176,12 +177,9 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
     Value value;
     final Attribute nullAttr = start.getAttributeByName(this.nullQName);
     if (nullAttr == null) {
-      final ODataJClientEdmType typeInfo = StringUtils.isBlank(property.getType())
+      final EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
               ? null
-              : new ODataJClientEdmType(property.getType());
-//      final EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
-//              ? null
-//              : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
+              : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
 
       final ODataPropertyType propType = typeInfo == null
               ? guessPropertyType(reader)