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

[2/7] OLINGO-205 ODataJClient request/response layer implementation imported

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/d3b05e01/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
new file mode 100644
index 0000000..d7e51d8
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
@@ -0,0 +1,97 @@
+/*
+ * 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.communication.request.retrieve;
+
+import java.io.IOException;
+import java.net.URI;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.ODataProperty;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.http.HttpClientException;
+
+/**
+ * This class implements an OData entity property query request.
+ */
+public class ODataPropertyRequestImpl extends AbstractODataRetrieveRequest<ODataProperty, ODataFormat>
+        implements ODataPropertyRequest {
+
+  /**
+   * Private constructor.
+   *
+   * @param odataClient client instance getting this request
+   * @param query query to be executed.
+   */
+  ODataPropertyRequestImpl(final ODataClient odataClient, final URI query) {
+    super(odataClient, ODataFormat.class, query);
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public ODataRetrieveResponse<ODataProperty> execute() {
+    final HttpResponse res = doExecute();
+    return new ODataPropertyResponseImpl(httpClient, res);
+  }
+
+  protected class ODataPropertyResponseImpl extends ODataRetrieveResponseImpl {
+
+    private ODataProperty property = null;
+
+    /**
+     * Constructor.
+     * <p>
+     * Just to create response templates to be initialized from batch.
+     */
+    private ODataPropertyResponseImpl() {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param client HTTP client.
+     * @param res HTTP response.
+     */
+    private ODataPropertyResponseImpl(final HttpClient client, final HttpResponse res) {
+      super(client, res);
+    }
+
+    /**
+     * {@inheritDoc }
+     */
+    @Override
+    public ODataProperty getBody() {
+      if (property == null) {
+        try {
+          property = odataClient.getReader().readProperty(
+                  res.getEntity().getContent(), ODataFormat.fromString(getContentType()));
+        } catch (IOException e) {
+          throw new HttpClientException(e);
+        } finally {
+          this.close();
+        }
+      }
+      return property;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/d3b05e01/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
new file mode 100644
index 0000000..632a96e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.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.communication.request.retrieve;
+
+import java.net.URI;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
+import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.core.communication.request.ODataRequestImpl;
+
+/**
+ * This class implements a generic OData request.
+ */
+public class ODataRawRequestImpl extends ODataRequestImpl<ODataPubFormat>
+        implements ODataRawRequest {
+
+  /**
+   * Constructor.
+   *
+   * @param odataClient client instance getting this request
+   * @param uri request URI.
+   */
+  ODataRawRequestImpl(final ODataClient odataClient, final URI uri) {
+    super(odataClient, ODataPubFormat.class, HttpMethod.GET, uri);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/d3b05e01/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
new file mode 100644
index 0000000..67e240c
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
@@ -0,0 +1,93 @@
+/*
+ * 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.communication.request.retrieve;
+
+import java.net.URI;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.ODataServiceDocument;
+import org.apache.olingo.client.api.format.ODataFormat;
+
+/**
+ * This class implements an OData service document request.
+ */
+public class ODataServiceDocumentRequestImpl extends AbstractODataRetrieveRequest<ODataServiceDocument, ODataFormat>
+        implements ODataServiceDocumentRequest {
+
+  /**
+   * Constructor.
+   *
+   * @param odataClient client instance getting this request
+   * @param uri request URI.
+   */
+  ODataServiceDocumentRequestImpl(final ODataClient odataClient, final URI uri) {
+    super(odataClient, ODataFormat.class, uri);
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public ODataRetrieveResponse<ODataServiceDocument> execute() {
+    final HttpResponse res = doExecute();
+    return new ODataServiceResponseImpl(httpClient, res);
+  }
+
+  /**
+   * Response class about an ODataServiceDocumentRequest.
+   */
+  protected class ODataServiceResponseImpl extends ODataRetrieveResponseImpl {
+
+    private ODataServiceDocument serviceDocument = null;
+
+    /**
+     * Constructor.
+     * <p>
+     * Just to create response templates to be initialized from batch.
+     */
+    private ODataServiceResponseImpl() {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param client HTTP client.
+     * @param res HTTP response.
+     */
+    private ODataServiceResponseImpl(final HttpClient client, final HttpResponse res) {
+      super(client, res);
+    }
+
+    @Override
+    public ODataServiceDocument getBody() {
+      if (serviceDocument == null) {
+        try {
+          serviceDocument = odataClient.getReader().readServiceDocument(
+                  getRawResponse(), ODataFormat.fromString(getContentType()));
+        } finally {
+          this.close();
+        }
+      }
+      return serviceDocument;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/d3b05e01/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
new file mode 100644
index 0000000..db48449
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
@@ -0,0 +1,108 @@
+/*
+ * 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.communication.request.retrieve;
+
+import java.io.IOException;
+import java.net.URI;
+import org.apache.commons.io.IOUtils;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
+import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.client.api.domain.ODataValue;
+import org.apache.olingo.client.api.format.ODataValueFormat;
+import org.apache.olingo.client.api.http.HttpClientException;
+
+/**
+ * This class implements an OData entity property value query request.
+ */
+public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataValue, ODataValueFormat>
+        implements ODataValueRequest {
+
+  /**
+   * Private constructor.
+   *
+   * @param odataClient client instance getting this request
+   * @param query query to be executed.
+   */
+  ODataValueRequestImpl(final ODataClient odataClient, final URI query) {
+    super(odataClient, ODataValueFormat.class, query);
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public ODataRetrieveResponse<ODataValue> execute() {
+    final HttpResponse res = doExecute();
+    return new ODataValueResponseImpl(httpClient, res);
+  }
+
+  /**
+   * Response class about an ODataDeleteReODataValueRequestquest.
+   */
+  protected class ODataValueResponseImpl extends ODataRetrieveResponseImpl {
+
+    private ODataValue value = null;
+
+    /**
+     * Constructor.
+     * <p>
+     * Just to create response templates to be initialized from batch.
+     */
+    private ODataValueResponseImpl() {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param client HTTP client.
+     * @param res HTTP response.
+     */
+    private ODataValueResponseImpl(final HttpClient client, final HttpResponse res) {
+      super(client, res);
+    }
+
+    /**
+     * {@inheritDoc }
+     */
+    @Override
+    public ODataValue getBody() {
+      if (value == null) {
+        final ODataValueFormat format = ODataValueFormat.fromString(getContentType());
+
+        try {
+          value = new ODataPrimitiveValue.Builder(odataClient).
+                  setType(format == ODataValueFormat.TEXT
+                  ? ODataJClientEdmPrimitiveType.String : ODataJClientEdmPrimitiveType.Stream).
+                  setText(IOUtils.toString(getRawResponse())).
+                  build();
+        } catch (IOException e) {
+          throw new HttpClientException(e);
+        } finally {
+          this.close();
+        }
+      }
+      return value;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/d3b05e01/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/V3RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/V3RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/V3RetrieveRequestFactoryImpl.java
new file mode 100644
index 0000000..4f91b61
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/V3RetrieveRequestFactoryImpl.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.communication.request.retrieve;
+
+import java.net.URI;
+import org.apache.olingo.client.api.ODataV3Client;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataLinkCollectionRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.V3RetrieveRequestFactory;
+
+public class V3RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
+        implements V3RetrieveRequestFactory {
+
+  private static final long serialVersionUID = 6602745001042802479L;
+
+  public V3RetrieveRequestFactoryImpl(final ODataV3Client client) {
+    super(client);
+  }
+
+  @Override
+  public ODataLinkCollectionRequest getLinkCollectionRequest(final URI targetURI, final String linkName) {
+    return new ODataLinkCollectionRequestImpl((ODataV3Client) client, targetURI, linkName);
+  }
+}

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

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/d3b05e01/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
new file mode 100644
index 0000000..02445ae
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.communication.request.streamed;
+
+import java.net.URI;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.communication.request.ODataStreamManager;
+import org.apache.olingo.client.api.communication.request.streamed.ODataStreamedEntityRequest;
+import org.apache.olingo.client.api.communication.response.ODataResponse;
+import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.client.api.http.HttpMethod;
+
+/**
+ * Abstract class representing a request concerning a streamed entity.
+ *
+ * @param <V> OData response type corresponding to the request implementation.
+ * @param <T> OData request payload type corresponding to the request implementation.
+ */
+public abstract class AbstractODataStreamedEntityRequest<V extends ODataResponse, T extends ODataStreamManager<V>>
+        extends AbstractODataStreamedRequest<V, T>
+        implements ODataStreamedEntityRequest<V, T> {
+
+  private ODataPubFormat format;
+
+  /**
+   * Constructor.
+   *
+   * @param odataClient client instance getting this request
+   * @param method HTTP request method.
+   * @param uri request URI.
+   */
+  public AbstractODataStreamedEntityRequest(final ODataClient odataClient, final HttpMethod method,
+          URI uri) {
+    super(odataClient, method, uri);
+    setAccept(getFormat().toString());
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public final ODataPubFormat getFormat() {
+    return format == null ? odataClient.getConfiguration().getDefaultPubFormat() : format;
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public final void setFormat(final ODataPubFormat format) {
+    this.format = format;
+    setAccept(format.toString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/d3b05e01/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
new file mode 100644
index 0000000..7929398
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
@@ -0,0 +1,153 @@
+/*
+ * 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.communication.request.streamed;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Future;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
+import org.apache.http.entity.ContentType;
+import org.apache.olingo.client.api.ODataBatchConstants;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.communication.request.ODataStreamManager;
+import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
+import org.apache.olingo.client.api.communication.request.ODataStreamer;
+import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest;
+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.Wrapper;
+import org.apache.olingo.client.core.communication.request.ODataRequestImpl;
+import org.apache.commons.io.IOUtils;
+
+/**
+ * Streamed OData request abstract class.
+ *
+ * @param <V> OData response type corresponding to the request implementation.
+ * @param <T> OData request payload type corresponding to the request implementation.
+ */
+public abstract class AbstractODataStreamedRequest<V extends ODataResponse, T extends ODataStreamManager<V>>
+        extends ODataRequestImpl<ODataMediaFormat> implements ODataStreamedRequest<V, T> {
+
+  /**
+   * OData payload stream manager.
+   */
+  protected ODataStreamManager<V> streamManager;
+
+  /**
+   * Wrapper for actual streamed request's future. This holds information about the HTTP request / response currently
+   * open.
+   */
+  protected final Wrapper<Future<HttpResponse>> futureWrapper = new Wrapper<Future<HttpResponse>>();
+
+  /**
+   * Constructor.
+   *
+   * @param odataClient client instance getting this request
+   * @param method OData request HTTP method.
+   * @param uri OData request URI.
+   */
+  public AbstractODataStreamedRequest(final ODataClient odataClient,
+          final HttpMethod method, final URI uri) {
+
+    super(odataClient, ODataMediaFormat.class, method, uri);
+    setAccept(ContentType.APPLICATION_OCTET_STREAM.getMimeType());
+    setContentType(ContentType.APPLICATION_OCTET_STREAM.getMimeType());
+  }
+
+  /**
+   * Gets OData request payload management object.
+   *
+   * @return OData request payload management object.
+   */
+  protected abstract T getStreamManager();
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  @SuppressWarnings("unchecked")
+  public T execute() {
+    streamManager = getStreamManager();
+
+    ((HttpEntityEnclosingRequestBase) request).setEntity(
+            URIUtils.buildInputStreamEntity(odataClient, streamManager.getBody()));
+
+    futureWrapper.setWrapped(odataClient.getConfiguration().getExecutor().submit(new Callable<HttpResponse>() {
+      @Override
+      public HttpResponse call() throws Exception {
+        return doExecute();
+      }
+    }));
+
+    // returns the stream manager object
+    return (T) streamManager;
+  }
+
+  /**
+   * Writes (and consume) the request onto the given batch stream.
+   * <p>
+   * Please note that this method will consume the request (execution won't be possible anymore).
+   *
+   * @param req destination batch request.
+   */
+  public void batch(final ODataBatchRequest req) {
+    batch(req, null);
+  }
+
+  /**
+   * Writes (and consume) the request onto the given batch stream.
+   * <p>
+   * Please note that this method will consume the request (execution won't be possible anymore).
+   *
+   * @param req destination batch request.
+   * @param contentId ContentId header value to be added to the serialization. Use this in case of changeset items.
+   */
+  public void batch(final ODataBatchRequest req, final String contentId) {
+    final InputStream input = getStreamManager().getBody();
+
+    try {
+      // finalize the body
+      getStreamManager().finalizeBody();
+
+      req.rawAppend(toByteArray());
+      if (StringUtils.isNotBlank(contentId)) {
+        req.rawAppend((ODataBatchConstants.CHANGESET_CONTENT_ID_NAME + ": " + contentId).getBytes());
+        req.rawAppend(ODataStreamer.CRLF);
+      }
+      req.rawAppend(ODataStreamer.CRLF);
+
+      try {
+        req.rawAppend(IOUtils.toByteArray(input));
+      } catch (Exception e) {
+        LOG.debug("Invalid stream", e);
+        req.rawAppend(new byte[0]);
+      }
+    } catch (IOException e) {
+      throw new IllegalStateException(e);
+    } finally {
+      IOUtils.closeQuietly(input);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/d3b05e01/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractStreamedRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractStreamedRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractStreamedRequestFactory.java
new file mode 100644
index 0000000..b90db57
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractStreamedRequestFactory.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.communication.request.streamed;
+
+import java.io.InputStream;
+import java.net.URI;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest;
+import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest;
+import org.apache.olingo.client.api.communication.request.streamed.ODataStreamUpdateRequest;
+import org.apache.olingo.client.api.communication.request.streamed.StreamedRequestFactory;
+import org.apache.olingo.client.api.http.HttpMethod;
+
+public abstract class AbstractStreamedRequestFactory implements StreamedRequestFactory {
+
+  private static final long serialVersionUID = -2438839640443961168L;
+
+  protected final ODataClient client;
+
+  protected AbstractStreamedRequestFactory(final ODataClient client) {
+    this.client = client;
+  }
+
+  @Override
+  public ODataMediaEntityCreateRequest getMediaEntityCreateRequest(
+          final URI targetURI, final InputStream media) {
+
+    return new ODataMediaEntityCreateRequestImpl(client, targetURI, media);
+  }
+
+  @Override
+  public ODataStreamUpdateRequest getStreamUpdateRequest(final URI targetURI, final InputStream stream) {
+    final ODataStreamUpdateRequest req;
+
+    if (client.getConfiguration().isUseXHTTPMethod()) {
+      req = new ODataStreamUpdateRequestImpl(client, HttpMethod.POST, targetURI, stream);
+      req.setXHTTPMethod(HttpMethod.PUT.name());
+    } else {
+      req = new ODataStreamUpdateRequestImpl(client, HttpMethod.PUT, targetURI, stream);
+    }
+
+    return req;
+  }
+
+  @Override
+  public ODataMediaEntityUpdateRequest getMediaEntityUpdateRequest(
+          final URI editURI, final InputStream media) {
+
+    final ODataMediaEntityUpdateRequest req;
+
+    if (client.getConfiguration().isUseXHTTPMethod()) {
+      req = new ODataMediaEntityUpdateRequestImpl(client, HttpMethod.POST, editURI, media);
+      req.setXHTTPMethod(HttpMethod.PUT.name());
+    } else {
+      req = new ODataMediaEntityUpdateRequestImpl(client, HttpMethod.PUT, editURI, media);
+    }
+
+    return req;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/d3b05e01/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
new file mode 100644
index 0000000..4523969
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
@@ -0,0 +1,134 @@
+/*
+ * 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.communication.request.streamed;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.util.concurrent.TimeUnit;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
+import org.apache.olingo.client.api.communication.request.streamed.MediaEntityCreateStreamManager;
+import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest;
+import org.apache.olingo.client.api.communication.response.ODataMediaEntityCreateResponse;
+import org.apache.olingo.client.api.domain.ODataEntity;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
+import org.apache.olingo.client.core.communication.response.ODataResponseImpl;
+
+/**
+ * This class implements an OData Media Entity create request. Get instance by using ODataStreamedRequestFactory.
+ */
+public class ODataMediaEntityCreateRequestImpl
+        extends AbstractODataStreamedEntityRequest<ODataMediaEntityCreateResponse, MediaEntityCreateStreamManager>
+        implements ODataMediaEntityCreateRequest, ODataBatchableRequest {
+
+  private final InputStream media;
+
+  /**
+   * Constructor.
+   *
+   * @param odataClient client instance getting this request
+   * @param targetURI target entity set.
+   * @param media media entity blob to be created.
+   */
+  ODataMediaEntityCreateRequestImpl(final ODataClient odataClient, final URI targetURI, final InputStream media) {
+    super(odataClient, HttpMethod.POST, targetURI);
+    this.media = media;
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  protected MediaEntityCreateStreamManager getStreamManager() {
+    if (streamManager == null) {
+      streamManager = new MediaEntityCreateStreamManagerImpl(media);
+    }
+    return (MediaEntityCreateStreamManager) streamManager;
+  }
+
+  /**
+   * Media entity payload object.
+   */
+  public class MediaEntityCreateStreamManagerImpl extends AbstractODataStreamManager<ODataMediaEntityCreateResponse>
+          implements MediaEntityCreateStreamManager {
+
+    /**
+     * Private constructor.
+     *
+     * @param input media stream.
+     */
+    private MediaEntityCreateStreamManagerImpl(final InputStream input) {
+      super(ODataMediaEntityCreateRequestImpl.this.futureWrapper, input);
+    }
+
+    /**
+     * {@inheritDoc }
+     */
+    @Override
+    protected ODataMediaEntityCreateResponse getResponse(final long timeout, final TimeUnit unit) {
+      finalizeBody();
+      return new ODataMediaEntityCreateResponseImpl(httpClient, getHttpResponse(timeout, unit));
+    }
+  }
+
+  /**
+   * Response class about an ODataMediaEntityCreateRequest.
+   */
+  private class ODataMediaEntityCreateResponseImpl extends ODataResponseImpl
+          implements ODataMediaEntityCreateResponse {
+
+    private ODataEntity entity = null;
+
+    /**
+     * Constructor.
+     * <p>
+     * Just to create response templates to be initialized from batch.
+     */
+    private ODataMediaEntityCreateResponseImpl() {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param client HTTP client.
+     * @param res HTTP response.
+     */
+    private ODataMediaEntityCreateResponseImpl(final HttpClient client, final HttpResponse res) {
+      super(client, res);
+    }
+
+    /**
+     * {@inheritDoc }
+     */
+    @Override
+    public ODataEntity getBody() {
+      if (entity == null) {
+        try {
+          entity = odataClient.getReader().readEntity(getRawResponse(), getFormat());
+        } finally {
+          this.close();
+        }
+      }
+      return entity;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/d3b05e01/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
new file mode 100644
index 0000000..dbff55a
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
@@ -0,0 +1,137 @@
+/*
+ * 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.communication.request.streamed;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.util.concurrent.TimeUnit;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
+import org.apache.olingo.client.api.communication.request.streamed.MediaEntityUpdateStreamManager;
+import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest;
+import org.apache.olingo.client.api.communication.response.ODataMediaEntityUpdateResponse;
+import org.apache.olingo.client.api.domain.ODataEntity;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
+import org.apache.olingo.client.core.communication.response.ODataResponseImpl;
+
+/**
+ * This class implements an OData Media Entity create request. Get instance by using ODataStreamedRequestFactory.
+ */
+public class ODataMediaEntityUpdateRequestImpl
+        extends AbstractODataStreamedEntityRequest<ODataMediaEntityUpdateResponse, MediaEntityUpdateStreamManager>
+        implements ODataMediaEntityUpdateRequest, ODataBatchableRequest {
+
+  private final InputStream media;
+
+  /**
+   * Constructor.
+   *
+   * @param odataClient client instance getting this request
+   * @param method request method.
+   * @param editURI edit URI of the entity to be updated.
+   * @param media media entity blob to be created.
+   */
+  ODataMediaEntityUpdateRequestImpl(final ODataClient odataClient,
+          final HttpMethod method, final URI editURI, final InputStream media) {
+
+    super(odataClient, method, editURI);
+    this.media = media;
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  protected MediaEntityUpdateStreamManager getStreamManager() {
+    if (streamManager == null) {
+      streamManager = new MediaEntityUpdateStreamManagerImpl(media);
+    }
+    return (MediaEntityUpdateStreamManager) streamManager;
+  }
+
+  /**
+   * Media entity payload object.
+   */
+  public class MediaEntityUpdateStreamManagerImpl extends AbstractODataStreamManager<ODataMediaEntityUpdateResponse>
+          implements MediaEntityUpdateStreamManager {
+
+    /**
+     * Private constructor.
+     *
+     * @param input media stream.
+     */
+    private MediaEntityUpdateStreamManagerImpl(final InputStream input) {
+      super(ODataMediaEntityUpdateRequestImpl.this.futureWrapper, input);
+    }
+
+    /**
+     * {@inheritDoc }
+     */
+    @Override
+    protected ODataMediaEntityUpdateResponse getResponse(final long timeout, final TimeUnit unit) {
+      finalizeBody();
+      return new ODataMediaEntityUpdateResponseImpl(httpClient, getHttpResponse(timeout, unit));
+    }
+  }
+
+  /**
+   * Response class about an ODataMediaEntityUpdateRequest.
+   */
+  private class ODataMediaEntityUpdateResponseImpl extends ODataResponseImpl
+          implements ODataMediaEntityUpdateResponse {
+
+    private ODataEntity entity = null;
+
+    /**
+     * Constructor.
+     * <p>
+     * Just to create response templates to be initialized from batch.
+     */
+    private ODataMediaEntityUpdateResponseImpl() {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param client HTTP client.
+     * @param res HTTP response.
+     */
+    private ODataMediaEntityUpdateResponseImpl(final HttpClient client, final HttpResponse res) {
+      super(client, res);
+    }
+
+    /**
+     * {@inheritDoc }
+     */
+    @Override
+    public ODataEntity getBody() {
+      if (entity == null) {
+        try {
+          entity = odataClient.getReader().readEntity(getRawResponse(), getFormat());
+        } finally {
+          this.close();
+        }
+      }
+      return entity;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/d3b05e01/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataStreamUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataStreamUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataStreamUpdateRequestImpl.java
new file mode 100644
index 0000000..3d42632
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataStreamUpdateRequestImpl.java
@@ -0,0 +1,132 @@
+/*
+ * 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.communication.request.streamed;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.util.concurrent.TimeUnit;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
+import org.apache.olingo.client.api.communication.request.streamed.ODataStreamUpdateRequest;
+import org.apache.olingo.client.api.communication.request.streamed.StreamUpdateStreamManager;
+import org.apache.olingo.client.api.communication.response.ODataStreamUpdateResponse;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
+import org.apache.olingo.client.core.communication.response.ODataResponseImpl;
+
+/**
+ * This class implements an OData stream create/update request. Get instance by using ODataStreamedRequestFactory.
+ */
+public class ODataStreamUpdateRequestImpl
+        extends AbstractODataStreamedRequest<ODataStreamUpdateResponse, StreamUpdateStreamManager>
+        implements ODataStreamUpdateRequest, ODataBatchableRequest {
+
+  private final InputStream stream;
+
+  /**
+   * Constructor.
+   *
+   * @param odataClient client instance getting this request
+   * @param method request method.
+   * @param targetURI target URI.
+   * @param stream stream to be updated.
+   */
+  ODataStreamUpdateRequestImpl(final ODataClient odataClient,
+          final HttpMethod method, final URI targetURI, final InputStream stream) {
+
+    super(odataClient, method, targetURI);
+    this.stream = stream;
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  protected StreamUpdateStreamManager getStreamManager() {
+    if (streamManager == null) {
+      streamManager = new StreamUpdateStreamManagerImpl(this.stream);
+    }
+
+    return (StreamUpdateStreamManager) streamManager;
+  }
+
+  public class StreamUpdateStreamManagerImpl extends AbstractODataStreamManager<ODataStreamUpdateResponse> {
+
+    /**
+     * Private constructor.
+     *
+     * @param input payload input stream.
+     */
+    private StreamUpdateStreamManagerImpl(final InputStream input) {
+      super(ODataStreamUpdateRequestImpl.this.futureWrapper, input);
+    }
+
+    /**
+     * {@inheritDoc }
+     */
+    @Override
+    protected ODataStreamUpdateResponse getResponse(final long timeout, final TimeUnit unit) {
+      finalizeBody();
+      return new ODataStreamUpdateResponseImpl(httpClient, getHttpResponse(timeout, unit));
+    }
+  }
+
+  /**
+   * Response class about an ODataStreamUpdateRequest.
+   */
+  private class ODataStreamUpdateResponseImpl extends ODataResponseImpl implements ODataStreamUpdateResponse {
+
+    private InputStream input = null;
+
+    /**
+     * Constructor.
+     * <p>
+     * Just to create response templates to be initialized from batch.
+     */
+    private ODataStreamUpdateResponseImpl() {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param client HTTP client.
+     * @param res HTTP response.
+     */
+    private ODataStreamUpdateResponseImpl(final HttpClient client, final HttpResponse res) {
+      super(client, res);
+    }
+
+    /**
+     * Gets query result objects.
+     * <br/>
+     * <b>WARNING</b>: Closing this <tt>ODataResponse</tt> instance is left to the caller.
+     *
+     * @return query result objects as <tt>InputStream</tt>.
+     */
+    @Override
+    public InputStream getBody() {
+      if (input == null) {
+        input = getRawResponse();
+      }
+      return input;
+    }
+  }
+}

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

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

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/d3b05e01/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/ODataResponseImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/ODataResponseImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/ODataResponseImpl.java
new file mode 100644
index 0000000..5a86aba
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/ODataResponseImpl.java
@@ -0,0 +1,276 @@
+/*
+ * 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.communication.response;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.TreeMap;
+import org.apache.commons.io.IOUtils;
+import org.apache.http.Header;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.client.HttpClient;
+import org.apache.olingo.client.api.communication.header.HeaderName;
+import org.apache.olingo.client.api.communication.request.batch.ODataBatchLineIterator;
+import org.apache.olingo.client.api.communication.response.ODataResponse;
+import org.apache.olingo.client.api.http.NoContentException;
+import org.apache.olingo.client.core.communication.request.batch.ODataBatchController;
+import org.apache.olingo.client.core.communication.request.batch.ODataBatchUtilities;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Abstract representation of an OData response.
+ */
+public abstract class ODataResponseImpl implements ODataResponse {
+
+  /**
+   * Logger.
+   */
+  protected static final org.slf4j.Logger LOG = LoggerFactory.getLogger(ODataResponse.class);
+
+  /**
+   * HTTP client.
+   */
+  protected final HttpClient client;
+
+  /**
+   * HTTP response.
+   */
+  protected final HttpResponse res;
+
+  /**
+   * Response headers.
+   */
+  protected final Map<String, Collection<String>> headers =
+          new TreeMap<String, Collection<String>>(String.CASE_INSENSITIVE_ORDER);
+
+  /**
+   * Response code.
+   */
+  private int statusCode = -1;
+
+  /**
+   * Response message.
+   */
+  private String statusMessage = null;
+
+  /**
+   * Response body/payload.
+   */
+  private InputStream payload = null;
+
+  /**
+   * Initialization check.
+   */
+  private boolean hasBeenInitialized = false;
+
+  /**
+   * Batch info (if to be batched).
+   */
+  private ODataBatchController batchInfo = null;
+
+  /**
+   * Constructor.
+   */
+  public ODataResponseImpl() {
+    this.client = null;
+    this.res = null;
+  }
+
+  /**
+   * Constructor.
+   *
+   * @param client HTTP client.
+   * @param res HTTP response.
+   */
+  public ODataResponseImpl(final HttpClient client, final HttpResponse res) {
+    this.client = client;
+    this.res = res;
+
+    try {
+      this.payload = this.res.getEntity() == null ? null : this.res.getEntity().getContent();
+    } catch (Exception e) {
+      LOG.error("Error retrieving payload", e);
+      throw new IllegalStateException(e);
+    }
+
+    this.hasBeenInitialized = true;
+
+    for (Header header : res.getAllHeaders()) {
+      final Collection<String> headerValues;
+      if (headers.containsKey(header.getName())) {
+        headerValues = headers.get(header.getName());
+      } else {
+        headerValues = new HashSet<String>();
+        headers.put(header.getName(), headerValues);
+      }
+
+      headerValues.add(header.getValue());
+    }
+
+    statusCode = res.getStatusLine().getStatusCode();
+    statusMessage = res.getStatusLine().getReasonPhrase();
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public Collection<String> getHeaderNames() {
+    return headers.keySet();
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public Collection<String> getHeader(final String name) {
+    return headers.get(name);
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public Collection<String> getHeader(final HeaderName name) {
+    return headers.get(name.toString());
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public String getEtag() {
+    final Collection<String> etag = getHeader(HeaderName.etag);
+    return etag == null || etag.isEmpty()
+            ? null
+            : etag.iterator().next();
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public String getContentType() {
+    final Collection<String> contentTypes = getHeader(HeaderName.contentType);
+    return contentTypes == null || contentTypes.isEmpty()
+            ? null
+            : contentTypes.iterator().next();
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public int getStatusCode() {
+    return statusCode;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public String getStatusMessage() {
+    return statusMessage;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public ODataResponse initFromBatch(
+          final Map.Entry<Integer, String> responseLine,
+          final Map<String, Collection<String>> headers,
+          final ODataBatchLineIterator batchLineIterator,
+          final String boundary) {
+
+    if (hasBeenInitialized) {
+      throw new IllegalStateException("Request already initialized");
+    }
+
+    this.hasBeenInitialized = true;
+
+    this.batchInfo = new ODataBatchController(batchLineIterator, boundary);
+
+    this.statusCode = responseLine.getKey();
+    this.statusMessage = responseLine.getValue();
+    this.headers.putAll(headers);
+
+    return this;
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public void close() {
+    if (client == null) {
+      IOUtils.closeQuietly(payload);
+    } else {
+      this.client.getConnectionManager().shutdown();
+    }
+
+    if (batchInfo != null) {
+      batchInfo.setValidBatch(false);
+    }
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public InputStream getRawResponse() {
+    if (HttpStatus.SC_NO_CONTENT == getStatusCode()) {
+      throw new NoContentException();
+    }
+
+    if (payload == null && batchInfo.isValidBatch()) {
+      // get input stream till the end of item
+      payload = new PipedInputStream();
+
+      try {
+        final PipedOutputStream os = new PipedOutputStream((PipedInputStream) payload);
+
+        new Thread(new Runnable() {
+          @Override
+          public void run() {
+            try {
+              ODataBatchUtilities.readBatchPart(batchInfo, os, true);
+            } catch (Exception e) {
+              LOG.error("Error streaming batch item payload", e);
+            } finally {
+              IOUtils.closeQuietly(os);
+            }
+          }
+        }).start();
+
+      } catch (IOException e) {
+        LOG.error("Error streaming payload response", e);
+        throw new IllegalStateException(e);
+      }
+    }
+
+    return payload;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/d3b05e01/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/batch/ODataBatchResponseManager.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/batch/ODataBatchResponseManager.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/batch/ODataBatchResponseManager.java
new file mode 100644
index 0000000..a8cfd2d
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/batch/ODataBatchResponseManager.java
@@ -0,0 +1,151 @@
+/*
+ * 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.communication.response.batch;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.client.api.communication.header.HeaderName;
+import org.apache.olingo.client.api.communication.request.batch.ODataBatchLineIterator;
+import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
+import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
+import org.apache.olingo.client.core.communication.request.batch.ODataBatchLineIteratorImpl;
+import org.apache.olingo.client.core.communication.request.batch.ODataBatchUtilities;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Batch response manager class.
+ */
+public class ODataBatchResponseManager implements Iterator<ODataBatchResponseItem> {
+
+  /**
+   * Logger.
+   */
+  private static final Logger LOG = LoggerFactory.getLogger(ODataBatchResponseManager.class);
+
+  /**
+   * Batch response line iterator.
+   */
+  private final ODataBatchLineIterator batchLineIterator;
+
+  /**
+   * Batch boundary.
+   */
+  private final String batchBoundary;
+
+  /**
+   * Expected batch response items iterator.
+   */
+  private final Iterator<ODataBatchResponseItem> expectedItemsIterator;
+
+  /**
+   * Last retrieved batch response item.
+   */
+  private ODataBatchResponseItem current = null;
+
+  /**
+   * Constructor.
+   *
+   * @param res OData batch response.
+   * @param expectedItems expected batch response items.
+   */
+  public ODataBatchResponseManager(final ODataBatchResponse res, final List<ODataBatchResponseItem> expectedItems) {
+    try {
+      this.expectedItemsIterator = expectedItems.iterator();
+      this.batchLineIterator = new ODataBatchLineIteratorImpl(
+              IOUtils.lineIterator(res.getRawResponse(), Constants.UTF8));
+
+      // search for boundary
+      batchBoundary = ODataBatchUtilities.getBoundaryFromHeader(
+              res.getHeader(HeaderName.contentType));
+      LOG.debug("Retrieved batch response bondary '{}'", batchBoundary);
+    } catch (IOException e) {
+      LOG.error("Error parsing batch response", e);
+      throw new IllegalStateException(e);
+    }
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public boolean hasNext() {
+    return expectedItemsIterator.hasNext();
+  }
+
+  /**
+   * {@inheritDoc }
+   */
+  @Override
+  public ODataBatchResponseItem next() {
+    if (current != null) {
+      current.close();
+    }
+
+    if (!hasNext()) {
+      throw new NoSuchElementException("No item found");
+    }
+
+    current = expectedItemsIterator.next();
+
+    final Map<String, Collection<String>> nextItemHeaders =
+            ODataBatchUtilities.nextItemHeaders(batchLineIterator, batchBoundary);
+
+    switch (ODataBatchUtilities.getItemType(nextItemHeaders)) {
+      case CHANGESET:
+        if (!current.isChangeset()) {
+          throw new IllegalStateException("Unexpected batch item");
+        }
+
+        current.initFromBatch(
+                batchLineIterator,
+                ODataBatchUtilities.getBoundaryFromHeader(
+                nextItemHeaders.get(HeaderName.contentType.toString())));
+        break;
+
+      case RETRIEVE:
+        if (current.isChangeset()) {
+          throw new IllegalStateException("Unexpected batch item");
+        }
+
+        current.initFromBatch(
+                batchLineIterator,
+                batchBoundary);
+        break;
+      default:
+        throw new IllegalStateException("Expected item not found");
+    }
+
+    return current;
+  }
+
+  /**
+   * Unsupported operation.
+   */
+  @Override
+  public void remove() {
+    throw new UnsupportedOperationException("Remove operation is not supported");
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/d3b05e01/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
index 5502629..0b5e974 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
@@ -23,7 +23,7 @@ import java.net.URI;
 import java.util.List;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.ODataConstants;
+import org.apache.olingo.client.api.Constants;
 import org.apache.olingo.client.api.domain.ODataOperation;
 import org.apache.olingo.client.api.utils.XMLUtils;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
@@ -45,26 +45,26 @@ public class AtomDeserializer {
   }
 
   private void common(final Element input, final AtomObject object) {
-    if (StringUtils.isNotBlank(input.getAttribute(ODataConstants.ATTR_XMLBASE))) {
-      object.setBaseURI(input.getAttribute(ODataConstants.ATTR_XMLBASE));
+    if (StringUtils.isNotBlank(input.getAttribute(Constants.ATTR_XMLBASE))) {
+      object.setBaseURI(input.getAttribute(Constants.ATTR_XMLBASE));
     }
 
-    final List<Element> ids = XMLUtils.getChildElements(input, ODataConstants.ATOM_ELEM_ID);
+    final List<Element> ids = XMLUtils.getChildElements(input, Constants.ATOM_ELEM_ID);
     if (!ids.isEmpty()) {
       object.setId(ids.get(0).getTextContent());
     }
 
-    final List<Element> titles = XMLUtils.getChildElements(input, ODataConstants.ATOM_ELEM_TITLE);
+    final List<Element> titles = XMLUtils.getChildElements(input, Constants.ATOM_ELEM_TITLE);
     if (!titles.isEmpty()) {
       object.setTitle(titles.get(0).getTextContent());
     }
 
-    final List<Element> summaries = XMLUtils.getChildElements(input, ODataConstants.ATOM_ELEM_SUMMARY);
+    final List<Element> summaries = XMLUtils.getChildElements(input, Constants.ATOM_ELEM_SUMMARY);
     if (!summaries.isEmpty()) {
       object.setSummary(summaries.get(0).getTextContent());
     }
 
-    final List<Element> updateds = XMLUtils.getChildElements(input, ODataConstants.ATOM_ELEM_UPDATED);
+    final List<Element> updateds = XMLUtils.getChildElements(input, Constants.ATOM_ELEM_UPDATED);
     if (!updateds.isEmpty()) {
       try {
         object.setUpdated(ISO_DATEFORMAT.parse(updateds.get(0).getTextContent()));
@@ -75,7 +75,7 @@ public class AtomDeserializer {
   }
 
   public AtomEntryImpl entry(final Element input) {
-    if (!ODataConstants.ATOM_ELEM_ENTRY.equals(input.getNodeName())) {
+    if (!Constants.ATOM_ELEM_ENTRY.equals(input.getNodeName())) {
       return null;
     }
 
@@ -83,43 +83,43 @@ public class AtomDeserializer {
 
     common(input, entry);
 
-    final String etag = input.getAttribute(ODataConstants.ATOM_ATTR_ETAG);
+    final String etag = input.getAttribute(Constants.ATOM_ATTR_ETAG);
     if (StringUtils.isNotBlank(etag)) {
       entry.setETag(etag);
     }
 
-    final List<Element> categories = XMLUtils.getChildElements(input, ODataConstants.ATOM_ELEM_CATEGORY);
+    final List<Element> categories = XMLUtils.getChildElements(input, Constants.ATOM_ELEM_CATEGORY);
     if (!categories.isEmpty()) {
-      entry.setType(categories.get(0).getAttribute(ODataConstants.ATOM_ATTR_TERM));
+      entry.setType(categories.get(0).getAttribute(Constants.ATOM_ATTR_TERM));
     }
 
-    final List<Element> links = XMLUtils.getChildElements(input, ODataConstants.ATOM_ELEM_LINK);
+    final List<Element> links = XMLUtils.getChildElements(input, Constants.ATOM_ELEM_LINK);
     for (Element linkElem : links) {
       final LinkImpl link = new LinkImpl();
-      link.setRel(linkElem.getAttribute(ODataConstants.ATTR_REL));
-      link.setTitle(linkElem.getAttribute(ODataConstants.ATTR_TITLE));
-      link.setHref(linkElem.getAttribute(ODataConstants.ATTR_HREF));
+      link.setRel(linkElem.getAttribute(Constants.ATTR_REL));
+      link.setTitle(linkElem.getAttribute(Constants.ATTR_TITLE));
+      link.setHref(linkElem.getAttribute(Constants.ATTR_HREF));
 
-      if (ODataConstants.SELF_LINK_REL.equals(link.getRel())) {
+      if (Constants.SELF_LINK_REL.equals(link.getRel())) {
         entry.setSelfLink(link);
-      } else if (ODataConstants.EDIT_LINK_REL.equals(link.getRel())) {
+      } else if (Constants.EDIT_LINK_REL.equals(link.getRel())) {
         entry.setEditLink(link);
       } else if (link.getRel().startsWith(
               client.getServiceVersion().getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL))) {
 
-        link.setType(linkElem.getAttribute(ODataConstants.ATTR_TYPE));
+        link.setType(linkElem.getAttribute(Constants.ATTR_TYPE));
         entry.getNavigationLinks().add(link);
 
-        final List<Element> inlines = XMLUtils.getChildElements(linkElem, ODataConstants.ATOM_ELEM_INLINE);
+        final List<Element> inlines = XMLUtils.getChildElements(linkElem, Constants.ATOM_ELEM_INLINE);
         if (!inlines.isEmpty()) {
           final List<Element> entries =
-                  XMLUtils.getChildElements(inlines.get(0), ODataConstants.ATOM_ELEM_ENTRY);
+                  XMLUtils.getChildElements(inlines.get(0), Constants.ATOM_ELEM_ENTRY);
           if (!entries.isEmpty()) {
             link.setInlineEntry(entry(entries.get(0)));
           }
 
           final List<Element> feeds =
-                  XMLUtils.getChildElements(inlines.get(0), ODataConstants.ATOM_ELEM_FEED);
+                  XMLUtils.getChildElements(inlines.get(0), Constants.ATOM_ELEM_FEED);
           if (!feeds.isEmpty()) {
             link.setInlineFeed(feed(feeds.get(0)));
           }
@@ -135,15 +135,15 @@ public class AtomDeserializer {
       }
     }
 
-    final List<Element> authors = XMLUtils.getChildElements(input, ODataConstants.ATOM_ELEM_AUTHOR);
+    final List<Element> authors = XMLUtils.getChildElements(input, Constants.ATOM_ELEM_AUTHOR);
     if (!authors.isEmpty()) {
       final AtomEntryImpl.Author author = new AtomEntryImpl.Author();
       for (Node child : XMLUtils.getChildNodes(input, Node.ELEMENT_NODE)) {
-        if (ODataConstants.ATOM_ELEM_AUTHOR_NAME.equals(XMLUtils.getSimpleName(child))) {
+        if (Constants.ATOM_ELEM_AUTHOR_NAME.equals(XMLUtils.getSimpleName(child))) {
           author.setName(child.getTextContent());
-        } else if (ODataConstants.ATOM_ELEM_AUTHOR_URI.equals(XMLUtils.getSimpleName(child))) {
+        } else if (Constants.ATOM_ELEM_AUTHOR_URI.equals(XMLUtils.getSimpleName(child))) {
           author.setUri(child.getTextContent());
-        } else if (ODataConstants.ATOM_ELEM_AUTHOR_EMAIL.equals(XMLUtils.getSimpleName(child))) {
+        } else if (Constants.ATOM_ELEM_AUTHOR_EMAIL.equals(XMLUtils.getSimpleName(child))) {
           author.setEmail(child.getTextContent());
         }
       }
@@ -152,26 +152,26 @@ public class AtomDeserializer {
       }
     }
 
-    final List<Element> actions = XMLUtils.getChildElements(input, ODataConstants.ATOM_ELEM_ACTION);
+    final List<Element> actions = XMLUtils.getChildElements(input, Constants.ATOM_ELEM_ACTION);
     for (Element action : actions) {
       final ODataOperation operation = new ODataOperation();
-      operation.setMetadataAnchor(action.getAttribute(ODataConstants.ATTR_METADATA));
-      operation.setTitle(action.getAttribute(ODataConstants.ATTR_TITLE));
-      operation.setTarget(URI.create(action.getAttribute(ODataConstants.ATTR_TARGET)));
+      operation.setMetadataAnchor(action.getAttribute(Constants.ATTR_METADATA));
+      operation.setTitle(action.getAttribute(Constants.ATTR_TITLE));
+      operation.setTarget(URI.create(action.getAttribute(Constants.ATTR_TARGET)));
 
       entry.getOperations().add(operation);
     }
 
-    final List<Element> contents = XMLUtils.getChildElements(input, ODataConstants.ATOM_ELEM_CONTENT);
+    final List<Element> contents = XMLUtils.getChildElements(input, Constants.ATOM_ELEM_CONTENT);
     if (!contents.isEmpty()) {
       final Element content = contents.get(0);
 
-      List<Element> props = XMLUtils.getChildElements(content, ODataConstants.ELEM_PROPERTIES);
+      List<Element> props = XMLUtils.getChildElements(content, Constants.ELEM_PROPERTIES);
       if (props.isEmpty()) {
-        entry.setMediaContentSource(content.getAttribute(ODataConstants.ATOM_ATTR_SRC));
-        entry.setMediaContentType(content.getAttribute(ODataConstants.ATTR_TYPE));
+        entry.setMediaContentSource(content.getAttribute(Constants.ATOM_ATTR_SRC));
+        entry.setMediaContentType(content.getAttribute(Constants.ATTR_TYPE));
 
-        props = XMLUtils.getChildElements(input, ODataConstants.ELEM_PROPERTIES);
+        props = XMLUtils.getChildElements(input, Constants.ELEM_PROPERTIES);
         if (!props.isEmpty()) {
           entry.setMediaEntryProperties(props.get(0));
         }
@@ -184,7 +184,7 @@ public class AtomDeserializer {
   }
 
   public AtomFeedImpl feed(final Element input) {
-    if (!ODataConstants.ATOM_ELEM_FEED.equals(input.getNodeName())) {
+    if (!Constants.ATOM_ELEM_FEED.equals(input.getNodeName())) {
       return null;
     }
 
@@ -192,19 +192,19 @@ public class AtomDeserializer {
 
     common(input, feed);
 
-    final List<Element> entries = XMLUtils.getChildElements(input, ODataConstants.ATOM_ELEM_ENTRY);
+    final List<Element> entries = XMLUtils.getChildElements(input, Constants.ATOM_ELEM_ENTRY);
     for (Element entry : entries) {
       feed.getEntries().add(entry(entry));
     }
 
-    final List<Element> links = XMLUtils.getChildElements(input, ODataConstants.ATOM_ELEM_LINK);
+    final List<Element> links = XMLUtils.getChildElements(input, Constants.ATOM_ELEM_LINK);
     for (Element link : links) {
-      if (ODataConstants.NEXT_LINK_REL.equals(link.getAttribute(ODataConstants.ATTR_REL))) {
-        feed.setNext(URI.create(link.getAttribute(ODataConstants.ATTR_HREF)));
+      if (Constants.NEXT_LINK_REL.equals(link.getAttribute(Constants.ATTR_REL))) {
+        feed.setNext(URI.create(link.getAttribute(Constants.ATTR_HREF)));
       }
     }
 
-    final List<Element> counts = XMLUtils.getChildElements(input, ODataConstants.ATOM_ATTR_COUNT);
+    final List<Element> counts = XMLUtils.getChildElements(input, Constants.ATOM_ATTR_COUNT);
     if (!counts.isEmpty()) {
       try {
         feed.setCount(Integer.parseInt(counts.get(0).getTextContent()));

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/d3b05e01/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomSerializer.java
index 73def31..7a358dc 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomSerializer.java
@@ -25,7 +25,7 @@ import javax.xml.parsers.ParserConfigurationException;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.http.entity.ContentType;
 import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.ODataConstants;
+import org.apache.olingo.client.api.Constants;
 import org.apache.olingo.client.api.data.Entry;
 import org.apache.olingo.client.api.data.Link;
 import org.apache.olingo.client.api.utils.XMLUtils;
@@ -53,18 +53,18 @@ public class AtomSerializer {
 
   private void setLinks(final Element entry, final List<Link> links) throws ParserConfigurationException {
     for (Link link : links) {
-      final Element linkElem = entry.getOwnerDocument().createElement(ODataConstants.ATOM_ELEM_LINK);
+      final Element linkElem = entry.getOwnerDocument().createElement(Constants.ATOM_ELEM_LINK);
 
-      linkElem.setAttribute(ODataConstants.ATTR_REL, link.getRel());
-      linkElem.setAttribute(ODataConstants.ATTR_TITLE, link.getTitle());
-      linkElem.setAttribute(ODataConstants.ATTR_HREF, link.getHref());
+      linkElem.setAttribute(Constants.ATTR_REL, link.getRel());
+      linkElem.setAttribute(Constants.ATTR_TITLE, link.getTitle());
+      linkElem.setAttribute(Constants.ATTR_HREF, link.getHref());
 
       if (StringUtils.isNotBlank(link.getType())) {
-        linkElem.setAttribute(ODataConstants.ATTR_TYPE, link.getType());
+        linkElem.setAttribute(Constants.ATTR_TYPE, link.getType());
       }
 
       if (link.getInlineEntry() != null || link.getInlineFeed() != null) {
-        final Element inline = entry.getOwnerDocument().createElement(ODataConstants.ATOM_ELEM_INLINE);
+        final Element inline = entry.getOwnerDocument().createElement(Constants.ATOM_ELEM_INLINE);
         linkElem.appendChild(inline);
 
         if (link.getInlineEntry() != null) {
@@ -85,33 +85,33 @@ public class AtomSerializer {
     final DocumentBuilder builder = XMLUtils.DOC_BUILDER_FACTORY.newDocumentBuilder();
     final Document doc = builder.newDocument();
 
-    final Element entryElem = doc.createElement(ODataConstants.ATOM_ELEM_ENTRY);
-    entryElem.setAttribute(XMLConstants.XMLNS_ATTRIBUTE, ODataConstants.NS_ATOM);
-    entryElem.setAttribute(ODataConstants.XMLNS_METADATA,
+    final Element entryElem = doc.createElement(Constants.ATOM_ELEM_ENTRY);
+    entryElem.setAttribute(XMLConstants.XMLNS_ATTRIBUTE, Constants.NS_ATOM);
+    entryElem.setAttribute(Constants.XMLNS_METADATA,
             client.getServiceVersion().getNamespaceMap().get(ODataServiceVersion.NS_METADATA));
-    entryElem.setAttribute(ODataConstants.XMLNS_DATASERVICES,
+    entryElem.setAttribute(Constants.XMLNS_DATASERVICES,
             client.getServiceVersion().getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
-    entryElem.setAttribute(ODataConstants.XMLNS_GML, ODataConstants.NS_GML);
-    entryElem.setAttribute(ODataConstants.XMLNS_GEORSS, ODataConstants.NS_GEORSS);
+    entryElem.setAttribute(Constants.XMLNS_GML, Constants.NS_GML);
+    entryElem.setAttribute(Constants.XMLNS_GEORSS, Constants.NS_GEORSS);
     if (entry.getBaseURI() != null) {
-      entryElem.setAttribute(ODataConstants.ATTR_XMLBASE, entry.getBaseURI().toASCIIString());
+      entryElem.setAttribute(Constants.ATTR_XMLBASE, entry.getBaseURI().toASCIIString());
     }
     doc.appendChild(entryElem);
 
-    final Element category = doc.createElement(ODataConstants.ATOM_ELEM_CATEGORY);
-    category.setAttribute(ODataConstants.ATOM_ATTR_TERM, entry.getType());
-    category.setAttribute(ODataConstants.ATOM_ATTR_SCHEME,
+    final Element category = doc.createElement(Constants.ATOM_ELEM_CATEGORY);
+    category.setAttribute(Constants.ATOM_ATTR_TERM, entry.getType());
+    category.setAttribute(Constants.ATOM_ATTR_SCHEME,
             client.getServiceVersion().getNamespaceMap().get(ODataServiceVersion.NS_SCHEME));
     entryElem.appendChild(category);
 
     if (StringUtils.isNotBlank(entry.getTitle())) {
-      final Element title = doc.createElement(ODataConstants.ATOM_ELEM_TITLE);
+      final Element title = doc.createElement(Constants.ATOM_ELEM_TITLE);
       title.appendChild(doc.createTextNode(entry.getTitle()));
       entryElem.appendChild(title);
     }
 
     if (StringUtils.isNotBlank(entry.getSummary())) {
-      final Element summary = doc.createElement(ODataConstants.ATOM_ELEM_SUMMARY);
+      final Element summary = doc.createElement(Constants.ATOM_ELEM_SUMMARY);
       summary.appendChild(doc.createTextNode(entry.getSummary()));
       entryElem.appendChild(summary);
     }
@@ -120,13 +120,13 @@ public class AtomSerializer {
     setLinks(entryElem, entry.getNavigationLinks());
     setLinks(entryElem, entry.getMediaEditLinks());
 
-    final Element content = doc.createElement(ODataConstants.ATOM_ELEM_CONTENT);
+    final Element content = doc.createElement(Constants.ATOM_ELEM_CONTENT);
     if (entry.isMediaEntry()) {
       if (StringUtils.isNotBlank(entry.getMediaContentType())) {
-        content.setAttribute(ODataConstants.ATTR_TYPE, entry.getMediaContentType());
+        content.setAttribute(Constants.ATTR_TYPE, entry.getMediaContentType());
       }
       if (StringUtils.isNotBlank(entry.getMediaContentSource())) {
-        content.setAttribute(ODataConstants.ATOM_ATTR_SRC, entry.getMediaContentSource());
+        content.setAttribute(Constants.ATOM_ATTR_SRC, entry.getMediaContentSource());
       }
       if (content.getAttributes().getLength() > 0) {
         entryElem.appendChild(content);
@@ -136,7 +136,7 @@ public class AtomSerializer {
         entryElem.appendChild(doc.importNode(entry.getMediaEntryProperties(), true));
       }
     } else {
-      content.setAttribute(ODataConstants.ATTR_TYPE, ContentType.APPLICATION_XML.getMimeType());
+      content.setAttribute(Constants.ATTR_TYPE, ContentType.APPLICATION_XML.getMimeType());
       if (entry.getContent() != null) {
         content.appendChild(doc.importNode(entry.getContent(), true));
       }
@@ -150,27 +150,27 @@ public class AtomSerializer {
     final DocumentBuilder builder = XMLUtils.DOC_BUILDER_FACTORY.newDocumentBuilder();
     final Document doc = builder.newDocument();
 
-    final Element feedElem = doc.createElement(ODataConstants.ATOM_ELEM_FEED);
-    feedElem.setAttribute(XMLConstants.XMLNS_ATTRIBUTE, ODataConstants.NS_ATOM);
-    feedElem.setAttribute(ODataConstants.XMLNS_METADATA,
+    final Element feedElem = doc.createElement(Constants.ATOM_ELEM_FEED);
+    feedElem.setAttribute(XMLConstants.XMLNS_ATTRIBUTE, Constants.NS_ATOM);
+    feedElem.setAttribute(Constants.XMLNS_METADATA,
             client.getServiceVersion().getNamespaceMap().get(ODataServiceVersion.NS_METADATA));
-    feedElem.setAttribute(ODataConstants.XMLNS_DATASERVICES,
+    feedElem.setAttribute(Constants.XMLNS_DATASERVICES,
             client.getServiceVersion().getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
-    feedElem.setAttribute(ODataConstants.XMLNS_GML, ODataConstants.NS_GML);
-    feedElem.setAttribute(ODataConstants.XMLNS_GEORSS, ODataConstants.NS_GEORSS);
+    feedElem.setAttribute(Constants.XMLNS_GML, Constants.NS_GML);
+    feedElem.setAttribute(Constants.XMLNS_GEORSS, Constants.NS_GEORSS);
     if (feed.getBaseURI() != null) {
-      feedElem.setAttribute(ODataConstants.ATTR_XMLBASE, feed.getBaseURI().toASCIIString());
+      feedElem.setAttribute(Constants.ATTR_XMLBASE, feed.getBaseURI().toASCIIString());
     }
     doc.appendChild(feedElem);
 
     if (StringUtils.isNotBlank(feed.getTitle())) {
-      final Element title = doc.createElement(ODataConstants.ATOM_ELEM_TITLE);
+      final Element title = doc.createElement(Constants.ATOM_ELEM_TITLE);
       title.appendChild(doc.createTextNode(feed.getTitle()));
       feedElem.appendChild(title);
     }
 
     if (StringUtils.isNotBlank(feed.getSummary())) {
-      final Element summary = doc.createElement(ODataConstants.ATOM_ELEM_SUMMARY);
+      final Element summary = doc.createElement(Constants.ATOM_ELEM_SUMMARY);
       summary.appendChild(doc.createTextNode(feed.getSummary()));
       feedElem.appendChild(summary);
     }