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

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

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/odata4/client/api/uri/filter/V4FilterArgFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/odata4/client/api/uri/filter/V4FilterArgFactory.java b/lib/client-api/src/main/java/org/apache/olingo/odata4/client/api/uri/filter/V4FilterArgFactory.java
deleted file mode 100644
index acf9c5c..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/odata4/client/api/uri/filter/V4FilterArgFactory.java
+++ /dev/null
@@ -1,55 +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.odata4.client.api.uri.filter;
-
-public interface V4FilterArgFactory extends FilterArgFactory {
-
-  FilterArg contains(FilterArg first, FilterArg second);
-
-  FilterArg fractionalseconds(FilterArg param);
-
-  FilterArg date(FilterArg param);
-
-  FilterArg time(FilterArg param);
-
-  FilterArg totaloffsetminutes(FilterArg param);
-
-  FilterArg now();
-
-  FilterArg mindatetime();
-
-  FilterArg maxdatetime();
-
-  FilterArg totalseconds(FilterArg param);
-
-  FilterArg cast(FilterArg type);
-
-  FilterArg cast(FilterArg expression, FilterArg type);
-
-  FilterArg geoDistance(FilterArg first, FilterArg second);
-
-  FilterArg geoIntersects(FilterArg first, FilterArg second);
-
-  FilterArg geoLength(FilterArg first, FilterArg second);
-
-  FilterArg any(FilterArg collection, URIFilter expression);
-
-  FilterArg all(FilterArg collection, URIFilter expression);
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/odata4/client/api/uri/filter/V4FilterFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/odata4/client/api/uri/filter/V4FilterFactory.java b/lib/client-api/src/main/java/org/apache/olingo/odata4/client/api/uri/filter/V4FilterFactory.java
deleted file mode 100644
index 0328774..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/odata4/client/api/uri/filter/V4FilterFactory.java
+++ /dev/null
@@ -1,32 +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.odata4.client.api.uri.filter;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
-
-public interface V4FilterFactory extends FilterFactory {
-
-  @Override
-  V4FilterArgFactory getArgFactory();
-
-  URIFilter has(String key, EdmEnumType enumType, String memberName);
-
-  URIFilter has(FilterArg left, EdmEnumType enumType, String memberName);
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/odata4/client/api/utils/EdmTypeInfo.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/odata4/client/api/utils/EdmTypeInfo.java b/lib/client-api/src/main/java/org/apache/olingo/odata4/client/api/utils/EdmTypeInfo.java
deleted file mode 100644
index 33dd468..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/odata4/client/api/utils/EdmTypeInfo.java
+++ /dev/null
@@ -1,81 +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.odata4.client.api.utils;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
-
-public class EdmTypeInfo {
-
-  private final String typeExpression;
-
-  private final boolean collection;
-
-  private final FullQualifiedName fullQualifiedName;
-
-  public EdmTypeInfo(final String typeExpression, final String defaultNamespace) {
-    this(typeExpression.indexOf('.') == -1
-            ? defaultNamespace + "." + typeExpression
-            : typeExpression);
-  }
-
-  public EdmTypeInfo(final String typeExpression) {
-    this.typeExpression = typeExpression;
-
-    String baseType;
-    final int collStartIdx = typeExpression.indexOf("Collection(");
-    final int collEndIdx = typeExpression.lastIndexOf(')');
-    if (collStartIdx == -1) {
-      baseType = typeExpression;
-      this.collection = false;
-    } else {
-      if (collEndIdx == -1) {
-        throw new IllegalArgumentException("Malformed type: " + typeExpression);
-      }
-
-      this.collection = true;
-      baseType = typeExpression.substring(collStartIdx + 11, collEndIdx);
-    }
-
-    final int lastDotIdx = baseType.lastIndexOf('.');
-    if (lastDotIdx == -1) {
-      throw new IllegalArgumentException("Cannot find namespace or alias in " + typeExpression);
-    }
-    final String namespace = 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);
-    }
-
-    this.fullQualifiedName = new FullQualifiedName(namespace, typeName);
-  }
-
-  public String getTypeExpression() {
-    return typeExpression;
-  }
-
-  public boolean isCollection() {
-    return collection;
-  }
-
-  public FullQualifiedName getFullQualifiedName() {
-    return fullQualifiedName;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-api/src/main/java/org/apache/olingo/odata4/client/api/utils/XMLUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/odata4/client/api/utils/XMLUtils.java b/lib/client-api/src/main/java/org/apache/olingo/odata4/client/api/utils/XMLUtils.java
deleted file mode 100644
index e1d580a..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/odata4/client/api/utils/XMLUtils.java
+++ /dev/null
@@ -1,176 +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.odata4.client.api.utils;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.parsers.DocumentBuilderFactory;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.odata4.client.api.Constants;
-import org.apache.olingo.odata4.client.api.domain.EdmSimpleType;
-import org.apache.olingo.odata4.client.api.domain.geospatial.Geospatial;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * XML utilities.
- */
-public final class XMLUtils {
-
-  /**
-   * DOM factory.
-   */
-  public static final DocumentBuilderFactory DOC_BUILDER_FACTORY = DocumentBuilderFactory.newInstance();
-
-  private XMLUtils() {
-    // Empty private constructor for static utility classes       
-  }
-
-  /**
-   * Gets XML node name.
-   *
-   * @param node node.
-   * @return node name.
-   */
-  public static String getSimpleName(final Node node) {
-    return node.getLocalName() == null
-            ? node.getNodeName().substring(node.getNodeName().indexOf(':') + 1)
-            : node.getLocalName();
-  }
-
-  /**
-   * Gets the given node's children of the given type.
-   *
-   * @param node parent.
-   * @param nodetype searched child type.
-   * @return children.
-   */
-  public static List<Node> getChildNodes(final Node node, final short nodetype) {
-    final List<Node> result = new ArrayList<Node>();
-
-    final NodeList children = node.getChildNodes();
-    for (int i = 0; i < children.getLength(); i++) {
-      final Node child = children.item(i);
-      if (child.getNodeType() == nodetype) {
-        result.add(child);
-      }
-    }
-
-    return result;
-  }
-
-  /**
-   * Gets the given node's children with the given name.
-   *
-   * @param node parent.
-   * @param name searched child name.
-   * @return children.
-   */
-  public static List<Element> getChildElements(final Element node, final String name) {
-    final List<Element> result = new ArrayList<Element>();
-
-    if (StringUtils.isNotBlank(name)) {
-      final NodeList children = node.getChildNodes();
-      for (int i = 0; i < children.getLength(); i++) {
-        final Node child = children.item(i);
-        if ((child instanceof Element) && name.equals(child.getNodeName())) {
-          result.add((Element) child);
-        }
-      }
-    }
-
-    return result;
-  }
-
-  /**
-   * Checks if the given node has <tt>element</tt> children.
-   *
-   * @param node parent.
-   * @return 'TRUE' if the given node has at least one <tt>element</tt> child; 'FALSE' otherwise.
-   */
-  public static boolean hasElementsChildNode(final Node node) {
-    boolean found = false;
-
-    for (Node child : getChildNodes(node, Node.ELEMENT_NODE)) {
-      if (Constants.ELEM_ELEMENT.equals(XMLUtils.getSimpleName(child))) {
-        found = true;
-      }
-    }
-
-    return found;
-  }
-
-  /**
-   * Checks if the given node has only text children.
-   *
-   * @param node parent.
-   * @return 'TRUE' if the given node has only text children; 'FALSE' otherwise.
-   */
-  public static boolean hasOnlyTextChildNodes(final Node node) {
-    boolean result = true;
-    final NodeList children = node.getChildNodes();
-    for (int i = 0; result && i < children.getLength(); i++) {
-      final Node child = children.item(i);
-      if (child.getNodeType() != Node.TEXT_NODE) {
-        result = false;
-      }
-    }
-
-    return result;
-  }
-
-  public static EdmSimpleType simpleTypeForNode(final Geospatial.Dimension dimension, final Node node) {
-    EdmSimpleType type = null;
-
-    if (Constants.ELEM_POINT.equals(node.getNodeName())) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? EdmSimpleType.GeographyPoint
-              : EdmSimpleType.GeometryPoint;
-    } else if (Constants.ELEM_MULTIPOINT.equals(node.getNodeName())) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? EdmSimpleType.GeographyMultiPoint
-              : EdmSimpleType.GeometryMultiPoint;
-    } else if (Constants.ELEM_LINESTRING.equals(node.getNodeName())) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? EdmSimpleType.GeographyLineString
-              : EdmSimpleType.GeometryLineString;
-    } else if (Constants.ELEM_MULTILINESTRING.equals(node.getNodeName())) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? EdmSimpleType.GeographyMultiLineString
-              : EdmSimpleType.GeometryMultiLineString;
-    } else if (Constants.ELEM_POLYGON.equals(node.getNodeName())) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? EdmSimpleType.GeographyPolygon
-              : EdmSimpleType.GeometryPolygon;
-    } else if (Constants.ELEM_MULTIPOLYGON.equals(node.getNodeName())) {
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? EdmSimpleType.GeographyMultiPolygon
-              : EdmSimpleType.GeometryMultiPolygon;
-    } else if (Constants.ELEM_GEOCOLLECTION.equals(node.getNodeName())
-            || Constants.ELEM_GEOMEMBERS.equals(node.getNodeName())) {
-
-      type = dimension == Geospatial.Dimension.GEOGRAPHY
-              ? EdmSimpleType.GeographyCollection
-              : EdmSimpleType.GeometryCollection;
-    }
-
-    return type;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractConfiguration.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractConfiguration.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractConfiguration.java
new file mode 100644
index 0000000..78d0e9e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractConfiguration.java
@@ -0,0 +1,198 @@
+/*
+ * 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;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.apache.olingo.client.api.Configuration;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.format.ODataMediaFormat;
+import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.client.api.format.ODataValueFormat;
+import org.apache.olingo.client.api.http.HttpClientFactory;
+import org.apache.olingo.client.api.http.HttpUriRequestFactory;
+import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
+import org.apache.olingo.client.core.http.DefaultHttpUriRequestFactory;
+
+public abstract class AbstractConfiguration implements Configuration {
+
+  private static final String DEFAULT_PUB_FORMAT = "pubFormat";
+
+  private static final String DEFAULT_VALUE_FORMAT = "valueFormat";
+
+  private static final String DEFAULT_MEDIA_FORMAT = "valueFormat";
+
+  private static final String HTTP_CLIENT_FACTORY = "httpClientFactory";
+
+  private static final String HTTP_URI_REQUEST_FACTORY = "httpUriRequestFactory";
+
+  private static final String USE_XHTTP_METHOD = "useHTTPMethod";
+
+  private static final String GZIP_COMPRESSION = "gzipCompression";
+
+  private static final String CHUNKING = "chunking";
+
+  private final Map<String, Object> CONF = new HashMap<String, Object>();
+
+  private transient ExecutorService executor = Executors.newFixedThreadPool(10);
+
+  /**
+   * Gets given configuration property.
+   *
+   * @param key key value of the property to be retrieved.
+   * @param defaultValue default value to be used in case of the given key doesn't exist.
+   * @return property value if exists; default value if does not exist.
+   */
+  protected Object getProperty(final String key, final Object defaultValue) {
+    return CONF.containsKey(key) ? CONF.get(key) : defaultValue;
+  }
+
+  /**
+   * Sets new configuration property.
+   *
+   * @param key configuration property key.
+   * @param value configuration property value.
+   * @return given value.
+   */
+  protected Object setProperty(final String key, final Object value) {
+    return CONF.put(key, value);
+  }
+
+  @Override
+  public ODataPubFormat getDefaultPubFormat() {
+    return ODataPubFormat.valueOf(
+            getProperty(DEFAULT_PUB_FORMAT, ODataPubFormat.JSON_FULL_METADATA.name()).toString());
+  }
+
+  @Override
+  public void setDefaultPubFormat(final ODataPubFormat format) {
+    setProperty(DEFAULT_PUB_FORMAT, format.name());
+  }
+
+  @Override
+  public ODataFormat getDefaultFormat() {
+    ODataFormat format;
+
+    switch (getDefaultPubFormat()) {
+      case ATOM:
+        format = ODataFormat.XML;
+        break;
+
+      case JSON_FULL_METADATA:
+        format = ODataFormat.JSON_FULL_METADATA;
+        break;
+
+      case JSON_NO_METADATA:
+        format = ODataFormat.JSON_NO_METADATA;
+        break;
+
+      case JSON:
+      default:
+        format = ODataFormat.JSON;
+    }
+
+    return format;
+  }
+
+  @Override
+  public ODataValueFormat getDefaultValueFormat() {
+    return ODataValueFormat.valueOf(
+            getProperty(DEFAULT_VALUE_FORMAT, ODataValueFormat.TEXT.name()).toString());
+  }
+
+  @Override
+  public void setDefaultValueFormat(final ODataValueFormat format) {
+    setProperty(DEFAULT_VALUE_FORMAT, format.name());
+  }
+
+  @Override
+  public ODataMediaFormat getDefaultMediaFormat() {
+    return ODataMediaFormat.valueOf(
+            getProperty(DEFAULT_VALUE_FORMAT, ODataMediaFormat.APPLICATION_OCTET_STREAM.name()).toString());
+  }
+
+  @Override
+  public void setDefaultMediaFormat(final ODataMediaFormat format) {
+    setProperty(DEFAULT_MEDIA_FORMAT, format.name());
+  }
+
+  @Override
+  public HttpClientFactory getHttpClientFactory() {
+    return (HttpClientFactory) getProperty(HTTP_CLIENT_FACTORY, new DefaultHttpClientFactory());
+  }
+
+  @Override
+  public void setHttpClientFactory(final HttpClientFactory factory) {
+    setProperty(HTTP_CLIENT_FACTORY, factory);
+  }
+
+  @Override
+  public HttpUriRequestFactory getHttpUriRequestFactory() {
+    return (HttpUriRequestFactory) getProperty(HTTP_URI_REQUEST_FACTORY, new DefaultHttpUriRequestFactory());
+  }
+
+  @Override
+  public void setHttpUriRequestFactory(final HttpUriRequestFactory factory) {
+    setProperty(HTTP_URI_REQUEST_FACTORY, factory);
+  }
+
+  @Override
+  public boolean isUseXHTTPMethod() {
+    return (Boolean) getProperty(USE_XHTTP_METHOD, false);
+  }
+
+  @Override
+  public void setUseXHTTPMethod(final boolean value) {
+    setProperty(USE_XHTTP_METHOD, value);
+  }
+
+  @Override
+  public boolean isGzipCompression() {
+    return (Boolean) getProperty(GZIP_COMPRESSION, false);
+  }
+
+  @Override
+  public void setGzipCompression(final boolean value) {
+    setProperty(GZIP_COMPRESSION, value);
+  }
+
+  @Override
+  public boolean isUseChuncked() {
+    return (Boolean) getProperty(CHUNKING, true);
+  }
+
+  @Override
+  public void setUseChuncked(final boolean value) {
+    setProperty(CHUNKING, value);
+  }
+
+  @Override
+  public ExecutorService getExecutor() {
+    return executor;
+  }
+
+  @Override
+  public void setExecutor(final ExecutorService executorService) {
+    executor = executorService;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/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
new file mode 100644
index 0000000..35bb385
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core;
+
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.domain.ODataGeospatialValue;
+import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
+
+abstract class AbstractODataClient implements ODataClient {
+
+  private static final long serialVersionUID = 7269096702397630265L;
+
+  public ODataPrimitiveValue.Builder getPrimitiveValueBuilder() {
+    return new ODataPrimitiveValue.Builder(this);
+  }
+
+  public ODataGeospatialValue.Builder getGeospatialValueBuilder() {
+    return new ODataGeospatialValue.Builder(this);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java
new file mode 100644
index 0000000..f45b725
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core;
+
+import org.apache.olingo.client.api.ODataV3Client;
+import org.apache.olingo.client.api.ODataV4Client;
+
+public final class ODataClientFactory {
+
+  public static ODataV3Client getV3() {
+    return new ODataV3ClientImpl();
+  }
+
+  public static ODataV4Client getV4() {
+    return new ODataV4ClientImpl();
+  }
+
+  private ODataClientFactory() {
+    // empty constructory for static utility class
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataV3ClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataV3ClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataV3ClientImpl.java
new file mode 100644
index 0000000..70ed75a
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataV3ClientImpl.java
@@ -0,0 +1,146 @@
+/*
+ * 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;
+
+import org.apache.olingo.client.api.ODataV3Client;
+import org.apache.olingo.client.api.V3Configuration;
+import org.apache.olingo.client.api.op.ODataBinder;
+import org.apache.olingo.client.api.op.ODataReader;
+import org.apache.olingo.client.api.op.ODataSerializer;
+import org.apache.olingo.client.api.op.ODataV3Deserializer;
+import org.apache.olingo.client.api.uri.V3URIBuilder;
+import org.apache.olingo.client.api.uri.filter.V3FilterFactory;
+import org.apache.olingo.client.core.op.impl.ODataV3BinderImpl;
+import org.apache.olingo.client.core.op.impl.ODataV3DeserializerImpl;
+import org.apache.olingo.client.core.op.impl.ODataV3ReaderImpl;
+import org.apache.olingo.client.core.op.impl.ODataV3SerializerImpl;
+import org.apache.olingo.client.core.uri.V3URIBuilderImpl;
+import org.apache.olingo.client.core.uri.filter.V3FilterFactoryImpl;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public class ODataV3ClientImpl extends AbstractODataClient implements ODataV3Client {
+
+  private static final long serialVersionUID = -1655712193243609209L;
+
+  private final V3Configuration configuration = new V3ConfigurationImpl();
+
+  private final V3FilterFactory filterFactory = new V3FilterFactoryImpl();
+
+  private final ODataV3Deserializer deserializer = new ODataV3DeserializerImpl(this);
+
+  private final ODataSerializer serializer = new ODataV3SerializerImpl(this);
+
+  private final ODataReader reader = new ODataV3ReaderImpl(this);
+
+//  private final ODataWriterImpl writer = new ODataWriterImpl(this);
+  private final ODataBinder binder = new ODataV3BinderImpl(this);
+
+//  private final ODataObjectFactory objectFactory = new ODataObjectFactoryImpl(this);
+//
+//  private final V3RetrieveRequestFactory retrieveReqFact = new V3RetrieveRequestFactory(this);
+//
+//  private final V3CUDRequestFactory cudReqFact = new V3CUDRequestFactory(this);
+//
+//  private final V3StreamedRequestFactory streamedReqFact = new V3StreamedRequestFactory(this);
+//
+//  private final V3InvokeRequestFactory invokeReqFact = new V3InvokeRequestFactory(this);
+//
+//  private final V3BatchRequestFactory batchReqFact = new V3BatchRequestFactory(this);
+  @Override
+  public ODataServiceVersion getServiceVersion() {
+    return ODataServiceVersion.V30;
+  }
+
+//  @Override
+//  public ODataHeaders getVersionHeaders() {
+//    final ODataHeaders odataHeaders = new ODataHeaders();
+//    odataHeaders.setHeader(ODataHeaders.HeaderName.minDataServiceVersion, ODataVersion.V3.toString());
+//    odataHeaders.setHeader(ODataHeaders.HeaderName.maxDataServiceVersion, ODataVersion.V3.toString());
+//    odataHeaders.setHeader(ODataHeaders.HeaderName.dataServiceVersion, ODataVersion.V3.toString());
+//    return odataHeaders;
+//  }
+  @Override
+  public V3Configuration getConfiguration() {
+    return configuration;
+  }
+
+  @Override
+  public V3URIBuilder getURIBuilder(final String serviceRoot) {
+    return new V3URIBuilderImpl(configuration, serviceRoot);
+  }
+
+  @Override
+  public V3FilterFactory getFilterFactory() {
+    return filterFactory;
+  }
+
+  @Override
+  public ODataV3Deserializer getDeserializer() {
+    return deserializer;
+  }
+
+  @Override
+  public ODataSerializer getSerializer() {
+    return serializer;
+  }
+
+  @Override
+  public ODataReader getReader() {
+    return reader;
+  }
+
+//  @Override
+//  public ODataWriterImpl getWriter() {
+//    return writer;
+//  }
+  @Override
+  public ODataBinder getBinder() {
+    return binder;
+  }
+
+//  @Override
+//  public ODataObjectFactoryImpl getObjectFactory() {
+//    return objectFactory;
+//  }
+//
+//  @Override
+//  public V3RetrieveRequestFactory getRetrieveRequestFactory() {
+//    return retrieveReqFact;
+//  }
+//
+//  @Override
+//  public V3CUDRequestFactory getCUDRequestFactory() {
+//    return cudReqFact;
+//  }
+//
+//  @Override
+//  public V3StreamedRequestFactory getStreamedRequestFactory() {
+//    return streamedReqFact;
+//  }
+//
+//  @Override
+//  public V3InvokeRequestFactory getInvokeRequestFactory() {
+//    return invokeReqFact;
+//  }
+//
+//  @Override
+//  public V3BatchRequestFactory getBatchRequestFactory() {
+//    return batchReqFact;
+//  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataV4ClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataV4ClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataV4ClientImpl.java
new file mode 100644
index 0000000..c3c5e14
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataV4ClientImpl.java
@@ -0,0 +1,146 @@
+/*
+ * 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;
+
+import org.apache.olingo.client.api.ODataV4Client;
+import org.apache.olingo.client.api.V4Configuration;
+import org.apache.olingo.client.api.op.ODataBinder;
+import org.apache.olingo.client.api.op.ODataReader;
+import org.apache.olingo.client.api.op.ODataSerializer;
+import org.apache.olingo.client.api.op.ODataV4Deserializer;
+import org.apache.olingo.client.api.uri.V4URIBuilder;
+import org.apache.olingo.client.api.uri.filter.V4FilterFactory;
+import org.apache.olingo.client.core.op.impl.ODataV4BinderImpl;
+import org.apache.olingo.client.core.op.impl.ODataV4DeserializerImpl;
+import org.apache.olingo.client.core.op.impl.ODataV4ReaderImpl;
+import org.apache.olingo.client.core.op.impl.ODataV4SerializerImpl;
+import org.apache.olingo.client.core.uri.V4URIBuilderImpl;
+import org.apache.olingo.client.core.uri.filter.V4FilterFactoryImpl;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public class ODataV4ClientImpl extends AbstractODataClient implements ODataV4Client {
+
+  private static final long serialVersionUID = -6653176125573631964L;
+
+  private final V4Configuration configuration = new V4ConfigurationImpl();
+
+  private final V4FilterFactory filterFactory = new V4FilterFactoryImpl();
+
+  private final ODataV4Deserializer deserializer = new ODataV4DeserializerImpl(this);
+
+  private final ODataSerializer serializer = new ODataV4SerializerImpl(this);
+
+  private final ODataReader reader = new ODataV4ReaderImpl(this);
+
+//    private final ODataWriter writer = new ODataWriterImpl(this);
+  private final ODataBinder binder = new ODataV4BinderImpl(this);
+
+//    private final ODataObjectFactory objectFactory = new ODataObjectFactoryImpl(this);
+//
+//    private final V4RetrieveRequestFactory retrieveReqFact = new V4RetrieveRequestFactory(this);
+//
+//    private final V4CUDRequestFactory cudReqFact = new V4CUDRequestFactory(this);
+//
+//    private final V4StreamedRequestFactory streamedReqFact = new V4StreamedRequestFactory(this);
+//
+//    private final V4InvokeRequestFactory invokeReqFact = new V4InvokeRequestFactory(this);
+//
+//    private final V4BatchRequestFactory batchReqFact = new V4BatchRequestFactory(this);
+  @Override
+  public ODataServiceVersion getServiceVersion() {
+    return ODataServiceVersion.V40;
+  }
+//
+//    @Override
+//    public ODataHeaders getVersionHeaders() {
+//        final ODataHeaders odataHeaders = new ODataHeaders();
+//        odataHeaders.setHeader(ODataHeaders.HeaderName.maxDataServiceVersion, ODataVersion.V4.toString());
+//        odataHeaders.setHeader(ODataHeaders.HeaderName.dataServiceVersion, ODataVersion.V4.toString());
+//        return odataHeaders;
+//    }
+
+  @Override
+  public V4Configuration getConfiguration() {
+    return configuration;
+  }
+
+  @Override
+  public V4URIBuilder getURIBuilder(final String serviceRoot) {
+    return new V4URIBuilderImpl(serviceRoot);
+  }
+
+  @Override
+  public V4FilterFactory getFilterFactory() {
+    return filterFactory;
+  }
+
+  @Override
+  public ODataV4Deserializer getDeserializer() {
+    return deserializer;
+  }
+
+  @Override
+  public ODataSerializer getSerializer() {
+    return serializer;
+  }
+
+  @Override
+  public ODataReader getReader() {
+    return reader;
+  }
+
+//    @Override
+//    public ODataWriterImpl getWriter() {
+//        return writer;
+//    }
+  @Override
+  public ODataBinder getBinder() {
+    return binder;
+  }
+
+//    @Override
+//    public ODataObjectFactoryImpl getObjectFactory() {
+//        return objectFactory;
+//    }
+//
+//    @Override
+//    public V4RetrieveRequestFactory getRetrieveRequestFactory() {
+//        return retrieveReqFact;
+//    }
+//
+//    @Override
+//    public V4CUDRequestFactory getCUDRequestFactory() {
+//        return cudReqFact;
+//    }
+//
+//    @Override
+//    public V4StreamedRequestFactory getStreamedRequestFactory() {
+//        return streamedReqFact;
+//    }
+//
+//    @Override
+//    public V4InvokeRequestFactory getInvokeRequestFactory() {
+//        return invokeReqFact;
+//    }
+//
+//    @Override
+//    public V4BatchRequestFactory getBatchRequestFactory() {
+//        return batchReqFact;
+//    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/V3ConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/V3ConfigurationImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/V3ConfigurationImpl.java
new file mode 100644
index 0000000..3844794
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/V3ConfigurationImpl.java
@@ -0,0 +1,57 @@
+/*
+ * 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;
+
+import org.apache.olingo.client.api.V3Configuration;
+
+public class V3ConfigurationImpl extends AbstractConfiguration implements V3Configuration {
+
+  private static final long serialVersionUID = -8719958537946884777L;
+
+  private static final String KEY_AS_SEGMENT = "keyAsSegment";
+
+  protected V3ConfigurationImpl() {
+    super();
+  }
+
+  /**
+   * Checks whether URIs contain entity key between parentheses (standard) or instead as additional segment. Example:
+   * http://services.odata.org/V4/OData/OData.svc/Products(0) or http://services.odata.org/V4/OData/OData.svc/Products/0
+   *
+   * @return whether URIs shall be built with entity key between parentheses (standard) or instead as additional
+   * segment.
+   */
+  @Override
+  public boolean isKeyAsSegment() {
+    return (Boolean) getProperty(KEY_AS_SEGMENT, false);
+  }
+
+  /**
+   * Sets whether URIs shall be built with entity key between parentheses (standard) or instead as additional segment.
+   * Example: http://services.odata.org/V4/OData/OData.svc/Products(0) or
+   * http://services.odata.org/V4/OData/OData.svc/Products/0
+   *
+   * @param value 'TRUE' to use this feature.
+   */
+  @Override
+  public void setKeyAsSegment(final boolean value) {
+    setProperty(KEY_AS_SEGMENT, value);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/V4ConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/V4ConfigurationImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/V4ConfigurationImpl.java
new file mode 100644
index 0000000..11c579e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/V4ConfigurationImpl.java
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+import org.apache.olingo.client.api.V4Configuration;
+
+public class V4ConfigurationImpl extends AbstractConfiguration implements V4Configuration {
+
+  private static final long serialVersionUID = -1134213707190176857L;
+
+  protected V4ConfigurationImpl() {
+    super();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java
new file mode 100644
index 0000000..57ba0ef
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java
@@ -0,0 +1,146 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.data.ServiceDocumentItem;
+
+public abstract class AbstractServiceDocument implements ServiceDocument {
+
+  private String title;
+
+  private final List<ServiceDocumentItem> entitySets = new ArrayList<ServiceDocumentItem>();
+
+  @Override
+  public String getMetadataContext() {
+    return null;
+  }
+
+  @Override
+  public String getMetadataETag() {
+    return null;
+  }
+
+  @Override
+  public String getTitle() {
+    return title;
+  }
+
+  public void setTitle(final String title) {
+    this.title = title;
+  }
+
+  protected ServiceDocumentItem getByName(final List<ServiceDocumentItem> elements, final String name) {
+    ServiceDocumentItem result = null;
+    for (ServiceDocumentItem element : elements) {
+      if (name.equals(element.getName())) {
+        result = element;
+      }
+    }
+    return result;
+  }
+
+  protected ServiceDocumentItem getByTitle(final List<ServiceDocumentItem> elements, final String title) {
+    ServiceDocumentItem result = null;
+    for (ServiceDocumentItem element : elements) {
+      if (title.equals(element.getTitle())) {
+        result = element;
+      }
+    }
+    return result;
+  }
+
+  @Override
+  public List<ServiceDocumentItem> getEntitySets() {
+    return entitySets;
+  }
+
+  @Override
+  public ServiceDocumentItem getEntitySetByName(final String name) {
+    return getByName(getEntitySets(), name);
+  }
+
+  @Override
+  public ServiceDocumentItem getEntitySetByTitle(final String title) {
+    return getByTitle(getEntitySets(), title);
+  }
+
+  @Override
+  public List<ServiceDocumentItem> getFunctionImports() {
+    return Collections.<ServiceDocumentItem>emptyList();
+  }
+
+  @Override
+  public ServiceDocumentItem getFunctionImportByName(final String name) {
+    return getByName(getFunctionImports(), name);
+  }
+
+  @Override
+  public ServiceDocumentItem getFunctionImportByTitle(final String title) {
+    return getByTitle(getFunctionImports(), title);
+  }
+
+  @Override
+  public List<ServiceDocumentItem> getSingletons() {
+    return Collections.<ServiceDocumentItem>emptyList();
+  }
+
+  @Override
+  public ServiceDocumentItem getSingletonByName(final String name) {
+    return getByName(getSingletons(), name);
+  }
+
+  @Override
+  public ServiceDocumentItem getSingletonByTitle(final String title) {
+    return getByTitle(getSingletons(), title);
+  }
+
+  @Override
+  public List<ServiceDocumentItem> getRelatedServiceDocuments() {
+    return Collections.<ServiceDocumentItem>emptyList();
+  }
+
+  @Override
+  public ServiceDocumentItem getRelatedServiceDocumentByTitle(final String title) {
+    return getByTitle(getRelatedServiceDocuments(), title);
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    return EqualsBuilder.reflectionEquals(this, obj);
+  }
+
+  @Override
+  public int hashCode() {
+    return HashCodeBuilder.reflectionHashCode(this);
+  }
+
+  @Override
+  public String toString() {
+    return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
new file mode 100644
index 0000000..10f5664
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.data;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.ODataConstants;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public class JSONServiceDocumentDeserializer extends ODataJacksonDeserializer<AbstractServiceDocument> {
+
+  @Override
+  protected AbstractServiceDocument doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
+          throws IOException, JsonProcessingException {
+
+    final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
+
+    final AbstractServiceDocument serviceDocument = ODataServiceVersion.V30 == client.getServiceVersion()
+            ? new org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl()
+            : new org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl();
+
+    if (tree.hasNonNull(ODataConstants.JSON_METADATA)
+            && serviceDocument instanceof org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl) {
+
+      ((org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl) serviceDocument).
+              setMetadata(tree.get(ODataConstants.JSON_METADATA).textValue());
+    }
+    if (tree.hasNonNull(ODataConstants.JSON_CONTEXT)
+            && serviceDocument instanceof org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl) {
+
+      ((org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl) serviceDocument).
+              setMetadataContext(tree.get(ODataConstants.JSON_CONTEXT).textValue());
+    }
+
+    for (final Iterator<JsonNode> itor = tree.get(ODataConstants.JSON_VALUE).elements(); itor.hasNext();) {
+      final JsonNode node = itor.next();
+
+      final ServiceDocumentItemImpl item = new ServiceDocumentItemImpl();
+      item.setName(node.get("name").asText());
+      if (node.has("title")) {
+        item.setTitle(node.get("title").asText());
+      }
+      item.setHref(node.get("url").asText());
+
+      final String kind = node.has("kind") ? node.get("kind").asText() : null;
+      if (StringUtils.isBlank(kind) || "EntitySet".equals(kind)) {
+        serviceDocument.getEntitySets().add(item);
+      } else if ("Singleton".equals(kind)) {
+        serviceDocument.getSingletons().add(item);
+      } else if ("FunctionImport".equals(kind)) {
+        serviceDocument.getFunctionImports().add(item);
+      } else if ("ServiceDocument".equals(kind)) {
+        serviceDocument.getRelatedServiceDocuments().add(item);
+      }
+    }
+
+    return serviceDocument;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonDeserializer.java
new file mode 100644
index 0000000..7ed323e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonDeserializer.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.data;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+
+import java.io.IOException;
+
+import org.apache.olingo.client.api.ODataClient;
+
+abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
+
+  protected ODataClient client;
+
+  protected abstract T doDeserialize(JsonParser jp, DeserializationContext ctxt)
+          throws IOException, JsonProcessingException;
+
+  @Override
+  public T deserialize(final JsonParser jp, final DeserializationContext ctxt)
+          throws IOException, JsonProcessingException {
+
+    client = (ODataClient) ctxt.findInjectableValue(ODataClient.class.getName(), null, null);
+    return doDeserialize(jp, ctxt);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonSerializer.java
new file mode 100644
index 0000000..7802116
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonSerializer.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.data;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+
+import java.io.IOException;
+
+import org.apache.olingo.client.api.ODataClient;
+
+abstract class ODataJacksonSerializer<T> extends JsonSerializer<T> {
+
+  protected ODataClient client;
+
+  protected abstract void doSerialize(T value, JsonGenerator jgen, SerializerProvider provider)
+          throws IOException, JsonProcessingException;
+
+  @Override
+  public void serialize(final T value, final JsonGenerator jgen, final SerializerProvider provider)
+          throws IOException, JsonProcessingException {
+
+    client = (ODataClient) provider.getAttribute(ODataClient.class);
+    doSerialize(value, jgen, provider);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ServiceDocumentItemImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ServiceDocumentItemImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ServiceDocumentItemImpl.java
new file mode 100644
index 0000000..57d5840
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ServiceDocumentItemImpl.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.data;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+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.data.ServiceDocumentItem;
+
+public class ServiceDocumentItemImpl implements ServiceDocumentItem {
+
+  private String name;
+
+  private String title;
+
+  @JsonProperty("url")
+  private String href;
+
+  @Override
+  public String getName() {
+    return name;
+  }
+
+  public void setName(final String name) {
+    this.name = name;
+  }
+
+  @Override
+  public String getTitle() {
+    return title;
+  }
+
+  public void setTitle(final String title) {
+    this.title = title;
+  }
+
+  @Override
+  public String getHref() {
+    return href;
+  }
+
+  public void setHref(final String href) {
+    this.href = href;
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    return EqualsBuilder.reflectionEquals(this, obj);
+  }
+
+  @Override
+  public int hashCode() {
+    return HashCodeBuilder.reflectionHashCode(this);
+  }
+
+  @Override
+  public String toString() {
+    return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
new file mode 100644
index 0000000..da2017f
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.data;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public class XMLServiceDocumentDeserializer extends ODataJacksonDeserializer<ServiceDocument> {
+
+  private String getTitle(final JsonParser jp) throws IOException {
+    String title = jp.nextTextValue();
+    if (title == null) {
+      jp.nextToken();
+      jp.nextToken();
+      jp.nextToken();
+      title = jp.nextTextValue();
+    }
+    return title;
+  }
+
+  private ServiceDocumentItemImpl deserializeElement(final JsonParser jp, final String elementName)
+          throws IOException {
+
+    final ServiceDocumentItemImpl element = new ServiceDocumentItemImpl();
+    for (; jp.getCurrentToken() != JsonToken.END_OBJECT
+            || !elementName.equals(((FromXmlParser) jp).getStaxReader().getLocalName()); jp.nextToken()) {
+
+      final JsonToken token = jp.getCurrentToken();
+      if (token == JsonToken.FIELD_NAME) {
+        if ("href".equals(jp.getCurrentName())) {
+          element.setHref(jp.nextTextValue());
+        } else if ("name".equals(jp.getCurrentName())) {
+          element.setName(jp.nextTextValue());
+        } else if ("title".equals(jp.getCurrentName())) {
+          element.setTitle(getTitle(jp));
+        }
+      }
+    }
+
+    return element;
+  }
+
+  @Override
+  protected ServiceDocument doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+          throws IOException, JsonProcessingException {
+
+    final AbstractServiceDocument sdoc = ODataServiceVersion.V30 == client.getServiceVersion()
+            ? new org.apache.olingo.client.core.data.v3.XMLServiceDocumentImpl()
+            : new org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl();
+
+    for (; jp.getCurrentToken() != JsonToken.END_OBJECT
+            || !"service".equals(((FromXmlParser) jp).getStaxReader().getLocalName()); jp.nextToken()) {
+
+      final JsonToken token = jp.getCurrentToken();
+      if (token == JsonToken.FIELD_NAME) {
+        if ("base".equals(jp.getCurrentName())) {
+          if (sdoc instanceof org.apache.olingo.client.core.data.v3.XMLServiceDocumentImpl) {
+            ((org.apache.olingo.client.core.data.v3.XMLServiceDocumentImpl) sdoc).
+                    setBaseURI(URI.create(jp.nextTextValue()));
+          } else {
+            ((org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl) sdoc).
+                    setBaseURI(URI.create(jp.nextTextValue()));
+          }
+        } else if ("context".equals(jp.getCurrentName())) {
+          ((org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl) sdoc).
+                  setMetadataContext(jp.nextTextValue());
+        } else if ("metadata-etag".equals(jp.getCurrentName())) {
+          ((org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl) sdoc).
+                  setMetadataETag(jp.nextTextValue());
+        } else if ("workspace".equals(jp.getCurrentName())) {
+          jp.nextToken();
+          jp.nextToken();
+          if ("title".equals(jp.getCurrentName())) {
+            sdoc.setTitle(getTitle(jp));
+          }
+        } else if ("collection".equals(jp.getCurrentName())) {
+          jp.nextToken();
+          sdoc.getEntitySets().add(deserializeElement(jp, "collection"));
+        } else if ("function-import".equals(jp.getCurrentName())) {
+          jp.nextToken();
+          sdoc.getFunctionImports().add(deserializeElement(jp, "function-import"));
+        } else if ("singleton".equals(jp.getCurrentName())) {
+          jp.nextToken();
+          sdoc.getSingletons().add(deserializeElement(jp, "singleton"));
+        } else if ("service-document".equals(jp.getCurrentName())) {
+          jp.nextToken();
+          sdoc.getRelatedServiceDocuments().add(deserializeElement(jp, "service-document"));
+        }
+      }
+    }
+
+    return sdoc;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
new file mode 100644
index 0000000..659e91c
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
@@ -0,0 +1,67 @@
+/*
+ * 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.v3;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.net.URI;
+
+import org.apache.olingo.client.api.uri.SegmentType;
+import org.apache.olingo.client.core.data.AbstractServiceDocument;
+import org.apache.olingo.client.core.data.JSONServiceDocumentDeserializer;
+
+/**
+ * Service document, represented via JSON.
+ */
+@JsonDeserialize(using = JSONServiceDocumentDeserializer.class)
+public class JSONServiceDocumentImpl extends AbstractServiceDocument {
+
+  private static final long serialVersionUID = 4195734928526398830L;
+
+  private String metadata;
+
+  @Override
+  public URI getBaseURI() {
+    URI baseURI = null;
+    if (metadata != null) {
+      final String metadataURI = getMetadata();
+      baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(SegmentType.METADATA.getValue())));
+    }
+
+    return baseURI;
+  }
+
+  /**
+   * Gets the metadata URI.
+   *
+   * @return the metadata URI
+   */
+  public String getMetadata() {
+    return metadata;
+  }
+
+  /**
+   * Sets the metadata URI.
+   *
+   * @param metadata metadata URI.
+   */
+  public void setMetadata(final String metadata) {
+    this.metadata = metadata;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLServiceDocumentImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLServiceDocumentImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLServiceDocumentImpl.java
new file mode 100644
index 0000000..682f500
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLServiceDocumentImpl.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.data.v3;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.net.URI;
+
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.core.data.AbstractServiceDocument;
+import org.apache.olingo.client.core.data.XMLServiceDocumentDeserializer;
+
+@JsonDeserialize(using = XMLServiceDocumentDeserializer.class)
+public class XMLServiceDocumentImpl extends AbstractServiceDocument implements ServiceDocument {
+
+  private URI baseURI;
+
+  @Override
+  public URI getBaseURI() {
+    return this.baseURI;
+  }
+
+  /**
+   * Sets base URI.
+   *
+   * @param baseURI base URI.
+   */
+  public void setBaseURI(final URI baseURI) {
+    this.baseURI = baseURI;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/AbstractServiceDocument.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/AbstractServiceDocument.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/AbstractServiceDocument.java
new file mode 100644
index 0000000..47f294f
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/AbstractServiceDocument.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.data.v4;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.client.api.data.ServiceDocumentItem;
+
+public abstract class AbstractServiceDocument
+        extends org.apache.olingo.client.core.data.AbstractServiceDocument {
+
+  private URI baseURI;
+
+  private String metadataContext;
+
+  private String metadataETag;
+
+  private List<ServiceDocumentItem> functionImports = new ArrayList<ServiceDocumentItem>();
+
+  private List<ServiceDocumentItem> singletons = new ArrayList<ServiceDocumentItem>();
+
+  private List<ServiceDocumentItem> relatedServiceDocuments = new ArrayList<ServiceDocumentItem>();
+
+  @Override
+  public URI getBaseURI() {
+    return this.baseURI;
+  }
+
+  /**
+   * Sets base URI.
+   *
+   * @param baseURI base URI.
+   */
+  public void setBaseURI(final URI baseURI) {
+    this.baseURI = baseURI;
+  }
+
+  @Override
+  public String getMetadataContext() {
+    return metadataContext;
+  }
+
+  public void setMetadataContext(final String metadataContext) {
+    this.metadataContext = metadataContext;
+  }
+
+  @Override
+  public String getMetadataETag() {
+    return metadataETag;
+  }
+
+  public void setMetadataETag(final String metadataETag) {
+    this.metadataETag = metadataETag;
+  }
+
+  @Override
+  public List<ServiceDocumentItem> getFunctionImports() {
+    return functionImports;
+  }
+
+  @Override
+  public List<ServiceDocumentItem> getSingletons() {
+    return singletons;
+  }
+
+  @Override
+  public List<ServiceDocumentItem> getRelatedServiceDocuments() {
+    return relatedServiceDocuments;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
new file mode 100644
index 0000000..23ed64c
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
@@ -0,0 +1,43 @@
+/*
+ * 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.v4;
+
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.uri.SegmentType;
+import org.apache.olingo.client.core.data.JSONServiceDocumentDeserializer;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.net.URI;
+
+@JsonDeserialize(using = JSONServiceDocumentDeserializer.class)
+public class JSONServiceDocumentImpl extends AbstractServiceDocument implements ServiceDocument {
+
+  @Override
+  public URI getBaseURI() {
+    URI baseURI = null;
+    if (getMetadataContext() != null) {
+      final String metadataURI = getMetadataContext();
+      baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(SegmentType.METADATA.getValue())));
+    }
+
+    return baseURI;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/XMLServiceDocumentImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/XMLServiceDocumentImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/XMLServiceDocumentImpl.java
new file mode 100644
index 0000000..2885658
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/XMLServiceDocumentImpl.java
@@ -0,0 +1,29 @@
+/*
+ * 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.v4;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.core.data.XMLServiceDocumentDeserializer;
+
+@JsonDeserialize(using = XMLServiceDocumentDeserializer.class)
+public class XMLServiceDocumentImpl extends AbstractServiceDocument implements ServiceDocument {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/AnnotationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/AnnotationPropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/AnnotationPropertyImpl.java
new file mode 100644
index 0000000..3ee57a6
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/AnnotationPropertyImpl.java
@@ -0,0 +1,53 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.deserializer;
+
+import org.apache.olingo.client.api.deserializer.AnnotationProperty;
+
+public class AnnotationPropertyImpl implements AnnotationProperty {
+
+  private final String name;
+
+  private final String value;
+
+  public AnnotationPropertyImpl(final String name, final String value) {
+    this.name = name;
+    this.value = value;
+  }
+
+  @Override
+  public String getName() {
+    return name;
+  }
+
+  @Override
+  public String getValue() {
+    return value;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see java.lang.Object#toString()
+   */
+  @Override
+  public String toString() {
+    return "AnnotationPropertyImpl [name=" + name + ", value=" + value + "]";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/ComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/ComplexValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/ComplexValueImpl.java
new file mode 100644
index 0000000..eda1e34
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/ComplexValueImpl.java
@@ -0,0 +1,82 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.deserializer;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.olingo.client.api.deserializer.AnnotationProperty;
+import org.apache.olingo.client.api.deserializer.ComplexValue;
+import org.apache.olingo.client.api.deserializer.NavigationProperty;
+import org.apache.olingo.client.api.deserializer.StructuralProperty;
+import org.apache.olingo.client.api.deserializer.Value;
+
+public class ComplexValueImpl extends PropertyCollection implements ComplexValue {
+
+  public ComplexValueImpl() {
+  }
+
+  public ComplexValueImpl(final Map<String, AnnotationProperty> annotationProperties,
+          final Map<String, NavigationProperty> navigationProperties,
+          final Map<String, StructuralProperty> structuralProperties) {
+
+    super(annotationProperties, navigationProperties, structuralProperties);
+  }
+
+  @Override
+  public Value getValue(final String name) {
+    final StructuralProperty property = structuralProperties.get(name);
+    if (property == null) {
+      return null;
+    }
+    return property.getValue();
+  }
+
+  @Override
+  public Map<String, AnnotationProperty> getAnnotationProperties() {
+    return Collections.unmodifiableMap(annotationProperties);
+  }
+
+  @Override
+  public Map<String, NavigationProperty> getNavigationProperties() {
+    return Collections.unmodifiableMap(navigationProperties);
+  }
+
+  @Override
+  public boolean isComplex() {
+    return true;
+  }
+
+  @Override
+  public Map<String, StructuralProperty> getContent() {
+    return Collections.unmodifiableMap(structuralProperties);
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public <T> T getContentAs(final T type) {
+    return (T) getContent();
+  }
+
+  @Override
+  public String toString() {
+    return "ComplexValueImpl [annotations=" + annotationProperties + ", navigationProperties=" + navigationProperties
+            + ", properties=" + structuralProperties + "]";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/EntityImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/EntityImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/EntityImpl.java
new file mode 100644
index 0000000..ac88bf3
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/EntityImpl.java
@@ -0,0 +1,126 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.deserializer;
+
+import java.util.Map;
+
+import org.apache.olingo.client.api.deserializer.AnnotationProperty;
+import org.apache.olingo.client.api.deserializer.Entity;
+import org.apache.olingo.client.api.deserializer.NavigationProperty;
+import org.apache.olingo.client.api.deserializer.Property;
+import org.apache.olingo.client.api.deserializer.StructuralProperty;
+
+public class EntityImpl extends PropertyCollection implements Entity {
+
+  public EntityImpl() {
+  }
+
+  public EntityImpl(final Map<String, AnnotationProperty> annotationProperties,
+          final Map<String, NavigationProperty> navigationProperties,
+          final Map<String, StructuralProperty> structuralProperties) {
+
+    super(annotationProperties, navigationProperties, structuralProperties);
+  }
+
+  @Override
+  public String getODataMetaDataEtag() {
+    return getAnnotationValue("odata.metadataEtag");
+  }
+
+  @Override
+  public String getODataType() {
+    return getAnnotationValue("odata.type");
+  }
+
+  @Override
+  public Long getODataCount() {
+    return Long.valueOf(getAnnotationValue("odata.count"));
+  }
+
+  @Override
+  public String getODataNextLink() {
+    return getAnnotationValue("odata.nextLink");
+  }
+
+  @Override
+  public String getODataDeltaLink() {
+    return getAnnotationValue("odata.deltaLink");
+  }
+
+  @Override
+  public String getODataReadLink() {
+    return getAnnotationValue("odata.readLink");
+  }
+
+  @Override
+  public String getODataContext() {
+    return getAnnotationValue("odata.context");
+  }
+
+  @Override
+  public String getODataId() {
+    return getAnnotationValue("odata.id");
+  }
+
+  @Override
+  public String getODataETag() {
+    return getAnnotationValue("odata.etag");
+  }
+
+  @Override
+  public String getODataEditLink() {
+    return getAnnotationValue("odata.editLink");
+  }
+
+  @Override
+  public Object getPropertyContent(final String name) {
+    final StructuralProperty property = structuralProperties.get(name);
+    if (property != null) {
+      return property.getValue().getContent();
+    }
+    return null;
+  }
+
+  @Override
+  public Property getProperty(final String name) {
+    Property property = structuralProperties.get(name);
+    if (property == null) {
+      property = annotationProperties.get(name);
+    }
+    if (property == null) {
+      property = navigationProperties.get(name);
+    }
+    return property;
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public <T extends Property> T getProperty(final String name, final Class<T> clazz) {
+    final Property property = getProperty(name);
+    return (T) property;
+  }
+
+  private String getAnnotationValue(final String key) {
+    final AnnotationProperty property = annotationProperties.get(key);
+    if (property == null) {
+      return null;
+    }
+    return property.getValue();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/EntitySetBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/EntitySetBuilder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/EntitySetBuilder.java
new file mode 100644
index 0000000..879622a
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/deserializer/EntitySetBuilder.java
@@ -0,0 +1,72 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.deserializer;
+
+import java.io.IOException;
+
+import org.apache.olingo.client.api.deserializer.EntitySet;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+
+public class EntitySetBuilder {
+
+  private final JsonParser parser;
+
+  public EntitySetBuilder(final JsonParser jp) {
+    parser = jp;
+  }
+
+  public EntitySet buildEntitySet() throws JsonParseException, IOException {
+    return parseEntitySet(parser);
+  }
+
+  private EntitySet parseEntitySet(final JsonParser jp) throws JsonParseException, IOException {
+    final EntitySetImpl entitySet = new EntitySetImpl();
+    boolean arrayStarted = false;
+
+    while (jp.nextToken() != null) {
+      final JsonToken token = jp.getCurrentToken();
+      switch (token) {
+        case START_ARRAY:
+          final PropertyCollectionBuilder builder = new PropertyCollectionBuilder(jp, entitySet);
+          entitySet.setPropertyCollectionBuilder(builder);
+          arrayStarted = true;
+          break;
+
+        case START_OBJECT:
+          if (arrayStarted) {
+            return entitySet;
+          }
+          break;
+
+        case VALUE_NUMBER_INT:
+        case VALUE_STRING:
+          entitySet.addAnnotation(jp.getCurrentName(), jp.getValueAsString());
+          break;
+
+        default:
+          break;
+      }
+    }
+
+    return entitySet;
+  }
+}