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:54 UTC
[46/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/request/retrieve/ODataValueRequest.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/retrieve/ODataValueRequest.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/retrieve/ODataValueRequest.java
deleted file mode 100644
index 539aa11..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/retrieve/ODataValueRequest.java
+++ /dev/null
@@ -1,105 +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.retrieve;
-
-import com.msopentech.odatajclient.engine.client.ODataClient;
-import com.msopentech.odatajclient.engine.client.http.HttpClientException;
-import com.msopentech.odatajclient.engine.communication.response.ODataRetrieveResponse;
-import com.msopentech.odatajclient.engine.data.ODataPrimitiveValue;
-import com.msopentech.odatajclient.engine.data.ODataValue;
-import com.msopentech.odatajclient.engine.metadata.edm.EdmSimpleType;
-import com.msopentech.odatajclient.engine.format.ODataValueFormat;
-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;
-
-/**
- * This class implements an OData entity property value query request.
- */
-public class ODataValueRequest extends AbstractODataRetrieveRequest<ODataValue, ODataValueFormat> {
-
- /**
- * Private constructor.
- *
- * @param odataClient client instance getting this request
- * @param query query to be executed.
- */
- ODataValueRequest(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 ? EdmSimpleType.String : EdmSimpleType.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/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/retrieve/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/retrieve/RetrieveRequestFactory.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/retrieve/RetrieveRequestFactory.java
deleted file mode 100644
index 278e7c9..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/retrieve/RetrieveRequestFactory.java
+++ /dev/null
@@ -1,122 +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.retrieve;
-
-import java.io.Serializable;
-import java.net.URI;
-
-/**
- * OData request factory class.
- */
-public interface RetrieveRequestFactory extends Serializable {
-
- /**
- * Gets a service document request instance.
- *
- * @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the
- * data service.
- * @return new ODataServiceDocumentRequest instance.
- */
- ODataServiceDocumentRequest getServiceDocumentRequest(String serviceRoot);
-
- /**
- * Gets a metadata request instance.
- *
- * @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the
- * data service.
- * @return new ODataMetadataRequest instance.
- */
- ODataMetadataRequest getMetadataRequest(String serviceRoot);
-
- /**
- * Gets a query request returning a set of one or more OData entities.
- *
- * @param query query to be performed.
- * @return new ODataEntitySetRequest instance.
- */
- ODataEntitySetRequest getEntitySetRequest(URI query);
-
- /**
- * Gets a query request returning a set of one or more OData entities.
- * <br/>
- * Returned request gives the possibility to consume entities iterating on them without parsing and loading in
- * memory the entire entity set.
- *
- * @param query query to be performed.
- * @return new ODataEntitySetIteratorRequest instance.
- */
- ODataEntitySetIteratorRequest getEntitySetIteratorRequest(URI query);
-
- /**
- * Gets a query request returning a single OData entity.
- *
- * @param query query to be performed.
- * @return new ODataEntityRequest instance.
- */
- ODataEntityRequest getEntityRequest(URI query);
-
- /**
- * Gets a query request returning a single OData entity property.
- *
- * @param query query to be performed.
- * @return new ODataPropertyRequest instance.
- */
- ODataPropertyRequest getPropertyRequest(URI query);
-
- /**
- * Gets a query request returning a single OData entity property value.
- *
- * @param query query to be performed.
- * @return new ODataValueRequest instance.
- */
- ODataValueRequest getValueRequest(URI query);
-
- /**
- * Gets a query request returning a single OData link.
- *
- * @param targetURI target URI.
- * @param linkName link name.
- * @return new ODataLinkRequest instance.
- */
- ODataLinkCollectionRequest getLinkCollectionRequest(URI targetURI, String linkName);
-
- /**
- * Gets a query request returning a media stream.
- *
- * @param query query to be performed.
- * @return new ODataMediaRequest instance.
- */
- ODataMediaRequest getMediaRequest(URI query);
-
- /**
- * Implements a raw request returning a stream.
- *
- * @param uri query to be performed.
- * @return new ODataRawRequest instance.
- */
- ODataRawRequest getRawRequest(URI uri);
-
- /**
- * Implements a generic retrieve request without specifying any return type.
- *
- * @param uri query to be performed.
- * @return new ODataGenericRerieveRequest instance.
- */
- ODataGenericRetrieveRequest getGenericRetrieveRequest(URI uri);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/retrieve/V3RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/retrieve/V3RetrieveRequestFactory.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/retrieve/V3RetrieveRequestFactory.java
deleted file mode 100644
index cd8dc9a..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/retrieve/V3RetrieveRequestFactory.java
+++ /dev/null
@@ -1,45 +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.retrieve;
-
-import com.msopentech.odatajclient.engine.client.ODataV3Client;
-import org.apache.commons.lang3.StringUtils;
-
-public class V3RetrieveRequestFactory extends AbstractRetrieveRequestFactory {
-
- private static final long serialVersionUID = 6602745001042802479L;
-
- public V3RetrieveRequestFactory(final ODataV3Client client) {
- super(client);
- }
-
- @Override
- public ODataV3MetadataRequest getMetadataRequest(final String serviceRoot) {
- return new ODataV3MetadataRequest(client, client.getURIBuilder(serviceRoot).appendMetadataSegment().build());
- }
-
- @Override
- public ODataServiceDocumentRequest getServiceDocumentRequest(final String serviceRoot) {
- return new ODataServiceDocumentRequest(client,
- StringUtils.isNotBlank(serviceRoot) && serviceRoot.endsWith("/")
- ? client.getURIBuilder(serviceRoot).build()
- : client.getURIBuilder(serviceRoot + "/").build());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/retrieve/V4RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/retrieve/V4RetrieveRequestFactory.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/retrieve/V4RetrieveRequestFactory.java
deleted file mode 100644
index af0e5ec..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/retrieve/V4RetrieveRequestFactory.java
+++ /dev/null
@@ -1,44 +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.retrieve;
-
-import com.msopentech.odatajclient.engine.client.ODataV4Client;
-import org.apache.commons.lang3.StringUtils;
-
-public class V4RetrieveRequestFactory extends AbstractRetrieveRequestFactory {
-
- private static final long serialVersionUID = 546577958047902917L;
-
- public V4RetrieveRequestFactory(final ODataV4Client client) {
- super(client);
- }
-
- @Override
- public ODataV4MetadataRequest getMetadataRequest(final String serviceRoot) {
- return new ODataV4MetadataRequest(client, client.getURIBuilder(serviceRoot).appendMetadataSegment().build());
- }
-
- @Override
- public ODataServiceDocumentRequest getServiceDocumentRequest(final String serviceRoot) {
- return new ODataServiceDocumentRequest(client,
- StringUtils.isNotBlank(serviceRoot) && serviceRoot.endsWith("/")
- ? client.getURIBuilder(serviceRoot).build()
- : client.getURIBuilder(serviceRoot + "/").build());
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/AbstractODataStreamedEntityRequestImpl.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/AbstractODataStreamedEntityRequestImpl.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/AbstractODataStreamedEntityRequestImpl.java
deleted file mode 100644
index 267f2bc..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/AbstractODataStreamedEntityRequestImpl.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.msopentech.odatajclient.engine.communication.request.streamed;
-
-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.response.ODataResponse;
-import com.msopentech.odatajclient.engine.format.ODataFormat;
-import com.msopentech.odatajclient.engine.format.ODataPubFormat;
-import java.net.URI;
-import javax.security.auth.login.Configuration;
-
-/**
- * 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 AbstractODataStreamedEntityRequestImpl<V extends ODataResponse, T extends ODataStreamManager<V>>
- extends AbstractODataStreamedRequestImpl<V, T> {
-
- private ODataPubFormat format;
-
- /**
- * Constructor.
- *
- * @param odataClient client instance getting this request
- * @param method HTTP request method.
- * @param uri request URI.
- */
- public AbstractODataStreamedEntityRequestImpl(final ODataClient odataClient, final HttpMethod method,
- URI uri) {
- super(odataClient, method, uri);
- setAccept(getFormat().toString());
- }
-
- /**
- * Returns resource representation format.
- *
- * @return the configured format (or default if not specified).
- * @see Configuration#getDefaultPubFormat()
- */
- public final ODataPubFormat getFormat() {
- return format == null ? odataClient.getConfiguration().getDefaultPubFormat() : format;
- }
-
- /**
- * Override configured request format.
- *
- * @param format request format.
- * @see ODataFormat
- */
- public final void setFormat(final ODataPubFormat format) {
- this.format = format;
- setAccept(format.toString());
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/AbstractODataStreamedRequestImpl.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/AbstractODataStreamedRequestImpl.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/AbstractODataStreamedRequestImpl.java
deleted file mode 100644
index fe12421..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/AbstractODataStreamedRequestImpl.java
+++ /dev/null
@@ -1,154 +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.streamed;
-
-import com.msopentech.odatajclient.engine.client.ODataClient;
-import com.msopentech.odatajclient.engine.client.http.HttpMethod;
-import com.msopentech.odatajclient.engine.communication.request.ODataRequestImpl;
-import com.msopentech.odatajclient.engine.communication.request.ODataStreamer;
-import com.msopentech.odatajclient.engine.communication.request.ODataStreamManager;
-import com.msopentech.odatajclient.engine.communication.request.batch.ODataBatchRequest;
-import com.msopentech.odatajclient.engine.communication.response.ODataResponse;
-import com.msopentech.odatajclient.engine.format.ODataMediaFormat;
-import com.msopentech.odatajclient.engine.utils.ODataBatchConstants;
-import com.msopentech.odatajclient.engine.utils.URIUtils;
-import com.msopentech.odatajclient.engine.utils.Wrapper;
-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;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
-import org.apache.http.entity.ContentType;
-
-/**
- * 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 AbstractODataStreamedRequestImpl<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 AbstractODataStreamedRequestImpl(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/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/AbstractStreamedRequestFactory.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/AbstractStreamedRequestFactory.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/AbstractStreamedRequestFactory.java
deleted file mode 100644
index d77b93e..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/AbstractStreamedRequestFactory.java
+++ /dev/null
@@ -1,72 +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.streamed;
-
-import com.msopentech.odatajclient.engine.client.ODataClient;
-import com.msopentech.odatajclient.engine.client.http.HttpMethod;
-import java.io.InputStream;
-import java.net.URI;
-
-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 ODataMediaEntityCreateRequest(client, targetURI, media);
- }
-
- @Override
- public ODataStreamUpdateRequest getStreamUpdateRequest(final URI targetURI, final InputStream stream) {
- final ODataStreamUpdateRequest req;
-
- if (client.getConfiguration().isUseXHTTPMethod()) {
- req = new ODataStreamUpdateRequest(client, HttpMethod.POST, targetURI, stream);
- req.setXHTTPMethod(HttpMethod.PUT.name());
- } else {
- req = new ODataStreamUpdateRequest(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 ODataMediaEntityUpdateRequest(client, HttpMethod.POST, editURI, media);
- req.setXHTTPMethod(HttpMethod.PUT.name());
- } else {
- req = new ODataMediaEntityUpdateRequest(client, HttpMethod.PUT, editURI, media);
- }
-
- return req;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/ODataMediaEntityCreateRequest.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/ODataMediaEntityCreateRequest.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/ODataMediaEntityCreateRequest.java
deleted file mode 100644
index bdf2554..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/ODataMediaEntityCreateRequest.java
+++ /dev/null
@@ -1,133 +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.streamed;
-
-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.ODataBatchableRequest;
-import com.msopentech.odatajclient.engine.communication.request.streamed.ODataMediaEntityCreateRequest.MediaEntityCreateStreamManager;
-import com.msopentech.odatajclient.engine.communication.response.ODataMediaEntityCreateResponse;
-import com.msopentech.odatajclient.engine.communication.response.ODataResponseImpl;
-import com.msopentech.odatajclient.engine.data.ODataEntity;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.concurrent.TimeUnit;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-
-/**
- * This class implements an OData Media Entity create request.
- * Get instance by using ODataStreamedRequestFactory.
- */
-public class ODataMediaEntityCreateRequest
- extends AbstractODataStreamedEntityRequestImpl<ODataMediaEntityCreateResponse, MediaEntityCreateStreamManager>
- implements 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.
- */
- ODataMediaEntityCreateRequest(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 MediaEntityCreateStreamManager(media);
- }
- return (MediaEntityCreateStreamManager) streamManager;
- }
-
- /**
- * Media entity payload object.
- */
- public class MediaEntityCreateStreamManager extends ODataStreamManager<ODataMediaEntityCreateResponse> {
-
- /**
- * Private constructor.
- *
- * @param input media stream.
- */
- private MediaEntityCreateStreamManager(final InputStream input) {
- super(ODataMediaEntityCreateRequest.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/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/ODataMediaEntityUpdateRequest.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/ODataMediaEntityUpdateRequest.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/ODataMediaEntityUpdateRequest.java
deleted file mode 100644
index 42219a5..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/ODataMediaEntityUpdateRequest.java
+++ /dev/null
@@ -1,136 +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.streamed;
-
-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.ODataBatchableRequest;
-import com.msopentech.odatajclient.engine.communication.request.streamed.ODataMediaEntityUpdateRequest.MediaEntityUpdateStreamManager;
-import com.msopentech.odatajclient.engine.communication.response.ODataMediaEntityUpdateResponse;
-import com.msopentech.odatajclient.engine.communication.response.ODataResponseImpl;
-import com.msopentech.odatajclient.engine.data.ODataEntity;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.concurrent.TimeUnit;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-
-/**
- * This class implements an OData Media Entity create request.
- * Get instance by using ODataStreamedRequestFactory.
- */
-public class ODataMediaEntityUpdateRequest
- extends AbstractODataStreamedEntityRequestImpl<ODataMediaEntityUpdateResponse, MediaEntityUpdateStreamManager>
- implements 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.
- */
- ODataMediaEntityUpdateRequest(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 MediaEntityUpdateStreamManager(media);
- }
- return (MediaEntityUpdateStreamManager) streamManager;
- }
-
- /**
- * Media entity payload object.
- */
- public class MediaEntityUpdateStreamManager extends ODataStreamManager<ODataMediaEntityUpdateResponse> {
-
- /**
- * Private constructor.
- *
- * @param input media stream.
- */
- private MediaEntityUpdateStreamManager(final InputStream input) {
- super(ODataMediaEntityUpdateRequest.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/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/ODataStreamUpdateRequest.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/ODataStreamUpdateRequest.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/ODataStreamUpdateRequest.java
deleted file mode 100644
index 0c3f77d..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/ODataStreamUpdateRequest.java
+++ /dev/null
@@ -1,132 +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.streamed;
-
-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.ODataBatchableRequest;
-import com.msopentech.odatajclient.engine.communication.request.streamed.ODataStreamUpdateRequest.StreamUpdateStreamManager;
-import com.msopentech.odatajclient.engine.communication.response.ODataResponseImpl;
-import com.msopentech.odatajclient.engine.communication.response.ODataStreamUpdateResponse;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.concurrent.TimeUnit;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-
-/**
- * This class implements an OData stream create/update request.
- * Get instance by using ODataStreamedRequestFactory.
- */
-public class ODataStreamUpdateRequest
- extends AbstractODataStreamedRequestImpl<ODataStreamUpdateResponse, StreamUpdateStreamManager>
- implements 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.
- */
- ODataStreamUpdateRequest(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 StreamUpdateStreamManager(this.stream);
- }
-
- return (StreamUpdateStreamManager) streamManager;
- }
-
- public class StreamUpdateStreamManager extends ODataStreamManager<ODataStreamUpdateResponse> {
-
- /**
- * Private constructor.
- *
- * @param input payload input stream.
- */
- private StreamUpdateStreamManager(final InputStream input) {
- super(ODataStreamUpdateRequest.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/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/ODataStreamedRequest.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/ODataStreamedRequest.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/ODataStreamedRequest.java
deleted file mode 100644
index 4ed2e5d..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/ODataStreamedRequest.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.streamed;
-
-import com.msopentech.odatajclient.engine.communication.request.ODataRequest;
-import com.msopentech.odatajclient.engine.communication.request.ODataStreamManager;
-import com.msopentech.odatajclient.engine.communication.response.ODataResponse;
-
-/**
- * Streamed OData request interface.
- *
- * @param <V> OData response type corresponding to the request implementation.
- * @param <T> OData request payload type corresponding to the request implementation.
- */
-public interface ODataStreamedRequest<V extends ODataResponse, T extends ODataStreamManager<V>>
- extends ODataRequest {
-
- /**
- * Streamed request execute.
- *
- * @return OData request payload manager object.
- */
- T execute();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/StreamedRequestFactory.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/StreamedRequestFactory.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/StreamedRequestFactory.java
deleted file mode 100644
index bf8e2bd..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/StreamedRequestFactory.java
+++ /dev/null
@@ -1,62 +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.streamed;
-
-import java.io.InputStream;
-import java.io.Serializable;
-import java.net.URI;
-
-/**
- * OData request factory class.
- */
-public interface StreamedRequestFactory extends Serializable {
-
- /**
- * Gets a media entity create request object instance.
- * <br/>
- * Use this kind of request to create a new media entity.
- *
- * @param targetURI entity set URI.
- * @param media entity blob to be created.
- * @return new ODataMediaEntityCreateRequest instance.
- */
- ODataMediaEntityCreateRequest getMediaEntityCreateRequest(URI targetURI, InputStream media);
-
- /**
- * Gets a stream update request object instance.
- * <br/>
- * Use this kind of request to update a named stream property.
- *
- * @param targetURI target URI.
- * @param stream stream to be updated.
- * @return new ODataStreamUpdateRequest instance.
- */
- ODataStreamUpdateRequest getStreamUpdateRequest(URI targetURI, InputStream stream);
-
- /**
- * Gets a media entity update request object instance.
- * <br/>
- * Use this kind of request to update a media entity.
- *
- * @param editURI media entity edit link URI.
- * @param media entity blob to be updated.
- * @return new ODataMediaEntityUpdateRequest instance.
- */
- ODataMediaEntityUpdateRequest getMediaEntityUpdateRequest(URI editURI, InputStream media);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/V3StreamedRequestFactory.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/V3StreamedRequestFactory.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/V3StreamedRequestFactory.java
deleted file mode 100644
index c93c039..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/V3StreamedRequestFactory.java
+++ /dev/null
@@ -1,31 +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.streamed;
-
-import com.msopentech.odatajclient.engine.client.ODataV3Client;
-
-public class V3StreamedRequestFactory extends AbstractStreamedRequestFactory {
-
- private static final long serialVersionUID = 2255688283995758441L;
-
- public V3StreamedRequestFactory(final ODataV3Client client) {
- super(client);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/V4StreamedRequestFactory.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/V4StreamedRequestFactory.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/V4StreamedRequestFactory.java
deleted file mode 100644
index 74b155b..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/request/streamed/V4StreamedRequestFactory.java
+++ /dev/null
@@ -1,31 +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.streamed;
-
-import com.msopentech.odatajclient.engine.client.ODataV4Client;
-
-public class V4StreamedRequestFactory extends AbstractStreamedRequestFactory {
-
- private static final long serialVersionUID = 960862845654673053L;
-
- public V4StreamedRequestFactory(final ODataV4Client client) {
- super(client);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataBatchResponse.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataBatchResponse.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataBatchResponse.java
deleted file mode 100644
index 443986a..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataBatchResponse.java
+++ /dev/null
@@ -1,37 +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.response;
-
-import com.msopentech.odatajclient.engine.communication.request.batch.ODataBatchResponseItem;
-import java.util.Iterator;
-
-/**
- * This class implements a response to a batch request.
- *
- * @see com.msopentech.odatajclient.engine.communication.request.batch.ODataBatchRequest
- */
-public interface ODataBatchResponse extends ODataResponse {
-
- /**
- * Get all the batch response items.
- *
- * @return an iterator on batch response items.
- */
- Iterator<ODataBatchResponseItem> getBody();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataDeleteResponse.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataDeleteResponse.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataDeleteResponse.java
deleted file mode 100644
index 41bf8d6..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataDeleteResponse.java
+++ /dev/null
@@ -1,27 +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.response;
-
-/**
- * This class implements the response to an OData delete request.
- *
- * @see com.msopentech.odatajclient.engine.communication.request.cud.ODataDeleteRequest
- */
-public interface ODataDeleteResponse extends ODataResponse {
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataEntityCreateResponse.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataEntityCreateResponse.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataEntityCreateResponse.java
deleted file mode 100644
index c86d697..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataEntityCreateResponse.java
+++ /dev/null
@@ -1,36 +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.response;
-
-import com.msopentech.odatajclient.engine.data.ODataEntity;
-
-/**
- * This class implements the response to an OData entity create request.
- *
- * @see com.msopentech.odatajclient.engine.communication.request.cud.ODataEntityCreateRequest
- */
-public interface ODataEntityCreateResponse extends ODataResponse {
-
- /**
- * Gets created object.
- *
- * @return created object.
- */
- ODataEntity getBody();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataEntityUpdateResponse.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataEntityUpdateResponse.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataEntityUpdateResponse.java
deleted file mode 100644
index 5607261..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataEntityUpdateResponse.java
+++ /dev/null
@@ -1,36 +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.response;
-
-import com.msopentech.odatajclient.engine.data.ODataEntity;
-
-/**
- * This class implements the response to an OData update request.
- *
- * @see com.msopentech.odatajclient.engine.communication.request.cud.ODataEntityUpdateRequest
- */
-public interface ODataEntityUpdateResponse extends ODataResponse {
-
- /**
- * Gets updated object.
- *
- * @return updated object.
- */
- ODataEntity getBody();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataInvokeResponse.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataInvokeResponse.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataInvokeResponse.java
deleted file mode 100644
index 4fe20bd..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataInvokeResponse.java
+++ /dev/null
@@ -1,36 +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.response;
-
-import com.msopentech.odatajclient.engine.data.ODataInvokeResult;
-
-/**
- * This class implements a response to a specific invoke request.
- *
- * @see com.msopentech.odatajclient.engine.communication.request.invoke.ODataInvokeRequest
- */
-public interface ODataInvokeResponse<T extends ODataInvokeResult> extends ODataResponse {
-
- /**
- * Gets operation return value if exists.
- *
- * @return operation return value.
- */
- T getBody();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataLinkOperationResponse.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataLinkOperationResponse.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataLinkOperationResponse.java
deleted file mode 100644
index c0a474a..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataLinkOperationResponse.java
+++ /dev/null
@@ -1,28 +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.response;
-
-/**
- * This interface defines the response to an OData link operation request.
- *
- * @see com.msopentech.odatajclient.engine.communication.request.cud.ODataLinkCreateRequest
- * @see com.msopentech.odatajclient.engine.communication.request.cud.ODataLinkUpdateRequest
- */
-public interface ODataLinkOperationResponse extends ODataResponse {
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataMediaEntityCreateResponse.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataMediaEntityCreateResponse.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataMediaEntityCreateResponse.java
deleted file mode 100644
index 177bc1d..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataMediaEntityCreateResponse.java
+++ /dev/null
@@ -1,36 +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.response;
-
-import com.msopentech.odatajclient.engine.data.ODataEntity;
-
-/**
- * This class implements the response to an Odata media entity create request.
- *
- * @see com.msopentech.odatajclient.engine.communication.request.streamed.ODataMediaEntityCreateRequest
- */
-public interface ODataMediaEntityCreateResponse extends ODataResponse {
-
- /**
- * Gets created object.
- *
- * @return created object.
- */
- ODataEntity getBody();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataMediaEntityUpdateResponse.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataMediaEntityUpdateResponse.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataMediaEntityUpdateResponse.java
deleted file mode 100644
index 79fec72..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataMediaEntityUpdateResponse.java
+++ /dev/null
@@ -1,36 +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.response;
-
-import com.msopentech.odatajclient.engine.data.ODataEntity;
-
-/**
- * This class implements the response to an Odata media entity update request.
- *
- * @see com.msopentech.odatajclient.engine.communication.request.streamed.ODataMediaEntityUpdateRequest
- */
-public interface ODataMediaEntityUpdateResponse extends ODataResponse {
-
- /**
- * Gets updated object.
- *
- * @return updated object.
- */
- ODataEntity getBody();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataPropertyUpdateResponse.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataPropertyUpdateResponse.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataPropertyUpdateResponse.java
deleted file mode 100644
index 43dd1a9..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataPropertyUpdateResponse.java
+++ /dev/null
@@ -1,36 +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.response;
-
-import com.msopentech.odatajclient.engine.data.ODataProperty;
-
-/**
- * This class implements the response to an OData update entity property request.
- *
- * @see com.msopentech.odatajclient.engine.communication.request.cud.ODataPropertyUpdateRequest
- */
-public interface ODataPropertyUpdateResponse extends ODataResponse {
-
- /**
- * Gets updated object.
- *
- * @return updated object.
- */
- ODataProperty getBody();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataResponse.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataResponse.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataResponse.java
deleted file mode 100644
index 6adeba6..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataResponse.java
+++ /dev/null
@@ -1,117 +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.response;
-
-import com.msopentech.odatajclient.engine.communication.header.ODataHeaders.HeaderName;
-import com.msopentech.odatajclient.engine.communication.request.batch.ODataBatchLineIterator;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * Abstract representation of an OData response.
- */
-public interface ODataResponse {
-
- /**
- * Gets header names.
- *
- * @return response header names.
- */
- Collection<String> getHeaderNames();
-
- /**
- * Gets header value of the given header.
- *
- * @param name header to be retrieved.
- * @return response header value.
- */
- Collection<String> getHeader(final String name);
-
- /**
- * Gets header value of the given header.
- *
- * @param name header to be retrieved.
- * @return response header value.
- */
- Collection<String> getHeader(final HeaderName name);
-
- /**
- * Gets 'ETag' header value.
- *
- * @return ETag header value, if provided
- */
- String getEtag();
-
- /**
- * Gets the content type.
- *
- * @return content type
- */
- String getContentType();
-
- /**
- * Gets status code.
- *
- * @return status code.
- */
- int getStatusCode();
-
- /**
- * Gets status message.
- *
- * @return status message.
- */
- String getStatusMessage();
-
- /**
- * Gets response body as InputStream.
- *
- * @return response body input stream.
- */
- InputStream getRawResponse();
-
- /**
- * Initializes response from batch response item.
- *
- * @param responseLine response line.
- * @param headers response headers.
- * @param batchLineIterator batch line iterator.
- * @param boundary batch boundary.
- */
- ODataResponse initFromBatch(
- final Map.Entry<Integer, String> responseLine,
- final Map<String, Collection<String>> headers,
- final ODataBatchLineIterator batchLineIterator,
- final String boundary);
-
- /**
- * Close the underlying message entity input stream (if available and open) as well as releases any other
- * resources associated with the response.
- * <p>
- * This operation is idempotent, i.e. it can be invoked multiple times with the same effect which also means that
- * calling the close() method on an already closed message instance is legal and has no further effect.
- * <p>
- * The close() method should be invoked on all instances that contain an un-consumed entity input stream to ensure
- * the resources associated with the instance are properly cleaned-up and prevent potential memory leaks.
- * This is typical for client-side scenarios where application layer code processes only the response headers and
- * ignores the response entity.
- */
- void close();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataResponseImpl.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataResponseImpl.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataResponseImpl.java
deleted file mode 100644
index c8d3489..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataResponseImpl.java
+++ /dev/null
@@ -1,276 +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.response;
-
-import com.msopentech.odatajclient.engine.client.http.NoContentException;
-import com.msopentech.odatajclient.engine.communication.header.ODataHeaders;
-import com.msopentech.odatajclient.engine.communication.request.batch.ODataBatchUtilities;
-import com.msopentech.odatajclient.engine.communication.request.batch.ODataBatchController;
-import com.msopentech.odatajclient.engine.communication.request.batch.ODataBatchLineIterator;
-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.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 ODataHeaders.HeaderName name) {
- return headers.get(name.toString());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getEtag() {
- final Collection<String> etag = getHeader(ODataHeaders.HeaderName.etag);
- return etag == null || etag.isEmpty()
- ? null
- : etag.iterator().next();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getContentType() {
- final Collection<String> contentTypes = getHeader(ODataHeaders.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/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataRetrieveResponse.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataRetrieveResponse.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataRetrieveResponse.java
deleted file mode 100644
index a21c13c..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/communication/response/ODataRetrieveResponse.java
+++ /dev/null
@@ -1,34 +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.response;
-
-/**
- * This class implements a response to a specific query request.
- *
- * @see com.msopentech.odatajclient.engine.communication.request.retrieve.ODataRetrieveRequest
- */
-public interface ODataRetrieveResponse<T> extends ODataResponse {
-
- /**
- * Gets query result objects.
- *
- * @return query result objects.
- */
- T getBody();
-}