mirror of
https://github.com/apache/olingo-odata4.git
synced 2025-03-04 23:59:09 +00:00
batch method and manager renaming
This commit is contained in:
parent
7d6c587c7b
commit
8ad67fede0
@ -34,7 +34,7 @@ import org.apache.olingo.client.api.CommonEdmEnabledODataClient;
|
|||||||
import org.apache.olingo.client.api.communication.header.ODataPreferences;
|
import org.apache.olingo.client.api.communication.header.ODataPreferences;
|
||||||
import org.apache.olingo.client.api.communication.request.ODataRequest;
|
import org.apache.olingo.client.api.communication.request.ODataRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
|
import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.BatchStreamManager;
|
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.request.batch.CommonODataBatchRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
|
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.ODataChangeset;
|
||||||
@ -90,7 +90,7 @@ class ContainerImpl implements Container {
|
|||||||
final CommonODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(client.getServiceRoot());
|
final CommonODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(client.getServiceRoot());
|
||||||
((ODataRequest) request).setAccept(client.getConfiguration().getDefaultBatchAcceptFormat());
|
((ODataRequest) request).setAccept(client.getConfiguration().getDefaultBatchAcceptFormat());
|
||||||
|
|
||||||
final BatchStreamManager streamManager = (BatchStreamManager) ((ODataStreamedRequest) request).execute();
|
final BatchManager streamManager = (BatchManager) ((ODataStreamedRequest) request).payloadManager();
|
||||||
|
|
||||||
final ODataChangeset changeset = streamManager.addChangeset();
|
final ODataChangeset changeset = streamManager.addChangeset();
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
|
|||||||
final ODataMediaEntityCreateRequest<ODataEntity> createReq =
|
final ODataMediaEntityCreateRequest<ODataEntity> createReq =
|
||||||
client.getStreamedRequestFactory().getMediaEntityCreateRequest(builder.build(), input);
|
client.getStreamedRequestFactory().getMediaEntityCreateRequest(builder.build(), input);
|
||||||
|
|
||||||
final MediaEntityCreateStreamManager<ODataEntity> streamManager = createReq.execute();
|
final MediaEntityCreateStreamManager<ODataEntity> streamManager = createReq.payloadManager();
|
||||||
final Future<ODataMediaEntityCreateResponse<ODataEntity>> futureCreateRes = streamManager.getAsyncResponse();
|
final Future<ODataMediaEntityCreateResponse<ODataEntity>> futureCreateRes = streamManager.getAsyncResponse();
|
||||||
|
|
||||||
while (!futureCreateRes.isDone()) {
|
while (!futureCreateRes.isDone()) {
|
||||||
|
@ -30,11 +30,10 @@ import java.util.concurrent.Future;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.olingo.client.api.ODataBatchConstants;
|
import org.apache.olingo.client.api.ODataBatchConstants;
|
||||||
import org.apache.olingo.client.api.communication.request.ODataStreamManager;
|
import org.apache.olingo.client.api.communication.request.ODataPayloadManager;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.BatchStreamManager;
|
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.ODataBatchResponseItem;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.ODataChangeset;
|
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.v3.ODataBatchRequest;
|
import org.apache.olingo.client.api.communication.request.batch.v3.ODataBatchRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
|
import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
|
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
|
||||||
@ -90,7 +89,7 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
// create your request
|
// create your request
|
||||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
||||||
|
|
||||||
final BatchStreamManager payload = request.execute();
|
final BatchManager payload = request.payloadManager();
|
||||||
final ODataBatchResponse response = payload.getResponse();
|
final ODataBatchResponse response = payload.getResponse();
|
||||||
|
|
||||||
assertEquals(202, response.getStatusCode());
|
assertEquals(202, response.getStatusCode());
|
||||||
@ -105,7 +104,7 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
// create your request
|
// create your request
|
||||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
||||||
|
|
||||||
final BatchStreamManager payload = request.execute();
|
final BatchManager payload = request.payloadManager();
|
||||||
final ODataChangeset changeset = payload.addChangeset();
|
final ODataChangeset changeset = payload.addChangeset();
|
||||||
|
|
||||||
URIBuilder targetURI;
|
URIBuilder targetURI;
|
||||||
@ -158,7 +157,7 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
public void changesetWithReference() throws EdmPrimitiveTypeException {
|
public void changesetWithReference() throws EdmPrimitiveTypeException {
|
||||||
// create your request
|
// create your request
|
||||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
||||||
final BatchStreamManager streamManager = request.execute();
|
final BatchManager streamManager = request.payloadManager();
|
||||||
|
|
||||||
final ODataChangeset changeset = streamManager.addChangeset();
|
final ODataChangeset changeset = streamManager.addChangeset();
|
||||||
ODataEntity customer = getSampleCustomerProfile(20, "sample customer", false);
|
ODataEntity customer = getSampleCustomerProfile(20, "sample customer", false);
|
||||||
@ -234,7 +233,7 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
public void updateLinkWithReference() throws EdmPrimitiveTypeException {
|
public void updateLinkWithReference() throws EdmPrimitiveTypeException {
|
||||||
// create your request
|
// create your request
|
||||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
||||||
final BatchStreamManager streamManager = request.execute();
|
final BatchManager streamManager = request.payloadManager();
|
||||||
|
|
||||||
final ODataChangeset changeset = streamManager.addChangeset();
|
final ODataChangeset changeset = streamManager.addChangeset();
|
||||||
|
|
||||||
@ -294,9 +293,9 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
|
|
||||||
final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(
|
final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(
|
||||||
URIUtils.getURI(testStaticServiceRootURL, uriBuilder.build() + "/Info"));
|
URIUtils.getURI(testStaticServiceRootURL, uriBuilder.build() + "/Info"));
|
||||||
|
|
||||||
final ODataEntity navigatedInfo = req.execute().getBody();
|
final ODataEntity navigatedInfo = req.execute().getBody();
|
||||||
|
|
||||||
assertEquals(infoEntity.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class),
|
assertEquals(infoEntity.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class),
|
||||||
navigatedInfo.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class));
|
navigatedInfo.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class));
|
||||||
}
|
}
|
||||||
@ -307,13 +306,11 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
// create your request
|
// create your request
|
||||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
||||||
|
|
||||||
final BatchStreamManager streamManager = request.execute();
|
final BatchManager streamManager = request.payloadManager();
|
||||||
|
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
// Add retrieve item
|
// Add retrieve item
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
ODataRetrieve retrieve = streamManager.addRetrieve();
|
|
||||||
|
|
||||||
// prepare URI
|
// prepare URI
|
||||||
URIBuilder targetURI = client.getURIBuilder(testStaticServiceRootURL);
|
URIBuilder targetURI = client.getURIBuilder(testStaticServiceRootURL);
|
||||||
targetURI.appendEntitySetSegment("Customer").appendKeySegment(-10).
|
targetURI.appendEntitySetSegment("Customer").appendKeySegment(-10).
|
||||||
@ -323,7 +320,7 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
||||||
queryReq.setFormat(ODataPubFormat.ATOM);
|
queryReq.setFormat(ODataPubFormat.ATOM);
|
||||||
|
|
||||||
retrieve.setRequest(queryReq);
|
streamManager.addRetrieve(queryReq);
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
@ -368,7 +365,6 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
// Add retrieve item
|
// Add retrieve item
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
retrieve = streamManager.addRetrieve();
|
|
||||||
|
|
||||||
// prepare URI
|
// prepare URI
|
||||||
targetURI = client.getURIBuilder(testStaticServiceRootURL).
|
targetURI = client.getURIBuilder(testStaticServiceRootURL).
|
||||||
@ -377,7 +373,7 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
// create new request
|
// create new request
|
||||||
queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
||||||
|
|
||||||
retrieve.setRequest(queryReq);
|
streamManager.addRetrieve(queryReq);
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
final ODataBatchResponse response = streamManager.getResponse();
|
final ODataBatchResponse response = streamManager.getResponse();
|
||||||
@ -448,7 +444,7 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
super(new Wrapper<Future<HttpResponse>>());
|
super(new Wrapper<Future<HttpResponse>>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ODataStreamManager<ODataBatchResponse> addObject(byte[] src) {
|
public ODataPayloadManager<ODataBatchResponse> addObject(byte[] src) {
|
||||||
stream(src);
|
stream(src);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -499,9 +495,9 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
|
|
||||||
private static class BatchStreamingThread extends Thread {
|
private static class BatchStreamingThread extends Thread {
|
||||||
|
|
||||||
private final BatchStreamManager streaming;
|
private final BatchManager streaming;
|
||||||
|
|
||||||
public BatchStreamingThread(final BatchStreamManager streaming) {
|
public BatchStreamingThread(final BatchManager streaming) {
|
||||||
this.streaming = streaming;
|
this.streaming = streaming;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public class MediaEntityTestITCase extends AbstractTestITCase {
|
|||||||
client.getStreamedRequestFactory().getMediaEntityUpdateRequest(builder.build(), input);
|
client.getStreamedRequestFactory().getMediaEntityUpdateRequest(builder.build(), input);
|
||||||
updateReq.setFormat(format);
|
updateReq.setFormat(format);
|
||||||
|
|
||||||
final MediaEntityUpdateStreamManager<ODataEntity> streamManager = updateReq.execute();
|
final MediaEntityUpdateStreamManager<ODataEntity> streamManager = updateReq.payloadManager();
|
||||||
final ODataMediaEntityUpdateResponse<ODataEntity> updateRes = streamManager.getResponse();
|
final ODataMediaEntityUpdateResponse<ODataEntity> updateRes = streamManager.getResponse();
|
||||||
assertEquals(204, updateRes.getStatusCode());
|
assertEquals(204, updateRes.getStatusCode());
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ public class MediaEntityTestITCase extends AbstractTestITCase {
|
|||||||
client.getStreamedRequestFactory().getMediaEntityCreateRequest(builder.build(), input);
|
client.getStreamedRequestFactory().getMediaEntityCreateRequest(builder.build(), input);
|
||||||
createReq.setFormat(format);
|
createReq.setFormat(format);
|
||||||
|
|
||||||
final MediaEntityCreateStreamManager<ODataEntity> streamManager = createReq.execute();
|
final MediaEntityCreateStreamManager<ODataEntity> streamManager = createReq.payloadManager();
|
||||||
final ODataMediaEntityCreateResponse<ODataEntity> createRes = streamManager.getResponse();
|
final ODataMediaEntityCreateResponse<ODataEntity> createRes = streamManager.getResponse();
|
||||||
assertEquals(201, createRes.getStatusCode());
|
assertEquals(201, createRes.getStatusCode());
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ public class MediaEntityTestITCase extends AbstractTestITCase {
|
|||||||
final ODataStreamUpdateRequest updateReq =
|
final ODataStreamUpdateRequest updateReq =
|
||||||
client.getStreamedRequestFactory().getStreamUpdateRequest(builder.build(), input);
|
client.getStreamedRequestFactory().getStreamUpdateRequest(builder.build(), input);
|
||||||
|
|
||||||
final StreamUpdateStreamManager streamManager = updateReq.execute();
|
final StreamUpdateStreamManager streamManager = updateReq.payloadManager();
|
||||||
final ODataStreamUpdateResponse updateRes = streamManager.getResponse();
|
final ODataStreamUpdateResponse updateRes = streamManager.getResponse();
|
||||||
updateRes.close();
|
updateRes.close();
|
||||||
assertEquals(204, updateRes.getStatusCode());
|
assertEquals(204, updateRes.getStatusCode());
|
||||||
|
@ -34,13 +34,11 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.olingo.client.api.ODataBatchConstants;
|
import org.apache.olingo.client.api.ODataBatchConstants;
|
||||||
import org.apache.olingo.client.api.communication.header.HeaderName;
|
import org.apache.olingo.client.api.communication.header.HeaderName;
|
||||||
import org.apache.olingo.client.api.communication.request.ODataStreamManager;
|
import org.apache.olingo.client.api.communication.request.ODataPayloadManager;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
|
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.ODataChangeset;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.ODataRetrieve;
|
import org.apache.olingo.client.api.communication.request.batch.v4.BatchManager;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.v4.BatchStreamManager;
|
|
||||||
import org.apache.olingo.client.api.communication.request.batch.v4.ODataBatchRequest;
|
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.request.cud.ODataEntityCreateRequest;
|
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
|
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.cud.v4.UpdateType;
|
import org.apache.olingo.client.api.communication.request.cud.v4.UpdateType;
|
||||||
@ -103,7 +101,7 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
||||||
request.setAccept(ACCEPT);
|
request.setAccept(ACCEPT);
|
||||||
|
|
||||||
final BatchStreamManager payload = request.execute();
|
final BatchManager payload = request.payloadManager();
|
||||||
final ODataBatchResponse response = payload.getResponse();
|
final ODataBatchResponse response = payload.getResponse();
|
||||||
|
|
||||||
assertEquals(200, response.getStatusCode());
|
assertEquals(200, response.getStatusCode());
|
||||||
@ -119,7 +117,7 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
||||||
request.setAccept(ACCEPT);
|
request.setAccept(ACCEPT);
|
||||||
|
|
||||||
final BatchStreamManager payload = request.execute();
|
final BatchManager payload = request.payloadManager();
|
||||||
final ODataChangeset changeset = payload.addChangeset();
|
final ODataChangeset changeset = payload.addChangeset();
|
||||||
|
|
||||||
URIBuilder targetURI;
|
URIBuilder targetURI;
|
||||||
@ -181,13 +179,11 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
request.setAccept(ACCEPT);
|
request.setAccept(ACCEPT);
|
||||||
request.continueOnError();
|
request.continueOnError();
|
||||||
|
|
||||||
final BatchStreamManager streamManager = request.execute();
|
final BatchManager streamManager = request.payloadManager();
|
||||||
|
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
// Add retrieve item
|
// Add retrieve item
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
ODataRetrieve retrieve = streamManager.addRetrieve();
|
|
||||||
|
|
||||||
// prepare URI
|
// prepare URI
|
||||||
URIBuilder targetURI = client.getURIBuilder(testStaticServiceRootURL);
|
URIBuilder targetURI = client.getURIBuilder(testStaticServiceRootURL);
|
||||||
targetURI.appendEntitySetSegment("UnexistinfEntitySet").appendKeySegment(1);
|
targetURI.appendEntitySetSegment("UnexistinfEntitySet").appendKeySegment(1);
|
||||||
@ -196,21 +192,19 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
||||||
queryReq.setFormat(ODataPubFormat.JSON);
|
queryReq.setFormat(ODataPubFormat.JSON);
|
||||||
|
|
||||||
retrieve.setRequest(queryReq);
|
streamManager.addRetrieve(queryReq);
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
// Add retrieve item
|
// Add retrieve item
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
retrieve = streamManager.addRetrieve();
|
|
||||||
|
|
||||||
// prepare URI
|
// prepare URI
|
||||||
targetURI = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").appendKeySegment(1);
|
targetURI = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").appendKeySegment(1);
|
||||||
|
|
||||||
// create new request
|
// create new request
|
||||||
queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
||||||
|
|
||||||
retrieve.setRequest(queryReq);
|
streamManager.addRetrieve(queryReq);
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
final ODataBatchResponse response = streamManager.getResponse();
|
final ODataBatchResponse response = streamManager.getResponse();
|
||||||
@ -245,7 +239,7 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
// create your request
|
// create your request
|
||||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
||||||
request.setAccept(ACCEPT);
|
request.setAccept(ACCEPT);
|
||||||
final BatchStreamManager streamManager = request.execute();
|
final BatchManager streamManager = request.payloadManager();
|
||||||
|
|
||||||
final ODataChangeset changeset = streamManager.addChangeset();
|
final ODataChangeset changeset = streamManager.addChangeset();
|
||||||
ODataEntity order = newOrder(20);
|
ODataEntity order = newOrder(20);
|
||||||
@ -329,13 +323,11 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
// create your request
|
// create your request
|
||||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
||||||
request.setAccept(ACCEPT);
|
request.setAccept(ACCEPT);
|
||||||
final BatchStreamManager streamManager = request.execute();
|
final BatchManager streamManager = request.payloadManager();
|
||||||
|
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
// Add retrieve item
|
// Add retrieve item
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
ODataRetrieve retrieve = streamManager.addRetrieve();
|
|
||||||
|
|
||||||
// prepare URI
|
// prepare URI
|
||||||
URIBuilder targetURI = client.getURIBuilder(testStaticServiceRootURL);
|
URIBuilder targetURI = client.getURIBuilder(testStaticServiceRootURL);
|
||||||
targetURI.appendEntitySetSegment("Customers").appendKeySegment(1).
|
targetURI.appendEntitySetSegment("Customers").appendKeySegment(1).
|
||||||
@ -345,21 +337,19 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
||||||
queryReq.setFormat(ODataPubFormat.JSON);
|
queryReq.setFormat(ODataPubFormat.JSON);
|
||||||
|
|
||||||
retrieve.setRequest(queryReq);
|
streamManager.addRetrieve(queryReq);
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
// Add new order with outside item
|
// Add new order with outside item
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
final ODataOutsideUpdate outside = streamManager.addOutsideUpdate();
|
|
||||||
|
|
||||||
// prepare URI
|
// prepare URI
|
||||||
targetURI = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
|
targetURI = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
|
||||||
final ODataEntity original = newOrder(2000);
|
final ODataEntity original = newOrder(2000);
|
||||||
final ODataEntityCreateRequest<ODataEntity> createReq =
|
final ODataEntityCreateRequest<ODataEntity> createReq =
|
||||||
client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original);
|
client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original);
|
||||||
createReq.setFormat(ODataPubFormat.JSON);
|
createReq.setFormat(ODataPubFormat.JSON);
|
||||||
outside.setRequest(createReq);
|
streamManager.addOutsideUpdate(createReq);
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
final ODataBatchResponse response = streamManager.getResponse();
|
final ODataBatchResponse response = streamManager.getResponse();
|
||||||
@ -401,13 +391,11 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
||||||
request.setAccept(ACCEPT);
|
request.setAccept(ACCEPT);
|
||||||
|
|
||||||
final BatchStreamManager streamManager = request.execute();
|
final BatchManager streamManager = request.payloadManager();
|
||||||
|
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
// Add retrieve item
|
// Add retrieve item
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
ODataRetrieve retrieve = streamManager.addRetrieve();
|
|
||||||
|
|
||||||
// prepare URI
|
// prepare URI
|
||||||
URIBuilder targetURI = client.getURIBuilder(testStaticServiceRootURL);
|
URIBuilder targetURI = client.getURIBuilder(testStaticServiceRootURL);
|
||||||
targetURI.appendEntitySetSegment("Customers").appendKeySegment(1);
|
targetURI.appendEntitySetSegment("Customers").appendKeySegment(1);
|
||||||
@ -416,7 +404,7 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
||||||
queryReq.setFormat(ODataPubFormat.JSON);
|
queryReq.setFormat(ODataPubFormat.JSON);
|
||||||
|
|
||||||
retrieve.setRequest(queryReq);
|
streamManager.addRetrieve(queryReq);
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
@ -454,15 +442,13 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
// Add retrieve item
|
// Add retrieve item
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
retrieve = streamManager.addRetrieve();
|
|
||||||
|
|
||||||
// prepare URI
|
// prepare URI
|
||||||
targetURI = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").appendKeySegment(1);
|
targetURI = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").appendKeySegment(1);
|
||||||
|
|
||||||
// create new request
|
// create new request
|
||||||
queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
||||||
|
|
||||||
retrieve.setRequest(queryReq);
|
streamManager.addRetrieve(queryReq);
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
final ODataBatchResponse response = streamManager.getResponse();
|
final ODataBatchResponse response = streamManager.getResponse();
|
||||||
@ -534,8 +520,6 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
// Add retrieve item
|
// Add retrieve item
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
ODataRetrieve retrieve = async.addRetrieve();
|
|
||||||
|
|
||||||
// prepare URI
|
// prepare URI
|
||||||
URIBuilder targetURI = client.getURIBuilder(testStaticServiceRootURL);
|
URIBuilder targetURI = client.getURIBuilder(testStaticServiceRootURL);
|
||||||
targetURI.appendEntitySetSegment("People").appendKeySegment(5);
|
targetURI.appendEntitySetSegment("People").appendKeySegment(5);
|
||||||
@ -544,21 +528,19 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
||||||
queryReq.setFormat(ODataPubFormat.JSON);
|
queryReq.setFormat(ODataPubFormat.JSON);
|
||||||
|
|
||||||
retrieve.setRequest(queryReq);
|
async.addRetrieve(queryReq);
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
// Add retrieve item
|
// Add retrieve item
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
retrieve = async.addRetrieve();
|
|
||||||
|
|
||||||
// prepare URI
|
// prepare URI
|
||||||
targetURI = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").appendKeySegment(1);
|
targetURI = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").appendKeySegment(1);
|
||||||
|
|
||||||
// create new request
|
// create new request
|
||||||
queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
||||||
|
|
||||||
retrieve.setRequest(queryReq);
|
async.addRetrieve(queryReq);
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
final AsyncResponseWrapper<ODataBatchResponse> responseWrapper = async.execute();
|
final AsyncResponseWrapper<ODataBatchResponse> responseWrapper = async.execute();
|
||||||
@ -599,7 +581,7 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
super(new Wrapper<Future<HttpResponse>>());
|
super(new Wrapper<Future<HttpResponse>>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ODataStreamManager<ODataBatchResponse> addObject(final byte[] src) {
|
public ODataPayloadManager<ODataBatchResponse> addObject(final byte[] src) {
|
||||||
stream(src);
|
stream(src);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -651,9 +633,9 @@ public class BatchTestITCase extends AbstractTestITCase {
|
|||||||
|
|
||||||
private static class BatchStreamingThread extends Thread {
|
private static class BatchStreamingThread extends Thread {
|
||||||
|
|
||||||
private final BatchStreamManager streaming;
|
private final BatchManager streaming;
|
||||||
|
|
||||||
public BatchStreamingThread(final BatchStreamManager streaming) {
|
public BatchStreamingThread(final BatchManager streaming) {
|
||||||
super();
|
super();
|
||||||
this.streaming = streaming;
|
this.streaming = streaming;
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ public class MediaEntityTestITCase extends AbstractTestITCase {
|
|||||||
final URI uri = client.getURIBuilder(testDemoServiceRootURL).appendEntitySetSegment("Advertisements").build();
|
final URI uri = client.getURIBuilder(testDemoServiceRootURL).appendEntitySetSegment("Advertisements").build();
|
||||||
final ODataMediaEntityCreateRequest<ODataEntity> createReq =
|
final ODataMediaEntityCreateRequest<ODataEntity> createReq =
|
||||||
client.getStreamedRequestFactory().getMediaEntityCreateRequest(uri, input);
|
client.getStreamedRequestFactory().getMediaEntityCreateRequest(uri, input);
|
||||||
final MediaEntityCreateStreamManager<ODataEntity> streamManager = createReq.execute();
|
final MediaEntityCreateStreamManager<ODataEntity> streamManager = createReq.payloadManager();
|
||||||
|
|
||||||
final ODataMediaEntityCreateResponse<ODataEntity> createRes = streamManager.getResponse();
|
final ODataMediaEntityCreateResponse<ODataEntity> createRes = streamManager.getResponse();
|
||||||
assertEquals(201, createRes.getStatusCode());
|
assertEquals(201, createRes.getStatusCode());
|
||||||
@ -155,7 +155,7 @@ public class MediaEntityTestITCase extends AbstractTestITCase {
|
|||||||
getMediaEntityUpdateRequest(uri, IOUtils.toInputStream(random));
|
getMediaEntityUpdateRequest(uri, IOUtils.toInputStream(random));
|
||||||
updateReq.setFormat(format);
|
updateReq.setFormat(format);
|
||||||
|
|
||||||
final MediaEntityUpdateStreamManager<ODataEntity> streamManager = updateReq.execute();
|
final MediaEntityUpdateStreamManager<ODataEntity> streamManager = updateReq.payloadManager();
|
||||||
final ODataMediaEntityUpdateResponse<ODataEntity> createRes = streamManager.getResponse();
|
final ODataMediaEntityUpdateResponse<ODataEntity> createRes = streamManager.getResponse();
|
||||||
assertEquals(204, createRes.getStatusCode());
|
assertEquals(204, createRes.getStatusCode());
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ import org.apache.olingo.client.api.communication.response.ODataResponse;
|
|||||||
*
|
*
|
||||||
* @param <T> OData response type corresponding to the request implementation.
|
* @param <T> OData response type corresponding to the request implementation.
|
||||||
*/
|
*/
|
||||||
public interface ODataStreamManager<T extends ODataResponse> extends ODataStreamer {
|
public interface ODataPayloadManager<T extends ODataResponse> extends ODataStreamer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets payload stream.
|
* Gets payload stream.
|
@ -26,13 +26,13 @@ import org.apache.olingo.client.api.communication.response.ODataResponse;
|
|||||||
* @param <V> OData response type corresponding to the request implementation.
|
* @param <V> OData response type corresponding to the request implementation.
|
||||||
* @param <T> OData request payload 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>>
|
public interface ODataStreamedRequest<V extends ODataResponse, T extends ODataPayloadManager<V>>
|
||||||
extends ODataRequest {
|
extends ODataRequest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Streamed request execute.
|
* Streamed payload manager.
|
||||||
*
|
*
|
||||||
* @return OData request payload manager object.
|
* @return OData request payload manager object.
|
||||||
*/
|
*/
|
||||||
T execute();
|
T payloadManager();
|
||||||
}
|
}
|
||||||
|
@ -18,13 +18,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.communication.request.batch;
|
package org.apache.olingo.client.api.communication.request.batch;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.communication.request.ODataStreamManager;
|
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
|
||||||
|
import org.apache.olingo.client.api.communication.request.ODataPayloadManager;
|
||||||
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
|
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Batch request payload management.
|
* Batch request payload management.
|
||||||
*/
|
*/
|
||||||
public interface BatchStreamManager extends ODataStreamManager<ODataBatchResponse> {
|
public interface BatchManager extends ODataPayloadManager<ODataBatchResponse> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a changeset batch item instance. A changeset can be submitted embedded into a batch request only.
|
* Gets a changeset batch item instance. A changeset can be submitted embedded into a batch request only.
|
||||||
@ -34,9 +35,9 @@ public interface BatchStreamManager extends ODataStreamManager<ODataBatchRespons
|
|||||||
ODataChangeset addChangeset();
|
ODataChangeset addChangeset();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a retrieve batch item instance. A retrieve item can be submitted embedded into a batch request only.
|
* Adds a retrieve batch item instance. A retrieve item can be submitted embedded into a batch request only.
|
||||||
*
|
*
|
||||||
* @return ODataRetrieve instance.
|
* @param request retrieve request to batch.
|
||||||
*/
|
*/
|
||||||
ODataRetrieve addRetrieve();
|
void addRetrieve(final ODataBatchableRequest request);
|
||||||
}
|
}
|
@ -21,6 +21,5 @@ package org.apache.olingo.client.api.communication.request.batch.v3;
|
|||||||
/**
|
/**
|
||||||
* Batch request payload management.
|
* Batch request payload management.
|
||||||
*/
|
*/
|
||||||
public interface BatchStreamManager
|
public interface BatchManager extends org.apache.olingo.client.api.communication.request.batch.BatchManager {
|
||||||
extends org.apache.olingo.client.api.communication.request.batch.BatchStreamManager {
|
|
||||||
}
|
}
|
@ -26,5 +26,5 @@ import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
|
|||||||
* This class implements a batch request.
|
* This class implements a batch request.
|
||||||
*/
|
*/
|
||||||
public interface ODataBatchRequest
|
public interface ODataBatchRequest
|
||||||
extends CommonODataBatchRequest, ODataStreamedRequest<ODataBatchResponse, BatchStreamManager> {
|
extends CommonODataBatchRequest, ODataStreamedRequest<ODataBatchResponse, BatchManager> {
|
||||||
}
|
}
|
||||||
|
@ -18,17 +18,18 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.communication.request.batch.v4;
|
package org.apache.olingo.client.api.communication.request.batch.v4;
|
||||||
|
|
||||||
|
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Batch request payload management.
|
* Batch request payload management.
|
||||||
*/
|
*/
|
||||||
public interface BatchStreamManager
|
public interface BatchManager extends org.apache.olingo.client.api.communication.request.batch.BatchManager {
|
||||||
extends org.apache.olingo.client.api.communication.request.batch.BatchStreamManager {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an outside update batch item instance. An outside update item can be submitted embedded into a batch request
|
* Adds an outside update batch item instance. An outside update item can be submitted embedded into a batch request
|
||||||
* only.
|
* only.
|
||||||
*
|
*
|
||||||
* @return ODataOutsideUpdate instance.
|
* @param request update request to batch.
|
||||||
*/
|
*/
|
||||||
ODataOutsideUpdate addOutsideUpdate();
|
void addOutsideUpdate(final ODataBatchableRequest request);
|
||||||
}
|
}
|
@ -26,7 +26,7 @@ import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
|
|||||||
* This class implements a batch request.
|
* This class implements a batch request.
|
||||||
*/
|
*/
|
||||||
public interface ODataBatchRequest
|
public interface ODataBatchRequest
|
||||||
extends CommonODataBatchRequest, ODataStreamedRequest<ODataBatchResponse, BatchStreamManager> {
|
extends CommonODataBatchRequest, ODataStreamedRequest<ODataBatchResponse, BatchManager> {
|
||||||
|
|
||||||
ODataBatchRequest continueOnError();
|
ODataBatchRequest continueOnError();
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.communication.request.streamed;
|
package org.apache.olingo.client.api.communication.request.streamed;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.communication.request.ODataStreamManager;
|
import org.apache.olingo.client.api.communication.request.ODataPayloadManager;
|
||||||
import org.apache.olingo.client.api.communication.response.ODataMediaEntityCreateResponse;
|
import org.apache.olingo.client.api.communication.response.ODataMediaEntityCreateResponse;
|
||||||
import org.apache.olingo.commons.api.domain.CommonODataEntity;
|
import org.apache.olingo.commons.api.domain.CommonODataEntity;
|
||||||
|
|
||||||
@ -28,5 +28,5 @@ import org.apache.olingo.commons.api.domain.CommonODataEntity;
|
|||||||
* @param <E> concrete ODataEntity implementation
|
* @param <E> concrete ODataEntity implementation
|
||||||
*/
|
*/
|
||||||
public interface MediaEntityCreateStreamManager<E extends CommonODataEntity>
|
public interface MediaEntityCreateStreamManager<E extends CommonODataEntity>
|
||||||
extends ODataStreamManager<ODataMediaEntityCreateResponse<E>> {
|
extends ODataPayloadManager<ODataMediaEntityCreateResponse<E>> {
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.communication.request.streamed;
|
package org.apache.olingo.client.api.communication.request.streamed;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.communication.request.ODataStreamManager;
|
import org.apache.olingo.client.api.communication.request.ODataPayloadManager;
|
||||||
import org.apache.olingo.client.api.communication.response.ODataMediaEntityUpdateResponse;
|
import org.apache.olingo.client.api.communication.response.ODataMediaEntityUpdateResponse;
|
||||||
import org.apache.olingo.commons.api.domain.CommonODataEntity;
|
import org.apache.olingo.commons.api.domain.CommonODataEntity;
|
||||||
|
|
||||||
@ -28,5 +28,5 @@ import org.apache.olingo.commons.api.domain.CommonODataEntity;
|
|||||||
* @param <E> concrete ODataEntity implementation
|
* @param <E> concrete ODataEntity implementation
|
||||||
*/
|
*/
|
||||||
public interface MediaEntityUpdateStreamManager<E extends CommonODataEntity>
|
public interface MediaEntityUpdateStreamManager<E extends CommonODataEntity>
|
||||||
extends ODataStreamManager<ODataMediaEntityUpdateResponse<E>> {
|
extends ODataPayloadManager<ODataMediaEntityUpdateResponse<E>> {
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.communication.request.streamed;
|
package org.apache.olingo.client.api.communication.request.streamed;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.communication.request.ODataStreamManager;
|
import org.apache.olingo.client.api.communication.request.ODataPayloadManager;
|
||||||
import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
|
import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
|
||||||
import org.apache.olingo.client.api.communication.response.ODataResponse;
|
import org.apache.olingo.client.api.communication.response.ODataResponse;
|
||||||
import org.apache.olingo.commons.api.format.ODataPubFormat;
|
import org.apache.olingo.commons.api.format.ODataPubFormat;
|
||||||
@ -29,7 +29,7 @@ import org.apache.olingo.commons.api.format.ODataPubFormat;
|
|||||||
* @param <V> OData response type corresponding to the request implementation.
|
* @param <V> OData response type corresponding to the request implementation.
|
||||||
* @param <T> OData request payload type corresponding to the request implementation.
|
* @param <T> OData request payload type corresponding to the request implementation.
|
||||||
*/
|
*/
|
||||||
public interface ODataStreamedEntityRequest<V extends ODataResponse, T extends ODataStreamManager<V>>
|
public interface ODataStreamedEntityRequest<V extends ODataResponse, T extends ODataPayloadManager<V>>
|
||||||
extends ODataStreamedRequest<V, T> {
|
extends ODataStreamedRequest<V, T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,11 +18,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.communication.request.streamed;
|
package org.apache.olingo.client.api.communication.request.streamed;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.communication.request.ODataStreamManager;
|
import org.apache.olingo.client.api.communication.request.ODataPayloadManager;
|
||||||
import org.apache.olingo.client.api.communication.response.ODataStreamUpdateResponse;
|
import org.apache.olingo.client.api.communication.response.ODataStreamUpdateResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Streamed entity payload object.
|
* Streamed entity payload object.
|
||||||
*/
|
*/
|
||||||
public interface StreamUpdateStreamManager extends ODataStreamManager<ODataStreamUpdateResponse> {
|
public interface StreamUpdateStreamManager extends ODataPayloadManager<ODataStreamUpdateResponse> {
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.communication.request.v4;
|
package org.apache.olingo.client.api.communication.request.v4;
|
||||||
|
|
||||||
|
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.ODataChangeset;
|
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.v4.ODataOutsideUpdate;
|
|
||||||
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
|
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
|
||||||
|
|
||||||
public interface AsyncBatchRequestWrapper extends AsyncRequestWrapper<ODataBatchResponse> {
|
public interface AsyncBatchRequestWrapper extends AsyncRequestWrapper<ODataBatchResponse> {
|
||||||
@ -33,16 +32,16 @@ public interface AsyncBatchRequestWrapper extends AsyncRequestWrapper<ODataBatch
|
|||||||
ODataChangeset addChangeset();
|
ODataChangeset addChangeset();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a retrieve batch item instance. A retrieve item can be submitted embedded into a batch request only.
|
* Adds a retrieve batch item instance. A retrieve item can be submitted embedded into a batch request only.
|
||||||
*
|
*
|
||||||
* @return ODataRetrieve instance.
|
* @param request retrieve request to batch.
|
||||||
*/
|
*/
|
||||||
ODataRetrieve addRetrieve();
|
void addRetrieve(final ODataBatchableRequest request);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an outside change batch item instance. An outside item can be submitted embedded into a batch request only.
|
* Adds an outside change batch item instance. An outside item can be submitted embedded into a batch request only.
|
||||||
*
|
*
|
||||||
* @return ODataOutsideUpdate instance.
|
* @param request update request to batch outside a changeset.
|
||||||
*/
|
*/
|
||||||
ODataOutsideUpdate addOutsideUpdate();
|
void addOutsideUpdate(final ODataBatchableRequest request);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.olingo.client.api.communication.request.ODataStreamManager;
|
import org.apache.olingo.client.api.communication.request.ODataPayloadManager;
|
||||||
import org.apache.olingo.client.api.communication.response.ODataResponse;
|
import org.apache.olingo.client.api.communication.response.ODataResponse;
|
||||||
import org.apache.olingo.client.api.http.HttpClientException;
|
import org.apache.olingo.client.api.http.HttpClientException;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ import org.apache.olingo.client.api.http.HttpClientException;
|
|||||||
* @param <T> OData response type corresponding to the request implementation.
|
* @param <T> OData response type corresponding to the request implementation.
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractODataStreamManager<T extends ODataResponse> extends AbstractODataStreamer
|
public abstract class AbstractODataStreamManager<T extends ODataResponse> extends AbstractODataStreamer
|
||||||
implements ODataStreamManager<T> {
|
implements ODataPayloadManager<T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Body input stream.
|
* Body input stream.
|
||||||
|
@ -21,6 +21,7 @@ package org.apache.olingo.client.core.communication.request.batch;
|
|||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
|
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.CommonODataBatchRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequestItem;
|
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.ODataChangeset;
|
||||||
@ -32,7 +33,7 @@ import org.apache.olingo.client.core.communication.request.Wrapper;
|
|||||||
/**
|
/**
|
||||||
* Batch request payload management.
|
* Batch request payload management.
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractBatchStreamManager extends AbstractODataStreamManager<ODataBatchResponse> {
|
public abstract class AbstractBatchManager extends AbstractODataStreamManager<ODataBatchResponse> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Batch request current item.
|
* Batch request current item.
|
||||||
@ -49,7 +50,7 @@ public abstract class AbstractBatchStreamManager extends AbstractODataStreamMana
|
|||||||
*
|
*
|
||||||
* @param req batch request reference.
|
* @param req batch request reference.
|
||||||
*/
|
*/
|
||||||
protected AbstractBatchStreamManager(
|
protected AbstractBatchManager(
|
||||||
final CommonODataBatchRequest req, final Wrapper<Future<HttpResponse>> futureWrap) {
|
final CommonODataBatchRequest req, final Wrapper<Future<HttpResponse>> futureWrap) {
|
||||||
super(futureWrap);
|
super(futureWrap);
|
||||||
this.req = req;
|
this.req = req;
|
||||||
@ -75,11 +76,11 @@ public abstract class AbstractBatchStreamManager extends AbstractODataStreamMana
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a retrieve batch item instance. A retrieve item can be submitted embedded into a batch request only.
|
* Adds a retrieve batch item instance. A retrieve item can be submitted embedded into a batch request only.
|
||||||
*
|
*
|
||||||
* @return ODataRetrieve instance.
|
* @param request retrieve request to batch.
|
||||||
*/
|
*/
|
||||||
public ODataRetrieve addRetrieve() {
|
public void addRetrieve(final ODataBatchableRequest request) {
|
||||||
closeCurrentItem();
|
closeCurrentItem();
|
||||||
|
|
||||||
// stream dash boundary
|
// stream dash boundary
|
||||||
@ -90,7 +91,7 @@ public abstract class AbstractBatchStreamManager extends AbstractODataStreamMana
|
|||||||
|
|
||||||
((AbstractODataBatchRequest) req).addExpectedResItem(expectedResItem);
|
((AbstractODataBatchRequest) req).addExpectedResItem(expectedResItem);
|
||||||
|
|
||||||
return (ODataRetrieve) currentItem;
|
((ODataRetrieve) currentItem).setRequest(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -25,7 +25,7 @@ import java.util.List;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import org.apache.olingo.client.api.ODataBatchConstants;
|
import org.apache.olingo.client.api.ODataBatchConstants;
|
||||||
import org.apache.olingo.client.api.CommonODataClient;
|
import org.apache.olingo.client.api.CommonODataClient;
|
||||||
import org.apache.olingo.client.api.communication.request.ODataStreamManager;
|
import org.apache.olingo.client.api.communication.request.ODataPayloadManager;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest;
|
import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
|
import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
|
||||||
import org.apache.olingo.client.api.communication.response.ODataResponse;
|
import org.apache.olingo.client.api.communication.response.ODataResponse;
|
||||||
@ -36,7 +36,7 @@ import org.apache.olingo.commons.api.format.ContentType;
|
|||||||
/**
|
/**
|
||||||
* This class implements a batch request.
|
* This class implements a batch request.
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractODataBatchRequest<V extends ODataResponse, T extends ODataStreamManager<V>>
|
public abstract class AbstractODataBatchRequest<V extends ODataResponse, T extends ODataPayloadManager<V>>
|
||||||
extends AbstractODataStreamedRequest<V, T> {
|
extends AbstractODataStreamedRequest<V, T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,7 +73,7 @@ public abstract class AbstractODataBatchRequest<V extends ODataResponse, T exten
|
|||||||
* {@inheritDoc }
|
* {@inheritDoc }
|
||||||
*/
|
*/
|
||||||
public PipedOutputStream getOutputStream() {
|
public PipedOutputStream getOutputStream() {
|
||||||
return getStreamManager().getBodyStreamWriter();
|
return getPayloadManager().getBodyStreamWriter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,11 +26,11 @@ import org.apache.http.HttpResponse;
|
|||||||
import org.apache.http.client.HttpClient;
|
import org.apache.http.client.HttpClient;
|
||||||
import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
|
import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
|
import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.v3.BatchStreamManager;
|
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.request.batch.v3.ODataBatchRequest;
|
||||||
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
|
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
|
||||||
import org.apache.olingo.client.api.v3.ODataClient;
|
import org.apache.olingo.client.api.v3.ODataClient;
|
||||||
import org.apache.olingo.client.core.communication.request.batch.AbstractBatchStreamManager;
|
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.AbstractODataBatchRequest;
|
||||||
import org.apache.olingo.client.core.communication.request.batch.v3.ODataBatchRequestImpl.BatchStreamManagerImpl;
|
import org.apache.olingo.client.core.communication.request.batch.v3.ODataBatchRequestImpl.BatchStreamManagerImpl;
|
||||||
import org.apache.olingo.client.core.communication.request.batch.v3.ODataBatchRequestImpl.ODataBatchResponseImpl;
|
import org.apache.olingo.client.core.communication.request.batch.v3.ODataBatchRequestImpl.ODataBatchResponseImpl;
|
||||||
@ -41,8 +41,8 @@ import org.apache.olingo.client.core.communication.response.batch.ODataBatchResp
|
|||||||
* This class implements a batch request.
|
* This class implements a batch request.
|
||||||
*/
|
*/
|
||||||
public class ODataBatchRequestImpl
|
public class ODataBatchRequestImpl
|
||||||
extends AbstractODataBatchRequest<ODataBatchResponse, BatchStreamManager>
|
extends AbstractODataBatchRequest<ODataBatchResponse, BatchManager>
|
||||||
implements ODataBatchRequest, ODataStreamedRequest<ODataBatchResponse, BatchStreamManager> {
|
implements ODataBatchRequest, ODataStreamedRequest<ODataBatchResponse, BatchManager> {
|
||||||
|
|
||||||
public ODataBatchRequestImpl(final ODataClient odataClient, final URI uri) {
|
public ODataBatchRequestImpl(final ODataClient odataClient, final URI uri) {
|
||||||
super(odataClient, uri);
|
super(odataClient, uri);
|
||||||
@ -50,11 +50,11 @@ public class ODataBatchRequestImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BatchStreamManager getStreamManager() {
|
protected BatchManager getPayloadManager() {
|
||||||
if (streamManager == null) {
|
if (payloadManager == null) {
|
||||||
streamManager = new BatchStreamManagerImpl(this);
|
payloadManager = new BatchStreamManagerImpl(this);
|
||||||
}
|
}
|
||||||
return (BatchStreamManager) streamManager;
|
return (BatchManager) payloadManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,7 +62,7 @@ public class ODataBatchRequestImpl
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ODataBatchRequest rawAppend(final byte[] toBeStreamed) throws IOException {
|
public ODataBatchRequest rawAppend(final byte[] toBeStreamed) throws IOException {
|
||||||
getStreamManager().getBodyStreamWriter().write(toBeStreamed);
|
getPayloadManager().getBodyStreamWriter().write(toBeStreamed);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,14 +71,14 @@ public class ODataBatchRequestImpl
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ODataBatchRequest rawAppend(final byte[] toBeStreamed, int off, int len) throws IOException {
|
public ODataBatchRequest rawAppend(final byte[] toBeStreamed, int off, int len) throws IOException {
|
||||||
getStreamManager().getBodyStreamWriter().write(toBeStreamed, off, len);
|
getPayloadManager().getBodyStreamWriter().write(toBeStreamed, off, len);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Batch request payload management.
|
* Batch request payload management.
|
||||||
*/
|
*/
|
||||||
public class BatchStreamManagerImpl extends AbstractBatchStreamManager implements BatchStreamManager {
|
public class BatchStreamManagerImpl extends AbstractBatchManager implements BatchManager {
|
||||||
|
|
||||||
public BatchStreamManagerImpl(final ODataBatchRequest req) {
|
public BatchStreamManagerImpl(final ODataBatchRequest req) {
|
||||||
super(req, ODataBatchRequestImpl.this.futureWrapper);
|
super(req, ODataBatchRequestImpl.this.futureWrapper);
|
||||||
|
@ -26,13 +26,14 @@ import org.apache.http.HttpResponse;
|
|||||||
import org.apache.http.client.HttpClient;
|
import org.apache.http.client.HttpClient;
|
||||||
import org.apache.olingo.client.api.communication.header.HeaderName;
|
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.header.ODataPreferences;
|
||||||
|
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
|
import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.v4.BatchStreamManager;
|
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.ODataBatchRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.v4.ODataOutsideUpdate;
|
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.communication.response.ODataBatchResponse;
|
||||||
import org.apache.olingo.client.api.v4.ODataClient;
|
import org.apache.olingo.client.api.v4.ODataClient;
|
||||||
import org.apache.olingo.client.core.communication.request.batch.AbstractBatchStreamManager;
|
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.AbstractODataBatchRequest;
|
||||||
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
|
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
|
||||||
import org.apache.olingo.client.core.communication.response.batch.ODataBatchResponseManager;
|
import org.apache.olingo.client.core.communication.response.batch.ODataBatchResponseManager;
|
||||||
@ -41,7 +42,7 @@ import org.apache.olingo.client.core.communication.response.batch.ODataBatchResp
|
|||||||
* This class implements a batch request.
|
* This class implements a batch request.
|
||||||
*/
|
*/
|
||||||
public class ODataBatchRequestImpl
|
public class ODataBatchRequestImpl
|
||||||
extends AbstractODataBatchRequest<ODataBatchResponse, BatchStreamManager>
|
extends AbstractODataBatchRequest<ODataBatchResponse, BatchManager>
|
||||||
implements ODataBatchRequest {
|
implements ODataBatchRequest {
|
||||||
|
|
||||||
private boolean continueOnError = false;
|
private boolean continueOnError = false;
|
||||||
@ -52,11 +53,11 @@ public class ODataBatchRequestImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BatchStreamManager getStreamManager() {
|
protected BatchManager getPayloadManager() {
|
||||||
if (streamManager == null) {
|
if (payloadManager == null) {
|
||||||
streamManager = new BatchStreamManagerImpl(this);
|
payloadManager = new BatchManagerImpl(this);
|
||||||
}
|
}
|
||||||
return (BatchStreamManager) streamManager;
|
return (BatchManager) payloadManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,7 +65,7 @@ public class ODataBatchRequestImpl
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ODataBatchRequest rawAppend(final byte[] toBeStreamed) throws IOException {
|
public ODataBatchRequest rawAppend(final byte[] toBeStreamed) throws IOException {
|
||||||
getStreamManager().getBodyStreamWriter().write(toBeStreamed);
|
getPayloadManager().getBodyStreamWriter().write(toBeStreamed);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ public class ODataBatchRequestImpl
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ODataBatchRequest rawAppend(final byte[] toBeStreamed, int off, int len) throws IOException {
|
public ODataBatchRequest rawAppend(final byte[] toBeStreamed, int off, int len) throws IOException {
|
||||||
getStreamManager().getBodyStreamWriter().write(toBeStreamed, off, len);
|
getPayloadManager().getBodyStreamWriter().write(toBeStreamed, off, len);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,9 +88,9 @@ public class ODataBatchRequestImpl
|
|||||||
/**
|
/**
|
||||||
* Batch request payload management.
|
* Batch request payload management.
|
||||||
*/
|
*/
|
||||||
public class BatchStreamManagerImpl extends AbstractBatchStreamManager implements BatchStreamManager {
|
public class BatchManagerImpl extends AbstractBatchManager implements BatchManager {
|
||||||
|
|
||||||
public BatchStreamManagerImpl(final ODataBatchRequest req) {
|
public BatchManagerImpl(final ODataBatchRequest req) {
|
||||||
super(req, ODataBatchRequestImpl.this.futureWrapper);
|
super(req, ODataBatchRequestImpl.this.futureWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +100,7 @@ public class ODataBatchRequestImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ODataOutsideUpdate addOutsideUpdate() {
|
public void addOutsideUpdate(final ODataBatchableRequest request) {
|
||||||
closeCurrentItem();
|
closeCurrentItem();
|
||||||
|
|
||||||
// stream dash boundary
|
// stream dash boundary
|
||||||
@ -110,7 +111,7 @@ public class ODataBatchRequestImpl
|
|||||||
|
|
||||||
((ODataBatchRequestImpl) req).expectedResItems.add(expectedResItem);
|
((ODataBatchRequestImpl) req).expectedResItems.add(expectedResItem);
|
||||||
|
|
||||||
return (ODataOutsideUpdate) currentItem;
|
((ODataOutsideUpdate) currentItem).setRequest(request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ package org.apache.olingo.client.core.communication.request.streamed;
|
|||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import org.apache.olingo.client.api.CommonODataClient;
|
import org.apache.olingo.client.api.CommonODataClient;
|
||||||
import org.apache.olingo.client.api.communication.request.ODataStreamManager;
|
import org.apache.olingo.client.api.communication.request.ODataPayloadManager;
|
||||||
import org.apache.olingo.client.api.communication.request.streamed.ODataStreamedEntityRequest;
|
import org.apache.olingo.client.api.communication.request.streamed.ODataStreamedEntityRequest;
|
||||||
import org.apache.olingo.client.api.communication.response.ODataResponse;
|
import org.apache.olingo.client.api.communication.response.ODataResponse;
|
||||||
import org.apache.olingo.commons.api.format.ODataPubFormat;
|
import org.apache.olingo.commons.api.format.ODataPubFormat;
|
||||||
@ -32,7 +32,7 @@ import org.apache.olingo.client.api.http.HttpMethod;
|
|||||||
* @param <V> OData response type corresponding to the request implementation.
|
* @param <V> OData response type corresponding to the request implementation.
|
||||||
* @param <T> OData request payload type corresponding to the request implementation.
|
* @param <T> OData request payload type corresponding to the request implementation.
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractODataStreamedEntityRequest<V extends ODataResponse, T extends ODataStreamManager<V>>
|
public abstract class AbstractODataStreamedEntityRequest<V extends ODataResponse, T extends ODataPayloadManager<V>>
|
||||||
extends AbstractODataStreamedRequest<V, T>
|
extends AbstractODataStreamedRequest<V, T>
|
||||||
implements ODataStreamedEntityRequest<V, T> {
|
implements ODataStreamedEntityRequest<V, T> {
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
|
|||||||
import org.apache.http.entity.ContentType;
|
import org.apache.http.entity.ContentType;
|
||||||
import org.apache.olingo.client.api.ODataBatchConstants;
|
import org.apache.olingo.client.api.ODataBatchConstants;
|
||||||
import org.apache.olingo.client.api.CommonODataClient;
|
import org.apache.olingo.client.api.CommonODataClient;
|
||||||
import org.apache.olingo.client.api.communication.request.ODataStreamManager;
|
import org.apache.olingo.client.api.communication.request.ODataPayloadManager;
|
||||||
import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
|
import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.ODataStreamer;
|
import org.apache.olingo.client.api.communication.request.ODataStreamer;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest;
|
import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest;
|
||||||
@ -47,13 +47,13 @@ import org.apache.commons.io.IOUtils;
|
|||||||
* @param <V> OData response type corresponding to the request implementation.
|
* @param <V> OData response type corresponding to the request implementation.
|
||||||
* @param <T> OData request payload type corresponding to the request implementation.
|
* @param <T> OData request payload type corresponding to the request implementation.
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractODataStreamedRequest<V extends ODataResponse, T extends ODataStreamManager<V>>
|
public abstract class AbstractODataStreamedRequest<V extends ODataResponse, T extends ODataPayloadManager<V>>
|
||||||
extends AbstractODataRequest<ODataMediaFormat> implements ODataStreamedRequest<V, T> {
|
extends AbstractODataRequest<ODataMediaFormat> implements ODataStreamedRequest<V, T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OData payload stream manager.
|
* OData payload stream manager.
|
||||||
*/
|
*/
|
||||||
protected ODataStreamManager<V> streamManager;
|
protected ODataPayloadManager<V> payloadManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for actual streamed request's future. This holds information about the HTTP request / response currently
|
* Wrapper for actual streamed request's future. This holds information about the HTTP request / response currently
|
||||||
@ -81,18 +81,18 @@ public abstract class AbstractODataStreamedRequest<V extends ODataResponse, T ex
|
|||||||
*
|
*
|
||||||
* @return OData request payload management object.
|
* @return OData request payload management object.
|
||||||
*/
|
*/
|
||||||
protected abstract T getStreamManager();
|
protected abstract T getPayloadManager();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc }
|
* {@inheritDoc }
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public T execute() {
|
public T payloadManager() {
|
||||||
streamManager = getStreamManager();
|
payloadManager = getPayloadManager();
|
||||||
|
|
||||||
((HttpEntityEnclosingRequestBase) request).setEntity(
|
((HttpEntityEnclosingRequestBase) request).setEntity(
|
||||||
URIUtils.buildInputStreamEntity(odataClient, streamManager.getBody()));
|
URIUtils.buildInputStreamEntity(odataClient, payloadManager.getBody()));
|
||||||
|
|
||||||
futureWrapper.setWrapped(odataClient.getConfiguration().getExecutor().submit(new Callable<HttpResponse>() {
|
futureWrapper.setWrapped(odataClient.getConfiguration().getExecutor().submit(new Callable<HttpResponse>() {
|
||||||
@Override
|
@Override
|
||||||
@ -102,7 +102,7 @@ public abstract class AbstractODataStreamedRequest<V extends ODataResponse, T ex
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// returns the stream manager object
|
// returns the stream manager object
|
||||||
return (T) streamManager;
|
return (T) payloadManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,11 +125,11 @@ public abstract class AbstractODataStreamedRequest<V extends ODataResponse, T ex
|
|||||||
* @param contentId ContentId header value to be added to the serialization. Use this in case of changeset items.
|
* @param contentId ContentId header value to be added to the serialization. Use this in case of changeset items.
|
||||||
*/
|
*/
|
||||||
public void batch(final CommonODataBatchRequest req, final String contentId) {
|
public void batch(final CommonODataBatchRequest req, final String contentId) {
|
||||||
final InputStream input = getStreamManager().getBody();
|
final InputStream input = getPayloadManager().getBody();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// finalize the body
|
// finalize the body
|
||||||
getStreamManager().finalizeBody();
|
getPayloadManager().finalizeBody();
|
||||||
|
|
||||||
req.rawAppend(toByteArray());
|
req.rawAppend(toByteArray());
|
||||||
if (StringUtils.isNotBlank(contentId)) {
|
if (StringUtils.isNotBlank(contentId)) {
|
||||||
|
@ -60,11 +60,11 @@ public class ODataMediaEntityCreateRequestImpl<E extends CommonODataEntity>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected MediaEntityCreateStreamManager<E> getStreamManager() {
|
protected MediaEntityCreateStreamManager<E> getPayloadManager() {
|
||||||
if (streamManager == null) {
|
if (payloadManager == null) {
|
||||||
streamManager = new MediaEntityCreateStreamManagerImpl(media);
|
payloadManager = new MediaEntityCreateStreamManagerImpl(media);
|
||||||
}
|
}
|
||||||
return (MediaEntityCreateStreamManager<E>) streamManager;
|
return (MediaEntityCreateStreamManager<E>) payloadManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,11 +61,11 @@ public class ODataMediaEntityUpdateRequestImpl<E extends CommonODataEntity>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected MediaEntityUpdateStreamManager<E> getStreamManager() {
|
protected MediaEntityUpdateStreamManager<E> getPayloadManager() {
|
||||||
if (streamManager == null) {
|
if (payloadManager == null) {
|
||||||
streamManager = new MediaEntityUpdateStreamManagerImpl(media);
|
payloadManager = new MediaEntityUpdateStreamManagerImpl(media);
|
||||||
}
|
}
|
||||||
return (MediaEntityUpdateStreamManager<E>) streamManager;
|
return (MediaEntityUpdateStreamManager<E>) payloadManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,12 +59,12 @@ public class ODataStreamUpdateRequestImpl
|
|||||||
* {@inheritDoc }
|
* {@inheritDoc }
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected StreamUpdateStreamManager getStreamManager() {
|
protected StreamUpdateStreamManager getPayloadManager() {
|
||||||
if (streamManager == null) {
|
if (payloadManager == null) {
|
||||||
streamManager = new StreamUpdateStreamManagerImpl(this.stream);
|
payloadManager = new StreamUpdateStreamManagerImpl(this.stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (StreamUpdateStreamManager) streamManager;
|
return (StreamUpdateStreamManager) payloadManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class StreamUpdateStreamManagerImpl extends AbstractODataStreamManager<ODataStreamUpdateResponse>
|
public class StreamUpdateStreamManagerImpl extends AbstractODataStreamManager<ODataStreamUpdateResponse>
|
||||||
|
@ -23,11 +23,10 @@ import java.util.Collection;
|
|||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.olingo.client.api.communication.header.HeaderName;
|
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.header.ODataPreferences;
|
||||||
|
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.ODataChangeset;
|
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.v4.BatchManager;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.v4.BatchStreamManager;
|
|
||||||
import org.apache.olingo.client.api.communication.request.batch.v4.ODataBatchRequest;
|
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.request.v4.AsyncBatchRequestWrapper;
|
import org.apache.olingo.client.api.communication.request.v4.AsyncBatchRequestWrapper;
|
||||||
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
|
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
|
||||||
import org.apache.olingo.client.api.communication.response.v4.AsyncResponseWrapper;
|
import org.apache.olingo.client.api.communication.response.v4.AsyncResponseWrapper;
|
||||||
@ -37,11 +36,11 @@ import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
|||||||
public class AsyncBatchRequestWrapperImpl extends AsyncRequestWrapperImpl<ODataBatchResponse>
|
public class AsyncBatchRequestWrapperImpl extends AsyncRequestWrapperImpl<ODataBatchResponse>
|
||||||
implements AsyncBatchRequestWrapper {
|
implements AsyncBatchRequestWrapper {
|
||||||
|
|
||||||
private BatchStreamManager batchStreamManager;
|
private BatchManager batchManager;
|
||||||
|
|
||||||
protected AsyncBatchRequestWrapperImpl(final ODataClient odataClient, final ODataBatchRequest odataRequest) {
|
protected AsyncBatchRequestWrapperImpl(final ODataClient odataClient, final ODataBatchRequest odataRequest) {
|
||||||
super(odataClient, odataRequest);
|
super(odataClient, odataRequest);
|
||||||
batchStreamManager = odataRequest.execute();
|
batchManager = odataRequest.payloadManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,28 +48,28 @@ public class AsyncBatchRequestWrapperImpl extends AsyncRequestWrapperImpl<ODataB
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ODataChangeset addChangeset() {
|
public ODataChangeset addChangeset() {
|
||||||
return batchStreamManager.addChangeset();
|
return batchManager.addChangeset();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ODataRetrieve addRetrieve() {
|
public void addRetrieve(final ODataBatchableRequest request) {
|
||||||
return batchStreamManager.addRetrieve();
|
batchManager.addRetrieve(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ODataOutsideUpdate addOutsideUpdate() {
|
public void addOutsideUpdate(final ODataBatchableRequest request) {
|
||||||
return batchStreamManager.addOutsideUpdate();
|
batchManager.addOutsideUpdate(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AsyncResponseWrapper<ODataBatchResponse> execute() {
|
public AsyncResponseWrapper<ODataBatchResponse> execute() {
|
||||||
return new AsyncResponseWrapperImpl(batchStreamManager.getResponse());
|
return new AsyncResponseWrapperImpl(batchManager.getResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AsyncResponseWrapperImpl
|
public class AsyncResponseWrapperImpl
|
||||||
|
Loading…
x
Reference in New Issue
Block a user