http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java index 39ed4ce..1b3537c 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java @@ -28,20 +28,23 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.IOException; +import java.net.URI; import java.util.Collections; import java.util.Iterator; import java.util.List; -import org.apache.olingo.client.api.CommonODataClient; import org.apache.olingo.client.api.communication.ODataClientErrorException; import org.apache.olingo.client.api.communication.ODataServerErrorException; 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.v4.UpdateType; import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest; import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest; import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest; import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest; import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest; import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse; +import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.edm.xml.XMLMetadata; import org.apache.olingo.client.api.edm.xml.v4.Reference; @@ -52,14 +55,19 @@ import org.apache.olingo.commons.api.domain.ODataServiceDocument; import org.apache.olingo.commons.api.domain.v4.ODataAnnotation; import org.apache.olingo.commons.api.domain.v4.ODataEntity; import org.apache.olingo.commons.api.domain.v4.ODataEntitySet; +import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue; +import org.apache.olingo.commons.api.domain.v4.ODataObjectFactory; import org.apache.olingo.commons.api.domain.v4.ODataProperty; import org.apache.olingo.commons.api.domain.v4.ODataValue; import org.apache.olingo.commons.api.edm.Edm; +import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.commons.api.format.ODataFormat; +import org.apache.olingo.commons.api.http.HttpHeader; import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.fit.AbstractBaseTestITCase; import org.apache.olingo.fit.tecsvc.TecSvcConst; +import org.junit.Ignore; import org.junit.Test; public class BasicITCase extends AbstractBaseTestITCase { @@ -169,7 +177,7 @@ public class BasicITCase extends AbstractBaseTestITCase { } @Test - public void readEntity() throws IOException { + public void readEntity() throws Exception { final ODataEntityRequest<ODataEntity> request = getClient().getRetrieveRequestFactory() .getEntityRequest(getClient().newURIBuilder(SERVICE_URI) .appendEntitySetSegment("ESCollAllPrim").appendKeySegment(1).build()); @@ -191,15 +199,153 @@ public class BasicITCase extends AbstractBaseTestITCase { assertEquals(30112, iterator.next().asPrimitive().toValue()); } + @Test + @Ignore + public void patchEntity() throws Exception { + final ODataClient client = getClient(); + final ODataObjectFactory factory = client.getObjectFactory(); + ODataEntity patchEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETAllPrim")); + patchEntity.getProperties().add(factory.newPrimitiveProperty("PropertyString", + factory.newPrimitiveValueBuilder().buildString("new"))); + patchEntity.getProperties().add(factory.newPrimitiveProperty("PropertyDecimal", + factory.newPrimitiveValueBuilder().buildDouble(42.875))); + patchEntity.getProperties().add(factory.newPrimitiveProperty("PropertyInt64", + factory.newPrimitiveValueBuilder().buildInt64(null))); + final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESAllPrim").appendKeySegment(32767) + .build(); + final ODataEntityUpdateRequest<ODataEntity> request = client.getCUDRequestFactory().getEntityUpdateRequest( + uri, UpdateType.PATCH, patchEntity); + final ODataEntityUpdateResponse<ODataEntity> response = request.execute(); + assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode()); + + // Check that the patched properties have changed and the other properties not. + // This check has to be in the same session in order to access the same data provider. + ODataEntityRequest<ODataEntity> entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri); + entityRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next()); + final ODataRetrieveResponse<ODataEntity> entityResponse = entityRequest.execute(); + assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode()); + final ODataEntity entity = entityResponse.getBody(); + assertNotNull(entity); + final ODataProperty property1 = entity.getProperty("PropertyString"); + assertNotNull(property1); + assertEquals("new", property1.getPrimitiveValue().toValue()); + final ODataProperty property2 = entity.getProperty("PropertyDecimal"); + assertNotNull(property2); + assertEquals(42.875, property2.getPrimitiveValue().toValue()); + final ODataProperty property3 = entity.getProperty("PropertyInt64"); + assertNotNull(property3); + assertNull(property3.getPrimitiveValue()); + final ODataProperty property4 = entity.getProperty("PropertyDuration"); + assertNotNull(property4); + assertEquals("PT6S", property4.getPrimitiveValue().toValue()); + } + + @Test + @Ignore + public void updateEntity() throws Exception { + final ODataClient client = getClient(); + final ODataObjectFactory factory = client.getObjectFactory(); + ODataEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETAllPrim")); + newEntity.getProperties().add(factory.newPrimitiveProperty("PropertyInt64", + factory.newPrimitiveValueBuilder().buildInt32(42))); + final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESAllPrim").appendKeySegment(32767) + .build(); + final ODataEntityUpdateRequest<ODataEntity> request = client.getCUDRequestFactory().getEntityUpdateRequest( + uri, UpdateType.REPLACE, newEntity); + final ODataEntityUpdateResponse<ODataEntity> response = request.execute(); + assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode()); + + // Check that the updated properties have changed and that other properties have their default values. + // This check has to be in the same session in order to access the same data provider. + ODataEntityRequest<ODataEntity> entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri); + entityRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next()); + final ODataRetrieveResponse<ODataEntity> entityResponse = entityRequest.execute(); + assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode()); + final ODataEntity entity = entityResponse.getBody(); + assertNotNull(entity); + final ODataProperty property1 = entity.getProperty("PropertyInt64"); + assertNotNull(property1); + assertEquals(42, property1.getPrimitiveValue().toValue()); + final ODataProperty property2 = entity.getProperty("PropertyDecimal"); + assertNotNull(property2); + assertNull(property2.getPrimitiveValue()); + } + + @Test + @Ignore + public void patchEntityWithComplex() throws Exception { + final ODataClient client = getClient(); + final ODataObjectFactory factory = client.getObjectFactory(); + ODataEntity patchEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETCompComp")); + patchEntity.getProperties().add(factory.newComplexProperty("PropertyComp", + factory.newLinkedComplexValue("olingo.odata.test1.CTCompComp").add( + factory.newComplexProperty("PropertyComp", + factory.newLinkedComplexValue("olingo.odata.test1.CTTwoPrim").add( + factory.newPrimitiveProperty("PropertyInt16", + factory.newPrimitiveValueBuilder().buildInt32(42))))))); + final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESCompComp").appendKeySegment(1).build(); + final ODataEntityUpdateRequest<ODataEntity> request = client.getCUDRequestFactory().getEntityUpdateRequest( + uri, UpdateType.PATCH, patchEntity); + final ODataEntityUpdateResponse<ODataEntity> response = request.execute(); + assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode()); + + // Check that the patched properties have changed and the other properties not. + // This check has to be in the same session in order to access the same data provider. + ODataEntityRequest<ODataEntity> entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri); + entityRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next()); + final ODataRetrieveResponse<ODataEntity> entityResponse = entityRequest.execute(); + assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode()); + final ODataEntity entity = entityResponse.getBody(); + assertNotNull(entity); + final ODataLinkedComplexValue complex = entity.getProperty("PropertyComp").getLinkedComplexValue() + .get("PropertyComp").getLinkedComplexValue(); + assertNotNull(complex); + final ODataProperty property1 = complex.get("PropertyInt16"); + assertNotNull(property1); + assertEquals(42, property1.getPrimitiveValue().toValue()); + final ODataProperty property2 = complex.get("PropertyString"); + assertNotNull(property2); + assertEquals("String 1", property2.getPrimitiveValue().toValue()); + } + + @Test + @Ignore("Actual leads to an unexpected exception") + public void updateEntityWithComplex() throws Exception { + final ODataClient client = getClient(); + final ODataObjectFactory factory = client.getObjectFactory(); + ODataEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETCompComp")); + newEntity.getProperties().add(factory.newComplexProperty("PropertyComp", null)); + final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESCompComp").appendKeySegment(1).build(); + final ODataEntityUpdateRequest<ODataEntity> request = client.getCUDRequestFactory().getEntityUpdateRequest( + uri, UpdateType.REPLACE, newEntity); + final ODataEntityUpdateResponse<ODataEntity> response = request.execute(); + assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode()); + + // Check that the complex-property hierarchy is still there and that all primitive values are now null. + // This check has to be in the same session in order to access the same data provider. + ODataEntityRequest<ODataEntity> entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri); + entityRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next()); + final ODataRetrieveResponse<ODataEntity> entityResponse = entityRequest.execute(); + assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode()); + final ODataEntity entity = entityResponse.getBody(); + assertNotNull(entity); + final ODataLinkedComplexValue complex = entity.getProperty("PropertyComp").getLinkedComplexValue() + .get("PropertyComp").getLinkedComplexValue(); + assertNotNull(complex); + final ODataProperty property = complex.get("PropertyInt16"); + assertNotNull(property); + assertNull(property.getPrimitiveValue()); + } + /** - * Actual an create request for an entity will lead to an "501 - Not Implemented" response - * and hence to an ODataServerErrorException + * Currently a create request for an entity will lead to a "501 - Not Implemented" response + * and hence to an ODataServerErrorException. */ @Test(expected = ODataServerErrorException.class) public void createEntity() throws IOException { final ODataEntityRequest<ODataEntity> request = getClient().getRetrieveRequestFactory() - .getEntityRequest(getClient().newURIBuilder(SERVICE_URI) - .appendEntitySetSegment("ESCollAllPrim").appendKeySegment(1).build()); + .getEntityRequest(getClient().newURIBuilder(SERVICE_URI) + .appendEntitySetSegment("ESCollAllPrim").appendKeySegment(1).build()); assertNotNull(request); final ODataRetrieveResponse<ODataEntity> response = request.execute(); @@ -210,8 +356,8 @@ public class BasicITCase extends AbstractBaseTestITCase { assertNotNull(entity); final ODataEntityCreateRequest<ODataEntity> createRequest = getClient().getCUDRequestFactory() - .getEntityCreateRequest(getClient().newURIBuilder(SERVICE_URI) - .appendEntitySetSegment("ESCollAllPrim").build(), entity); + .getEntityCreateRequest(getClient().newURIBuilder(SERVICE_URI) + .appendEntitySetSegment("ESCollAllPrim").build(), entity); assertNotNull(createRequest); ODataEntityCreateResponse<ODataEntity> createResponse = createRequest.execute(); @@ -228,7 +374,7 @@ public class BasicITCase extends AbstractBaseTestITCase { } @Override - protected CommonODataClient<?> getClient() { + protected ODataClient getClient() { ODataClient odata = ODataClientFactory.getV4(); odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON); return odata;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java index 18fa834..b317234 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java @@ -49,6 +49,7 @@ import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.fit.AbstractBaseTestITCase; import org.apache.olingo.fit.tecsvc.TecSvcConst; import org.junit.Test; +import org.junit.Ignore; public final class MediaITCase extends AbstractBaseTestITCase { @@ -93,6 +94,7 @@ public final class MediaITCase extends AbstractBaseTestITCase { } @Test + @Ignore public void update() throws Exception { final CommonODataClient<?> client = getClient(); final URI uri = client.newURIBuilder(TecSvcConst.BASE_URI) @@ -104,13 +106,7 @@ public final class MediaITCase extends AbstractBaseTestITCase { assertNotNull(request); final ODataMediaEntityUpdateResponse<CommonODataEntity> response = request.payloadManager().getResponse(); - assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - final CommonODataEntity entity = response.getBody(); - assertNotNull(entity); - final CommonODataProperty property = entity.getProperty("PropertyInt16"); - assertNotNull(property); - assertNotNull(property.getPrimitiveValue()); - assertEquals(4, property.getPrimitiveValue().toValue()); + assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode()); // Check that the media stream has changed. // This check has to be in the same session in order to access the same data provider. http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/client-api/pom.xml ---------------------------------------------------------------------- diff --git a/lib/client-api/pom.xml b/lib/client-api/pom.xml index 7de111d..378a3b9 100644 --- a/lib/client-api/pom.xml +++ b/lib/client-api/pom.xml @@ -30,7 +30,7 @@ <parent> <groupId>org.apache.olingo</groupId> <artifactId>odata-lib</artifactId> - <version>4.0.0-beta-02</version> + <version>3.0.0-beta-01-SNAPSHOT</version> <relativePath>..</relativePath> </parent> http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/client-core/pom.xml ---------------------------------------------------------------------- diff --git a/lib/client-core/pom.xml b/lib/client-core/pom.xml index c30515a..98d30ca 100644 --- a/lib/client-core/pom.xml +++ b/lib/client-core/pom.xml @@ -30,7 +30,7 @@ <parent> <groupId>org.apache.olingo</groupId> <artifactId>odata-lib</artifactId> - <version>4.0.0-beta-02</version> + <version>3.0.0-beta-01-SNAPSHOT</version> <relativePath>..</relativePath> </parent> http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/commons-api/pom.xml ---------------------------------------------------------------------- diff --git a/lib/commons-api/pom.xml b/lib/commons-api/pom.xml index ce0d33a..a08a6a1 100644 --- a/lib/commons-api/pom.xml +++ b/lib/commons-api/pom.xml @@ -30,7 +30,7 @@ <parent> <groupId>org.apache.olingo</groupId> <artifactId>odata-lib</artifactId> - <version>4.0.0-beta-02</version> + <version>3.0.0-beta-01-SNAPSHOT</version> <relativePath>..</relativePath> </parent> http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/commons-core/pom.xml ---------------------------------------------------------------------- diff --git a/lib/commons-core/pom.xml b/lib/commons-core/pom.xml index fd5aa90..005fa5e 100644 --- a/lib/commons-core/pom.xml +++ b/lib/commons-core/pom.xml @@ -30,7 +30,7 @@ <parent> <groupId>org.apache.olingo</groupId> <artifactId>odata-lib</artifactId> - <version>4.0.0-beta-02</version> + <version>3.0.0-beta-01-SNAPSHOT</version> <relativePath>..</relativePath> </parent> http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/pom.xml ---------------------------------------------------------------------- diff --git a/lib/pom.xml b/lib/pom.xml index e4280fc..7fcfa2b 100644 --- a/lib/pom.xml +++ b/lib/pom.xml @@ -31,7 +31,7 @@ <parent> <groupId>org.apache.olingo</groupId> <artifactId>odata-parent</artifactId> - <version>4.0.0-beta-02</version> + <version>3.0.0-beta-01-SNAPSHOT</version> <relativePath>..</relativePath> </parent> @@ -40,9 +40,5 @@ <module>commons-core</module> <module>client-api</module> <module>client-core</module> - <module>server-api</module> - <module>server-core</module> - <module>server-tecsvc</module> - <module>server-test</module> </modules> </project> http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/pom.xml ---------------------------------------------------------------------- diff --git a/lib/server-api/pom.xml b/lib/server-api/pom.xml deleted file mode 100644 index 4d47a38..0000000 --- a/lib/server-api/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - 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. - ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <artifactId>odata-server-api</artifactId> - <packaging>jar</packaging> - <name>${project.artifactId}</name> - - <parent> - <groupId>org.apache.olingo</groupId> - <artifactId>odata-lib</artifactId> - <version>4.0.0-beta-02</version> - <relativePath>..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>org.apache.olingo</groupId> - <artifactId>odata-commons-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.5</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - </dependencies> - -</project> http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java deleted file mode 100644 index eddd0da..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java +++ /dev/null @@ -1,103 +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; - -import java.util.List; - -import org.apache.olingo.commons.api.ODataRuntimeException; -import org.apache.olingo.commons.api.format.ODataFormat; -import org.apache.olingo.server.api.deserializer.DeserializerException; -import org.apache.olingo.server.api.deserializer.FixedFormatDeserializer; -import org.apache.olingo.server.api.deserializer.ODataDeserializer; -import org.apache.olingo.server.api.edm.provider.EdmProvider; -import org.apache.olingo.server.api.edmx.EdmxReference; -import org.apache.olingo.server.api.serializer.FixedFormatSerializer; -import org.apache.olingo.server.api.serializer.ODataSerializer; -import org.apache.olingo.server.api.serializer.SerializerException; -import org.apache.olingo.server.api.uri.UriHelper; - -/** - * Root object for serving factory tasks and support loose coupling of implementation (core) from the API. - * This is not a singleton (static variables) to avoid issues with synchronization, OSGi, hot deployment and so on. - * Each thread (request) should keep its own instance. - */ -public abstract class OData { - - private static final String IMPLEMENTATION = "org.apache.olingo.server.core.ODataImpl"; - - public static OData newInstance() { - try { - final Class<?> clazz = Class.forName(OData.IMPLEMENTATION); - - /* - * We explicitly do not use the singleton pattern to keep the server state free - * and avoid class loading issues also during hot deployment. - */ - final Object object = clazz.newInstance(); - - return (OData) object; - - } catch (final Exception e) { - throw new ODataRuntimeException(e); - } - } - - /** - * Creates a new serializer object for rendering content in the specified format. - * Serializers are used in Processor implementations. - * - * @param format any format supported by Olingo (XML, JSON ...) - */ - public abstract ODataSerializer createSerializer(ODataFormat format) throws SerializerException; - - /** - * Creates a new serializer object for rendering content in a fixed format, e.g., for binary output. - * Serializers are used in Processor implementations. - */ - public abstract FixedFormatSerializer createFixedFormatSerializer(); - - /** - * Creates a new deserializer object for reading content in a fixed format, e.g., for binary input. - * Deserializers are used in Processor implementations. - */ - public abstract FixedFormatDeserializer createFixedFormatDeserializer(); - - /** - * Creates a new ODataHttpHandler for handling OData requests in an HTTP context. - * - * @param serviceMetadata - metadata object required to handle an OData request - */ - public abstract ODataHttpHandler createHandler(ServiceMetadata serviceMetadata); - - /** - * Creates a metadata object for this service. - * - * @param edmProvider a custom or default implementation for creating metadata - * @param references list of edmx references - */ - public abstract ServiceMetadata createServiceMetadata(EdmProvider edmProvider, List<EdmxReference> references); - - /** - * Creates a new URI helper object for performing URI-related tasks. - * It can be used in Processor implementations. - */ - public abstract UriHelper createUriHelper(); - - public abstract ODataDeserializer createDeserializer(ODataFormat format) throws DeserializerException; -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java deleted file mode 100644 index 6dda314..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java +++ /dev/null @@ -1,111 +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; - -import java.util.Locale; - -import org.apache.olingo.commons.api.ODataException; -import org.apache.olingo.commons.api.http.HttpStatusCode; - -/** - * Exception thrown by OData service implementations. - * @see ODataException - */ -public class ODataApplicationException extends ODataException { - - private static final long serialVersionUID = 5358683245923127425L; - private int statusCode = HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(); - private Locale locale; - private String oDataErrorCode; - - /** - * Exception in an OData service implementation. - * @param msg the text of the exception - * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error - * @param locale a {@link Locale} to enable translation of error messages - * @see ODataException - * @see HttpStatusCode - */ - public ODataApplicationException(final String msg, final int statusCode, final Locale locale) { - super(msg); - this.statusCode = statusCode; - this.locale = locale; - } - - /** - * Exception in an OData service implementation. - * @param msg the text of the exception - * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error - * @param locale a {@link Locale} to enable translation of error messages - * @param oDataErrorCode the error code of the exception as defined by the OData standard - * @see ODataException - * @see HttpStatusCode - */ - public ODataApplicationException(final String msg, final int statusCode, final Locale locale, - final String oDataErrorCode) { - this(msg, statusCode, locale); - this.oDataErrorCode = oDataErrorCode; - } - - /** - * Exception in an OData service implementation. - * @param msg the text of the exception - * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error - * @param locale a {@link Locale} to enable translation of error messages - * @param cause the cause of this exception - * @see ODataException - * @see HttpStatusCode - * @see Throwable#getCause() - */ - public ODataApplicationException(final String msg, final int statusCode, final Locale locale, - final Throwable cause) { - super(msg, cause); - this.statusCode = statusCode; - this.locale = locale; - } - - /** - * Exception in an OData service implementation. - * @param msg the text of the exception - * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error - * @param locale a {@link Locale} to enable translation of error messages - * @param cause the cause of this exception - * @param oDataErrorCode the error code of the exception as defined by the OData standard - * @see ODataException - * @see HttpStatusCode - * @see Throwable#getCause() - */ - public ODataApplicationException(final String msg, final int statusCode, final Locale locale, final Throwable cause, - final String oDataErrorCode) { - this(msg, statusCode, locale, cause); - this.oDataErrorCode = oDataErrorCode; - } - - public int getStatusCode() { - return statusCode; - } - - public Locale getLocale() { - return locale; - } - - public String getODataErrorCode() { - return oDataErrorCode; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java deleted file mode 100644 index 8e4f257..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.server.api; - -import org.apache.olingo.server.api.processor.Processor; -import org.apache.olingo.server.api.serializer.CustomContentTypeSupport; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Handles HTTP requests as OData requests. - */ -public interface ODataHttpHandler { - - /** - * <p>Processes an OData request.</p> - * <p>This includes URI parsing, content negotiation, dispatching the request - * to a specific custom processor implementation for handling data and - * creating the serialized content for the response object.</p> - * @param request - must be a HTTP OData request - * @param response - HTTP OData response - */ - void process(HttpServletRequest request, HttpServletResponse response); - - /** - * <p>Registers additional custom processor implementations for handling OData requests.</p> - * <p>If request processing requires a processor that is not registered then a - * "not implemented" exception will happen.</p> - */ - void register(Processor processor); - - /** - * Registers a service implementation for modifying the standard list of supported - * content types. - * @see CustomContentTypeSupport - */ - void register(CustomContentTypeSupport customContentTypeSupport); - - /** - * Sets the split parameter which is used for service resolution. - * @param split the number of path segments reserved for service resolution; default is 0 - */ - void setSplit(int split); - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java deleted file mode 100644 index 03e2936..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java +++ /dev/null @@ -1,196 +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; - -import org.apache.olingo.commons.api.http.HttpMethod; - -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Request object to carry HTTP information optimized for and required to handle OData requests only. - */ -public class ODataRequest { - private HttpMethod method; - private Map<String, List<String>> headers = new HashMap<String, List<String>>(); - private InputStream body; - private String rawQueryPath; - private String rawRequestUri; - private String rawODataPath; - private String rawBaseUri; - private String rawServiceResolutionUri; - - /** - * Gets the HTTP method. - * @return the HTTP method (GET, PUT, POST ...) - */ - public HttpMethod getMethod() { - return method; - } - - /** - * Sets the HTTP method. - * @param method the HTTP method (GET, PUT, POST ...) - */ - public void setMethod(final HttpMethod method) { - this.method = method; - } - - /** - * <p>Adds a header to the request.</p> - * <p>The header name will be handled as case-insensitive key.</p> - * <p>If a header already exists then the list of values will just be extended.</p> - * @param name case-insensitive header name - * @param values list of values for the given header name - * @see <a href="http://ietf.org/rfc/rfc7230.txt">RFC 7230, section 3.2.2</a> - */ - public void addHeader(final String name, final List<String> values) { - String key = name.toUpperCase(); - if (headers.containsKey(key)) { - List<String> oldValues = headers.get(key); - - List<String> newValues = new ArrayList<String>(); - newValues.addAll(oldValues); - newValues.addAll(values); - - headers.put(name.toUpperCase(), newValues); - } else { - headers.put(name.toUpperCase(), values); - } - } - - /** - * Gets header value for a given name. - * @param name the header name as a case-insensitive key - * @return the header value(s) or null if not found - */ - public List<String> getHeaders(final String name) { - return headers.get(name.toUpperCase()); - } - - /** - * Gets first header value for a given name. - * @param name the header name as a case-insensitive key - * @return the first header value or null if not found - */ - public String getHeader(final String name) { - final List<String> values = getHeaders(name); - return values == null ? null : values.get(0); - } - - /** - * Gets the body of the request. - * @return the request payload as {@link InputStream} or null - */ - public InputStream getBody() { - return body; - } - - /** - * Sets the body of the request. - * @param body the request payload as {@link InputStream} - */ - public void setBody(final InputStream body) { - this.body = body; - } - - /** - * Gets the query part of the request URI. - * @return the undecoded query options, e.g., "<code>$format=json,$top=10</code>" - * @see <a href="http://ietf.org/rfc/rfc3986.txt">RFC 3986, section 3.4</a> - */ - public String getRawQueryPath() { - return rawQueryPath; - } - - /** - * Sets the query part of the request URI. - * @see #getRawQueryPath() - */ - public void setRawQueryPath(final String rawQueryPath) { - this.rawQueryPath = rawQueryPath; - } - - /** - * Gets the base URI. - * @return undecoded base URI, e.g., "<code>http://localhost/my%20service</code>" - */ - public String getRawBaseUri() { - return rawBaseUri; - } - - /** - * Sets the base URI. - * @see #getRawBaseUri() - */ - public void setRawBaseUri(final String rawBaseUri) { - this.rawBaseUri = rawBaseUri; - } - - /** - * Gets the total request URI. - * @return undecoded request URI, e.g., "<code>http://localhost/my%20service/sys1/Employees?$format=json</code>" - */ - public String getRawRequestUri() { - return rawRequestUri; - } - - /** - * Sets the total request URI. - * @see #getRawRequestUri() - */ - public void setRawRequestUri(final String rawRequestUri) { - this.rawRequestUri = rawRequestUri; - } - - /** - * Gets the path segments of the request URI that belong to OData. - * @return undecoded OData path segments, e.g., "/Employees" - */ - public String getRawODataPath() { - return rawODataPath; - } - - /** - * Sets the path segments of the request URI that belong to OData. - * @see #getRawODataPath() - */ - public void setRawODataPath(final String rawODataPath) { - this.rawODataPath = rawODataPath; - } - - /** - * Gets the URI part responsible for service resolution. - * @return undecoded path segments that do not belong to the OData URL schema or null, e.g., "<code>sys1</code>" - */ - public String getRawServiceResolutionUri() { - return rawServiceResolutionUri; - } - - /** - * Sets the URI part responsible for service resolution. - * @see #getRawServiceResolutionUri() - */ - public void setRawServiceResolutionUri(final String rawServiceResolutionUri) { - this.rawServiceResolutionUri = rawServiceResolutionUri; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java deleted file mode 100644 index d629112..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.server.api; - -import java.io.InputStream; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.apache.olingo.commons.api.http.HttpStatusCode; - -/** - * Response object to carry OData-relevant HTTP information (status code, response headers, and content). - */ -public class ODataResponse { - - private int statusCode = HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(); - private Map<String, String> headers = new HashMap<String, String>(); - private InputStream content; - - - /** - * Sets the status code. - * @see HttpStatusCode - */ - public void setStatusCode(final int statusCode) { - this.statusCode = statusCode; - } - - /** - * Gets the status code. - * @see HttpStatusCode - */ - public int getStatusCode() { - return statusCode; - } - - /** - * Sets a header. - * @param name the name - * @param value the value - */ - public void setHeader(final String name, final String value) { - headers.put(name, value); - } - - /** - * Gets all headers. - * @return an unmodifiable Map of header names/values - */ - public Map<String, String> getHeaders() { - return Collections.unmodifiableMap(headers); - } - - /** - * Sets the content (body). - * @param content the content as {@link InputStream} - */ - public void setContent(final InputStream content) { - this.content = content; - } - - /** - * Gets the content (body). - * @return the content as {@link InputStream} - */ - public InputStream getContent() { - return content; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java deleted file mode 100644 index 8b184b2..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java +++ /dev/null @@ -1,138 +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; - -import java.util.List; -import java.util.Locale; -import java.util.Map; - -import org.apache.olingo.commons.api.domain.ODataError; -import org.apache.olingo.commons.api.domain.ODataErrorDetail; - -/** - * Server error. - */ -public class ODataServerError extends ODataError { - - private Exception exception; - private int statusCode; - private Locale locale; - - /** - * Gets the locale. - * @return the locale for the exception message - */ - public Locale getLocale() { - return locale; - } - - /** - * Sets the locale. - * @return this for method chaining - */ - public ODataServerError setLocale(Locale locale) { - this.locale = locale; - return this; - } - - /** - * Gets the exception. - * @return the exception with its hierarchy - */ - public Exception getException() { - return exception; - } - - /** - * Sets the exception. - * @return this for method chaining - */ - public ODataServerError setException(Exception exception) { - this.exception = exception; - return this; - } - - /** - * Gets the status code. - * @return the status code which this error results in. - */ - public int getStatusCode() { - return statusCode; - } - - /** - * Sets the status code. - * @param statusCode the status code which this error results in - * @return this for method chaining - */ - public ODataServerError setStatusCode(int statusCode) { - this.statusCode = statusCode; - return this; - } - - /** - * The value for the code name/value pair is a language-independent string. - * Its value is a service-defined error code. This code serves as a sub-status - * for the HTTP error code specified in the response. MAY be null. - * @return this for method chaining - */ - public ODataServerError setCode(String code) { - super.setCode(code); - return this; - } - - /** - * The value for the message name/value pair MUST be a human-readable, - * language-dependent representation of the error. MUST not be null. - * @return this for method chaining - */ - public ODataServerError setMessage(String message) { - super.setMessage(message); - return this; - } - - /** - * The value for the target name/value pair is the target of the particular error (for example, the name of the - * property in error). MAY be null. - * @return this for method chaining - */ - public ODataServerError setTarget(String target) { - super.setTarget(target); - return this; - } - - /** - * Sets error details. - * @return this for method chaining. - */ - public ODataServerError setDetails(List<ODataErrorDetail> details) { - super.setDetails(details); - return this; - } - - /** - * Sets server defined key-value pairs for debug environment only. - * @return this for method chaining. - */ - public ODataServerError setInnerError(Map<String, String> innerError) { - super.setInnerError(innerError); - return this; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataTranslatedException.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataTranslatedException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataTranslatedException.java deleted file mode 100644 index 4336456..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataTranslatedException.java +++ /dev/null @@ -1,157 +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; - -import java.util.Arrays; -import java.util.Formatter; -import java.util.Locale; -import java.util.MissingFormatArgumentException; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.apache.olingo.commons.api.ODataException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Abstract superclass of all translatable server exceptions. - */ -public abstract class ODataTranslatedException extends ODataException { - - private static final long serialVersionUID = -1210541002198287561L; - private static final Logger LOG = LoggerFactory.getLogger(ODataTranslatedException.class); - private static final Locale DEFAULT_LOCALE = Locale.ENGLISH; - - protected static final String DEFAULT_SERVER_BUNDLE_NAME = "server-core-exceptions-i18n"; - - /** Key for the exception text in the resource bundle. */ - public static interface MessageKey { - /** Gets this key. */ - public String getKey(); - } - - private MessageKey messageKey; - private Object[] parameters; - - protected ODataTranslatedException(String developmentMessage, MessageKey messageKey, String... parameters) { - super(developmentMessage); - this.messageKey = messageKey; - this.parameters = parameters; - } - - protected ODataTranslatedException(String developmentMessage, Throwable cause, MessageKey messageKey, - String... parameters) { - super(developmentMessage, cause); - this.messageKey = messageKey; - this.parameters = parameters; - } - - @Override - public String getLocalizedMessage() { - return getTranslatedMessage(DEFAULT_LOCALE).getMessage(); - } - - @Override - public String toString() { - return getMessage(); - } - - /** Gets the message key. */ - public MessageKey getMessageKey() { - return messageKey; - } - - /** - * Gets the translated message text for a given locale (or the default locale if not available), - * returning the developer message text if none is found. - * @param locale the preferred {@link Locale} - * @return the error message - */ - public ODataErrorMessage getTranslatedMessage(final Locale locale) { - if (messageKey == null) { - return new ODataErrorMessage(getMessage(), DEFAULT_LOCALE); - } - ResourceBundle bundle = createResourceBundle(locale); - if (bundle == null) { - return new ODataErrorMessage(getMessage(), DEFAULT_LOCALE); - } - - return buildMessage(bundle, locale); - } - - /** - * <p>Gets the name of the {@link ResourceBundle} containing the exception texts.</p> - * <p>The key for an exception text is the concatenation of the exception-class name and - * the {@link MessageKey}, separated by a dot.</p> - * @return the name of the resource bundle - */ - protected abstract String getBundleName(); - - private ResourceBundle createResourceBundle(final Locale locale) { - try { - return ResourceBundle.getBundle(getBundleName(), locale == null ? DEFAULT_LOCALE : locale); - } catch (final MissingResourceException e) { - LOG.error(e.getMessage(), e); - return null; - } - } - - private ODataErrorMessage buildMessage(ResourceBundle bundle, Locale locale) { - String message = null; - - try { - message = bundle.getString(getClass().getSimpleName() + '.' + messageKey.getKey()); - StringBuilder builder = new StringBuilder(); - Formatter f = new Formatter(builder, locale); - f.format(message, parameters); - f.close(); - Locale usedLocale = bundle.getLocale(); - if (Locale.ROOT.equals(usedLocale)) { - usedLocale = DEFAULT_LOCALE; - } - return new ODataErrorMessage(builder.toString(), usedLocale); - } catch (MissingResourceException e) { - return new ODataErrorMessage("Missing message for key '" + messageKey.getKey() + "'!", DEFAULT_LOCALE); - } catch (MissingFormatArgumentException e) { - return new ODataErrorMessage("Missing replacement for place holder in message '" + message + - "' for following arguments '" + Arrays.toString(parameters) + "'!", DEFAULT_LOCALE); - } - } - - /** Error message text and {@link Locale} used for it. */ - public class ODataErrorMessage { - String message; - Locale locale; - - public ODataErrorMessage(final String message, final Locale usedLocale) { - this.message = message; - this.locale = usedLocale; - } - - /** Gets the message text. */ - public String getMessage() { - return message; - } - - /** Gets the {@link Locale} used for this message. */ - public Locale getLocale() { - return locale; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/ServiceMetadata.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ServiceMetadata.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ServiceMetadata.java deleted file mode 100644 index dc06b94..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ServiceMetadata.java +++ /dev/null @@ -1,48 +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; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.server.api.edmx.EdmxReference; -import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; - -import java.util.List; - -/** - * Metadata of an OData service like the Entity Data Model. - */ -public interface ServiceMetadata { - /** - * - * @return entity data model of this service - */ - Edm getEdm(); - - /** - * - * @return data service version of this service - */ - ODataServiceVersion getDataServiceVersion(); - - /** - * - * @return list of defined emdx references of this service - */ - List<EdmxReference> getReferences(); -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java deleted file mode 100644 index 64d6a51..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java +++ /dev/null @@ -1,67 +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.batch; - -import org.apache.olingo.server.api.ODataRequest; -import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.batch.exception.BatchDeserializerException; -import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart; -import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart; -import org.apache.olingo.server.api.processor.BatchProcessor; - -/** - * Provides methods to process {@link ODataRequest} and {@link BatchRequestPart}. - * - * Within a {@link BatchProcessor} implementation BatchRequestsParts should be passed to - * {@link BatchFacade#handleBatchRequest(BatchRequestPart)}. If only if the BatchRequests part represents - * a change set, the request will be delegated to - * {@link org.apache.olingo.server.api.processor.BatchProcessor#processChangeSet(BatchFacade, java.util.List)}. - * Otherwise the requests will be directly executed. - * - * The processor implementation could use {@link BatchFacade#handleODataRequest(ODataRequest)} to processes - * requests in a change set. - */ -public interface BatchFacade { - /** - * Executes a ODataRequest, which must be a part of a change set. - * Each requests must have a Content-Id header field, which holds an id that is unique in the whole batch request. - * - * @param request ODataRequest to process - * @return Corresponding ODataResult to the given request - * @throws BatchDeserializerException - */ - public ODataResponse handleODataRequest(ODataRequest request) throws BatchDeserializerException; - - /** - * Handles a BatchRequestPart. - * - * @param request Request to process - * @return Corresponding {@link ODataResponsePart} - * @throws BatchDeserializerException - */ - public ODataResponsePart handleBatchRequest(BatchRequestPart request) throws BatchDeserializerException; - - /** - * Extracts the boundary of a multipart/mixed header. - * See RFC 2046#5.1 - * - * @param contentType Content Type - * @return Boundary - */ - public String extractBoundaryFromContentType(String contentType) throws BatchDeserializerException; -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchDeserializerException.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchDeserializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchDeserializerException.java deleted file mode 100644 index eeb11d6..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchDeserializerException.java +++ /dev/null @@ -1,65 +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.batch.exception; - -import org.apache.olingo.server.api.deserializer.DeserializerException; - -public class BatchDeserializerException extends DeserializerException { - public static enum MessageKeys implements MessageKey { - INVALID_BOUNDARY, - INVALID_CHANGESET_METHOD, - INVALID_CONTENT, - INVALID_CONTENT_LENGTH, - INVALID_CONTENT_TRANSFER_ENCODING, - INVALID_CONTENT_TYPE, - INVALID_HEADER, - INVALID_HTTP_VERSION, - INVALID_METHOD, - INVALID_QUERY_OPERATION_METHOD, - INVALID_STATUS_LINE, - INVALID_URI, - MISSING_BLANK_LINE, - MISSING_BOUNDARY_DELIMITER, - MISSING_CLOSE_DELIMITER, - MISSING_CONTENT_ID, - MISSING_CONTENT_TRANSFER_ENCODING, - MISSING_CONTENT_TYPE, - MISSING_MANDATORY_HEADER, - FORBIDDEN_HEADER, - INVALID_BASE_URI; - - @Override - public String getKey() { - return name(); - } - } - - private static final long serialVersionUID = -907752788975531134L; - - public BatchDeserializerException(final String developmentMessage, final MessageKey messageKey, - final int lineNumber) { - this(developmentMessage, messageKey, "" + lineNumber); - } - - public BatchDeserializerException(final String developmentMessage, final MessageKey messageKey, - final String... parameters) { - super(developmentMessage, messageKey, parameters); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchSerializerException.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchSerializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchSerializerException.java deleted file mode 100644 index 03b1f14..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchSerializerException.java +++ /dev/null @@ -1,46 +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.batch.exception; - -import org.apache.olingo.server.api.serializer.SerializerException; - -public class BatchSerializerException extends SerializerException { - - private static final long serialVersionUID = 2634433974342796905L; - - public static enum MessageKeys implements MessageKey { - MISSING_CONTENT_ID; - - @Override - public String getKey() { - return name(); - } - } - - public BatchSerializerException(final String developmentMessage, final MessageKey messageKey, - final String... parameters) { - super(developmentMessage, messageKey, parameters); - } - - @Override - protected String getBundleName() { - return DEFAULT_SERVER_BUNDLE_NAME; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java deleted file mode 100644 index 0278a82..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java +++ /dev/null @@ -1,83 +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.deserializer; - -import org.apache.olingo.server.api.ODataTranslatedException; - -/** Exception thrown by deserializers. */ -public class DeserializerException extends ODataTranslatedException { - - private static final long serialVersionUID = 6341270437497060906L; - - /** Keys for exception texts in the resource bundle. */ - public static enum MessageKeys implements MessageKey { - NOT_IMPLEMENTED, - IO_EXCEPTION, - //TODO: create texts for the following message keys: - /** parameter: format */ UNSUPPORTED_FORMAT, - JSON_SYNTAX_EXCEPTION, - /** parameter: propertyName */ INVALID_NULL_PROPERTY, - /** parameter: keyName */ UNKOWN_CONTENT, - /** parameter: propertyName */ INVALID_VALUE_FOR_PROPERTY, - /** parameter: propertyName */ INVALID_JSON_TYPE_FOR_PROPERTY, - VALUE_ARRAY_NOT_PRESENT, - VALUE_TAG_MUST_BE_AN_ARRAY, - INVALID_ENTITY, - /** parameter: navigationPropertyName */INVALID_VALUE_FOR_NAVIGATION_PROPERTY, - DUPLICATE_PROPERTY, - DUPLICATE_JSON_PROPERTY, - /** parameters: primitiveTypeName, propertyName */ UNKNOWN_PRIMITIVE_TYPE, - /** parameter: navigationPropertyName */NAVIGATION_PROPERTY_NOT_FOUND, - /** parameter: annotationName */INVALID_ANNOTATION_TYPE, - /** parameter: annotationName */INVALID_NULL_ANNOTATION; - - @Override - public String getKey() { - return name(); - } - } - - /** - * Creates deserializer exception. - * @param developmentMessage message text as fallback and for debugging purposes - * @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle - * @param parameters parameters for the exception text - */ - public DeserializerException(final String developmentMessage, - final MessageKey messageKey, final String... parameters) { - super(developmentMessage, messageKey, parameters); - } - - /** - * Creates deserializer exception. - * @param developmentMessage message text as fallback and for debugging purposes - * @param cause the cause of this exception - * @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle - * @param parameters parameters for the exception text - */ - public DeserializerException(final String developmentMessage, final Throwable cause, - final MessageKey messageKey, final String... parameters) { - super(developmentMessage, cause, messageKey, parameters); - } - - @Override - protected String getBundleName() { - return DEFAULT_SERVER_BUNDLE_NAME; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java deleted file mode 100644 index 0182d6d..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java +++ /dev/null @@ -1,39 +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.deserializer; - -import java.io.InputStream; -import java.util.List; - -import org.apache.olingo.server.api.batch.exception.BatchDeserializerException; -import org.apache.olingo.server.api.deserializer.batch.BatchOptions; -import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart; - -public interface FixedFormatDeserializer { - - /** - * Reads binary data from an InputStream. - * @param content the binary data as input stream - * @return the binary data - */ - byte[] binary(InputStream content) throws DeserializerException; - - public List<BatchRequestPart> parseBatchRequest(InputStream content, String boundary, BatchOptions options) - throws BatchDeserializerException; -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java deleted file mode 100644 index 46567ae..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java +++ /dev/null @@ -1,53 +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.deserializer; - -import java.io.InputStream; - -import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; -import org.apache.olingo.commons.api.edm.EdmEntityType; - -/** - * Deserializer on OData server side. - */ -public interface ODataDeserializer { - - /** - * Deserializes an entity stream into an {@link Entity} object. - * Validates: property types, no double properties, correct json types - * @param stream - * @param edmEntityType - * @return deserialized {@link Entity} object - * @throws DeserializerException - */ - Entity entity(InputStream stream, EdmEntityType edmEntityType) throws DeserializerException; - - /** - * Deserializes an entity collection stream into an {@link EntitySet} object. - * @param stream - * @param edmEntityType - * @return deserialized {@link EntitySet} object - * @throws DeserializerException - */ - EntitySet entityCollection(InputStream stream, EdmEntityType edmEntityType) throws DeserializerException; - - - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java deleted file mode 100644 index e01d810..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java +++ /dev/null @@ -1,114 +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.deserializer.batch; - -import java.io.InputStream; - -import org.apache.olingo.server.api.ODataRequest; -import org.apache.olingo.server.api.deserializer.FixedFormatDeserializer; - -/** - * Options for the batch deserializer. - * See {@link FixedFormatDeserializer#parseBatchRequest(InputStream, String, BatchOptions)} - */ -public class BatchOptions { - private boolean isStrict = true; - private String rawBaseUri = ""; - private String rawServiceResolutionUri = ""; - - private BatchOptions() { } - - /** - * Returns if the batch parsing is strict. - * Default is true - * - * @return true if parsing is strict - */ - public boolean isStrict() { - return isStrict; - } - - /** - * See {@link ODataRequest#getRawBaseUri()} - */ - public String getRawBaseUri() { - return rawBaseUri; - } - - /** - * See {@link ODataRequest#getRawServiceResolutionUri()} - */ - public String getRawServiceResolutionUri() { - return rawServiceResolutionUri; - } - - /** - * Creates a new BatchOptions builder - * - * @return new BatchOptions builder instance - */ - public static Builder with() { - return new Builder(); - } - - /** - * BatchOptions builder - */ - public static class Builder { - private BatchOptions options; - - /** Initializes the options builder. */ - public Builder() { - options = new BatchOptions(); - } - - /** - * See {@link BatchOptions#isStrict()} - */ - public Builder isStrict(boolean isStrict) { - options.isStrict = isStrict; - return this; - } - - /** - * See {@link ODataRequest#getRawBaseUri()} - */ - public Builder rawBaseUri(String baseUri) { - options.rawBaseUri = baseUri; - return this; - } - - /** - * See {@link ODataRequest#getRawServiceResolutionUri()} - */ - public Builder rawServiceResolutionUri(String serviceResolutionUri) { - options.rawServiceResolutionUri = serviceResolutionUri; - return this; - } - - /** - * Creates a new BatchOptions instance - * - * @return new BatchOptions instance - */ - public BatchOptions build() { - return options; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java deleted file mode 100644 index 01c8330..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java +++ /dev/null @@ -1,73 +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.deserializer.batch; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.olingo.server.api.ODataRequest; - -/** - * A BatchPart - * <p> BatchPart represents a distinct MIME part of a Batch Request body. It can be a ChangeSet or a Query Operation - */ -public class BatchRequestPart { - private List<ODataRequest> requests = new ArrayList<ODataRequest>(); - private boolean isChangeSet; - - /** - * Creates a new instance of BachRequestPart - * - * @param isChangeSet True, if this instance represents a change set - * @param requests A list of {@link ODataRequest} - */ - public BatchRequestPart(final boolean isChangeSet, final List<ODataRequest> requests) { - this.isChangeSet = isChangeSet; - this.requests = requests; - } - - /** - * Creates a new instance of BachRequestPart - * - * @param isChangeSet True, if this instance represents a change set - * @param request A single {@link ODataRequest} - */ - public BatchRequestPart(final boolean isChangeSet, final ODataRequest request) { - this.isChangeSet = isChangeSet; - this.requests = new ArrayList<ODataRequest>(); - this.requests.add(request); - } - - /** - * Get the info if a BatchPart is a ChangeSet - * @return true or false - */ - public boolean isChangeSet() { - return isChangeSet; - } - - /** - * Get requests. If a BatchPart is a Query Operation, the list contains one request. - * @return a list of {@link ODataRequest} - */ - public List<ODataRequest> getRequests() { - return Collections.unmodifiableList(requests); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/ODataResponsePart.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/ODataResponsePart.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/ODataResponsePart.java deleted file mode 100644 index 405deab..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/ODataResponsePart.java +++ /dev/null @@ -1,85 +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.deserializer.batch; - -import java.util.Arrays; -import java.util.List; - -import org.apache.olingo.server.api.ODataResponse; - -/** - * An ODataResponsePart represents a collections of ODataResponses. - * A list of ODataResponseParts can be combined by the BatchSerializer to a single - * OData batch response. - */ -public class ODataResponsePart { - private List<ODataResponse> responses; - private boolean isChangeSet; - - /** - * Creates a new ODataResponsePart. - * - * An ODataResponsePart represents a collections of ODataResponses. - * A list of ODataResponseParts can be combined by the BatchSerializer to a single - * OData batch response. - * - * @param responses A list of {@link ODataResponse} - * @param isChangeSet True this ODataResponsePart represents a change set, otherwise false - */ - public ODataResponsePart(List<ODataResponse> responses, boolean isChangeSet) { - this.responses = responses; - this.isChangeSet = isChangeSet; - } - - /** - * Creates a new ODataResponsePart. - * - * An ODataResponsePart represents a collections of ODataResponses. - * A list of ODataResponseParts can be combined by the BatchSerializer to a single - * OData batch response. - * - * @param response A single {@link ODataResponse} - * @param isChangeSet True this ODataResponsePart represents a change set, otherwise false - */ - public ODataResponsePart(ODataResponse response, boolean isChangeSet) { - this.responses = Arrays.asList(response); - this.isChangeSet = isChangeSet; - } - - /** - * Returns true if the current instance represents a change set. - * - * @return true or false - */ - public List<ODataResponse> getResponses() { - return responses; - } - - /** - * Returns a collection of ODataResponses. - * Each collections contains at least one {@link ODataResponse}. - * - * If this instance represents a change set, there are may many ODataResponses - * - * @return a list of {@link ODataResponse} - */ - public boolean isChangeSet() { - return isChangeSet; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Action.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Action.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Action.java deleted file mode 100644 index c33d139..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Action.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.server.api.edm.provider; - -import java.util.List; - -public class Action extends Operation { - - @Override - public Action setName(final String name) { - this.name = name; - return this; - } - - @Override - public Action setBound(final boolean isBound) { - this.isBound = isBound; - return this; - } - - @Override - public Action setEntitySetPath(final EntitySetPath entitySetPath) { - this.entitySetPath = entitySetPath; - return this; - } - - @Override - public Action setParameters(final List<Parameter> parameters) { - this.parameters = parameters; - return this; - } - - @Override - public Action setReturnType(final ReturnType returnType) { - this.returnType = returnType; - return this; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/ActionImport.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/ActionImport.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/ActionImport.java deleted file mode 100644 index 5086818..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/ActionImport.java +++ /dev/null @@ -1,48 +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.edm.provider; - -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.Target; - -public class ActionImport extends OperationImport { - - private FullQualifiedName action; - - @Override - public ActionImport setName(final String name) { - this.name = name; - return this; - } - - @Override - public ActionImport setEntitySet(final Target entitySet) { - this.entitySet = entitySet; - return this; - } - - public FullQualifiedName getAction() { - return action; - } - - public ActionImport setAction(final FullQualifiedName action) { - this.action = action; - return this; - } -}
