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

[49/51] [abbrv] [partial] Removing /ODataJClient: merge complete

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/header/ODataHeaders.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/header/ODataHeaders.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/header/ODataHeaders.java
deleted file mode 100644
index 68bb42c..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/header/ODataHeaders.java
+++ /dev/null
@@ -1,253 +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 com.msopentech.odatajclient.engine.communication.header;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.TreeMap;
-
-/**
- * ODataHeaders wraps OData request/response headers.
- *
- * @see com.msopentech.odatajclient.engine.communication.request.ODataRequest
- * @see com.msopentech.odatajclient.engine.communication.response.ODataResponse
- */
-public class ODataHeaders {
-
-    /**
-     * Major OData request/response header names.
-     */
-    public enum HeaderName {
-
-        /**
-         * The OData protocol uses the Accept request-header field, as specified in [RFC2616].
-         */
-        accept("Accept"),
-        /**
-         * The Content-Type header is used as specified in [RFC2616].
-         * <br/>
-         * OData request/response supports the following types:
-         * <ul>
-         * <li>application/atom+xml</li>
-         * <li>application/atom+xml;type=entry</li>
-         * <li>application/atom+xml;type=feed</li>
-         * <li>application/json; odata=verbose</li>
-         * <li>application/json</li>
-         * <li>application/xml</li>
-         * <li>text/plain</li>
-         * <li>text/xml</li>
-         * <li>octet/stream</li>
-         * <li>multipart/mixed</li>
-         * </ul>
-         */
-        contentType("Content-Type"),
-        /**
-         * This header is a custom HTTP header defined for protocol versioning purposes.
-         * This header MAY be present on any request or response message.
-         */
-        dataServiceVersion("DataServiceVersion"),
-        /**
-         * An ETag (entity tag) is an HTTP response header returned by an HTTP/1.1 compliant web server
-         * used to determine change in content of a resource at a given URL. The value of the header is an
-         * opaque string representing the state of the resource at the time the response was generated.
-         */
-        etag("ETag"),
-        /**
-         * The If-Match request-header field is used with a method to make it conditional. As specified in
-         * [RFC2616], "the purpose of this feature is to allow efficient updates of cached information with a
-         * minimum amount of transaction overhead. It is also used, on updating requests, to prevent
-         * inadvertent modification of the wrong version of a resource".
-         */
-        ifMatch("If-Match"),
-        /**
-         * The If-None-Match request header is used with a method to make it conditional. As specified in
-         * [RFC2616], "The purpose of this feature is to allow efficient updates of cached information with a
-         * minimum amount of transaction overhead. It is also used to prevent a method (for example, PUT)
-         * from inadvertently modifying an existing resource when the client believes that the resource does
-         * not exist."
-         */
-        ifNoneMatch("If-None-Match"),
-        /**
-         * This header is a custom HTTP request only header defined for protocol versioning purposes.
-         * This header MAY be present on any request message from client to server.
-         */
-        maxDataServiceVersion("MaxDataServiceVersion"),
-        /**
-         * This header is a custom HTTP request only header defined for protocol versioning purposes.
-         * This header MAY be present on any request message from client to server.
-         */
-        minDataServiceVersion("MinDataServiceVersion"),
-        /**
-         * A Prefer header is included in a request to state the client’s preferred, but not required, server
-         * behavior (that is, a hint to the server). The Prefer header MAY be included on any request type
-         * (within a standalone or batch request), and a server MAY honor the header for HTTP POST, PUT,
-         * PATCH, and MERGE requests. A Prefer header with a value of “return-content” MUST NOT be
-         * specified on a DELETE request, a batch request as a whole, or a PUT request to update a named
-         * stream.
-         */
-        prefer("Prefer"),
-        /**
-         * When a Prefer header value is successfully honored by the server, it MAY include a
-         * Preference-Applied response header that states which preference values were honored by the
-         * server.
-         */
-        preferenceApplied("Preference-Applied"),
-        /**
-         * The DataServiceId response header is returned by the server when the response payload for an
-         * HTTP PUT, POST, PATCH, or MERGE request is empty.
-         * The value of the header is the identifier of the entity that was acted on by the PUT, POST, PATCH, or
-         * MERGE request. The identifier, in this case, is the same identifier that would have been returned in
-         * the response payload (for example, as the value of the atom:id element for Atom responses)
-         */
-        dataServiceId("DataServiceId"),
-        /**
-         * Location header is used to specify the URL of an entity modified through a Data Modification request, or the
-         * request URL to check on the status of an asynchronous operation as described in
-         * <code>202 Accepted</code>.
-         */
-        location("Location"),
-        /**
-         * A service must include a
-         * <code>Retry-After</code> header in a
-         * <code>202 Accepted</code>.
-         */
-        retryAfter("Retry-After"),
-        dataServiceUrlConventions("DataServiceUrlConventions"),
-        slug("Slug"),
-        /**
-         * This header is a custom HTTP request header.
-         * <br/>
-         * It is possible to instruct network intermediaries (proxies, firewalls, and so on) inspecting traffic at
-         * the application protocol layer (for example, HTTP) to block requests that contain certain HTTP verbs.
-         * In practice, GET and POST verbs are rarely blocked (traditional web pages rely heavily on these
-         * HTTP methods), while, for a variety of reasons (such as security vulnerabilities in prior protocols),
-         * other HTTP methods (PUT, DELETE, and so on) are at times blocked by intermediaries. Additionally,
-         * some existing HTTP libraries do not allow creation of requests using verbs other than GET or POST.
-         * Therefore, an alternative way of specifying request types which use verbs other than GET and POST
-         * is needed to ensure that this document works well in a wide range of environments.
-         * <br/>
-         * To address this need, the X-HTTP-Method header can be added to a POST request that signals that
-         * the server MUST process the request not as a POST, but as if the HTTP verb specified as the value of
-         * the header was used as the method on the HTTP request's request line, as specified in [RFC2616]
-         * section 5.1. This technique is often referred to as "verb tunneling".
-         * <br/>
-         * This header is only valid when on POST requests.
-         */
-        xHttpMethod("X-HTTP-METHOD");
-
-        private final String headerName;
-
-        private HeaderName(final String headerName) {
-            this.headerName = headerName;
-        }
-
-        @Override
-        public String toString() {
-            return headerName;
-        }
-    }
-
-    /**
-     * OData request/response header key/value pairs.
-     */
-    private final Map<String, String> headers = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
-
-    /**
-     * Add the specified (custom) header (header name is case-insensitive).
-     *
-     * @param name header key.
-     * @param value header value.
-     * @return the current updated header instance.
-     */
-    public ODataHeaders setHeader(final String name, final String value) {
-        headers.put(name, value);
-        return this;
-    }
-
-    /**
-     * Add the specified header.
-     *
-     * @param name header key.
-     * @param value header value.
-     * @return the current updated header instance.
-     */
-    public ODataHeaders setHeader(final HeaderName name, final String value) {
-        headers.put(name.toString(), value);
-        return this;
-    }
-
-    /**
-     * Gets the value of the header identified by the given name.
-     * <br/>
-     * Please note that header name is case-insensitive.
-     *
-     * @param name name of the header to be retrieved.
-     * @return header value.
-     */
-    public String getHeader(final HeaderName name) {
-        return headers.get(name.toString());
-    }
-
-    /**
-     * Gets the value of the header identified by the given name.
-     * <br/>
-     * Please note that header name is case-insensitive.
-     *
-     * @param name name of the header to be retrieved.
-     * @return header value.
-     */
-    public String getHeader(final String name) {
-        return headers.get(name);
-    }
-
-    /**
-     * Removes the header identified by the given name.
-     * <br/>
-     * Please note that header name is case-insensitive.
-     *
-     * @param name name of the header to be retrieved.
-     * @return header name (if found).
-     */
-    public String removeHeader(final HeaderName name) {
-        return headers.remove(name.toString());
-    }
-
-    /**
-     * Removes the header identified by the given name.
-     * <br/>
-     * Please note that header name is case-insensitive.
-     *
-     * @param name name of the header to be retrieved.
-     * @return header name (if found).
-     */
-    public String removeHeader(final String name) {
-        return headers.remove(name);
-    }
-
-    /**
-     * Gets header names.
-     * <br/>
-     * Please note that header name is case-insensitive.
-     *
-     * @return header names.
-     */
-    public Collection<String> getHeaderNames() {
-        return headers.keySet();
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/AbstractODataBasicRequestImpl.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/AbstractODataBasicRequestImpl.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/AbstractODataBasicRequestImpl.java
deleted file mode 100644
index 39c7112..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/AbstractODataBasicRequestImpl.java
+++ /dev/null
@@ -1,124 +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 com.msopentech.odatajclient.engine.communication.request;
-
-import com.msopentech.odatajclient.engine.client.ODataClient;
-import com.msopentech.odatajclient.engine.client.http.HttpMethod;
-import com.msopentech.odatajclient.engine.communication.request.batch.ODataBatchRequest;
-import com.msopentech.odatajclient.engine.communication.response.ODataResponse;
-import com.msopentech.odatajclient.engine.utils.ODataBatchConstants;
-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.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-
-/**
- * Basic request abstract implementation.
- *
- * @param <V> OData response type corresponding to the request implementation.
- * @param <T> OData format being used.
- */
-public abstract class AbstractODataBasicRequestImpl<V extends ODataResponse, T extends Enum<T>>
-        extends ODataRequestImpl<T>
-        implements ODataBasicRequest<V, T> {
-
-    /**
-     * Constructor.
-     *
-     * @param odataClient client instance getting this request
-     * @param formatRef reference class for the format being used
-     * @param method request method.
-     * @param uri OData request URI.
-     */
-    public AbstractODataBasicRequestImpl(final ODataClient odataClient,
-            final Class<T> formatRef, final HttpMethod method, final URI uri) {
-
-        super(odataClient, formatRef, method, uri);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setFormat(final T format) {
-        if (format != null) {
-            setAccept(format.toString());
-            setContentType(format.toString());
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public final Future<V> asyncExecute() {
-        return odataClient.getConfiguration().getExecutor().submit(new Callable<V>() {
-
-            @Override
-            public V call() throws Exception {
-                return execute();
-            }
-        });
-    }
-
-    /**
-     * Gets payload as an InputStream.
-     *
-     * @return InputStream for entire payload.
-     */
-    protected abstract InputStream getPayload();
-
-    /**
-     * Serializes the full request into the given batch request.
-     *
-     * @param req destination batch request.
-     */
-    public void batch(final ODataBatchRequest req) {
-        batch(req, null);
-    }
-
-    /**
-     * Serializes the full request into the given batch request.
-     * <p>
-     * This method have to be used to serialize a changeset item with the specified contentId.
-     *
-     * @param req destination batch request.
-     * @param contentId contentId of the changeset item.
-     */
-    public void batch(final ODataBatchRequest req, final String contentId) {
-        try {
-            req.rawAppend(toByteArray());
-            if (StringUtils.isNotBlank(contentId)) {
-                req.rawAppend((ODataBatchConstants.CHANGESET_CONTENT_ID_NAME + ": " + contentId).getBytes());
-                req.rawAppend(ODataStreamer.CRLF);
-            }
-            req.rawAppend(ODataStreamer.CRLF);
-
-            final InputStream payload = getPayload();
-            if (payload != null) {
-                req.rawAppend(IOUtils.toByteArray(getPayload()));
-            }
-        } catch (IOException e) {
-            throw new IllegalStateException(e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataBasicRequest.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataBasicRequest.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataBasicRequest.java
deleted file mode 100644
index 52fd2f9..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataBasicRequest.java
+++ /dev/null
@@ -1,54 +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 com.msopentech.odatajclient.engine.communication.request;
-
-import com.msopentech.odatajclient.engine.communication.response.ODataResponse;
-import java.util.concurrent.Future;
-
-/**
- * Basic OData request.
- *
- * @param <V> OData response type corresponding to the request implementation.
- * @param <T> Accepted content-type formats by the request in object.
- */
-public interface ODataBasicRequest<V extends ODataResponse, T extends Enum<T>> extends ODataRequest {
-
-    /**
-     * Request execute.
-     *
-     * @return return an OData response.
-     */
-    V execute();
-
-    /**
-     * Async request execute.
-     *
-     * @return <code>Future&lt;ODataResponse&gt;</code> about the executed request.
-     */
-    Future<V> asyncExecute();
-
-    /**
-     * Override configured request format.
-     *
-     * @param format request format.
-     * @see com.msopentech.odatajclient.engine.format.ODataFormat
-     * @see com.msopentech.odatajclient.engine.format.ODataPubFormat
-     */
-    void setFormat(T format);
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataRequest.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataRequest.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataRequest.java
deleted file mode 100644
index 4fbd413..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataRequest.java
+++ /dev/null
@@ -1,197 +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 com.msopentech.odatajclient.engine.communication.request;
-
-import com.msopentech.odatajclient.engine.client.http.HttpMethod;
-import com.msopentech.odatajclient.engine.communication.request.batch.BatchRequestFactory;
-import com.msopentech.odatajclient.engine.communication.request.cud.CUDRequestFactory;
-import com.msopentech.odatajclient.engine.communication.request.invoke.InvokeRequestFactory;
-import com.msopentech.odatajclient.engine.communication.request.retrieve.RetrieveRequestFactory;
-import com.msopentech.odatajclient.engine.communication.request.streamed.StreamedRequestFactory;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.Collection;
-
-/**
- * Abstract representation of an OData request.
- * Get instance by using factories.
- *
- * @see CUDRequestFactory
- * @see RetrieveRequestFactory
- * @see BatchRequestFactory
- * @see InvokeRequestFactory
- * @see StreamedRequestFactory
- */
-public interface ODataRequest {
-
-    /**
-     * Returns OData request target URI.
-     *
-     * @return OData request target URI.
-     */
-    URI getURI();
-
-    /**
-     * Returns HTTP request method.
-     *
-     * @return HTTP request method.
-     */
-    HttpMethod getMethod();
-
-    /**
-     * Gets all OData request header names.
-     *
-     * @return all request header names.
-     */
-    Collection<String> getHeaderNames();
-
-    /**
-     * Gets the value of the OData request header identified by the given name.
-     *
-     * @param name name of the OData request header to be retrieved.
-     * @return header value.
-     */
-    String getHeader(final String name);
-
-    /**
-     * Adds <tt>Accept</tt> OData request header.
-     *
-     * @param value header value.
-     * @return current object
-     * @see com.msopentech.odatajclient.engine.communication.header.ODataHeaders.HeaderName#accept
-     */
-    ODataRequest setAccept(final String value);
-
-    /**
-     * Gets <tt>Accept</tt> OData request header.
-     *
-     * @return header value.
-     * @see com.msopentech.odatajclient.engine.communication.header.ODataHeaders.HeaderName#accept
-     */
-    String getAccept();
-
-    /**
-     * Adds <tt>If-Match</tt> OData request header.
-     *
-     * @param value header value.
-     * @return current object
-     * @see com.msopentech.odatajclient.engine.communication.header.ODataHeaders.HeaderName#ifMatch
-     */
-    ODataRequest setIfMatch(final String value);
-
-    /**
-     * Gets <tt>If-Match</tt> OData request header.
-     *
-     * @return header value.
-     * @see com.msopentech.odatajclient.engine.communication.header.ODataHeaders.HeaderName#ifMatch
-     */
-    String getIfMatch();
-
-    /**
-     * Adds <tt>If-None-Match</tt> OData request header.
-     *
-     * @param value header value.
-     * @return current object
-     * @see com.msopentech.odatajclient.engine.communication.header.ODataHeaders.HeaderName#ifNoneMatch
-     */
-    ODataRequest setIfNoneMatch(final String value);
-
-    /**
-     * Gets <tt>If-None-Match</tt> OData request header.
-     *
-     * @return header value.
-     * @see com.msopentech.odatajclient.engine.communication.header.ODataHeaders.HeaderName#ifNoneMatch
-     */
-    String getIfNoneMatch();
-
-    /**
-     * Adds <tt>Prefer</tt> OData request header.
-     *
-     * @param value header value.
-     * @return current object
-     * @see com.msopentech.odatajclient.engine.communication.header.ODataHeaders.HeaderName#prefer
-     */
-    ODataRequest setPrefer(final String value);
-
-    /**
-     * Gets <tt>Prefer</tt> OData request header.
-     *
-     * @return header value.
-     * @see com.msopentech.odatajclient.engine.communication.header.ODataHeaders.HeaderName#prefer
-     */
-    String getPrefer();
-
-    /**
-     * Adds <tt>contentType</tt> OData request header.
-     *
-     * @param value header value.
-     * @return current object
-     * @see com.msopentech.odatajclient.engine.communication.header.ODataHeaders.HeaderName#contentType
-     */
-    ODataRequest setContentType(final String value);
-
-    /**
-     * Gets <tt>contentType</tt> OData request header.
-     *
-     * @return header value.
-     * @see com.msopentech.odatajclient.engine.communication.header.ODataHeaders.HeaderName#contentType
-     */
-    String getContentType();
-
-    /**
-     * Adds <tt>Slug</tt> OData request header.
-     *
-     * @param value header value.
-     * @return current object
-     * @see com.msopentech.odatajclient.engine.communication.header.ODataHeaders.HeaderName#slug
-     */
-    ODataRequest setSlug(final String value);
-
-    /**
-     * Adds <tt>X-HTTP-METHOD</tt> OData request header.
-     *
-     * @param value header value.
-     * @return current object
-     * @see com.msopentech.odatajclient.engine.communication.header.ODataHeaders.HeaderName#xHttpMethod
-     */
-    ODataRequest setXHTTPMethod(final String value);
-
-    /**
-     * Adds a custom OData request header.
-     *
-     * @param name header name.
-     * @param value header value.
-     * @return current object
-     */
-    ODataRequest addCustomHeader(final String name, final String value);
-
-    /**
-     * Gets byte array representation of the full request header.
-     *
-     * @return full request header.
-     */
-    byte[] toByteArray();
-
-    /**
-     * Request raw execute.
-     *
-     * @return raw input stream response.
-     */
-    InputStream rawExecute();
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataRequestImpl.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataRequestImpl.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataRequestImpl.java
deleted file mode 100644
index b546457..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataRequestImpl.java
+++ /dev/null
@@ -1,481 +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 com.msopentech.odatajclient.engine.communication.request;
-
-import com.msopentech.odatajclient.engine.client.ODataClient;
-import com.msopentech.odatajclient.engine.client.http.HttpClientException;
-import com.msopentech.odatajclient.engine.client.http.HttpMethod;
-import com.msopentech.odatajclient.engine.communication.ODataClientErrorException;
-import com.msopentech.odatajclient.engine.communication.ODataServerErrorException;
-import com.msopentech.odatajclient.engine.communication.header.ODataHeaderValues;
-import com.msopentech.odatajclient.engine.communication.header.ODataHeaders;
-import com.msopentech.odatajclient.engine.communication.request.batch.BatchRequestFactory;
-import com.msopentech.odatajclient.engine.communication.request.cud.CUDRequestFactory;
-import com.msopentech.odatajclient.engine.communication.request.invoke.InvokeRequestFactory;
-import com.msopentech.odatajclient.engine.communication.request.streamed.StreamedRequestFactory;
-import com.msopentech.odatajclient.engine.communication.response.ODataResponse;
-import com.msopentech.odatajclient.engine.data.ODataError;
-import com.msopentech.odatajclient.engine.data.impl.v3.JSONODataError;
-import com.msopentech.odatajclient.engine.data.impl.v3.XMLODataError;
-import com.msopentech.odatajclient.engine.format.ODataMediaFormat;
-import com.msopentech.odatajclient.engine.format.ODataPubFormat;
-import com.msopentech.odatajclient.engine.format.ODataValueFormat;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Constructor;
-import java.net.URI;
-import java.util.Collection;
-import java.util.Collections;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.http.Header;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpUriRequest;
-import org.apache.http.impl.client.DecompressingHttpClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Abstract representation of an OData request.
- * Get instance by using factories.
- *
- * @param <T> Accepted content-type formats by the request in object.
- *
- * @see CUDRequestFactory
- * @see BatchRequestFactory
- * @see InvokeRequestFactory
- * @see StreamedRequestFactory
- */
-public class ODataRequestImpl<T extends Enum<T>> implements ODataRequest {
-
-    /**
-     * Logger.
-     */
-    protected static final Logger LOG = LoggerFactory.getLogger(ODataRequest.class);
-
-    protected final ODataClient odataClient;
-
-    protected final Class<T> formatRef;
-
-    /**
-     * OData request method.
-     */
-    protected final HttpMethod method;
-
-    /**
-     * OData request header.
-     */
-    protected final ODataHeaders odataHeaders;
-
-    /**
-     * Target URI.
-     */
-    protected final URI uri;
-
-    /**
-     * HTTP client.
-     */
-    protected final HttpClient httpClient;
-
-    /**
-     * HTTP request.
-     */
-    protected final HttpUriRequest request;
-
-    /**
-     * Constructor.
-     *
-     * @param odataClient client instance getting this request
-     * @param formatRef reference class for the format being used
-     * @param method HTTP request method. If configured X-HTTP-METHOD header will be used.
-     * @param uri OData request URI.
-     */
-    protected ODataRequestImpl(final ODataClient odataClient,
-            final Class<T> formatRef, final HttpMethod method, final URI uri) {
-
-        this.odataClient = odataClient;
-
-        this.formatRef = formatRef;
-        this.method = method;
-
-        // initialize default headers
-        this.odataHeaders = odataClient.getVersionHeaders();
-
-        // target uri
-        this.uri = uri;
-
-        HttpClient _httpClient = odataClient.getConfiguration().getHttpClientFactory().
-                createHttpClient(this.method, this.uri);
-        if (odataClient.getConfiguration().isGzipCompression()) {
-            _httpClient = new DecompressingHttpClient(_httpClient);
-        }
-        this.httpClient = _httpClient;
-
-        this.request = odataClient.getConfiguration().getHttpUriRequestFactory().
-                createHttpUriRequest(this.method, this.uri);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @SuppressWarnings("unchecked")
-    public T getDefaultFormat() {
-        return (T) (formatRef.equals(ODataPubFormat.class)
-                ? odataClient.getConfiguration().getDefaultPubFormat()
-                : (formatRef.equals(ODataValueFormat.class)
-                ? odataClient.getConfiguration().getDefaultValueFormat()
-                : (formatRef.equals(ODataMediaFormat.class)
-                ? odataClient.getConfiguration().getDefaultMediaFormat()
-                : odataClient.getConfiguration().getDefaultFormat())));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public URI getURI() {
-        return uri;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Collection<String> getHeaderNames() {
-        return odataHeaders.getHeaderNames();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getHeader(final String name) {
-        return odataHeaders.getHeader(name);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ODataRequest setAccept(final String value) {
-        odataHeaders.setHeader(ODataHeaders.HeaderName.accept, value);
-        return this;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ODataRequest setIfMatch(final String value) {
-        odataHeaders.setHeader(ODataHeaders.HeaderName.ifMatch, value);
-        return this;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ODataRequest setIfNoneMatch(final String value) {
-        odataHeaders.setHeader(ODataHeaders.HeaderName.ifNoneMatch, value);
-        return this;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ODataRequest setPrefer(final String value) {
-        odataHeaders.setHeader(ODataHeaders.HeaderName.prefer, value);
-        return this;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ODataRequest setXHTTPMethod(final String value) {
-        odataHeaders.setHeader(ODataHeaders.HeaderName.xHttpMethod, value);
-        return this;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ODataRequest setContentType(final String value) {
-        odataHeaders.setHeader(ODataHeaders.HeaderName.contentType, value);
-        return this;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ODataRequest setSlug(final String value) {
-        odataHeaders.setHeader(ODataHeaders.HeaderName.slug, value);
-        return this;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ODataRequest addCustomHeader(final String name, final String value) {
-        odataHeaders.setHeader(name, value);
-        return this;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getAccept() {
-        final String acceptHead = odataHeaders.getHeader(ODataHeaders.HeaderName.accept);
-        return StringUtils.isBlank(acceptHead) ? getDefaultFormat().toString() : acceptHead;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getIfMatch() {
-        return odataHeaders.getHeader(ODataHeaders.HeaderName.ifMatch);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getIfNoneMatch() {
-        return odataHeaders.getHeader(ODataHeaders.HeaderName.ifNoneMatch);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getPrefer() {
-        return odataHeaders.getHeader(ODataHeaders.HeaderName.prefer);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getContentType() {
-        final String contentTypeHead = odataHeaders.getHeader(ODataHeaders.HeaderName.contentType);
-        return StringUtils.isBlank(contentTypeHead) ? getDefaultFormat().toString() : contentTypeHead;
-    }
-
-    /**
-     * ${@inheritDoc }
-     */
-    @Override
-    public HttpMethod getMethod() {
-        return method;
-    }
-
-    /**
-     * Gets request headers.
-     *
-     * @return request headers.
-     */
-    public ODataHeaders getHeader() {
-        return odataHeaders;
-    }
-
-    /**
-     * {@inheritDoc }
-     */
-    @Override
-    public byte[] toByteArray() {
-        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try {
-            final StringBuilder requestBuilder = new StringBuilder();
-            requestBuilder.append(getMethod().toString()).append(" ").
-                    append(uri.toString()).append(" ").append("HTTP/1.1");
-
-            baos.write(requestBuilder.toString().getBytes());
-
-            baos.write(ODataStreamer.CRLF);
-
-            // Set Content-Type and Accept headers with default values, if not yet set
-            if (StringUtils.isBlank(odataHeaders.getHeader(ODataHeaders.HeaderName.contentType))) {
-                setContentType(getContentType());
-            }
-            if (StringUtils.isBlank(odataHeaders.getHeader(ODataHeaders.HeaderName.accept))) {
-                setAccept(getAccept());
-            }
-
-            for (String name : getHeaderNames()) {
-                final String value = getHeader(name);
-
-                if (StringUtils.isNotBlank(value)) {
-                    baos.write((name + ": " + value).getBytes());
-                    baos.write(ODataStreamer.CRLF);
-                }
-            }
-
-            return baos.toByteArray();
-        } catch (IOException e) {
-            throw new IllegalStateException(e);
-        } finally {
-            IOUtils.closeQuietly(baos);
-        }
-    }
-
-    /**
-     * {@inheritDoc }
-     */
-    @Override
-    public InputStream rawExecute() {
-        try {
-            final HttpEntity httpEntity = doExecute().getEntity();
-            return httpEntity == null ? null : httpEntity.getContent();
-        } catch (IOException e) {
-            throw new HttpClientException(e);
-        } catch (RuntimeException e) {
-            this.request.abort();
-            throw new HttpClientException(e);
-        }
-    }
-
-    /**
-     * Builds the request and execute it.
-     *
-     * @return HttpReponse object.
-     */
-    protected HttpResponse doExecute() {
-        // Set Content-Type and Accept headers with default values, if not yet set
-        if (StringUtils.isBlank(odataHeaders.getHeader(ODataHeaders.HeaderName.contentType))) {
-            setContentType(getContentType());
-        }
-        if (StringUtils.isBlank(odataHeaders.getHeader(ODataHeaders.HeaderName.accept))) {
-            setAccept(getAccept());
-        }
-
-        // Add header for KeyAsSegment management
-        if (odataClient.getConfiguration().isKeyAsSegment()) {
-            addCustomHeader(
-                    ODataHeaders.HeaderName.dataServiceUrlConventions.toString(), ODataHeaderValues.keyAsSegment);
-        }
-
-        // Add all available headers
-        for (String key : getHeaderNames()) {
-            this.request.addHeader(key, odataHeaders.getHeader(key));
-        }
-
-        if (LOG.isDebugEnabled()) {
-            for (Header header : this.request.getAllHeaders()) {
-                LOG.debug("HTTP header being sent: " + header);
-            }
-        }
-
-        final HttpResponse response;
-        try {
-            response = this.httpClient.execute(this.request);
-        } catch (IOException e) {
-            throw new HttpClientException(e);
-        } catch (RuntimeException e) {
-            this.request.abort();
-            throw new HttpClientException(e);
-        }
-
-        if (response.getStatusLine().getStatusCode() >= 500) {
-            throw new ODataServerErrorException(response.getStatusLine());
-        } else if (response.getStatusLine().getStatusCode() >= 400) {
-            try {
-                final HttpEntity httpEntity = response.getEntity();
-                if (httpEntity == null) {
-                    throw new ODataClientErrorException(response.getStatusLine());
-                } else {
-                    final boolean isXML = getAccept().indexOf("json") == -1;
-                    ODataError error;
-
-                    try {
-                        error = odataClient.getReader().readError(httpEntity.getContent(), isXML);
-                    } catch (IllegalArgumentException e) {
-                        LOG.warn("Error deserializing error response", e);
-                        error = getGenericError(
-                                response.getStatusLine().getStatusCode(),
-                                response.getStatusLine().getReasonPhrase(),
-                                isXML);
-                    }
-
-                    throw new ODataClientErrorException(response.getStatusLine(), error);
-                }
-            } catch (IOException e) {
-                throw new HttpClientException(
-                        "Received '" + response.getStatusLine() + "' but could not extract error body", e);
-            }
-        }
-
-        return response;
-    }
-
-    /**
-     * Gets an empty response that can be initialized by a stream.
-     * <p>
-     * This method has to be used to build response items about a batch request.
-     *
-     * @param <V> ODataResppnse type.
-     * @return empty OData response instance.
-     */
-    @SuppressWarnings("unchecked")
-    public <V extends ODataResponse> V getResponseTemplate() {
-
-        for (Class<?> clazz : this.getClass().getDeclaredClasses()) {
-            if (ODataResponse.class.isAssignableFrom(clazz)) {
-                try {
-                    final Constructor<?> constructor = clazz.getDeclaredConstructor(this.getClass());
-                    constructor.setAccessible(true);
-                    return (V) constructor.newInstance(this);
-                } catch (Exception e) {
-                    LOG.error("Error retrieving response class template instance", e);
-                }
-            }
-        }
-
-        throw new IllegalStateException("No response class template has been found");
-    }
-
-    private ODataError getGenericError(final int code, final String errorMsg, final boolean isXML) {
-        final ODataError error;
-        if (isXML) {
-            error = new XMLODataError();
-            final XMLODataError.Message msg = new XMLODataError.Message(
-                    Collections.singletonMap("", (Object) errorMsg));
-
-            ((XMLODataError) error).setMessage(msg);
-            ((XMLODataError) error).setCode(String.valueOf(code));
-        } else {
-            error = new JSONODataError();
-            final JSONODataError.Message msg = new JSONODataError.Message();
-            msg.setValue(errorMsg);
-
-            ((JSONODataError) error).setMessage(msg);
-            ((JSONODataError) error).setCode(String.valueOf(code));
-        }
-
-        return error;
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataStreamManager.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataStreamManager.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataStreamManager.java
deleted file mode 100644
index 86edc52..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataStreamManager.java
+++ /dev/null
@@ -1,184 +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 com.msopentech.odatajclient.engine.communication.request;
-
-import com.msopentech.odatajclient.engine.client.http.HttpClientException;
-import com.msopentech.odatajclient.engine.communication.response.ODataResponse;
-import com.msopentech.odatajclient.engine.utils.Wrapper;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import org.apache.commons.io.IOUtils;
-import org.apache.http.HttpResponse;
-
-/**
- * OData request payload management abstract class.
- *
- * @param <T> OData response type corresponding to the request implementation.
- */
-public abstract class ODataStreamManager<T extends ODataResponse> extends ODataStreamer {
-
-    /**
-     * Body input stream.
-     */
-    private final PipedInputStream body;
-
-    /**
-     * Default body input stream.
-     */
-    private final InputStream defaultBody;
-
-    /**
-     * Wrapper for actual streamed request's future.
-     */
-    private final Wrapper<Future<HttpResponse>> futureWrap;
-
-    /**
-     * Constructor.
-     *
-     * @param futureWrap wrapper of the Future object of the HttpResponse.
-     */
-    public ODataStreamManager(final Wrapper<Future<HttpResponse>> futureWrap) {
-        this(futureWrap, new PipedOutputStream());
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param futureWrap wrapper of the Future object of the HttpResponse.
-     * @param output stream to be piped to retrieve the payload.
-     */
-    public ODataStreamManager(final Wrapper<Future<HttpResponse>> futureWrap, final PipedOutputStream output) {
-        super(output);
-
-        this.futureWrap = futureWrap;
-        try {
-            this.body = new PipedInputStream(getBodyStreamWriter());
-        } catch (IOException e) {
-            throw new IllegalStateException(e);
-        }
-        this.defaultBody = this.body;
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param futureWrap wrapper of the Future object of the HttpResponse.
-     * @param input stream to be used to retrieve the content.
-     */
-    public ODataStreamManager(final Wrapper<Future<HttpResponse>> futureWrap, final InputStream input) {
-        super(null);
-
-        this.futureWrap = futureWrap;
-        this.body = null;
-        this.defaultBody = input;
-    }
-
-    /**
-     * Gets payload stream.
-     *
-     * @return payload stream.
-     */
-    public InputStream getBody() {
-        return this.body == null ? this.defaultBody : this.body;
-    }
-
-    /**
-     * Closes piped output stream.
-     */
-    public void finalizeBody() {
-        IOUtils.closeQuietly(getBodyStreamWriter());
-    }
-
-    /**
-     * Gets HttpResponse.
-     *
-     * @param timeout maximum delay after which the request must be aborted.
-     * @param unit time unit.
-     * @return HttpResponse.
-     */
-    protected HttpResponse getHttpResponse(final long timeout, final TimeUnit unit) {
-        try {
-            return futureWrap.getWrapped().get(timeout, unit);
-        } catch (Exception e) {
-            LOG.error("Failure executing request");
-            throw new HttpClientException(e);
-        }
-    }
-
-    /**
-     * Gets OData response.
-     *
-     * @param timeout maximum delay after which the request must be aborted.
-     * @param unit time unit.
-     * @return ODataResponse instance.
-     */
-    protected abstract T getResponse(long timeout, TimeUnit unit);
-
-    /**
-     * Closes the payload input stream and gets the OData response back.
-     *
-     * @return OData response.
-     */
-    public final T getResponse() {
-        return getResponse(30, TimeUnit.SECONDS);
-    }
-
-    /**
-     * Closes the payload input stream and ask for an asynchronous response.
-     *
-     * @return <code>Future&lt;ODataResponse&gt;</code> about the executed request.
-     */
-    public final Future<T> getAsyncResponse() {
-        return new Future<T>() {
-
-            @Override
-            public boolean cancel(final boolean mayInterruptIfRunning) {
-                return futureWrap.getWrapped().cancel(mayInterruptIfRunning);
-            }
-
-            @Override
-            public boolean isCancelled() {
-                return futureWrap.getWrapped().isCancelled();
-            }
-
-            @Override
-            public boolean isDone() {
-                return futureWrap.getWrapped().isDone();
-            }
-
-            @Override
-            public T get() throws InterruptedException, ExecutionException {
-                return getResponse(0, TimeUnit.SECONDS);
-            }
-
-            @Override
-            public T get(final long timeout, final TimeUnit unit)
-                    throws InterruptedException, ExecutionException, TimeoutException {
-
-                return getResponse(timeout, unit);
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataStreamer.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataStreamer.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataStreamer.java
deleted file mode 100644
index 0411c66..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/ODataStreamer.java
+++ /dev/null
@@ -1,104 +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 com.msopentech.odatajclient.engine.communication.request;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PipedOutputStream;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Streamer utility object.
- */
-public abstract class ODataStreamer {
-
-    /**
-     * Logger.
-     */
-    protected static final Logger LOG = LoggerFactory.getLogger(ODataStreamer.class);
-
-    /**
-     * CR/LF.
-     */
-    public static final byte[] CRLF = {13, 10};
-
-    /**
-     * OutputStream to be used to write objects to the stream.
-     */
-    private final PipedOutputStream bodyStreamWriter;
-
-    /**
-     * Constructor.
-     *
-     * @param bodyStreamWriter piped stream to be used to retrieve the payload.
-     */
-    public ODataStreamer(final PipedOutputStream bodyStreamWriter) {
-        this.bodyStreamWriter = bodyStreamWriter;
-    }
-
-    /**
-     * Writes the gibe byte array onto the output stream provided at instantiation time.
-     *
-     * @param src byte array to be written.
-     */
-    protected void stream(final byte[] src) {
-        new Writer(src, bodyStreamWriter).run();
-    }
-
-    /**
-     * Stream CR/LF.
-     */
-    protected void newLine() {
-        stream(CRLF);
-    }
-
-    /**
-     * Gets the piped stream to be used to stream the payload.
-     *
-     * @return piped stream.
-     */
-    public PipedOutputStream getBodyStreamWriter() {
-        return bodyStreamWriter;
-    }
-
-    /**
-     * Writer thread.
-     */
-    private class Writer implements Runnable {
-
-        final OutputStream os;
-
-        final byte[] src;
-
-        public Writer(final byte[] src, final OutputStream os) {
-            this.os = os;
-            this.src = src;
-        }
-
-        @Override
-        public void run() {
-            try {
-                os.write(src);
-            } catch (IOException e) {
-                LOG.error("Error streaming object", e);
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/UpdateType.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/UpdateType.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/UpdateType.java
deleted file mode 100644
index c2c7c2b..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/UpdateType.java
+++ /dev/null
@@ -1,56 +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 com.msopentech.odatajclient.engine.communication.request;
-
-import com.msopentech.odatajclient.engine.client.http.HttpMethod;
-
-/**
- * Update type.
- */
-public enum UpdateType {
-
-    /**
-     * Replace all and remove missing attributes.
-     */
-    REPLACE(HttpMethod.PUT),
-    /**
-     * Differential update with whole entity as input (non-standard).
-     * Differences will be retrieved by the server itself.
-     */
-    MERGE(HttpMethod.MERGE),
-    /**
-     * Differential update with only specified input property values to be replaced.
-     */
-    PATCH(HttpMethod.PATCH);
-
-    private final HttpMethod method;
-
-    private UpdateType(final HttpMethod method) {
-        this.method = method;
-    }
-
-    /**
-     * Gets HTTP request method.
-     *
-     * @return HTTP request method.
-     */
-    public HttpMethod getMethod() {
-        return method;
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/AbstractBatchRequestFactory.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/AbstractBatchRequestFactory.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/AbstractBatchRequestFactory.java
deleted file mode 100644
index 0b4138b..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/AbstractBatchRequestFactory.java
+++ /dev/null
@@ -1,40 +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 com.msopentech.odatajclient.engine.communication.request.batch;
-
-import com.msopentech.odatajclient.engine.client.ODataClient;
-
-/**
- * OData batch request factory class.
- */
-public abstract class AbstractBatchRequestFactory implements BatchRequestFactory {
-
-    private static final long serialVersionUID = -3875283254713404483L;
-
-    protected final ODataClient client;
-
-    protected AbstractBatchRequestFactory(final ODataClient client) {
-        this.client = client;
-    }
-
-    @Override
-    public ODataBatchRequest getBatchRequest(final String serviceRoot) {
-        return new ODataBatchRequest(client, client.getURIBuilder(serviceRoot).appendBatchSegment().build());
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/BatchRequestFactory.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/BatchRequestFactory.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/BatchRequestFactory.java
deleted file mode 100644
index 1d184ae..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/BatchRequestFactory.java
+++ /dev/null
@@ -1,35 +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 com.msopentech.odatajclient.engine.communication.request.batch;
-
-import java.io.Serializable;
-
-/**
- * OData batch request factory class.
- */
-public interface BatchRequestFactory extends Serializable {
-
-    /**
-     * Gets a batch request object instance.
-     *
-     * @param serviceRoot service root.
-     * @return new ODataBatchRequest instance.
-     */
-    ODataBatchRequest getBatchRequest(String serviceRoot);
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchController.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchController.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchController.java
deleted file mode 100644
index 2dd78f9..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchController.java
+++ /dev/null
@@ -1,87 +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 com.msopentech.odatajclient.engine.communication.request.batch;
-
-/**
- * Utility class used to communicate batch info.
- */
-public class ODataBatchController {
-
-    /**
-     * Batch validity.
-     */
-    private boolean validBatch = true;
-
-    /**
-     * Batch boundary.
-     */
-    private final String boundary;
-
-    /**
-     * Batch line iterator.
-     */
-    private final ODataBatchLineIterator batchLineIterator;
-
-    /**
-     * Constructor.
-     *
-     * @param batchLineIterator batch line iterator.
-     * @param boundary batch boundary.
-     */
-    public ODataBatchController(final ODataBatchLineIterator batchLineIterator, final String boundary) {
-        this.batchLineIterator = batchLineIterator;
-        this.boundary = boundary;
-    }
-
-    /**
-     * Checks if batch is valid.
-     *
-     * @return batch validity.
-     */
-    public boolean isValidBatch() {
-        return validBatch;
-    }
-
-    /**
-     * Sets batch validity.
-     *
-     * @param validBatch validity.
-     */
-    public void setValidBatch(final boolean validBatch) {
-        this.validBatch = validBatch;
-    }
-
-    /**
-     * Gest batch boundary.
-     *
-     * @return batch boundary.
-     */
-    public String getBoundary() {
-        return boundary;
-    }
-
-    /**
-     * Gest batch line iterator.
-     *
-     * @return batch line iterator.
-     */
-    public ODataBatchLineIterator getBatchLineIterator() {
-        return batchLineIterator;
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchLineIterator.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchLineIterator.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchLineIterator.java
deleted file mode 100644
index 38be594..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchLineIterator.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.msopentech.odatajclient.engine.communication.request.batch;
-
-import java.util.Iterator;
-import org.apache.commons.io.LineIterator;
-
-/**
- * Batch line iterator class.
- */
-public class ODataBatchLineIterator implements Iterator<String> {
-
-    /**
-     * Stream line iterator.
-     */
-    private final LineIterator batchLineIterator;
-
-    /**
-     * Last cached line.
-     */
-    private String current;
-
-    /**
-     * Constructor.
-     *
-     * @param batchLineIterator stream line iterator.
-     */
-    public ODataBatchLineIterator(final LineIterator batchLineIterator) {
-        this.batchLineIterator = batchLineIterator;
-        this.current = null;
-    }
-
-    /**
-     * Checks if batch has next line.
-     *
-     * @return 'TRUE' if has next line; 'FALSE' otherwise.
-     */
-    @Override
-    public boolean hasNext() {
-        return batchLineIterator.hasNext();
-    }
-
-    /**
-     * Gets next line.
-     *
-     * @return next line.
-     */
-    @Override
-    public String next() {
-        return nextLine();
-    }
-
-    /**
-     * Gets next line.
-     *
-     * @return next line.
-     */
-    public String nextLine() {
-        current = batchLineIterator.nextLine();
-        return current;
-    }
-
-    /**
-     * Unsupported operation.
-     */
-    @Override
-    public void remove() {
-        throw new UnsupportedOperationException("Unsupported operation");
-    }
-
-    /**
-     * Gets last cached line (the current one).
-     *
-     * @return last cached line; null if <code>next()</code> method never called
-     */
-    public String getCurrent() {
-        return current;
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchRequest.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchRequest.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchRequest.java
deleted file mode 100644
index e08cdce..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchRequest.java
+++ /dev/null
@@ -1,259 +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 com.msopentech.odatajclient.engine.communication.request.batch;
-
-import com.msopentech.odatajclient.engine.client.ODataClient;
-import com.msopentech.odatajclient.engine.client.http.HttpMethod;
-import com.msopentech.odatajclient.engine.communication.request.ODataStreamManager;
-import com.msopentech.odatajclient.engine.communication.request.batch.ODataBatchRequest.BatchStreamManager;
-import com.msopentech.odatajclient.engine.communication.request.streamed.AbstractODataStreamedRequestImpl;
-import com.msopentech.odatajclient.engine.communication.response.ODataBatchResponse;
-import com.msopentech.odatajclient.engine.communication.response.ODataResponseImpl;
-import com.msopentech.odatajclient.engine.utils.ODataBatchConstants;
-import java.io.IOException;
-import java.io.PipedOutputStream;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.TimeUnit;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-
-/**
- * This class implements a batch request.
- */
-public class ODataBatchRequest extends AbstractODataStreamedRequestImpl<ODataBatchResponse, BatchStreamManager> {
-
-    /**
-     * Batch request boundary.
-     */
-    private final String boundary;
-
-    /**
-     * Expected batch response items.
-     */
-    private final List<ODataBatchResponseItem> expectedResItems = new ArrayList<ODataBatchResponseItem>();
-
-    /**
-     * Constructor.
-     *
-     * @param odataClient client instance getting this request
-     * @param uri batch request URI (http://serviceRoot/$batch)
-     */
-    ODataBatchRequest(final ODataClient odataClient, final URI uri) {
-        super(odataClient, HttpMethod.POST, uri);
-
-        // create a random UUID value for boundary
-        boundary = "batch_" + UUID.randomUUID().toString();
-
-        // specify the contentType header
-        setContentType(ODataBatchConstants.MULTIPART_CONTENT_TYPE + ";" + ODataBatchConstants.BOUNDARY + "=" + boundary);
-    }
-
-    /**
-     * {@inheritDoc }
-     */
-    @Override
-    protected BatchStreamManager getStreamManager() {
-        if (streamManager == null) {
-            streamManager = new BatchStreamManager(this);
-        }
-        return (BatchStreamManager) streamManager;
-    }
-
-    /**
-     * Gets piped stream to be used to stream batch items.
-     *
-     * @return piped stream for the payload.
-     */
-    PipedOutputStream getOutputStream() {
-        return getStreamManager().getBodyStreamWriter();
-    }
-
-    /**
-     * Appends the given byte array to the payload.
-     *
-     * @param toBeStreamed byte array to be appended.
-     * @return the current batch request.
-     * @throws IOException in case of write errors.
-     */
-    public ODataBatchRequest rawAppend(final byte[] toBeStreamed) throws IOException {
-        getStreamManager().getBodyStreamWriter().write(toBeStreamed);
-        return this;
-    }
-
-    /**
-     * Appends the given byte array to the payload.
-     *
-     * @param toBeStreamed byte array to be appended.
-     * @param off byte array offset.
-     * @param len number of byte to be streamed.
-     * @return the current batch request.
-     * @throws IOException in case of write errors.
-     */
-    public ODataBatchRequest rawAppend(final byte[] toBeStreamed, int off, int len) throws IOException {
-        getStreamManager().getBodyStreamWriter().write(toBeStreamed, off, len);
-        return this;
-    }
-
-    /**
-     * Batch request payload management.
-     */
-    public class BatchStreamManager extends ODataStreamManager<ODataBatchResponse> {
-
-        /**
-         * Batch request current item.
-         */
-        private ODataBatchRequestItem currentItem = null;
-
-        /**
-         * batch request reference.
-         */
-        private final ODataBatchRequest req;
-
-        /**
-         * Private constructor.
-         *
-         * @param req batch request reference.
-         */
-        private BatchStreamManager(final ODataBatchRequest req) {
-            super(ODataBatchRequest.this.futureWrapper);
-            this.req = req;
-        }
-
-        /**
-         * Gets a changeset batch item instance.
-         * A changeset can be submitted embedded into a batch request only.
-         *
-         * @return ODataChangeset instance.
-         */
-        public ODataChangeset addChangeset() {
-            closeCurrentItem();
-
-            // stream dash boundary
-            streamDashBoundary();
-
-            final ODataChangesetResponseItem expectedResItem = new ODataChangesetResponseItem();
-            expectedResItems.add(expectedResItem);
-
-            currentItem = new ODataChangeset(req, expectedResItem);
-
-            return (ODataChangeset) currentItem;
-        }
-
-        /**
-         * Gets a retrieve batch item instance.
-         * A retrieve item can be submitted embedded into a batch request only.
-         *
-         * @return ODataRetrieve instance.
-         */
-        public ODataRetrieve addRetrieve() {
-            closeCurrentItem();
-
-            // stream dash boundary
-            streamDashBoundary();
-
-            final ODataRetrieveResponseItem expectedResItem = new ODataRetrieveResponseItem();
-            currentItem = new ODataRetrieve(req, expectedResItem);
-
-            expectedResItems.add(expectedResItem);
-
-            return (ODataRetrieve) currentItem;
-        }
-
-        /**
-         * Close the current streamed item.
-         */
-        private void closeCurrentItem() {
-            if (currentItem != null) {
-                currentItem.close();
-            }
-        }
-
-        /**
-         * {@inheritDoc }
-         */
-        @Override
-        protected ODataBatchResponse getResponse(final long timeout, final TimeUnit unit) {
-            closeCurrentItem();
-            streamCloseDelimiter();
-            finalizeBody();
-            return new ODataBatchResponseImpl(httpClient, getHttpResponse(timeout, unit));
-        }
-
-        /**
-         * Streams dash boundary.
-         */
-        private void streamDashBoundary() {
-            // preamble
-            newLine();
-
-            // stream batch-boundary
-            stream(("--" + boundary).getBytes());
-            newLine();
-        }
-
-        /**
-         * Streams close delimiter.
-         */
-        private void streamCloseDelimiter() {
-            // stream close-delimiter
-            newLine();
-            stream(("--" + boundary + "--").getBytes());
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     * <p>
-     * This operation is unsupported by a batch request.
-     */
-    @Override
-    public void batch(ODataBatchRequest req) {
-        throw new UnsupportedOperationException("A batch request is not batchable");
-    }
-
-    /**
-     * This class implements a response to a batch request.
-     *
-     * @see com.msopentech.odatajclient.engine.communication.request.ODataBatchRequest
-     */
-    private class ODataBatchResponseImpl extends ODataResponseImpl implements ODataBatchResponse {
-
-        /**
-         * Constructor.
-         *
-         * @param client HTTP client.
-         * @param res HTTP response.
-         */
-        private ODataBatchResponseImpl(final HttpClient client, final HttpResponse res) {
-            super(client, res);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public Iterator<ODataBatchResponseItem> getBody() {
-            return new ODataBatchResponseManager(this, expectedResItems);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchRequestItem.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchRequestItem.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchRequestItem.java
deleted file mode 100644
index 6c31d4f..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchRequestItem.java
+++ /dev/null
@@ -1,121 +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 com.msopentech.odatajclient.engine.communication.request.batch;
-
-import com.msopentech.odatajclient.engine.communication.request.ODataStreamer;
-import com.msopentech.odatajclient.engine.utils.ODataBatchConstants;
-
-/**
- * Abstract representation of a batch request item.
- */
-public abstract class ODataBatchRequestItem extends ODataStreamer {
-
-    /**
-     * Stream started check.
-     */
-    protected boolean hasStreamedSomething = false;
-
-    /**
-     * Stream open check.
-     */
-    private boolean open = false;
-
-    /**
-     * OData batch request.
-     */
-    protected ODataBatchRequest req;
-
-    /**
-     * Constructor.
-     *
-     * @param req OData batch request.
-     */
-    public ODataBatchRequestItem(final ODataBatchRequest req) {
-        super(req.getOutputStream());
-        this.open = true;
-        this.req = req;
-    }
-
-    /**
-     * Checks if the current item is still opened.
-     *
-     * @return 'TRUE' if opened; 'FALSE' otherwise.
-     */
-    public boolean isOpen() {
-        return open;
-    }
-
-    /**
-     * Closes the item.
-     */
-    public void close() {
-        closeItem();
-        open = false;
-    }
-
-    /**
-     * Stream the given request header.
-     * <p>
-     * Use this method to stream changeset items.
-     *
-     * @param request request to be batched.
-     * @param contentId changeset item id.
-     */
-    protected void streamRequestHeader(final ODataBatchableRequest request, final int contentId) {
-        //stream batch content type
-        stream(ODataBatchConstants.ITEM_CONTENT_TYPE_LINE.getBytes());
-        newLine();
-        stream(ODataBatchConstants.ITEM_TRANSFER_ENCODING_LINE.getBytes());
-        newLine();
-        stream((ODataBatchConstants.CHANGESET_CONTENT_ID_NAME + ":" + contentId).getBytes());
-        newLine();
-        newLine();
-    }
-
-    /**
-     * Stream the given request header.
-     *
-     * @param request request to be batched.
-     */
-    protected void streamRequestHeader(final ODataBatchableRequest request) {
-        //stream batch content type
-        stream(ODataBatchConstants.ITEM_CONTENT_TYPE_LINE.getBytes());
-        newLine();
-        stream(ODataBatchConstants.ITEM_TRANSFER_ENCODING_LINE.getBytes());
-        newLine();
-        newLine();
-
-        stream(request.toByteArray());
-        newLine();
-    }
-
-    /**
-     * Checks if the streaming of the current item is started yet.
-     *
-     * @return 'TRUE' if started; 'FALSE' otherwise.
-     */
-    public boolean hasStreamedSomething() {
-        return hasStreamedSomething;
-    }
-
-    /**
-     * Closes the current item.
-     */
-    protected abstract void closeItem();
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchResponseItem.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchResponseItem.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchResponseItem.java
deleted file mode 100644
index 4bab39f..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/batch/ODataBatchResponseItem.java
+++ /dev/null
@@ -1,149 +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 com.msopentech.odatajclient.engine.communication.request.batch;
-
-import com.msopentech.odatajclient.engine.communication.response.ODataResponse;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Abstract representation of a response item about a batch request.
- */
-public abstract class ODataBatchResponseItem implements Iterator<ODataResponse> {
-
-    /**
-     * Logger.
-     */
-    protected static final Logger LOG = LoggerFactory.getLogger(ODataBatchResponseItem.class);
-
-    /**
-     * Expected OData responses for the current batch response item.
-     */
-    protected final Map<String, ODataResponse> responses = new HashMap<String, ODataResponse>();
-
-    /**
-     * Expected OData responses iterator.
-     */
-    protected Iterator<ODataResponse> expectedItemsIterator;
-
-    /**
-     * Changeset controller.
-     * Gives more information about the type of batch item.
-     */
-    private final boolean changeset;
-
-    /**
-     * Batch response line iterator.
-     */
-    protected ODataBatchLineIterator batchLineIterator;
-
-    /**
-     * Batch boundary.
-     */
-    protected String boundary;
-
-    /**
-     * Gives information about the batch response item status.
-     */
-    protected boolean closed = false;
-
-    /**
-     * Constructor.
-     *
-     * @param isChangeset 'TRUE' if the current batch response item is a changeset.
-     */
-    public ODataBatchResponseItem(boolean isChangeset) {
-        this.changeset = isChangeset;
-    }
-
-    /**
-     * Adds the given OData response template to the current OData batch response item.
-     *
-     * @param contentId changeset contentId in case of changeset; '__RETRIEVE__' in case of retrieve item.
-     * @param res OData response template to be added.
-     */
-    void addResponse(final String contentId, final ODataResponse res) {
-        if (closed) {
-            throw new IllegalStateException("Invalid batch item because explicitely closed");
-        }
-        responses.put(contentId, res);
-    }
-
-    /**
-     * Initializes ODataResponse template from batch response item part.
-     *
-     * @param batchLineIterator batch response line iterator.
-     * @param boundary batch response boundary.
-     */
-    void initFromBatch(final ODataBatchLineIterator batchLineIterator, final String boundary) {
-        if (closed) {
-            throw new IllegalStateException("Invalid batch item because explicitely closed");
-        }
-        LOG.debug("Init from batch - boundary '{}'", boundary);
-        this.batchLineIterator = batchLineIterator;
-        this.boundary = boundary;
-    }
-
-    /**
-     * Gets response about the given contentId.
-     *
-     * @param contentId response identifier (a specific contentId in case of changeset item).
-     * @return ODataResponse corresponding to the given contentId.
-     */
-    protected ODataResponse getResponse(final String contentId) {
-        if (closed) {
-            throw new IllegalStateException("Invalid batch item because explicitely closed");
-        }
-        return responses.get(contentId);
-    }
-
-    /**
-     * Gets OData responses iterator.
-     *
-     * @return OData responses iterator.
-     */
-    protected Iterator<ODataResponse> getResponseIterator() {
-        if (closed) {
-            throw new IllegalStateException("Invalid batch item because explicitely closed");
-        }
-        return responses.values().iterator();
-    }
-
-    /**
-     * Checks if the current batch response item is a changeset.
-     *
-     * @return 'TRUE' if the item is a changeset; 'FALSE' otherwise.
-     */
-    public final boolean isChangeset() {
-        return changeset;
-    }
-
-    /**
-     * Closes the current batch responses item including all wrapped OData responses.
-     */
-    public void close() {
-        for (ODataResponse response : responses.values()) {
-            response.close();
-        }
-        closed = true;
-    }
-}