You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/05/22 12:35:52 UTC
[09/19] git commit: Client api change: removed 'outside' batch item
Client api change: removed 'outside' batch item
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/84203da0
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/84203da0
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/84203da0
Branch: refs/heads/olingo-266-tecsvc
Commit: 84203da0a4e899018a346beaf75a89cbaec4a425
Parents: 859a7e8
Author: fmartelli <fa...@gmail.com>
Authored: Tue May 20 18:25:01 2014 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Tue May 20 18:25:01 2014 +0200
----------------------------------------------------------------------
.../apache/olingo/fit/v3/BatchTestITCase.java | 14 ++--
.../apache/olingo/fit/v4/BatchTestITCase.java | 61 +++++++-------
.../request/batch/BatchManager.java | 2 +-
.../request/batch/ODataRetrieve.java | 37 ---------
.../request/batch/ODataSingleRequest.java | 37 +++++++++
.../request/batch/v3/BatchManager.java | 25 ------
.../request/batch/v3/ODataBatchRequest.java | 1 +
.../request/batch/v4/BatchManager.java | 35 --------
.../request/batch/v4/ODataBatchRequest.java | 1 +
.../request/batch/AbstractBatchManager.java | 14 ++--
.../batch/AbstractODataBatchRequestItem.java | 2 +-
.../request/batch/ODataChangesetImpl.java | 2 +-
.../request/batch/ODataRetrieveImpl.java | 81 ------------------
.../batch/ODataRetrieveResponseItem.java | 87 --------------------
.../request/batch/ODataSingleRequestImpl.java | 82 ++++++++++++++++++
.../request/batch/ODataSingleResponseItem.java | 87 ++++++++++++++++++++
.../request/batch/v3/ODataBatchRequestImpl.java | 20 +++--
.../request/batch/v4/ODataBatchRequestImpl.java | 16 +---
.../batch/v4/ODataOutsideUpdateImpl.java | 84 -------------------
.../v4/ODataOutsideUpdateResponseItem.java | 80 ------------------
.../v4/AsyncBatchRequestWrapperImpl.java | 6 +-
21 files changed, 277 insertions(+), 497 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/fit/src/test/java/org/apache/olingo/fit/v3/BatchTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/BatchTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/BatchTestITCase.java
index e623c26..cc634ef 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v3/BatchTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v3/BatchTestITCase.java
@@ -49,7 +49,7 @@ import org.apache.olingo.client.api.uri.v3.URIBuilder;
import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
import org.apache.olingo.client.core.communication.request.Wrapper;
import org.apache.olingo.client.core.communication.request.batch.ODataChangesetResponseItem;
-import org.apache.olingo.client.core.communication.request.batch.ODataRetrieveResponseItem;
+import org.apache.olingo.client.core.communication.request.batch.ODataSingleResponseItem;
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl.ODataEntityResponseImpl;
import org.apache.olingo.client.core.uri.URIUtils;
@@ -320,7 +320,7 @@ public class BatchTestITCase extends AbstractTestITCase {
ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
queryReq.setFormat(ODataPubFormat.ATOM);
- streamManager.addRetrieve(queryReq);
+ streamManager.addRequest(queryReq);
// -------------------------------------------
// -------------------------------------------
@@ -373,7 +373,7 @@ public class BatchTestITCase extends AbstractTestITCase {
// create new request
queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
- streamManager.addRetrieve(queryReq);
+ streamManager.addRequest(queryReq);
// -------------------------------------------
final ODataBatchResponse response = streamManager.getResponse();
@@ -383,9 +383,9 @@ public class BatchTestITCase extends AbstractTestITCase {
// retrive the first item (ODataRetrieve)
ODataBatchResponseItem item = iter.next();
- assertTrue(item instanceof ODataRetrieveResponseItem);
+ assertTrue(item instanceof ODataSingleResponseItem);
- ODataRetrieveResponseItem retitem = (ODataRetrieveResponseItem) item;
+ ODataSingleResponseItem retitem = (ODataSingleResponseItem) item;
ODataResponse res = retitem.next();
assertTrue(res instanceof ODataEntityResponseImpl);
assertEquals(200, res.getStatusCode());
@@ -422,9 +422,9 @@ public class BatchTestITCase extends AbstractTestITCase {
// retrive the third item (ODataRetrieve)
item = iter.next();
- assertTrue(item instanceof ODataRetrieveResponseItem);
+ assertTrue(item instanceof ODataSingleResponseItem);
- retitem = (ODataRetrieveResponseItem) item;
+ retitem = (ODataSingleResponseItem) item;
res = retitem.next();
assertTrue(res instanceof ODataEntityResponseImpl);
assertEquals(200, res.getStatusCode());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
index b711e18..ef568b8 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
@@ -35,9 +35,9 @@ import org.apache.http.HttpResponse;
import org.apache.olingo.client.api.ODataBatchConstants;
import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.request.ODataPayloadManager;
+import org.apache.olingo.client.api.communication.request.batch.BatchManager;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
import org.apache.olingo.client.api.communication.request.batch.ODataChangeset;
-import org.apache.olingo.client.api.communication.request.batch.v4.BatchManager;
import org.apache.olingo.client.api.communication.request.batch.v4.ODataBatchRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
@@ -55,8 +55,7 @@ import org.apache.olingo.client.api.uri.v4.URIBuilder;
import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
import org.apache.olingo.client.core.communication.request.Wrapper;
import org.apache.olingo.client.core.communication.request.batch.ODataChangesetResponseItem;
-import org.apache.olingo.client.core.communication.request.batch.ODataRetrieveResponseItem;
-import org.apache.olingo.client.core.communication.request.batch.v4.ODataOutsideUpdateResponseItem;
+import org.apache.olingo.client.core.communication.request.batch.ODataSingleResponseItem;
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl.ODataEntityResponseImpl;
import org.apache.olingo.client.core.uri.URIUtils;
@@ -192,7 +191,7 @@ public class BatchTestITCase extends AbstractTestITCase {
ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
queryReq.setFormat(ODataPubFormat.JSON);
- streamManager.addRetrieve(queryReq);
+ streamManager.addRequest(queryReq);
// -------------------------------------------
// -------------------------------------------
@@ -204,7 +203,7 @@ public class BatchTestITCase extends AbstractTestITCase {
// create new request
queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
- streamManager.addRetrieve(queryReq);
+ streamManager.addRequest(queryReq);
// -------------------------------------------
final ODataBatchResponse response = streamManager.getResponse();
@@ -214,18 +213,18 @@ public class BatchTestITCase extends AbstractTestITCase {
// retrieve the first item (ODataRetrieve)
ODataBatchResponseItem item = iter.next();
- assertTrue(item instanceof ODataRetrieveResponseItem);
+ assertTrue(item instanceof ODataSingleResponseItem);
- ODataRetrieveResponseItem retitem = (ODataRetrieveResponseItem) item;
+ ODataSingleResponseItem retitem = (ODataSingleResponseItem) item;
ODataResponse res = retitem.next();
assertEquals(404, res.getStatusCode());
assertEquals("Not Found", res.getStatusMessage());
if (continueOnError) {
item = iter.next();
- assertTrue(item instanceof ODataRetrieveResponseItem);
+ assertTrue(item instanceof ODataSingleResponseItem);
- retitem = (ODataRetrieveResponseItem) item;
+ retitem = (ODataSingleResponseItem) item;
res = retitem.next();
assertTrue(res instanceof ODataEntityResponseImpl);
assertEquals(200, res.getStatusCode());
@@ -261,13 +260,13 @@ public class BatchTestITCase extends AbstractTestITCase {
"OrderDetails",
client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("OrderDetails").
appendKeySegment(new HashMap<String, Object>() {
- private static final long serialVersionUID = 3109256773218160485L;
+ private static final long serialVersionUID = 3109256773218160485L;
- {
- put("OrderID", 7);
- put("ProductID", 5);
- }
- }).build()));
+ {
+ put("OrderID", 7);
+ put("ProductID", 5);
+ }
+ }).build()));
final ODataEntityUpdateRequest<ODataEntity> updateReq = client.getCUDRequestFactory().getEntityUpdateRequest(
URI.create("$" + createRequestRef), UpdateType.PATCH, customerChanges);
@@ -337,7 +336,7 @@ public class BatchTestITCase extends AbstractTestITCase {
ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
queryReq.setFormat(ODataPubFormat.JSON);
- streamManager.addRetrieve(queryReq);
+ streamManager.addRequest(queryReq);
// -------------------------------------------
// -------------------------------------------
@@ -349,7 +348,7 @@ public class BatchTestITCase extends AbstractTestITCase {
final ODataEntityCreateRequest<ODataEntity> createReq =
client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original);
createReq.setFormat(ODataPubFormat.JSON);
- streamManager.addOutsideUpdate(createReq);
+ streamManager.addRequest(createReq);
// -------------------------------------------
final ODataBatchResponse response = streamManager.getResponse();
@@ -359,9 +358,9 @@ public class BatchTestITCase extends AbstractTestITCase {
// retrieve the first item (ODataRetrieve)
ODataBatchResponseItem item = iter.next();
- assertTrue(item instanceof ODataRetrieveResponseItem);
+ assertTrue(item instanceof ODataSingleResponseItem);
- ODataRetrieveResponseItem retitem = (ODataRetrieveResponseItem) item;
+ ODataSingleResponseItem retitem = (ODataSingleResponseItem) item;
ODataResponse res = retitem.next();
assertTrue(res instanceof ODataEntityResponseImpl);
assertEquals(200, res.getStatusCode());
@@ -369,9 +368,9 @@ public class BatchTestITCase extends AbstractTestITCase {
// retrieve the second item (ODataChangeset)
item = iter.next();
- assertTrue(item instanceof ODataOutsideUpdateResponseItem);
+ assertTrue(item instanceof ODataSingleResponseItem);
- final ODataOutsideUpdateResponseItem outitem = (ODataOutsideUpdateResponseItem) item;
+ final ODataSingleResponseItem outitem = (ODataSingleResponseItem) item;
res = outitem.next();
assertTrue(res instanceof ODataEntityCreateResponse);
assertEquals(201, res.getStatusCode());
@@ -404,7 +403,7 @@ public class BatchTestITCase extends AbstractTestITCase {
ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
queryReq.setFormat(ODataPubFormat.JSON);
- streamManager.addRetrieve(queryReq);
+ streamManager.addRequest(queryReq);
// -------------------------------------------
// -------------------------------------------
@@ -448,7 +447,7 @@ public class BatchTestITCase extends AbstractTestITCase {
// create new request
queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
- streamManager.addRetrieve(queryReq);
+ streamManager.addRequest(queryReq);
// -------------------------------------------
final ODataBatchResponse response = streamManager.getResponse();
@@ -458,9 +457,9 @@ public class BatchTestITCase extends AbstractTestITCase {
// retrieve the first item (ODataRetrieve)
ODataBatchResponseItem item = iter.next();
- assertTrue(item instanceof ODataRetrieveResponseItem);
+ assertTrue(item instanceof ODataSingleResponseItem);
- ODataRetrieveResponseItem retitem = (ODataRetrieveResponseItem) item;
+ ODataSingleResponseItem retitem = (ODataSingleResponseItem) item;
ODataResponse res = retitem.next();
assertTrue(res instanceof ODataEntityResponseImpl);
assertEquals(200, res.getStatusCode());
@@ -493,9 +492,9 @@ public class BatchTestITCase extends AbstractTestITCase {
// retrive the third item (ODataRetrieve)
item = iter.next();
- assertTrue(item instanceof ODataRetrieveResponseItem);
+ assertTrue(item instanceof ODataSingleResponseItem);
- retitem = (ODataRetrieveResponseItem) item;
+ retitem = (ODataSingleResponseItem) item;
res = retitem.next();
assertTrue(res instanceof ODataEntityResponseImpl);
assertEquals(200, res.getStatusCode());
@@ -556,10 +555,10 @@ public class BatchTestITCase extends AbstractTestITCase {
// retrieve the first item (ODataRetrieve)
ODataBatchResponseItem item = iter.next();
- assertTrue(item instanceof ODataRetrieveResponseItem);
+ assertTrue(item instanceof ODataSingleResponseItem);
// The service return interim results to an asynchronously executing batch.
- ODataRetrieveResponseItem retitem = (ODataRetrieveResponseItem) item;
+ ODataSingleResponseItem retitem = (ODataSingleResponseItem) item;
ODataResponse res = retitem.next();
assertTrue(res instanceof AsyncResponse);
assertEquals(202, res.getStatusCode());
@@ -677,8 +676,8 @@ public class BatchTestITCase extends AbstractTestITCase {
setType(EdmPrimitiveTypeKind.Duration).setText("PT0.0000002S").build()));
order.getProperties().add(getClient().getObjectFactory().newCollectionProperty("OrderShelfLifes",
getClient().getObjectFactory().newCollectionValue(EdmPrimitiveTypeKind.Duration.name()).add(
- getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Duration).
- setText("PT0.0000002S").build())));
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Duration).
+ setText("PT0.0000002S").build())));
return order;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/BatchManager.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/BatchManager.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/BatchManager.java
index 75e6b85..7632180 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/BatchManager.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/BatchManager.java
@@ -39,5 +39,5 @@ public interface BatchManager extends ODataPayloadManager<ODataBatchResponse> {
*
* @param request retrieve request to batch.
*/
- void addRetrieve(final ODataBatchableRequest request);
+ void addRequest(final ODataBatchableRequest request);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/ODataRetrieve.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/ODataRetrieve.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/ODataRetrieve.java
deleted file mode 100644
index 948cdc3..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/ODataRetrieve.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 org.apache.olingo.client.api.communication.request.batch;
-
-import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
-
-/**
- * Retrieve request wrapper for the corresponding batch item.
- */
-public interface ODataRetrieve extends ODataBatchRequestItem {
-
- /**
- * Serialize and send the given request.
- * <p>
- * An IllegalArgumentException is thrown in case of no GET request.
- *
- * @param request request to be serialized.
- * @return current item instance.
- */
- ODataRetrieve setRequest(final ODataBatchableRequest request);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/ODataSingleRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/ODataSingleRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/ODataSingleRequest.java
new file mode 100644
index 0000000..0f3bc79
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/ODataSingleRequest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.communication.request.batch;
+
+import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
+
+/**
+ * Retrieve request wrapper for the corresponding batch item.
+ */
+public interface ODataSingleRequest extends ODataBatchRequestItem {
+
+ /**
+ * Serialize and send the given request.
+ * <p>
+ * An IllegalArgumentException is thrown in case of no GET request.
+ *
+ * @param request request to be serialized.
+ * @return current item instance.
+ */
+ ODataSingleRequest setRequest(final ODataBatchableRequest request);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v3/BatchManager.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v3/BatchManager.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v3/BatchManager.java
deleted file mode 100644
index a9d0bff..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v3/BatchManager.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.communication.request.batch.v3;
-
-/**
- * Batch request payload management.
- */
-public interface BatchManager extends org.apache.olingo.client.api.communication.request.batch.BatchManager {
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v3/ODataBatchRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v3/ODataBatchRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v3/ODataBatchRequest.java
index b7ee6cc..009f7d0 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v3/ODataBatchRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v3/ODataBatchRequest.java
@@ -19,6 +19,7 @@
package org.apache.olingo.client.api.communication.request.batch.v3;
import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
+import org.apache.olingo.client.api.communication.request.batch.BatchManager;
import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest;
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v4/BatchManager.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v4/BatchManager.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v4/BatchManager.java
deleted file mode 100644
index 108e85c..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v4/BatchManager.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 org.apache.olingo.client.api.communication.request.batch.v4;
-
-import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
-
-/**
- * Batch request payload management.
- */
-public interface BatchManager extends org.apache.olingo.client.api.communication.request.batch.BatchManager {
-
- /**
- * Adds an outside update batch item instance. An outside update item can be submitted embedded into a batch request
- * only.
- *
- * @param request update request to batch.
- */
- void addOutsideUpdate(final ODataBatchableRequest request);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v4/ODataBatchRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v4/ODataBatchRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v4/ODataBatchRequest.java
index a12732d..6c348ad 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v4/ODataBatchRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v4/ODataBatchRequest.java
@@ -19,6 +19,7 @@
package org.apache.olingo.client.api.communication.request.batch.v4;
import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
+import org.apache.olingo.client.api.communication.request.batch.BatchManager;
import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest;
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchManager.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchManager.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchManager.java
index 9f9d962..e5ec432 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchManager.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchManager.java
@@ -25,7 +25,7 @@ import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequestItem;
import org.apache.olingo.client.api.communication.request.batch.ODataChangeset;
-import org.apache.olingo.client.api.communication.request.batch.ODataRetrieve;
+import org.apache.olingo.client.api.communication.request.batch.ODataSingleRequest;
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
import org.apache.olingo.client.core.communication.request.Wrapper;
@@ -80,18 +80,20 @@ public abstract class AbstractBatchManager extends AbstractODataStreamManager<OD
*
* @param request retrieve request to batch.
*/
- public void addRetrieve(final ODataBatchableRequest request) {
+ public void addRequest(final ODataBatchableRequest request) {
+ validateSingleRequest(request);
+
closeCurrentItem();
// stream dash boundary
streamDashBoundary();
- final ODataRetrieveResponseItem expectedResItem = new ODataRetrieveResponseItem();
- currentItem = new ODataRetrieveImpl(req, expectedResItem);
+ final ODataSingleResponseItem expectedResItem = new ODataSingleResponseItem();
+ currentItem = new ODataSingleRequestImpl(req, expectedResItem);
((AbstractODataBatchRequest) req).addExpectedResItem(expectedResItem);
- ((ODataRetrieve) currentItem).setRequest(request);
+ ((ODataSingleRequest) currentItem).setRequest(request);
}
/**
@@ -136,4 +138,6 @@ public abstract class AbstractBatchManager extends AbstractODataStreamManager<OD
newLine();
stream(("--" + ((AbstractODataBatchRequest) req).boundary + "--").getBytes());
}
+
+ protected abstract void validateSingleRequest(final ODataBatchableRequest request);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractODataBatchRequestItem.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractODataBatchRequestItem.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractODataBatchRequestItem.java
index 1f107dd..251d161 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractODataBatchRequestItem.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractODataBatchRequestItem.java
@@ -81,7 +81,7 @@ public abstract class AbstractODataBatchRequestItem extends AbstractODataStreame
* @param request request to be batched.
* @param contentId changeset item id.
*/
- protected void streamRequestHeader(final ODataBatchableRequest request, final String contentId) {
+ protected void streamRequestHeader(final String contentId) {
//stream batch content type
stream(ODataBatchConstants.ITEM_CONTENT_TYPE_LINE.getBytes());
newLine();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataChangesetImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataChangesetImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataChangesetImpl.java
index ec03220..c86fff4 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataChangesetImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataChangesetImpl.java
@@ -117,7 +117,7 @@ public class ODataChangesetImpl extends AbstractODataBatchRequestItem
newLine();
// stream the request
- streamRequestHeader(request, String.valueOf(contentId));
+ streamRequestHeader(String.valueOf(contentId));
request.batch(req, String.valueOf(contentId));
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataRetrieveImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataRetrieveImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataRetrieveImpl.java
deleted file mode 100644
index f7375ff..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataRetrieveImpl.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.communication.request.batch;
-
-import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
-import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest;
-import org.apache.olingo.client.api.communication.request.batch.ODataRetrieve;
-import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.core.communication.request.AbstractODataRequest;
-
-/**
- * Retrieve request wrapper for the corresponding batch item.
- */
-public class ODataRetrieveImpl extends AbstractODataBatchRequestItem
- implements ODataRetrieve {
-
- private final ODataRetrieveResponseItem expectedResItem;
-
- /**
- * Constructor.
- *
- * @param req batch request.
- * @param expectedResItem expected batch response item.
- */
- ODataRetrieveImpl(final CommonODataBatchRequest req, final ODataRetrieveResponseItem expectedResItem) {
- super(req);
- this.expectedResItem = expectedResItem;
- }
-
- /**
- * Close item.
- */
- @Override
- protected void closeItem() {
- // nop
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public ODataRetrieve setRequest(final ODataBatchableRequest request) {
- if (!isOpen()) {
- throw new IllegalStateException("Current batch item is closed");
- }
-
- if (((AbstractODataRequest) request).getMethod() != HttpMethod.GET) {
- throw new IllegalArgumentException("Invalid request. Only GET method is allowed");
- }
-
- hasStreamedSomething = true;
-
- // stream the request
- streamRequestHeader(request);
-
- // close before in order to avoid any further setRequest calls.
- close();
-
- // add request to the list
- expectedResItem.addResponse(
- ODataRetrieveResponseItem.RETRIEVE_CONTENT_ID, ((AbstractODataRequest) request).getResponseTemplate());
-
- return this;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataRetrieveResponseItem.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataRetrieveResponseItem.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataRetrieveResponseItem.java
deleted file mode 100644
index a180b37..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataRetrieveResponseItem.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 org.apache.olingo.client.core.communication.request.batch;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import org.apache.olingo.client.api.communication.response.ODataResponse;
-import static org.apache.olingo.client.core.communication.request.batch.AbstractODataBatchResponseItem.LOG;
-import org.apache.olingo.client.core.communication.response.batch.ODataBatchErrorResponse;
-import org.apache.olingo.client.core.communication.response.v4.AsyncResponseImpl;
-
-/**
- * Retrieve response wrapper for the corresponding batch item.
- */
-public class ODataRetrieveResponseItem extends AbstractODataBatchResponseItem {
-
- public static final String RETRIEVE_CONTENT_ID = "__RETRIEVE__";
-
- /**
- * Constructor.
- */
- public ODataRetrieveResponseItem() {
- super(false);
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public ODataResponse next() {
- if (closed) {
- throw new IllegalStateException("Invalid request - the item has been closed");
- }
-
- if (!hasNext()) {
- throw new NoSuchElementException("No item found");
- }
-
- final Map.Entry<Integer, String> responseLine = ODataBatchUtilities.readResponseLine(batchLineIterator);
- LOG.debug("Retrieved item response {}", responseLine);
-
- final Map<String, Collection<String>> headers = ODataBatchUtilities.readHeaders(batchLineIterator);
- LOG.debug("Retrieved item headers {}", headers);
-
- if (responseLine.getKey() == 202) {
- // generate async response
- current = new AsyncResponseImpl(responseLine, headers, batchLineIterator, boundary);
- breakingitem = true;
- } else if (responseLine.getKey() >= 400) {
- // generate error response
- current = new ODataBatchErrorResponse(responseLine, headers, batchLineIterator, boundary);
- breakingitem = true;
- } else {
- if (!hasNext()) {
- throw new NoSuchElementException("No item found");
- }
- current = expectedItemsIterator.next().initFromBatch(responseLine, headers, batchLineIterator, boundary);
- }
-
- return current;
- }
-
- /**
- * Unsupported operation.
- */
- @Override
- public void remove() {
- throw new UnsupportedOperationException("Operation not supported.");
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataSingleRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataSingleRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataSingleRequestImpl.java
new file mode 100644
index 0000000..8b915fe
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataSingleRequestImpl.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.communication.request.batch;
+
+import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
+import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest;
+import org.apache.olingo.client.api.communication.request.batch.ODataSingleRequest;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.core.communication.request.AbstractODataRequest;
+
+/**
+ * Retrieve request wrapper for the corresponding batch item.
+ */
+public class ODataSingleRequestImpl extends AbstractODataBatchRequestItem
+ implements ODataSingleRequest {
+
+ private final ODataSingleResponseItem expectedResItem;
+
+ /**
+ * Constructor.
+ *
+ * @param req batch request.
+ * @param expectedResItem expected batch response item.
+ */
+ ODataSingleRequestImpl(final CommonODataBatchRequest req, final ODataSingleResponseItem expectedResItem) {
+ super(req);
+ this.expectedResItem = expectedResItem;
+ }
+
+ /**
+ * Close item.
+ */
+ @Override
+ protected void closeItem() {
+ // nop
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public ODataSingleRequest setRequest(final ODataBatchableRequest request) {
+ if (!isOpen()) {
+ throw new IllegalStateException("Current batch item is closed");
+ }
+
+ hasStreamedSomething = true;
+
+ // stream the request
+ if (request.getMethod() == HttpMethod.GET) {
+ streamRequestHeader(request);
+ } else {
+ streamRequestHeader(ODataSingleResponseItem.SINGLE_CONTENT_ID);
+ request.batch(req, ODataSingleResponseItem.SINGLE_CONTENT_ID);
+ }
+
+ // close before in order to avoid any further setRequest calls.
+ close();
+
+ // add request to the list
+ expectedResItem.addResponse(
+ ODataSingleResponseItem.SINGLE_CONTENT_ID, ((AbstractODataRequest) request).getResponseTemplate());
+
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataSingleResponseItem.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataSingleResponseItem.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataSingleResponseItem.java
new file mode 100644
index 0000000..12e50f3
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataSingleResponseItem.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.communication.request.batch;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import org.apache.olingo.client.api.communication.response.ODataResponse;
+import static org.apache.olingo.client.core.communication.request.batch.AbstractODataBatchResponseItem.LOG;
+import org.apache.olingo.client.core.communication.response.batch.ODataBatchErrorResponse;
+import org.apache.olingo.client.core.communication.response.v4.AsyncResponseImpl;
+
+/**
+ * Retrieve response wrapper for the corresponding batch item.
+ */
+public class ODataSingleResponseItem extends AbstractODataBatchResponseItem {
+
+ public static final String SINGLE_CONTENT_ID = "__SINGLE__";
+
+ /**
+ * Constructor.
+ */
+ public ODataSingleResponseItem() {
+ super(false);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public ODataResponse next() {
+ if (closed) {
+ throw new IllegalStateException("Invalid request - the item has been closed");
+ }
+
+ if (!hasNext()) {
+ throw new NoSuchElementException("No item found");
+ }
+
+ final Map.Entry<Integer, String> responseLine = ODataBatchUtilities.readResponseLine(batchLineIterator);
+ LOG.debug("Retrieved item response {}", responseLine);
+
+ final Map<String, Collection<String>> headers = ODataBatchUtilities.readHeaders(batchLineIterator);
+ LOG.debug("Retrieved item headers {}", headers);
+
+ if (responseLine.getKey() == 202) {
+ // generate async response
+ current = new AsyncResponseImpl(responseLine, headers, batchLineIterator, boundary);
+ breakingitem = true;
+ } else if (responseLine.getKey() >= 400) {
+ // generate error response
+ current = new ODataBatchErrorResponse(responseLine, headers, batchLineIterator, boundary);
+ breakingitem = true;
+ } else {
+ if (!hasNext()) {
+ throw new NoSuchElementException("No item found");
+ }
+ current = expectedItemsIterator.next().initFromBatch(responseLine, headers, batchLineIterator, boundary);
+ }
+
+ return current;
+ }
+
+ /**
+ * Unsupported operation.
+ */
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException("Operation not supported.");
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v3/ODataBatchRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v3/ODataBatchRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v3/ODataBatchRequestImpl.java
index 8afa479..3fbfddb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v3/ODataBatchRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v3/ODataBatchRequestImpl.java
@@ -24,15 +24,18 @@ import java.util.Iterator;
import java.util.concurrent.TimeUnit;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
+import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
+import org.apache.olingo.client.api.communication.request.batch.BatchManager;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
-import org.apache.olingo.client.api.communication.request.batch.v3.BatchManager;
import org.apache.olingo.client.api.communication.request.batch.v3.ODataBatchRequest;
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
+import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.core.communication.request.AbstractODataRequest;
import org.apache.olingo.client.core.communication.request.batch.AbstractBatchManager;
import org.apache.olingo.client.core.communication.request.batch.AbstractODataBatchRequest;
-import org.apache.olingo.client.core.communication.request.batch.v3.ODataBatchRequestImpl.BatchStreamManagerImpl;
+import org.apache.olingo.client.core.communication.request.batch.v3.ODataBatchRequestImpl.BatchManagerImpl;
import org.apache.olingo.client.core.communication.request.batch.v3.ODataBatchRequestImpl.ODataBatchResponseImpl;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
import org.apache.olingo.client.core.communication.response.batch.ODataBatchResponseManager;
@@ -52,7 +55,7 @@ public class ODataBatchRequestImpl
@Override
protected BatchManager getPayloadManager() {
if (payloadManager == null) {
- payloadManager = new BatchStreamManagerImpl(this);
+ payloadManager = new BatchManagerImpl(this);
}
return (BatchManager) payloadManager;
}
@@ -78,9 +81,9 @@ public class ODataBatchRequestImpl
/**
* Batch request payload management.
*/
- public class BatchStreamManagerImpl extends AbstractBatchManager implements BatchManager {
+ public class BatchManagerImpl extends AbstractBatchManager implements BatchManager {
- public BatchStreamManagerImpl(final ODataBatchRequest req) {
+ public BatchManagerImpl(final ODataBatchRequest req) {
super(req, ODataBatchRequestImpl.this.futureWrapper);
}
@@ -88,6 +91,13 @@ public class ODataBatchRequestImpl
protected ODataBatchResponse getResponseInstance(final long timeout, final TimeUnit unit) {
return new ODataBatchResponseImpl(httpClient, getHttpResponse(timeout, unit));
}
+
+ @Override
+ protected void validateSingleRequest(final ODataBatchableRequest request) {
+ if (((AbstractODataRequest) request).getMethod() != HttpMethod.GET) {
+ throw new IllegalArgumentException("Invalid request. Only GET method is allowed");
+ }
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataBatchRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataBatchRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataBatchRequestImpl.java
index 88bbbea..0c43549 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataBatchRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataBatchRequestImpl.java
@@ -27,10 +27,9 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.header.ODataPreferences;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
+import org.apache.olingo.client.api.communication.request.batch.BatchManager;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
-import org.apache.olingo.client.api.communication.request.batch.v4.BatchManager;
import org.apache.olingo.client.api.communication.request.batch.v4.ODataBatchRequest;
-import org.apache.olingo.client.api.communication.request.batch.v4.ODataOutsideUpdate;
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.communication.request.batch.AbstractBatchManager;
@@ -100,18 +99,7 @@ public class ODataBatchRequestImpl
}
@Override
- public void addOutsideUpdate(final ODataBatchableRequest request) {
- closeCurrentItem();
-
- // stream dash boundary
- streamDashBoundary();
-
- final ODataOutsideUpdateResponseItem expectedResItem = new ODataOutsideUpdateResponseItem();
- currentItem = new ODataOutsideUpdateImpl(req, expectedResItem);
-
- ((ODataBatchRequestImpl) req).expectedResItems.add(expectedResItem);
-
- ((ODataOutsideUpdate) currentItem).setRequest(request);
+ protected void validateSingleRequest(final ODataBatchableRequest request) {
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataOutsideUpdateImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataOutsideUpdateImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataOutsideUpdateImpl.java
deleted file mode 100644
index fd79e0b..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataOutsideUpdateImpl.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.communication.request.batch.v4;
-
-import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
-import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest;
-import org.apache.olingo.client.api.communication.request.batch.v4.ODataOutsideUpdate;
-import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.core.communication.request.AbstractODataRequest;
-import org.apache.olingo.client.core.communication.request.batch.AbstractODataBatchRequestItem;
-
-/**
- * Retrieve request wrapper for the corresponding batch item.
- */
-public class ODataOutsideUpdateImpl extends AbstractODataBatchRequestItem
- implements ODataOutsideUpdate {
-
- private final ODataOutsideUpdateResponseItem expectedResItem;
-
- /**
- * Constructor.
- *
- * @param req batch request.
- * @param expectedResItem expected batch response item.
- */
- ODataOutsideUpdateImpl(final CommonODataBatchRequest req, final ODataOutsideUpdateResponseItem expectedResItem) {
- super(req);
- this.expectedResItem = expectedResItem;
- }
-
- /**
- * Close item.
- */
- @Override
- protected void closeItem() {
- // nop
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public ODataOutsideUpdate setRequest(final ODataBatchableRequest request) {
- if (!isOpen()) {
- throw new IllegalStateException("Current batch item is closed");
- }
-
- if (((AbstractODataRequest) request).getMethod() == HttpMethod.GET) {
- throw new IllegalArgumentException("Invalid request. Use ODataRetrieve for GET method");
- }
-
- hasStreamedSomething = true;
-
- // stream the request
- streamRequestHeader(request, ODataOutsideUpdateResponseItem.OUTSIDE_CONTENT_ID);
-
- request.batch(req, ODataOutsideUpdateResponseItem.OUTSIDE_CONTENT_ID);
-
- // close before in order to avoid any further setRequest calls.
- close();
-
- // add request to the list
- expectedResItem.addResponse(
- ODataOutsideUpdateResponseItem.OUTSIDE_CONTENT_ID, ((AbstractODataRequest) request).getResponseTemplate());
-
- return this;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataOutsideUpdateResponseItem.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataOutsideUpdateResponseItem.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataOutsideUpdateResponseItem.java
deleted file mode 100644
index 149c24a..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataOutsideUpdateResponseItem.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.communication.request.batch.v4;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import org.apache.olingo.client.api.communication.response.ODataResponse;
-import org.apache.olingo.client.core.communication.request.batch.AbstractODataBatchResponseItem;
-import org.apache.olingo.client.core.communication.request.batch.ODataBatchUtilities;
-import org.apache.olingo.client.core.communication.response.batch.ODataBatchErrorResponse;
-
-/**
- * Retrieve response wrapper for the corresponding batch item.
- */
-public class ODataOutsideUpdateResponseItem extends AbstractODataBatchResponseItem {
-
- public static final String OUTSIDE_CONTENT_ID = "__OUTSIDEUPDATE__";
-
- /**
- * Constructor.
- */
- public ODataOutsideUpdateResponseItem() {
- super(false);
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public ODataResponse next() {
- if (closed) {
- throw new IllegalStateException("Invalid request - the item has been closed");
- }
-
- final Map.Entry<Integer, String> responseLine = ODataBatchUtilities.readResponseLine(batchLineIterator);
- LOG.debug("Retrieved item response {}", responseLine);
-
- final Map<String, Collection<String>> headers = ODataBatchUtilities.readHeaders(batchLineIterator);
- LOG.debug("Retrieved item headers {}", headers);
-
- final ODataResponse res;
-
- if (responseLine.getKey() >= 400) {
- // generate error response
- res = new ODataBatchErrorResponse(responseLine, headers, batchLineIterator, boundary);
- } else {
- if (!hasNext()) {
- throw new NoSuchElementException("No item found");
- }
- res = expectedItemsIterator.next().initFromBatch(responseLine, headers, batchLineIterator, boundary);
- }
-
- return res;
- }
-
- /**
- * Unsupported operation.
- */
- @Override
- public void remove() {
- throw new UnsupportedOperationException("Operation not supported.");
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/84203da0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/v4/AsyncBatchRequestWrapperImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/v4/AsyncBatchRequestWrapperImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/v4/AsyncBatchRequestWrapperImpl.java
index 03021b0..e1fe102 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/v4/AsyncBatchRequestWrapperImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/v4/AsyncBatchRequestWrapperImpl.java
@@ -24,8 +24,8 @@ import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.header.ODataPreferences;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
+import org.apache.olingo.client.api.communication.request.batch.BatchManager;
import org.apache.olingo.client.api.communication.request.batch.ODataChangeset;
-import org.apache.olingo.client.api.communication.request.batch.v4.BatchManager;
import org.apache.olingo.client.api.communication.request.batch.v4.ODataBatchRequest;
import org.apache.olingo.client.api.communication.request.v4.AsyncBatchRequestWrapper;
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
@@ -56,7 +56,7 @@ public class AsyncBatchRequestWrapperImpl extends AsyncRequestWrapperImpl<ODataB
*/
@Override
public void addRetrieve(final ODataBatchableRequest request) {
- batchManager.addRetrieve(request);
+ batchManager.addRequest(request);
}
/**
@@ -64,7 +64,7 @@ public class AsyncBatchRequestWrapperImpl extends AsyncRequestWrapperImpl<ODataB
*/
@Override
public void addOutsideUpdate(final ODataBatchableRequest request) {
- batchManager.addOutsideUpdate(request);
+ batchManager.addRequest(request);
}
@Override