Repository: olingo-odata4 Updated Branches: refs/heads/master da4d75489 -> 03c277020
[OLINGO-482] Added new Processor Interfaces Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/a961214d Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/a961214d Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/a961214d Branch: refs/heads/master Commit: a961214d1fe032d416c7bd08f86e6058900eae85 Parents: aee1ebe Author: Michael Bolz <[email protected]> Authored: Wed Dec 10 11:28:05 2014 +0100 Committer: Michael Bolz <[email protected]> Committed: Wed Dec 10 14:57:47 2014 +0100 ---------------------------------------------------------------------- .../server/api/processor/BatchProcessor.java | 4 +- .../CountComplexCollectionProcessor.java | 5 +- .../CountEntityCollectionProcessor.java | 4 +- .../server/api/processor/DefaultProcessor.java | 6 +- .../server/api/processor/DeltaProcessor.java | 45 +++++++++++ .../server/api/processor/ErrorProcessor.java | 40 +++++++++ .../api/processor/ExceptionProcessor.java | 40 --------- .../processor/ReferenceCollectionProcessor.java | 47 +++++++++++ .../api/processor/ReferenceProcessor.java | 85 ++++++++++++++++++++ .../apache/olingo/server/core/ODataHandler.java | 10 +-- .../server/core/batchhandler/BatchHandler.java | 2 +- .../core/batchhandler/BatchPartHandler.java | 2 +- .../batchhandler/MockedBatchHandlerTest.java | 4 +- .../processor/TechnicalBatchProcessor.java | 4 +- .../processor/TechnicalEntityProcessor.java | 7 +- .../olingo/server/core/ODataHandlerTest.java | 4 +- 16 files changed, 241 insertions(+), 68 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a961214d/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/BatchProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/BatchProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/BatchProcessor.java index 390dfe9..2b3f1d0 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/BatchProcessor.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/BatchProcessor.java @@ -29,8 +29,8 @@ import org.apache.olingo.server.api.serializer.SerializerException; public interface BatchProcessor extends Processor { // TODO:Check exception signature - void executeBatch(BatchFacade facade, ODataRequest request, ODataResponse response) + void processBatch(BatchFacade facade, ODataRequest request, ODataResponse response) throws SerializerException, BatchException; - ODataResponsePart executeChangeSet(BatchFacade facade, List<ODataRequest> requests); + ODataResponsePart processChangeSet(BatchFacade facade, List<ODataRequest> requests); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a961214d/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountComplexCollectionProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountComplexCollectionProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountComplexCollectionProcessor.java index 4ccf310..29b1528 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountComplexCollectionProcessor.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountComplexCollectionProcessor.java @@ -18,7 +18,6 @@ */ package org.apache.olingo.server.api.processor; -import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataRequest; import org.apache.olingo.server.api.ODataResponse; @@ -36,11 +35,9 @@ public interface CountComplexCollectionProcessor extends Processor { * @param request OData request object containing raw HTTP information. * @param response OData response object for collecting response data * @param uriInfo information of a parsed OData URI - * @param responseFormat requested content type after content negotiation * @throws ODataApplicationException if the service implementation encounters a failure * @throws SerializerException if serialization failed */ - void countComplexCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, - ContentType responseFormat) + void countComplexCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo) throws ODataApplicationException, SerializerException; } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a961214d/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountEntityCollectionProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountEntityCollectionProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountEntityCollectionProcessor.java index c2464dc..d64c6ce 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountEntityCollectionProcessor.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountEntityCollectionProcessor.java @@ -18,7 +18,6 @@ */ package org.apache.olingo.server.api.processor; -import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataRequest; import org.apache.olingo.server.api.ODataResponse; @@ -36,10 +35,9 @@ public interface CountEntityCollectionProcessor extends Processor { * @param request OData request object containing raw HTTP information. * @param response OData response object for collecting response data * @param uriInfo information of a parsed OData URI - * @param responseFormat requested content type after content negotiation * @throws ODataApplicationException if the service implementation encounters a failure * @throws SerializerException if serialization failed */ - void countEntityCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat) + void countEntityCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo) throws ODataApplicationException, SerializerException; } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a961214d/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java index 0bc9ff1..302959a 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java @@ -42,7 +42,7 @@ import org.apache.olingo.server.api.uri.UriInfo; * <p>This implementation is registered in the ODataHandler by default. * The default can be replaced by re-registering a custom implementation.</p> */ -public class DefaultProcessor implements MetadataProcessor, ServiceDocumentProcessor, ExceptionProcessor { +public class DefaultProcessor implements MetadataProcessor, ServiceDocumentProcessor, ErrorProcessor { private OData odata; private ServiceMetadata serviceMetadata; @@ -71,8 +71,8 @@ public class DefaultProcessor implements MetadataProcessor, ServiceDocumentProce } @Override - public void processException(ODataRequest request, ODataResponse response, ODataServerError serverError, - ContentType requestedContentType) { + public void processError(ODataRequest request, ODataResponse response, ODataServerError serverError, + ContentType requestedContentType) { try { ODataSerializer serializer = odata.createSerializer(ODataFormat.fromContentType(requestedContentType)); response.setContent(serializer.error(serverError)); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a961214d/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DeltaProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DeltaProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DeltaProcessor.java new file mode 100644 index 0000000..e19397e --- /dev/null +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DeltaProcessor.java @@ -0,0 +1,45 @@ +/* + * 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.server.api.processor; + +import org.apache.olingo.commons.api.format.ContentType; +import org.apache.olingo.server.api.ODataApplicationException; +import org.apache.olingo.server.api.ODataRequest; +import org.apache.olingo.server.api.ODataResponse; +import org.apache.olingo.server.api.serializer.SerializerException; +import org.apache.olingo.server.api.uri.UriInfo; + +/** + * Processor interface for handling a single instance of an Delta Response. + */ +public interface DeltaProcessor extends Processor { + + /** + * Reads delta information from persistence and put it as serialized content and + * with according status into the response. + * @param request OData request object containing raw HTTP information + * @param response OData response object for collecting response data + * @param uriInfo information of a parsed OData URI + * @param responseFormat requested content type after content negotiation + * @throws ODataApplicationException if the service implementation encounters a failure + * @throws SerializerException if serialization failed + */ + void readDelta(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat) + throws ODataApplicationException, SerializerException; +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a961214d/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java new file mode 100644 index 0000000..15d5ce0 --- /dev/null +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java @@ -0,0 +1,40 @@ +/* + * 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.server.api.processor; + +import org.apache.olingo.commons.api.format.ContentType; +import org.apache.olingo.server.api.ODataRequest; +import org.apache.olingo.server.api.ODataResponse; +import org.apache.olingo.server.api.ODataServerError; + +/** + * Processor which is called if any error/exception occurs inside the library or another processor. + */ +public interface ErrorProcessor extends Processor { + + /** + * Processes an error/exception. MUST NOT throw an exception! + * @param request OData request object containing raw HTTP information + * @param response OData response object for collecting response data + * @param serverError the server error + * @param responseFormat requested content type after content negotiation + */ + public void processError(ODataRequest request, ODataResponse response, ODataServerError serverError, + ContentType responseFormat); +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a961214d/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ExceptionProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ExceptionProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ExceptionProcessor.java deleted file mode 100644 index b98d41a..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ExceptionProcessor.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.server.api.processor; - -import org.apache.olingo.commons.api.format.ContentType; -import org.apache.olingo.server.api.ODataRequest; -import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; - -/** - * Processor which is called if any exception occurs inside the library or another processor. - */ -public interface ExceptionProcessor extends Processor { - - /** - * Processes an exception. MUST NOT throw an exception! - * @param request the request - * @param response the response - * @param serverError the server error - * @param responseFormat the requested format for the error message - */ - public void processException(ODataRequest request, ODataResponse response, ODataServerError serverError, - ContentType responseFormat); -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a961214d/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ReferenceCollectionProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ReferenceCollectionProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ReferenceCollectionProcessor.java new file mode 100644 index 0000000..041d895 --- /dev/null +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ReferenceCollectionProcessor.java @@ -0,0 +1,47 @@ +/* + * 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.server.api.processor; + +import org.apache.olingo.commons.api.format.ContentType; +import org.apache.olingo.server.api.ODataApplicationException; +import org.apache.olingo.server.api.ODataRequest; +import org.apache.olingo.server.api.ODataResponse; +import org.apache.olingo.server.api.deserializer.DeserializerException; +import org.apache.olingo.server.api.serializer.SerializerException; +import org.apache.olingo.server.api.uri.UriInfo; + +/** + * Processor interface for handling a collection an Entity References. + */ +public interface ReferenceCollectionProcessor extends Processor { + + /** + * Reads entity references from persistence and put them as serialized content and with + * according status into the response. + * @param request OData request object containing raw HTTP information + * @param response OData response object for collecting response data + * @param uriInfo information of a parsed OData URI + * @param responseFormat requested content type after content negotiation + * @throws ODataApplicationException if the service implementation encounters a failure + * @throws SerializerException if serialization failed + */ + void readReferenceCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, + ContentType responseFormat) + throws ODataApplicationException, SerializerException; +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a961214d/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ReferenceProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ReferenceProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ReferenceProcessor.java new file mode 100644 index 0000000..c1568d8 --- /dev/null +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ReferenceProcessor.java @@ -0,0 +1,85 @@ +/* + * 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.server.api.processor; + +import org.apache.olingo.commons.api.format.ContentType; +import org.apache.olingo.server.api.ODataApplicationException; +import org.apache.olingo.server.api.ODataRequest; +import org.apache.olingo.server.api.ODataResponse; +import org.apache.olingo.server.api.deserializer.DeserializerException; +import org.apache.olingo.server.api.serializer.SerializerException; +import org.apache.olingo.server.api.uri.UriInfo; + +/** + * Processor interface for handling a single instance of an Entity Reference. + */ +public interface ReferenceProcessor extends Processor { + + /** + * Reads entity reference from persistence and put it as serialized content and status into the response. + * @param request OData request object containing raw HTTP information + * @param response OData response object for collecting response data + * @param uriInfo information of a parsed OData URI + * @param responseFormat requested content type after content negotiation + * @throws ODataApplicationException if the service implementation encounters a failure + * @throws SerializerException if serialization failed + */ + void readReference(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat) + throws ODataApplicationException, SerializerException; + + /** + * Creates entity reference data in the persistence and puts content, status, and Location into the response. + * @param request OData request object containing raw HTTP information + * @param response OData response object for collecting response data + * @param uriInfo information of a parsed OData URI + * @param requestFormat content type of body sent with request + * @param responseFormat requested content type after content negotiation + * @throws ODataApplicationException if the service implementation encounters a failure + * @throws DeserializerException if deserialization failed + * @throws SerializerException if serialization failed + */ + void createReference(ODataRequest request, ODataResponse response, UriInfo uriInfo, + ContentType requestFormat, ContentType responseFormat) + throws ODataApplicationException, DeserializerException, SerializerException; + + /** + * Update entity media reference in the persistence and puts content, status, and Location into the response. + * @param request OData request object containing raw HTTP information + * @param response OData response object for collecting response data + * @param uriInfo information of a parsed OData URI + * @param requestFormat content type of body sent with request + * @param responseFormat requested content type after content negotiation + * @throws ODataApplicationException if the service implementation encounters a failure + * @throws DeserializerException if deserialization failed + * @throws SerializerException if serialization failed + */ + void updateReference(ODataRequest request, ODataResponse response, UriInfo uriInfo, + ContentType requestFormat, ContentType responseFormat) + throws ODataApplicationException, DeserializerException, SerializerException; + + + /** + * Deletes entity (related to reference) from persistence and puts the status into the response. + * @param request OData request object containing raw HTTP information + * @param response OData response object for collecting response data + * @param uriInfo information of a parsed OData URI + * @throws ODataApplicationException if the service implementation encounters a failure + */ + void deleteReference(ODataRequest request, ODataResponse response, UriInfo uriInfo) throws ODataApplicationException; +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a961214d/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java index 3f899de..3ba055b 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java @@ -45,7 +45,7 @@ import org.apache.olingo.server.api.processor.CountEntityCollectionProcessor; import org.apache.olingo.server.api.processor.DefaultProcessor; import org.apache.olingo.server.api.processor.EntityCollectionProcessor; import org.apache.olingo.server.api.processor.EntityProcessor; -import org.apache.olingo.server.api.processor.ExceptionProcessor; +import org.apache.olingo.server.api.processor.ErrorProcessor; import org.apache.olingo.server.api.processor.MediaEntityProcessor; import org.apache.olingo.server.api.processor.MetadataProcessor; import org.apache.olingo.server.api.processor.PrimitiveCollectionProcessor; @@ -183,9 +183,9 @@ public class ODataHandler { } public void handleException(ODataRequest request, ODataResponse response, ODataServerError serverError) { - ExceptionProcessor exceptionProcessor; + ErrorProcessor exceptionProcessor; try { - exceptionProcessor = selectProcessor(ExceptionProcessor.class); + exceptionProcessor = selectProcessor(ErrorProcessor.class); } catch (ODataHandlerException e) { // This cannot happen since there is always an ExceptionProcessor registered. exceptionProcessor = new DefaultProcessor(); @@ -198,7 +198,7 @@ public class ODataHandler { } catch (final ContentNegotiatorException e) { requestedContentType = ODataFormat.JSON.getContentType(ODataServiceVersion.V40); } - exceptionProcessor.processException(request, response, serverError, requestedContentType); + exceptionProcessor.processError(request, response, serverError, requestedContentType); } private void handleResourceDispatching(final ODataRequest request, final ODataResponse response) @@ -261,7 +261,7 @@ public class ODataHandler { final UriResource resource = uriInfo.getUriResourceParts().get(lastPathSegmentIndex - 1); if (resource instanceof UriResourceEntitySet || resource instanceof UriResourceNavigation) { selectProcessor(CountEntityCollectionProcessor.class) - .countEntityCollection(request, response, uriInfo, ContentType.TEXT_PLAIN); + .countEntityCollection(request, response, uriInfo); } else { throw new ODataHandlerException( "Count of collections of primitive-type or complex-type instances is not implemented.", http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a961214d/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchHandler.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchHandler.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchHandler.java index b2d8647..d4b2c65 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchHandler.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchHandler.java @@ -46,7 +46,7 @@ public class BatchHandler { validateRequest(request); final BatchFacade operation = new BatchFascadeImpl(oDataHandler, request, batchProcessor, isStrict); - batchProcessor.executeBatch(operation, request, response); + batchProcessor.processBatch(operation, request, response); } private void validateRequest(final ODataRequest request) throws BatchDeserializerException { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a961214d/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchPartHandler.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchPartHandler.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchPartHandler.java index 74b0488..d72b6f4 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchPartHandler.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchPartHandler.java @@ -81,7 +81,7 @@ public class BatchPartHandler { } private ODataResponsePart handleChangeSet(BatchRequestPart request) { - return batchProcessor.executeChangeSet(batchFascade, request.getRequests()); + return batchProcessor.processChangeSet(batchFascade, request.getRequests()); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a961214d/lib/server-core/src/test/java/org/apache/olingo/server/core/batchhandler/MockedBatchHandlerTest.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/batchhandler/MockedBatchHandlerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/batchhandler/MockedBatchHandlerTest.java index 8d4b357..c3a47da 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/batchhandler/MockedBatchHandlerTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/batchhandler/MockedBatchHandlerTest.java @@ -580,7 +580,7 @@ public class MockedBatchHandlerTest { } @Override - public ODataResponsePart executeChangeSet(BatchFacade fascade, List<ODataRequest> requests) { + public ODataResponsePart processChangeSet(BatchFacade fascade, List<ODataRequest> requests) { List<ODataResponse> responses = new ArrayList<ODataResponse>(); for (ODataRequest request : requests) { @@ -595,7 +595,7 @@ public class MockedBatchHandlerTest { } @Override - public void executeBatch(BatchFacade fascade, ODataRequest request, ODataResponse response) + public void processBatch(BatchFacade fascade, ODataRequest request, ODataResponse response) throws BatchException, SerializerException { final String boundary = getBoundary(request.getHeader(HttpHeader.CONTENT_TYPE)); final BatchOptions options = BatchOptions.with().isStrict(true).rawBaseUri(BASE_URI).build(); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a961214d/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalBatchProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalBatchProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalBatchProcessor.java index 7db7088..ad1ba61 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalBatchProcessor.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalBatchProcessor.java @@ -49,7 +49,7 @@ public class TechnicalBatchProcessor extends TechnicalProcessor implements Batch } @Override - public void executeBatch(BatchFacade fascade, ODataRequest request, ODataResponse response) + public void processBatch(BatchFacade fascade, ODataRequest request, ODataResponse response) throws SerializerException, BatchException { // TODO refactor isContinueOnError @@ -132,7 +132,7 @@ public class TechnicalBatchProcessor extends TechnicalProcessor implements Batch } @Override - public ODataResponsePart executeChangeSet(BatchFacade fascade, List<ODataRequest> requests) { + public ODataResponsePart processChangeSet(BatchFacade fascade, List<ODataRequest> requests) { List<ODataResponse> responses = new ArrayList<ODataResponse>(); for (ODataRequest request : requests) { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a961214d/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java index 016b7b2..9c37f8b 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java @@ -28,6 +28,7 @@ import org.apache.olingo.commons.api.data.EntitySet; import org.apache.olingo.commons.api.edm.EdmEntitySet; import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.commons.api.format.ODataFormat; +import org.apache.olingo.commons.api.http.HttpContentType; import org.apache.olingo.commons.api.http.HttpHeader; import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.server.api.ODataApplicationException; @@ -89,8 +90,8 @@ public class TechnicalEntityProcessor extends TechnicalProcessor } @Override - public void countEntityCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo, - final ContentType requestedContentType) throws ODataApplicationException, SerializerException { + public void countEntityCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo) + throws ODataApplicationException, SerializerException { validateOptions(uriInfo.asUriInfoResource()); blockNavigation(uriInfo); @@ -103,7 +104,7 @@ public class TechnicalEntityProcessor extends TechnicalProcessor } else { response.setContent(odata.createFixedFormatSerializer().count(entitySet.getCount())); response.setStatusCode(HttpStatusCode.OK.getStatusCode()); - response.setHeader(HttpHeader.CONTENT_TYPE, requestedContentType.toContentTypeString()); + response.setHeader(HttpHeader.CONTENT_TYPE, HttpContentType.TEXT_PLAIN); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a961214d/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java ---------------------------------------------------------------------- diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java index 67ce094..d211a32 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java @@ -235,7 +235,7 @@ public class ODataHandlerTest { dispatch(HttpMethod.GET, "ESAllPrim/$count", processor); verify(processor).countEntityCollection( - any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), eq(ContentType.TEXT_PLAIN)); + any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class)); dispatchMethodNotAllowed(HttpMethod.POST, "ESAllPrim/$count", processor); } @@ -246,7 +246,7 @@ public class ODataHandlerTest { dispatch(HttpMethod.GET, "ESAllPrim(0)/NavPropertyETTwoPrimMany/$count", processor); verify(processor).countEntityCollection( - any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), eq(ContentType.TEXT_PLAIN)); + any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class)); } @Test
