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

[20/52] [abbrv] git commit: [OLINGO-65] Implementation completed

[OLINGO-65] Implementation completed


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

Branch: refs/heads/olingo-206-validator
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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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);
+  }
+
+}