From f38d54dcf3e5a938ffcb55cb1cebfe344a0af403 Mon Sep 17 00:00:00 2001 From: Christian Amend Date: Mon, 2 Mar 2015 14:58:56 +0100 Subject: [PATCH] [OLINGO-575] Delete abstract client class --- .../olingo/ext/proxy/AbstractService.java | 6 +- .../commons/AbstractInvocationHandler.java | 4 +- .../TransactionalPersistenceManagerImpl.java | 5 +- .../olingo/ext/proxy/utils/CoreUtils.java | 34 +-- .../ext/pojogen/AbstractPOJOGenMojo.java | 5 +- .../src/main/resources/service.vm | 6 +- .../olingo/fit/AbstractBaseTestITCase.java | 4 +- .../fit/proxy/v4/AbstractTestITCase.java | 4 +- .../olingo/fit/proxy/v4/demo/Service.java | 13 +- .../olingo/fit/proxy/v4/opentype/Service.java | 17 +- .../fit/proxy/v4/staticservice/Service.java | 17 +- .../client/BasicHttpExceptionHandling.java | 4 +- .../fit/tecsvc/client/ExpandSelectITCase.java | 10 +- .../olingo/fit/tecsvc/client/MediaITCase.java | 11 +- .../fit/tecsvc/client/NavigationITCase.java | 5 +- .../tecsvc/client/PrimitiveComplexITCase.java | 3 +- .../client/SystemQueryOptionITCase.java | 23 +- .../fit/tecsvc/http/BasicBatchITCase.java | 7 +- .../fit/tecsvc/http/BasicHttpITCase.java | 4 +- .../olingo/fit/tecsvc/http/PingITCase.java | 14 +- .../api/CommonEdmEnabledODataClient.java | 57 ----- .../olingo/client/api/CommonODataClient.java | 77 ------ .../client/api/EdmEnabledODataClient.java | 24 +- .../apache/olingo/client/api/ODataClient.java | 48 ++-- .../request/ODataBatchableRequest.java | 6 +- .../request/batch/BatchRequestFactory.java | 8 +- .../batch/CommonBatchRequestFactory.java | 33 --- .../batch/CommonODataBatchRequest.java | 55 ----- .../request/batch/ODataBatchRequest.java | 47 +++- .../request/cud/CUDRequestFactory.java | 136 ++++++++++- .../request/cud/CommonCUDRequestFactory.java | 163 ------------- .../request/cud/CommonUpdateType.java | 31 --- .../communication/request/cud/UpdateType.java | 5 +- .../api/domain/ODataEntitySetIterator.java | 6 +- .../client/core/AbstractODataClient.java | 49 ---- .../client/core/ODataClientFactory.java | 2 +- .../olingo/client/core/ODataClientImpl.java | 26 ++- .../header/ODataErrorResponseChecker.java | 4 +- .../request/AbstractODataBasicRequest.java | 10 +- .../request/AbstractODataRequest.java | 8 +- .../request/AbstractRequest.java | 14 +- .../request/batch/AbstractBatchManager.java | 6 +- .../batch/AbstractBatchRequestFactory.java | 28 --- .../batch/AbstractODataBatchRequest.java | 8 +- .../batch/AbstractODataBatchRequestItem.java | 6 +- .../batch/BatchRequestFactoryImpl.java | 23 +- .../request/batch/ODataBatchRequestImpl.java | 3 +- .../request/batch/ODataChangesetImpl.java | 4 +- .../request/batch/ODataSingleRequestImpl.java | 4 +- .../cud/AbstractCUDRequestFactory.java | 221 ------------------ .../request/cud/CUDRequestFactoryImpl.java | 209 ++++++++++++++++- .../request/cud/ODataDeleteRequestImpl.java | 6 +- .../cud/ODataEntityCreateRequestImpl.java | 6 +- .../cud/ODataEntityUpdateRequestImpl.java | 6 +- .../cud/ODataPropertyUpdateRequestImpl.java | 6 +- .../cud/ODataReferenceAddingRequestImpl.java | 6 +- .../cud/ODataValueUpdateRequestImpl.java | 6 +- ...bstractEdmEnabledInvokeRequestFactory.java | 6 +- .../invoke/AbstractODataInvokeRequest.java | 7 +- .../invoke/ODataInvokeRequestImpl.java | 4 +- .../retrieve/AbstractMetadataRequestImpl.java | 4 +- .../AbstractODataRetrieveRequest.java | 6 +- .../retrieve/EdmMetadataRequestImpl.java | 6 +- .../retrieve/ODataDeltaRequestImpl.java | 5 +- .../retrieve/ODataEntityRequestImpl.java | 6 +- .../ODataEntitySetIteratorRequestImpl.java | 6 +- .../retrieve/ODataEntitySetRequestImpl.java | 6 +- .../retrieve/ODataMediaRequestImpl.java | 6 +- .../retrieve/ODataPropertyRequestImpl.java | 6 +- .../request/retrieve/ODataRawRequestImpl.java | 6 +- .../ODataServiceDocumentRequestImpl.java | 6 +- .../retrieve/ODataValueRequestImpl.java | 6 +- .../retrieve/XMLMetadataRequestImpl.java | 5 +- .../AbstractODataStreamedEntityRequest.java | 4 +- .../AbstractODataStreamedRequest.java | 10 +- .../ODataMediaEntityCreateRequestImpl.java | 6 +- .../ODataMediaEntityUpdateRequestImpl.java | 6 +- .../ODataStreamUpdateRequestImpl.java | 6 +- .../response/AbstractODataResponse.java | 6 +- .../response/AsyncResponseImpl.java | 4 +- .../core/serialization/ODataReaderImpl.java | 5 +- .../core/serialization/ODataWriterImpl.java | 8 +- .../olingo/client/core/uri/URIUtils.java | 6 +- .../olingo/client/core/AbstractTest.java | 6 +- .../olingo/client/core/ODataClientTest.java | 10 +- 85 files changed, 702 insertions(+), 1019 deletions(-) delete mode 100644 lib/client-api/src/main/java/org/apache/olingo/client/api/CommonEdmEnabledODataClient.java delete mode 100644 lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java delete mode 100644 lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/CommonBatchRequestFactory.java delete mode 100644 lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/CommonODataBatchRequest.java delete mode 100644 lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java delete mode 100644 lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonUpdateType.java delete mode 100644 lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java delete mode 100644 lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchRequestFactory.java delete mode 100644 lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java index db80e72f5..aaed37a6b 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java @@ -27,7 +27,7 @@ import java.util.zip.GZIPInputStream; import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.IOUtils; -import org.apache.olingo.client.api.CommonEdmEnabledODataClient; +import org.apache.olingo.client.api.EdmEnabledODataClient; import org.apache.olingo.client.api.edm.xml.XMLMetadata; import org.apache.olingo.client.core.ODataClientFactory; import org.apache.olingo.client.core.edm.EdmClientImpl; @@ -49,13 +49,13 @@ import org.slf4j.LoggerFactory; * * @param actual client class */ -public abstract class AbstractService> { +public abstract class AbstractService { protected static final Logger LOG = LoggerFactory.getLogger(AbstractService.class); private final Map, Object> ENTITY_CONTAINERS = new ConcurrentHashMap, Object>(); - private final CommonEdmEnabledODataClient client; + private final EdmEnabledODataClient client; private final Context context; diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java index 0ed008012..d0d26d3b8 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java @@ -31,7 +31,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; -import org.apache.olingo.client.api.CommonEdmEnabledODataClient; +import org.apache.olingo.client.api.EdmEnabledODataClient; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.commons.api.domain.ODataEntity; import org.apache.olingo.commons.api.domain.ODataValue; @@ -64,7 +64,7 @@ abstract class AbstractInvocationHandler implements InvocationHandler { this.service = service; } - protected CommonEdmEnabledODataClient getClient() { + protected EdmEnabledODataClient getClient() { return service.getClient(); } diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/TransactionalPersistenceManagerImpl.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/TransactionalPersistenceManagerImpl.java index ae76f8a19..5f4212762 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/TransactionalPersistenceManagerImpl.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/TransactionalPersistenceManagerImpl.java @@ -22,12 +22,13 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; + import org.apache.olingo.client.api.communication.ODataServerErrorException; import org.apache.olingo.client.api.communication.request.ODataBatchableRequest; import org.apache.olingo.client.api.communication.request.ODataRequest; import org.apache.olingo.client.api.communication.request.ODataStreamedRequest; import org.apache.olingo.client.api.communication.request.batch.BatchManager; -import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest; +import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest; import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem; import org.apache.olingo.client.api.communication.request.batch.ODataChangeset; import org.apache.olingo.client.api.communication.response.ODataBatchResponse; @@ -58,7 +59,7 @@ public class TransactionalPersistenceManagerImpl extends AbstractPersistenceMana */ @Override protected void doFlush(final PersistenceChanges changes, final TransactionItems items) { - final CommonODataBatchRequest request = + final ODataBatchRequest request = service.getClient().getBatchRequestFactory().getBatchRequest(service.getClient().getServiceRoot()); ((ODataRequest) request).setAccept( service.getClient().getConfiguration().getDefaultBatchAcceptFormat().toContentTypeString()); diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java index fb4f92eb7..7ab03a63a 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java @@ -37,7 +37,7 @@ import java.util.Set; import java.util.TreeSet; import org.apache.commons.lang3.StringUtils; -import org.apache.olingo.client.api.CommonEdmEnabledODataClient; +import org.apache.olingo.client.api.EdmEnabledODataClient; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.client.core.uri.URIUtils; import org.apache.olingo.commons.api.domain.ODataAnnotatable; @@ -92,7 +92,7 @@ public final class CoreUtils { } public static ODataValue getODataValue( - final CommonEdmEnabledODataClient client, final EdmTypeInfo type, final Object obj) { + final EdmEnabledODataClient client, final EdmTypeInfo type, final Object obj) { final ODataValue value; @@ -150,7 +150,7 @@ public final class CoreUtils { } private static ODataProperty getODataEntityProperty( - final CommonEdmEnabledODataClient client, + final EdmEnabledODataClient client, final FullQualifiedName entity, final String property, final Object obj) { @@ -160,7 +160,7 @@ public final class CoreUtils { } private static ODataProperty getODataComplexProperty( - final CommonEdmEnabledODataClient client, + final EdmEnabledODataClient client, final FullQualifiedName complex, final String property, final Object obj) { @@ -170,7 +170,7 @@ public final class CoreUtils { } private static ODataProperty getODataProperty( - final CommonEdmEnabledODataClient client, + final EdmEnabledODataClient client, final EdmElement edmProperty, final String property, final Object obj) { @@ -192,7 +192,7 @@ public final class CoreUtils { } public static ODataAnnotation getODataAnnotation( - final CommonEdmEnabledODataClient client, final String term, final EdmType type, final Object obj) { + final EdmEnabledODataClient client, final String term, final EdmType type, final Object obj) { ODataAnnotation annotation; @@ -212,7 +212,7 @@ public final class CoreUtils { } public static ODataProperty getODataProperty( - final CommonEdmEnabledODataClient client, final String name, final EdmTypeInfo type, final Object obj) { + final EdmEnabledODataClient client, final String name, final EdmTypeInfo type, final Object obj) { ODataProperty property; @@ -246,7 +246,7 @@ public final class CoreUtils { } private static EdmTypeInfo guessTypeFromObject( - final CommonEdmEnabledODataClient client, final Object obj) { + final EdmEnabledODataClient client, final Object obj) { final EdmTypeInfo.Builder edmTypeInfo = new EdmTypeInfo.Builder().setEdm(client.getCachedEdm()); @@ -269,7 +269,7 @@ public final class CoreUtils { } } - private static EdmTypeInfo guessPrimitiveType(final CommonEdmEnabledODataClient client, final Class clazz) { + private static EdmTypeInfo guessPrimitiveType(final EdmEnabledODataClient client, final Class clazz) { EdmPrimitiveTypeKind bckCandidate = null; for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) { @@ -295,7 +295,7 @@ public final class CoreUtils { } public static void addProperties( - final CommonEdmEnabledODataClient client, + final EdmEnabledODataClient client, final Map changes, final ODataEntity entity) { @@ -306,7 +306,7 @@ public final class CoreUtils { } public static void addProperties( - final CommonEdmEnabledODataClient client, + final EdmEnabledODataClient client, final Map changes, final ODataComplexValue entity) { @@ -320,7 +320,7 @@ public final class CoreUtils { } public static void addAnnotations( - final CommonEdmEnabledODataClient client, + final EdmEnabledODataClient client, final Map, Object> annotations, final ODataAnnotatable annotatable) { @@ -386,7 +386,7 @@ public final class CoreUtils { } public static URIBuilder buildEditLink( - final CommonEdmEnabledODataClient client, + final EdmEnabledODataClient client, final String entitySetURI, final ODataEntity entity, final Object key) { @@ -435,7 +435,7 @@ public final class CoreUtils { } public static Object getKey( - final CommonEdmEnabledODataClient client, + final EdmEnabledODataClient client, final EntityInvocationHandler typeHandler, final Class entityTypeRef, final ODataEntity entity) { @@ -465,7 +465,7 @@ public final class CoreUtils { } private static void populate( - final CommonEdmEnabledODataClient client, + final EdmEnabledODataClient client, final EntityInvocationHandler typeHandler, final Object bean, final Class getterAnn, @@ -489,7 +489,7 @@ public final class CoreUtils { @SuppressWarnings({ "unchecked" }) private static void populate( - final CommonEdmEnabledODataClient client, + final EdmEnabledODataClient client, final EntityInvocationHandler typeHandler, final Object bean, final Class typeRef, @@ -662,7 +662,7 @@ public final class CoreUtils { } public static URI getTargetEntitySetURI( - final CommonEdmEnabledODataClient client, final NavigationProperty property) { + final EdmEnabledODataClient client, final NavigationProperty property) { final Edm edm = client.getCachedEdm(); final FullQualifiedName containerName = diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java index dda303a65..5caeafbf6 100644 --- a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java +++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java @@ -33,6 +33,7 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.zip.GZIPOutputStream; + import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; @@ -42,7 +43,7 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Parameter; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.edm.xml.XMLMetadata; @@ -195,7 +196,7 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo { protected abstract AbstractUtility getUtility(); - protected abstract CommonODataClient getClient(); + protected abstract ODataClient getClient(); private Triple getMetadata() throws FileNotFoundException { if (StringUtils.isEmpty(serviceRootURL) && StringUtils.isEmpty(localEdm)) { diff --git a/ext/pojogen-maven-plugin/src/main/resources/service.vm b/ext/pojogen-maven-plugin/src/main/resources/service.vm index 292ba8f86..e4762e2e9 100644 --- a/ext/pojogen-maven-plugin/src/main/resources/service.vm +++ b/ext/pojogen-maven-plugin/src/main/resources/service.vm @@ -23,12 +23,12 @@ package ${package}; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.apache.olingo.client.api.CommonEdmEnabledODataClient; +import org.apache.olingo.client.api.EdmEnabledODataClient; import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; import org.apache.olingo.ext.proxy.api.AbstractTerm; import org.apache.olingo.ext.proxy.AbstractService; -public class Service> extends AbstractService { +public class Service extends AbstractService { //CHECKSTYLE:OFF (Maven checkstyle) private static final String COMPRESSED_METADATA = "$metadata"; @@ -38,7 +38,7 @@ public class Service> extends AbstractS private static final Map> SERVICES = new ConcurrentHashMap>(); @SuppressWarnings("unchecked") - private static > Service getInstance( + private static Service getInstance( final ODataServiceVersion version, final String serviceRoot, final boolean transactional) { if (!SERVICES.containsKey(serviceRoot)) { diff --git a/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java index 385631868..64ed4eb0d 100644 --- a/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java @@ -29,7 +29,7 @@ import javax.servlet.http.HttpServletResponse; import org.apache.catalina.LifecycleException; import org.apache.commons.io.IOUtils; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.EntitySet; import org.apache.olingo.commons.api.domain.ODataEntity; @@ -50,7 +50,7 @@ public abstract class AbstractBaseTestITCase { */ protected static final Logger LOG = LoggerFactory.getLogger(AbstractBaseTestITCase.class); - protected abstract CommonODataClient getClient(); + protected abstract ODataClient getClient(); @BeforeClass public static void init() diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java index 70b34f5ad..e907a676d 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java @@ -29,8 +29,8 @@ import java.sql.Timestamp; import java.util.Calendar; import java.util.TimeZone; -import org.apache.olingo.client.api.CommonODataClient; import org.apache.olingo.client.api.EdmEnabledODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.ext.proxy.AbstractService; import org.apache.olingo.ext.proxy.api.PrimitiveCollection; @@ -142,7 +142,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { } @Override - protected CommonODataClient getClient() { + protected ODataClient getClient() { throw new RuntimeException("This method should not be used from proxy tests."); } } diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/Service.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/Service.java index 8f137269b..3711d65c1 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/Service.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/Service.java @@ -21,12 +21,13 @@ package org.apache.olingo.fit.proxy.v4.demo; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.apache.olingo.client.api.CommonEdmEnabledODataClient; -import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; -import org.apache.olingo.ext.proxy.api.AbstractTerm; -import org.apache.olingo.ext.proxy.AbstractService; -public class Service> extends AbstractService { +import org.apache.olingo.client.api.EdmEnabledODataClient; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; +import org.apache.olingo.ext.proxy.AbstractService; +import org.apache.olingo.ext.proxy.api.AbstractTerm; + +public class Service extends AbstractService { //CHECKSTYLE:OFF (Maven checkstyle) private static final String COMPRESSED_METADATA = "H4sIAAAAAAAAAMVaDYwcVR1/t7f3fW2PaylShS6mFFrLbq+9lsJhy/Z2e6zs0eP2esHjw8zNvNsbmZ0Z3ry92yVS1ERiwA8aFCFVVKIEI42mRgIYI6ggmjQmfAUTglHRhAgGAyGKJvp/b753ZvZmrhUbcuzMzvt//N7v/b9mH3kTdRkE7dNINSvogriIs5oiq1UtKyoyVmlW1AjOYqmWbdSU7NJo9rrJ8iSmgiRQoVTTlco3v7/r+D/OqacQahB0WTwx+XmDEkGkHlmPfWff7JrfnPxuCnWUURoebFD0kTKIy5nicqa4nCkObso5eCgH0nJFeHgMlO9JphyWlSiudV73hzfu3//CW8wBHZAYiY0E08sgePh7Gwrfvv4eiZveT/ACJlgVsUHRUPmTwpKQq1NZyZVlgzIrdyW2sjG+Dt02c8mml1MoVUaDDK0KJksyV7E7HkYFz6KxMupZwsSQNZWiYdNERVCruQolsH6scQs6ijqN2LsJUHjFM0gu/9gd194g7niBQ9JjgICaYDCx3YDA5ckQ8Mr++ZufvfTEqfwxjsSwB4lZ0x+moq+Mzq4JjUL4l6ZzOtvp9czzLNucbJ4Qocl2qPGZ5867/1fCNzpRRwmlDflW3NARQh3LafYXFu2OjUmFe83Q2PS5u15MP/qLm1NoANAAl8AYEw3YTkFVNQq2zitsO9d5GDMp6LBVQ9YDsGaCaHXdXjjg3ndkiRpow42Zpo7te+vANJk2x2GvBVnFhKLL4jFmaTRX9C8FYwZMaV4FfVit13w3Fuqqz8UuiknNsYfCowW8IKuy+wyQYjQZKUxwH/rJvb9+6lPp2zkdugRFNkkGDOhThRo2QBz27jpFfYcZLwq4pvEn18KupvjephLtbZ47yPa29LvX77vp6ZGHU6hrDnXNa3VVKqM1JkwVTKcEumiZlGYmWZ/7dYHAFQBj4wJxg9aJyoCkaDT2Fk07q1hsuSK+AxaOeZd9u187fsQYe+JafmYD7LKCgg0a4qChRgdg2luQDREcpyGQ7o1t0ZSNCEN1/lRja26uluEbG8L0tEFkiaIdYThptRo86ABVxVquMl0qMHwuTUYyx6S/jx28L5+q/DKFuudQr1pXFAYYsAziTBmrVbpI0XpPIC2pFFf5gfFuep9OsCjbkegCYKwhCgq2LtLsYHjIypDt0Ykm1UWqw+ezHOZmp8y7gc0wY8P5CJ4elqw9mcJEBAeFKmZC+iCdZMG63buCixtGbIBgu1zisf2a/dOrj2eLNzwTDZDl5QoYsG1lnzcH8UC6zjzoZx4UtDoLl+z+OQFHmPtDJVUkWDBwRVAEImPDecqO5A5S/Xp8hHQLYnY3ze+mE9VOeZfIDLUTxc+/cXLXay9HnLjE5ZRH/Pa7/mL88Mk/l/gB6rulDrFxQcbEYmI3FUgVU39oPNslGPtjp9xW4JKQxDWIuXv1S3f/dudPX78lhTrLaIPrbrEBpDDMcqQUO/K563P5EFFjIW6nWSJynT43sMPg3Exs51wDspAiDSqoNMwQ5vnkP++euf3KsYv5bnBiUzS7Gk/bKdrCswCcqCVBqVsnh6Cp1fgTJJSr5ulLJr5EssX/sHqZU+doO9DAlVVgxl1B1r9h3lms5cUai67ZIhQc3i+Bu91m6UrRzplF2cjAf0LGEFgxlOGszhgmmzPLMl3MLGmiMF83AwMszhwG6/ljWchkuiI0s7MjcAYMkcg6M6zBibK3fRD2BpaxILPYjQPsT5Gi7XlFydjrM+CXzMNlRlYzdBFnNBUgxBmDwgYlM29jwLzcNawOWoWNg5aADBMQbYX5kT3jWrE5NJDkKnVdB1IQNxb3c8X9ccxZNymLRDO0BZoZ14ieBTVbXYumIB3IoskrsIpfGouYOM6vID09WTk0AyK3rCyyJMURuLOkLgH9NdLckbH93pHJS9B2URm4aMBtSHvwv0OyKkCzCMoviFR+NW4ua0Qy4mg+e5FS/fJcbnl5OauxBinLwgyIvyhSfJ7C4Zmvs8sjRImjZD0jMJGri0BfOLKwwVgCFbk4KjzEPS1/tkcqK2hivcYyuuVR5jRciibZDGtqDi8cMXBM0CI92RbNOiIvCWJzCmKq2Iyppnc0tyu3a+fIbpB8YaTksmDQSU1i2TEWoSON/3CkilINSioGf6MRLttfVcSvosbdLpcl131fufTA5hsfepvXnsOCPTdxGlUoSDUd81I1tJfonYc6ccYuNqEyUYUlucofgRiosxPr9Lb9uv9O8hrNY/y6Z2979MY3P3SxOfJyGgUzq0Lxn5cklg8Riij0QwHt4jfYSC/mOIy1XqZTTYbmgaEn9n91wx0PRdakMTs6p4eyZP+18s6FI3c/9uUU6vN0CHOop67KoiZhNtjCC0JdobNO+RLSPyTop9r0Eh0dulU0YEzdtsIsIsKx/Zq5Jj0OrEq0oqsCAOJES3rmZH0cMEm2aJy1e2Rl4xqszI0/KWgZAjGOXLP11cFN7527PoW6ymiNYM9CNELbDKf6nZmIMwqyB0X+tf0GmKNg6uHcRxPOTP0mv3Xn1j1vjTx/JIXSc2ijxbKWZyByKMKtzbImSCC+qDJyShAbPoEbFKuSPVZqPaWIdZAD7dul+FPUvAcNhvO2K5459dSJ6iu8Yeo2cba576AZblmwt6Fok1uXtbbHYS1zm6jdw2/0JJrvFG2DmWcn33jwvutLzw+CZ3PoA7IqKnUJl1QLRDuBh/JoUyA8Nw/KqmQzvTv5mMexbHnzD46fLL1wiLdp/e6oM2Lzw9oByL92Yd8RjZ87OzgUG79rotxmeD4wdM8N5xe++I7ZYOru0DHY6bNK0LH6EBZonWDJ7hacCpXBT9Fa37VZfz4J0WUcIlpVYyTxXdjf99olL0V9/qofvlxj6SpgOHkK6PBdW6x7nKJzAthGrGiDs7ffAdU9wU1y1A276iyHmj7f4mtxZK+gJgykM6RlyIMdSGWDlR7zQwINg+YKG/U13ktX1cZWVeHPx1fb3WpxGCPa8zS+snUtB8ALZpv4F7hhd7JJhmNuhcpO8LMnFi666djOf/FYHxL2ElalMavpfKBaHvrx+pcrf3z3bf4+I7Sa7lsUDFY5CTVfZd1aRnfejOEE7YmecjFD3He4XAE0ugwL8w3kMffAArZ6/PczPlk9+/aNHXsw+zyvZwctoJrTeCH0tYabtWNWz1OuQKZtw+8f+PdzJ156N/hCqjV5QMZNlQptKNXJb7DXsAdOI0cwo/YfLVa/declj7QO58N6IXZgofbC0MzHm08ethawl8q6QKjqTFs3Wm/CqSwofNhHoNJyqjxPSU7QlcnYGnRz9v6nfvSFD2b2A+5zaK1oVnXGDM99IVXbCpFd94SBkDrq/HFNUTCvxi4OZo1tbEXHGuRJg4k1hGQJR6o/f4aKto9NiOSorBqs7XhrgXhrAUTVV3g34uuR+MgwSe8y4BkKxVxoWjYwDeSDuFOwW6xh/noIrmbkGj68sGDgIApezUP83SVwVK1jaRVSTDO6p4GNatUH0sjetku6pghUuqGvtHzNGt93FMxU8GVY/dlmMuBJfSaRfEkzlEitStsTyicvPLJ1BAjMQzv7pivU0F6GqLWgbbhs9c4+A6F++U0I8SoIrKvJfrnt2UzXwiTnpMdSv3LHbkPXawcZ8HQl1Npnl1a42nQterDG94N1Xmg8tARuawvc/ySyuHDZwTMGyc4kXL3eoL1KsOw53vsZhu2Jo97yewPrdtu1vWXNHP3yn1ZtD0no5u8ynDeCVQzJbbpUoD975bZ7K4/UeeHbJ0HAVc1XwVfE/HHHBNYM6HihythSsFf7XoNeAHXNkkBkVvX4f6dxUNMgfahjDf1o+M/SQmwOU4esf8PWO9ECbNJE8fDEdH7qqo8zPM5y315aOk9lyKdf/Pp7f4O6dM6ytaF3WKkHdFSJoC82pzRZbZ96BqC0EuuE/eKwuRI7nINh9Vhn/Fj4WsbQo2FpDjkYEY3k/zN8jNcNqtV4+Ajpqduk2rZtp2X74AzU3kqxAQ2UYRo1wOsALMo1IZiTXKuKUNJrTYxP3yq7xfBY1W9Lb0F272hbFvZeJZPVFGFW+cRHjt7JNZ8AR2Pg41kMFveazyfissXUUBb79IdwObArrppu/lC3DzzbunhcNhd15qsm2L3s+YNNGoTLB/EEViVMXJ5ZYajteemaWtTU9yOFIEcd1XzqsFCLZoG/gEUdZziYtRa/4ZWkf/IUpMK5kcPWtufQjmx8dyfqsnTGUj2y9kkmic5ronFY5A0ApHM0uzNw/78+E7hjhjAAAA=="; @@ -36,7 +37,7 @@ public class Service> extends AbstractS private static final Map> SERVICES = new ConcurrentHashMap>(); @SuppressWarnings("unchecked") - private static > Service getInstance( + private static Service getInstance( final ODataServiceVersion version, final String serviceRoot, final boolean transactional) { if (!SERVICES.containsKey(serviceRoot)) { diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/Service.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/Service.java index 1b1a0baa4..6fd3bda0b 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/Service.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/Service.java @@ -21,12 +21,13 @@ package org.apache.olingo.fit.proxy.v4.opentype; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.apache.olingo.client.api.CommonEdmEnabledODataClient; -import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; -import org.apache.olingo.ext.proxy.api.AbstractTerm; -import org.apache.olingo.ext.proxy.AbstractService; -public class Service> extends AbstractService { +import org.apache.olingo.client.api.EdmEnabledODataClient; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; +import org.apache.olingo.ext.proxy.AbstractService; +import org.apache.olingo.ext.proxy.api.AbstractTerm; + +public class Service extends AbstractService { // CHECKSTYLE:OFF (Maven checkstyle) private static final String COMPRESSED_METADATA = @@ -37,7 +38,7 @@ public class Service> extends AbstractS private static final Map> SERVICES = new ConcurrentHashMap>(); @SuppressWarnings("unchecked") - private static > Service getInstance( + private static Service getInstance( final ODataServiceVersion version, final String serviceRoot, final boolean transactional) { if (!SERVICES.containsKey(serviceRoot)) { @@ -55,7 +56,7 @@ public class Service> extends AbstractS * @param serviceRoot OData service root * @return OData 4.0 instance for given service root, operating in transactions (with batch requests) */ - public static Service getV4( + public static Service getV4( final String serviceRoot) { return getV4(serviceRoot, true); @@ -68,7 +69,7 @@ public class Service> extends AbstractS * @param transactional whether operating in transactions (with batch requests) or not * @return OData 4.0 instance for given service root */ - public static Service getV4( + public static Service getV4( final String serviceRoot, final boolean transactional) { return getInstance(ODataServiceVersion.V40, serviceRoot, transactional); diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/Service.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/Service.java index 1fbc53f53..ecea080b5 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/Service.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/Service.java @@ -21,12 +21,13 @@ package org.apache.olingo.fit.proxy.v4.staticservice; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.apache.olingo.client.api.CommonEdmEnabledODataClient; -import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; -import org.apache.olingo.ext.proxy.api.AbstractTerm; -import org.apache.olingo.ext.proxy.AbstractService; -public class Service> extends AbstractService { +import org.apache.olingo.client.api.EdmEnabledODataClient; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; +import org.apache.olingo.ext.proxy.AbstractService; +import org.apache.olingo.ext.proxy.api.AbstractTerm; + +public class Service extends AbstractService { // CHECKSTYLE:OFF (Maven checkstyle) private static final String COMPRESSED_METADATA = @@ -37,7 +38,7 @@ public class Service> extends AbstractS private static final Map> SERVICES = new ConcurrentHashMap>(); @SuppressWarnings("unchecked") - private static > Service getInstance( + private static Service getInstance( final ODataServiceVersion version, final String serviceRoot, final boolean transactional) { if (!SERVICES.containsKey(serviceRoot)) { @@ -55,7 +56,7 @@ public class Service> extends AbstractS * @param serviceRoot OData service root * @return OData 4.0 instance for given service root, operating in transactions (with batch requests) */ - public static Service getV4( + public static Service getV4( final String serviceRoot) { return getV4(serviceRoot, true); @@ -68,7 +69,7 @@ public class Service> extends AbstractS * @param transactional whether operating in transactions (with batch requests) or not * @return OData 4.0 instance for given service root */ - public static Service getV4( + public static Service getV4( final String serviceRoot, final boolean transactional) { return getInstance(ODataServiceVersion.V40, serviceRoot, transactional); diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicHttpExceptionHandling.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicHttpExceptionHandling.java index df208c58d..8248ee5f2 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicHttpExceptionHandling.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicHttpExceptionHandling.java @@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals; import java.net.HttpURLConnection; import java.net.URL; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.commons.api.http.HttpHeader; import org.apache.olingo.fit.AbstractBaseTestITCase; import org.apache.olingo.fit.tecsvc.TecSvcConst; @@ -49,7 +49,7 @@ public class BasicHttpExceptionHandling extends AbstractBaseTestITCase { } @Override - protected CommonODataClient getClient() { + protected ODataClient getClient() { return null; } diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectITCase.java index a4773ee49..4265c406e 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectITCase.java @@ -24,7 +24,7 @@ import static org.junit.Assert.assertNull; import java.util.List; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.core.ODataClientFactory; @@ -43,7 +43,7 @@ public final class ExpandSelectITCase extends AbstractBaseTestITCase { @Test public void readSelect() { - final CommonODataClient client = getClient(); + final ODataClient client = getClient(); final ODataEntityRequest request = client.getRetrieveRequestFactory() .getEntityRequest(client.newURIBuilder(TecSvcConst.BASE_URI) .appendEntitySetSegment("ESAllPrim").appendKeySegment(Short.MAX_VALUE) @@ -74,7 +74,7 @@ public final class ExpandSelectITCase extends AbstractBaseTestITCase { @Test public void readExpandSelect() { - final CommonODataClient client = getClient(); + final ODataClient client = getClient(); final ODataEntityRequest request = client.getRetrieveRequestFactory() .getEntityRequest(client.newURIBuilder(TecSvcConst.BASE_URI) .appendEntitySetSegment("ESTwoPrim").appendKeySegment(-365) @@ -115,7 +115,7 @@ public final class ExpandSelectITCase extends AbstractBaseTestITCase { @Test public void readExpandTwoLevels() { - final CommonODataClient client = getClient(); + final ODataClient client = getClient(); final ODataEntityRequest request = client.getRetrieveRequestFactory() .getEntityRequest(client.newURIBuilder(TecSvcConst.BASE_URI) .appendEntitySetSegment("ESTwoPrim").appendKeySegment(32767) @@ -150,7 +150,7 @@ public final class ExpandSelectITCase extends AbstractBaseTestITCase { } @Override - protected CommonODataClient getClient() { + protected ODataClient getClient() { return ODataClientFactory.getEdmEnabledV4(TecSvcConst.BASE_URI); } } 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 f4c9e9310..e931203bf 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 @@ -28,7 +28,6 @@ import java.io.InputStream; import java.net.URI; import org.apache.commons.io.IOUtils; -import org.apache.olingo.client.api.CommonODataClient; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.ODataClientErrorException; import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest; @@ -54,7 +53,7 @@ public final class MediaITCase extends AbstractBaseTestITCase { @Test public void read() throws Exception { - final CommonODataClient client = getClient(); + final ODataClient client = getClient(); final ODataMediaRequest request = client.getRetrieveRequestFactory().getMediaRequest( client.newURIBuilder(TecSvcConst.BASE_URI) .appendEntitySetSegment("ESMedia").appendKeySegment(1).appendValueSegment().build()); @@ -71,7 +70,7 @@ public final class MediaITCase extends AbstractBaseTestITCase { @Test public void delete() { - final CommonODataClient client = getClient(); + final ODataClient client = getClient(); final URI uri = client.newURIBuilder(TecSvcConst.BASE_URI) .appendEntitySetSegment("ESMedia").appendKeySegment(4).appendValueSegment().build(); final ODataDeleteRequest request = client.getCUDRequestFactory().getDeleteRequest(uri); @@ -94,7 +93,7 @@ public final class MediaITCase extends AbstractBaseTestITCase { @Test public void update() throws Exception { - final CommonODataClient client = getClient(); + final ODataClient client = getClient(); final URI uri = client.newURIBuilder(TecSvcConst.BASE_URI) .appendEntitySetSegment("ESMedia").appendKeySegment(4).appendValueSegment().build(); ODataMediaEntityUpdateRequest request = @@ -118,7 +117,7 @@ public final class MediaITCase extends AbstractBaseTestITCase { @Test public void create() throws Exception { - final CommonODataClient client = getClient(); + final ODataClient client = getClient(); ODataMediaEntityCreateRequest request = client.getCUDRequestFactory().getMediaEntityCreateRequest( client.newURIBuilder(TecSvcConst.BASE_URI).appendEntitySetSegment("ESMedia").build(), @@ -149,7 +148,7 @@ public final class MediaITCase extends AbstractBaseTestITCase { } @Override - protected CommonODataClient getClient() { + protected ODataClient getClient() { ODataClient odata = ODataClientFactory.getV4(); odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON); return odata; diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationITCase.java index 4c6b84867..79abd095e 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationITCase.java @@ -21,7 +21,6 @@ package org.apache.olingo.fit.tecsvc.client; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import org.apache.olingo.client.api.CommonODataClient; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.core.ODataClientFactory; @@ -36,7 +35,7 @@ import org.junit.Test; public final class NavigationITCase extends AbstractBaseTestITCase { - private final CommonODataClient client = getClient(); + private final ODataClient client = getClient(); @Test public void oneLevelToEntity() throws Exception { @@ -134,7 +133,7 @@ public final class NavigationITCase extends AbstractBaseTestITCase { } @Override - protected CommonODataClient getClient() { + protected ODataClient getClient() { ODataClient odata = ODataClientFactory.getV4(); odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON); return odata; diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java index 49396cb9f..2155c0803 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java @@ -28,7 +28,6 @@ import static org.junit.Assert.fail; import java.net.URI; import org.apache.commons.io.IOUtils; -import org.apache.olingo.client.api.CommonODataClient; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.ODataClientErrorException; import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest; @@ -226,7 +225,7 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase { } @Override - protected CommonODataClient getClient() { + protected ODataClient getClient() { ODataClient odata = ODataClientFactory.getV4(); odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON); return odata; diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java index a49562ee8..f319c503a 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java @@ -23,7 +23,6 @@ import static org.junit.Assert.fail; import java.net.URI; -import org.apache.olingo.client.api.CommonODataClient; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.ODataClientErrorException; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; @@ -45,7 +44,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { @Test public void testCountSimple() { - CommonODataClient client = getClient(); + ODataClient client = getClient(); URI uri = client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_ALL_PRIM) .addQueryOption(QueryOption.COUNT, "true") @@ -61,7 +60,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { @Test public void testServerSidePagingCount() { - CommonODataClient client = getClient(); + ODataClient client = getClient(); URI uri = client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_SERVER_SIDE_PAGING) .addQueryOption(QueryOption.COUNT, "true") @@ -77,7 +76,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { @Test public void testTopSimple() { - CommonODataClient client = getClient(); + ODataClient client = getClient(); URI uri = client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_SERVER_SIDE_PAGING) .addQueryOption(QueryOption.TOP, new Integer(5).toString()) @@ -97,7 +96,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { @Test public void testSkipSimple() { - CommonODataClient client = getClient(); + ODataClient client = getClient(); URI uri = client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_SERVER_SIDE_PAGING) .addQueryOption(QueryOption.SKIP, new Integer(5).toString()) @@ -117,7 +116,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { @Test public void testTopNothing() { - CommonODataClient client = getClient(); + ODataClient client = getClient(); URI uri = client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_SERVER_SIDE_PAGING) .addQueryOption(QueryOption.TOP, new Integer(20).toString()) @@ -133,7 +132,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { @Test public void testSkipNothing() { - CommonODataClient client = getClient(); + ODataClient client = getClient(); URI uri = client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_SERVER_SIDE_PAGING) .addQueryOption(QueryOption.SKIP, new Integer(10000).toString()) @@ -148,7 +147,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { @Test public void testFilterWithTopSkipOrderByAndServerSidePaging() { - CommonODataClient client = getClient(); + ODataClient client = getClient(); URI uri = client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_SERVER_SIDE_PAGING) .filter("PropertyInt16 le 105") // 1, 2, ... , 105 @@ -202,7 +201,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { @Test public void testNextLinkFormat() { - CommonODataClient client = getClient(); + ODataClient client = getClient(); URI uri = client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_SERVER_SIDE_PAGING) .build(); @@ -228,7 +227,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { @Test public void testNextLinkFormatWithQueryOptions() { - CommonODataClient client = getClient(); + ODataClient client = getClient(); URI uri = client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_SERVER_SIDE_PAGING) .addQueryOption(QueryOption.COUNT, Boolean.TRUE.toString()) @@ -266,7 +265,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { @Test @SuppressWarnings("unused") public void testNegativeSkip() { - CommonODataClient client = getClient(); + ODataClient client = getClient(); URI uri = client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_ALL_PRIM) .addQueryOption(QueryOption.SKIP, new Integer(-5).toString()) @@ -285,7 +284,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { @Test @SuppressWarnings("unused") public void testNegativeTop() { - CommonODataClient client = getClient(); + ODataClient client = getClient(); URI uri = client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_ALL_PRIM) .addQueryOption(QueryOption.TOP, new Integer(-5).toString()) diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicBatchITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicBatchITCase.java index 4663c6929..1c1b869d1 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicBatchITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicBatchITCase.java @@ -18,7 +18,8 @@ */ package org.apache.olingo.fit.tecsvc.http; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.io.BufferedReader; import java.io.IOException; @@ -29,7 +30,7 @@ import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.commons.api.http.HttpHeader; import org.apache.olingo.commons.api.http.HttpMethod; import org.apache.olingo.commons.api.http.HttpStatusCode; @@ -154,7 +155,7 @@ public class BasicBatchITCase extends AbstractBaseTestITCase { } @Override - protected CommonODataClient getClient() { + protected ODataClient getClient() { // TODO Auto-generated method stub return null; } diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicHttpITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicHttpITCase.java index ba008d6f3..3084b646d 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicHttpITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicHttpITCase.java @@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals; import java.net.HttpURLConnection; import java.net.URL; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.commons.api.http.HttpHeader; import org.apache.olingo.fit.AbstractBaseTestITCase; @@ -118,7 +118,7 @@ public class BasicHttpITCase extends AbstractBaseTestITCase{ } @Override - protected CommonODataClient getClient() { + protected ODataClient getClient() { return null; } diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/PingITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/PingITCase.java index a8251ef46..5146db9ff 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/PingITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/PingITCase.java @@ -18,7 +18,12 @@ */ package org.apache.olingo.fit.tecsvc.http; -import org.apache.olingo.client.api.CommonODataClient; +import static org.junit.Assert.assertEquals; + +import java.net.HttpURLConnection; +import java.net.URL; + +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.commons.api.http.HttpHeader; import org.apache.olingo.fit.AbstractBaseTestITCase; import org.apache.olingo.fit.tecsvc.TecSvcConst; @@ -26,11 +31,6 @@ import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.net.HttpURLConnection; -import java.net.URL; - -import static org.junit.Assert.assertEquals; - public class PingITCase extends AbstractBaseTestITCase{ private static final Logger LOG = LoggerFactory.getLogger(PingITCase.class); @@ -70,7 +70,7 @@ public class PingITCase extends AbstractBaseTestITCase{ } @Override - protected CommonODataClient getClient() { + protected ODataClient getClient() { return null; } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonEdmEnabledODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonEdmEnabledODataClient.java deleted file mode 100644 index 7a16e9783..000000000 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonEdmEnabledODataClient.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.client.api; - -import org.apache.olingo.client.api.communication.request.cud.CommonUpdateType; -import org.apache.olingo.client.api.communication.request.invoke.EdmEnabledInvokeRequestFactory; -import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.edm.Edm; - -/** - * Client interface that caches the Edm metadata information for a given service root. - *
- * Be aware that any request generated via this client instance will be performed against the given service root. - * - * @param concrete update type, depending on the protocol version - */ -public interface CommonEdmEnabledODataClient extends CommonODataClient { - - String getServiceRoot(); - - /** - * Checks if the cached Edm matadata information matches the argument and, if not, updates the cache against the - * configured service root. - * - * @param metadataETag metadata ETag to be compared against the cache - * @return Edm - */ - Edm getEdm(String metadataETag); - - /** - * Return the cached Edm matadata information. - * - * @return Edm - */ - Edm getCachedEdm(); - - URIBuilder newURIBuilder(); - - @Override - EdmEnabledInvokeRequestFactory getInvokeRequestFactory(); -} diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java deleted file mode 100644 index 05b3f7ac2..000000000 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.client.api; - -import org.apache.olingo.client.api.communication.header.ODataHeaders; -import org.apache.olingo.client.api.communication.header.ODataPreferences; -import org.apache.olingo.client.api.communication.request.batch.CommonBatchRequestFactory; -import org.apache.olingo.client.api.communication.request.cud.CommonCUDRequestFactory; -import org.apache.olingo.client.api.communication.request.cud.CommonUpdateType; -import org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory; -import org.apache.olingo.client.api.communication.request.retrieve.RetrieveRequestFactory; -import org.apache.olingo.client.api.serialization.ClientODataDeserializer; -import org.apache.olingo.client.api.serialization.ODataBinder; -import org.apache.olingo.client.api.serialization.ODataReader; -import org.apache.olingo.client.api.serialization.ODataWriter; -import org.apache.olingo.client.api.uri.FilterFactory; -import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataObjectFactory; -import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; -import org.apache.olingo.commons.api.format.ODataFormat; -import org.apache.olingo.commons.api.serialization.ODataSerializer; - -/** - * Generic client interface (common to all supported OData protocol versions). - * - * @param concrete update type, depending on the protocol version - */ -public interface CommonODataClient { - - ODataServiceVersion getServiceVersion(); - - ODataHeaders newVersionHeaders(); - - Configuration getConfiguration(); - - ODataPreferences newPreferences(); - - URIBuilder newURIBuilder(String serviceRoot); - - FilterFactory getFilterFactory(); - - ODataSerializer getSerializer(ODataFormat format); - - ClientODataDeserializer getDeserializer(ODataFormat format); - - ODataReader getReader(); - - ODataWriter getWriter(); - - ODataBinder getBinder(); - - ODataObjectFactory getObjectFactory(); - - RetrieveRequestFactory getRetrieveRequestFactory(); - - CommonCUDRequestFactory getCUDRequestFactory(); - - InvokeRequestFactory getInvokeRequestFactory(); - - CommonBatchRequestFactory getBatchRequestFactory(); -} diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/EdmEnabledODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/EdmEnabledODataClient.java index 0a5b1fbe2..cce6b6cd5 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/EdmEnabledODataClient.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/EdmEnabledODataClient.java @@ -18,15 +18,31 @@ */ package org.apache.olingo.client.api; -import org.apache.olingo.client.api.communication.request.cud.UpdateType; import org.apache.olingo.client.api.communication.request.invoke.EdmEnabledInvokeRequestFactory; import org.apache.olingo.client.api.uri.URIBuilder; +import org.apache.olingo.commons.api.edm.Edm; -public interface EdmEnabledODataClient extends CommonEdmEnabledODataClient, ODataClient { +public interface EdmEnabledODataClient extends ODataClient { - @Override + String getServiceRoot(); + + /** + * Checks if the cached Edm matadata information matches the argument and, if not, updates the cache against the + * configured service root. + * + * @param metadataETag metadata ETag to be compared against the cache + * @return Edm + */ + Edm getEdm(String metadataETag); + + /** + * Return the cached Edm matadata information. + * + * @return Edm + */ + Edm getCachedEdm(); + URIBuilder newURIBuilder(); - @Override EdmEnabledInvokeRequestFactory getInvokeRequestFactory(); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClient.java index b67d64f27..24b5119ab 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClient.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClient.java @@ -1,67 +1,77 @@ /* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.olingo.client.api; +import org.apache.olingo.client.api.communication.header.ODataHeaders; +import org.apache.olingo.client.api.communication.header.ODataPreferences; import org.apache.olingo.client.api.communication.request.AsyncRequestFactory; import org.apache.olingo.client.api.communication.request.batch.BatchRequestFactory; import org.apache.olingo.client.api.communication.request.cud.CUDRequestFactory; -import org.apache.olingo.client.api.communication.request.cud.UpdateType; +import org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory; import org.apache.olingo.client.api.communication.request.retrieve.RetrieveRequestFactory; import org.apache.olingo.client.api.serialization.ClientODataDeserializer; import org.apache.olingo.client.api.serialization.ODataBinder; import org.apache.olingo.client.api.serialization.ODataReader; +import org.apache.olingo.client.api.serialization.ODataWriter; import org.apache.olingo.client.api.uri.FilterFactory; import org.apache.olingo.client.api.uri.SearchFactory; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.commons.api.domain.ODataObjectFactory; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; import org.apache.olingo.commons.api.format.ODataFormat; +import org.apache.olingo.commons.api.serialization.ODataSerializer; -public interface ODataClient extends CommonODataClient { +public interface ODataClient { + + ODataServiceVersion getServiceVersion(); + + ODataHeaders newVersionHeaders(); + + Configuration getConfiguration(); + + ODataPreferences newPreferences(); + + ODataSerializer getSerializer(ODataFormat format); + + ODataWriter getWriter(); + + InvokeRequestFactory getInvokeRequestFactory(); - @Override ClientODataDeserializer getDeserializer(ODataFormat format); - @Override ODataReader getReader(); - @Override ODataBinder getBinder(); - @Override URIBuilder newURIBuilder(String serviceRoot); - - @Override + FilterFactory getFilterFactory(); SearchFactory getSearchFactory(); - @Override ODataObjectFactory getObjectFactory(); AsyncRequestFactory getAsyncRequestFactory(); - @Override RetrieveRequestFactory getRetrieveRequestFactory(); - @Override CUDRequestFactory getCUDRequestFactory(); - @Override BatchRequestFactory getBatchRequestFactory(); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataBatchableRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataBatchableRequest.java index 87a91ffd2..0d6283718 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataBatchableRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataBatchableRequest.java @@ -18,7 +18,7 @@ */ package org.apache.olingo.client.api.communication.request; -import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest; +import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest; /** * Object request that can be sent embedded into a batch request. @@ -32,7 +32,7 @@ public interface ODataBatchableRequest extends ODataRequest { * * @param req destination batch request. */ - void batch(final CommonODataBatchRequest req); + void batch(final ODataBatchRequest req); /** * Writes (and consume) the request onto the given batch stream. @@ -42,5 +42,5 @@ public interface ODataBatchableRequest extends ODataRequest { * @param req destination batch request. * @param contentId ContentId header value to be added to the serialization. Use this in case of changeset items. */ - void batch(final CommonODataBatchRequest req, final String contentId); + void batch(final ODataBatchRequest req, final String contentId); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/BatchRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/BatchRequestFactory.java index 48a08fc50..5d8b2308b 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/BatchRequestFactory.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/BatchRequestFactory.java @@ -19,11 +19,13 @@ package org.apache.olingo.client.api.communication.request.batch; -public interface BatchRequestFactory extends CommonBatchRequestFactory { +public interface BatchRequestFactory { /** - * {@inheritDoc } + * Gets a batch request object instance. + * + * @param serviceRoot service root. + * @return new ODataBatchRequest instance. */ - @Override ODataBatchRequest getBatchRequest(String serviceRoot); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/CommonBatchRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/CommonBatchRequestFactory.java deleted file mode 100644 index 27b723a83..000000000 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/CommonBatchRequestFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.client.api.communication.request.batch; - -/** - * OData batch request factory class. - */ -public interface CommonBatchRequestFactory { - - /** - * Gets a batch request object instance. - * - * @param serviceRoot service root. - * @return new ODataBatchRequest instance. - */ - CommonODataBatchRequest getBatchRequest(String serviceRoot); -} diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/CommonODataBatchRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/CommonODataBatchRequest.java deleted file mode 100644 index 466b26938..000000000 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/CommonODataBatchRequest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.client.api.communication.request.batch; - -import java.io.IOException; -import java.io.PipedOutputStream; - -/** - * This class implements a batch request. - */ -public interface CommonODataBatchRequest { - - /** - * Gets piped stream to be used to stream batch items. - * - * @return piped stream for the payload. - */ - PipedOutputStream getOutputStream(); - - /** - * Appends the given byte array to the payload. - * - * @param toBeStreamed byte array to be appended. - * @return the current batch request. - * @throws IOException in case of write errors. - */ - CommonODataBatchRequest rawAppend(final byte[] toBeStreamed) throws IOException; - - /** - * Appends the given byte array to the payload. - * - * @param toBeStreamed byte array to be appended. - * @param off byte array offset. - * @param len number of byte to be streamed. - * @return the current batch request. - * @throws IOException in case of write errors. - */ - CommonODataBatchRequest rawAppend(final byte[] toBeStreamed, int off, int len) throws IOException; -} diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/ODataBatchRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/ODataBatchRequest.java index 3a07e25ba..714d4ad4e 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/ODataBatchRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/ODataBatchRequest.java @@ -1,27 +1,56 @@ /* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.olingo.client.api.communication.request.batch; +import java.io.IOException; +import java.io.PipedOutputStream; + import org.apache.olingo.client.api.communication.request.ODataStreamedRequest; import org.apache.olingo.client.api.communication.response.ODataBatchResponse; -public interface ODataBatchRequest - extends CommonODataBatchRequest, ODataStreamedRequest { +public interface ODataBatchRequest extends ODataStreamedRequest { + + /** + * Gets piped stream to be used to stream batch items. + * + * @return piped stream for the payload. + */ + PipedOutputStream getOutputStream(); + + /** + * Appends the given byte array to the payload. + * + * @param toBeStreamed byte array to be appended. + * @return the current batch request. + * @throws IOException in case of write errors. + */ + ODataBatchRequest rawAppend(final byte[] toBeStreamed) throws IOException; + + /** + * Appends the given byte array to the payload. + * + * @param toBeStreamed byte array to be appended. + * @param off byte array offset. + * @param len number of byte to be streamed. + * @return the current batch request. + * @throws IOException in case of write errors. + */ + ODataBatchRequest rawAppend(final byte[] toBeStreamed, int off, int len) throws IOException; } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CUDRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CUDRequestFactory.java index 53c67ffea..9cc35c589 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CUDRequestFactory.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CUDRequestFactory.java @@ -18,11 +18,145 @@ */ package org.apache.olingo.client.api.communication.request.cud; +import java.io.InputStream; import java.net.URI; +import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest; +import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest; +import org.apache.olingo.client.api.communication.request.streamed.ODataStreamUpdateRequest; +import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; +import org.apache.olingo.commons.api.domain.ODataProperty; import org.apache.olingo.commons.api.domain.ODataSingleton; -public interface CUDRequestFactory extends CommonCUDRequestFactory { +public interface CUDRequestFactory { + + /** + * Gets a create request object instance. + *
+ * Use this kind of request to create a new entity. + * + * @param concrete ODataEntity implementation + * @param targetURI entity set URI. + * @param entity entity to be created. + * @return new ODataEntityCreateRequest instance. + */ + ODataEntityCreateRequest getEntityCreateRequest(URI targetURI, E entity); + + /** + * Gets an update request object instance. + * + * @param concrete ODataEntity implementation + * @param targetURI edit link of the object to be updated. + * @param type type of update to be performed. + * @param changes changes to be applied. + * @return new ODataEntityUpdateRequest instance. + */ + ODataEntityUpdateRequest getEntityUpdateRequest(URI targetURI, UpdateType type, E changes); + + /** + * Gets an update request object instance; uses entity's edit link as endpoint. + * + * @param concrete ODataEntity implementation + * @param type type of update to be performed. + * @param entity changes to be applied. + * @return new ODataEntityUpdateRequest instance. + */ + ODataEntityUpdateRequest getEntityUpdateRequest(UpdateType type, E entity); + + /** + * Gets a create request object instance. + *
+ * Use this kind of request to create a new value (e.g. http://Northwind.svc/Customer(1)/Picture/$value). + * + * @param targetURI entity set or entity or entity property URI. + * @param type type of update to be performed. + * @param value value to be created. + * @return new ODataValueUpdateRequest instance. + */ + ODataValueUpdateRequest getValueUpdateRequest(URI targetURI, UpdateType type, ODataPrimitiveValue value); + + /** + * Gets an update request object instance. + *
+ * Use this kind of request to update a primitive property value. + * + * @param targetURI entity set or entity or entity property URI. + * @param property value to be update. + * @return new ODataPropertyUpdateRequest instance. + */ + ODataPropertyUpdateRequest getPropertyPrimitiveValueUpdateRequest(URI targetURI, ODataProperty property); + + /** + * Gets an update request object instance. + *
+ * Use this kind of request to update a complex property value. + * + * @param targetURI entity set or entity or entity property URI. + * @param type type of update to be performed. + * @param property value to be update. + * @return new ODataPropertyUpdateRequest instance. + */ + ODataPropertyUpdateRequest + getPropertyComplexValueUpdateRequest(URI targetURI, UpdateType type, ODataProperty property); + + /** + * Gets an update request object instance. + *
+ * Use this kind of request to update a collection property value. + * + * @param targetURI entity set or entity or entity property URI. + * @param property value to be update. + * @return new ODataPropertyUpdateRequest instance. + */ + ODataPropertyUpdateRequest getPropertyCollectionValueUpdateRequest(URI targetURI, ODataProperty property); + + /** + * Gets a delete request object instance. + *
+ * Use this kind of request to delete an entity and media entity as well. + * + * @param targetURI edit link of the object to be removed. + * @return new ODataDeleteRequest instance. + */ + ODataDeleteRequest getDeleteRequest(URI targetURI); + + /** + * Gets a media entity create request object instance. + *
+ * Use this kind of request to create a new media entity. + * + * @param concrete ODataEntity implementation + * @param targetURI entity set URI. + * @param media entity blob to be created. + * @return new ODataMediaEntityCreateRequest instance. + */ + ODataMediaEntityCreateRequest getMediaEntityCreateRequest( + URI targetURI, InputStream media); + + /** + * Gets a stream update request object instance. + *
+ * Use this kind of request to update a named stream property. + * + * @param targetURI target URI. + * @param stream stream to be updated. + * @return new ODataStreamUpdateRequest instance. + */ + ODataStreamUpdateRequest getStreamUpdateRequest(URI targetURI, InputStream stream); + + /** + * Gets a media entity update request object instance. + *
+ * Use this kind of request to update a media entity. + * + * @param concrete ODataEntity implementation + * @param editURI media entity edit link URI. + * @param media entity blob to be updated. + * @return new ODataMediaEntityUpdateRequest instance. + */ + ODataMediaEntityUpdateRequest getMediaEntityUpdateRequest( + URI editURI, InputStream media); ODataEntityUpdateRequest getSingletonUpdateRequest( URI targetURI, UpdateType type, ODataSingleton changes); diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java deleted file mode 100644 index 6cd6c9246..000000000 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.client.api.communication.request.cud; - -import java.io.InputStream; -import java.net.URI; - -import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest; -import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest; -import org.apache.olingo.client.api.communication.request.streamed.ODataStreamUpdateRequest; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; - -/** - * OData request factory class. - * - * @param concrete UpdateType. - */ -public interface CommonCUDRequestFactory { - - /** - * Gets a create request object instance. - *
- * Use this kind of request to create a new entity. - * - * @param concrete ODataEntity implementation - * @param targetURI entity set URI. - * @param entity entity to be created. - * @return new ODataEntityCreateRequest instance. - */ - ODataEntityCreateRequest getEntityCreateRequest(URI targetURI, E entity); - - /** - * Gets an update request object instance. - * - * @param concrete ODataEntity implementation - * @param targetURI edit link of the object to be updated. - * @param type type of update to be performed. - * @param changes changes to be applied. - * @return new ODataEntityUpdateRequest instance. - */ - ODataEntityUpdateRequest getEntityUpdateRequest(URI targetURI, UT type, E changes); - - /** - * Gets an update request object instance; uses entity's edit link as endpoint. - * - * @param concrete ODataEntity implementation - * @param type type of update to be performed. - * @param entity changes to be applied. - * @return new ODataEntityUpdateRequest instance. - */ - ODataEntityUpdateRequest getEntityUpdateRequest(UT type, E entity); - - /** - * Gets a create request object instance. - *
- * Use this kind of request to create a new value (e.g. http://Northwind.svc/Customer(1)/Picture/$value). - * - * @param targetURI entity set or entity or entity property URI. - * @param type type of update to be performed. - * @param value value to be created. - * @return new ODataValueUpdateRequest instance. - */ - ODataValueUpdateRequest getValueUpdateRequest(URI targetURI, UT type, ODataPrimitiveValue value); - - /** - * Gets an update request object instance. - *
- * Use this kind of request to update a primitive property value. - * - * @param targetURI entity set or entity or entity property URI. - * @param property value to be update. - * @return new ODataPropertyUpdateRequest instance. - */ - ODataPropertyUpdateRequest getPropertyPrimitiveValueUpdateRequest(URI targetURI, ODataProperty property); - - /** - * Gets an update request object instance. - *
- * Use this kind of request to update a complex property value. - * - * @param targetURI entity set or entity or entity property URI. - * @param type type of update to be performed. - * @param property value to be update. - * @return new ODataPropertyUpdateRequest instance. - */ - ODataPropertyUpdateRequest getPropertyComplexValueUpdateRequest(URI targetURI, UT type, ODataProperty property); - - /** - * Gets an update request object instance. - *
- * Use this kind of request to update a collection property value. - * - * @param targetURI entity set or entity or entity property URI. - * @param property value to be update. - * @return new ODataPropertyUpdateRequest instance. - */ - ODataPropertyUpdateRequest getPropertyCollectionValueUpdateRequest(URI targetURI, ODataProperty property); - - /** - * Gets a delete request object instance. - *
- * Use this kind of request to delete an entity and media entity as well. - * - * @param targetURI edit link of the object to be removed. - * @return new ODataDeleteRequest instance. - */ - ODataDeleteRequest getDeleteRequest(URI targetURI); - - /** - * Gets a media entity create request object instance. - *
- * Use this kind of request to create a new media entity. - * - * @param concrete ODataEntity implementation - * @param targetURI entity set URI. - * @param media entity blob to be created. - * @return new ODataMediaEntityCreateRequest instance. - */ - ODataMediaEntityCreateRequest getMediaEntityCreateRequest( - URI targetURI, InputStream media); - - /** - * Gets a stream update request object instance. - *
- * Use this kind of request to update a named stream property. - * - * @param targetURI target URI. - * @param stream stream to be updated. - * @return new ODataStreamUpdateRequest instance. - */ - ODataStreamUpdateRequest getStreamUpdateRequest(URI targetURI, InputStream stream); - - /** - * Gets a media entity update request object instance. - *
- * Use this kind of request to update a media entity. - * - * @param concrete ODataEntity implementation - * @param editURI media entity edit link URI. - * @param media entity blob to be updated. - * @return new ODataMediaEntityUpdateRequest instance. - */ - ODataMediaEntityUpdateRequest getMediaEntityUpdateRequest( - URI editURI, InputStream media); -} diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonUpdateType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonUpdateType.java deleted file mode 100644 index 94168cec2..000000000 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonUpdateType.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.client.api.communication.request.cud; - -import org.apache.olingo.commons.api.http.HttpMethod; - -public interface CommonUpdateType { - - /** - * Gets HTTP request method. - * - * @return HTTP request method. - */ - HttpMethod getMethod(); -} diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/UpdateType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/UpdateType.java index 07a1b62f7..23481dc1c 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/UpdateType.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/UpdateType.java @@ -23,7 +23,7 @@ import org.apache.olingo.commons.api.http.HttpMethod; /** * Update type. */ -public enum UpdateType implements CommonUpdateType { +public enum UpdateType { /** * Replace all and remove missing attributes. @@ -39,13 +39,12 @@ public enum UpdateType implements CommonUpdateType { private UpdateType(final HttpMethod method) { this.method = method; } - + /** * Gets HTTP request method. * * @return HTTP request method. */ - @Override public HttpMethod getMethod() { return method; } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java index da0eb2f4f..2944471fd 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java @@ -29,7 +29,7 @@ import java.util.NoSuchElementException; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.ResWrap; @@ -56,7 +56,7 @@ public class ODataEntitySetIterator odataClient; + protected final ODataClient odataClient; protected ResWrap cached; @@ -79,7 +79,7 @@ public class ODataEntitySetIterator odataClient, final InputStream stream, + public ODataEntitySetIterator(final ODataClient odataClient, final InputStream stream, final ODataFormat format) { this.odataClient = odataClient; diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java deleted file mode 100644 index 5f04a4bc6..000000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.client.core; - -import org.apache.olingo.client.api.CommonODataClient; -import org.apache.olingo.client.api.Configuration; -import org.apache.olingo.client.api.communication.header.ODataPreferences; -import org.apache.olingo.client.api.communication.request.cud.CommonUpdateType; -import org.apache.olingo.client.api.serialization.ODataWriter; -import org.apache.olingo.client.core.serialization.ODataWriterImpl; - -public abstract class AbstractODataClient implements CommonODataClient { - - protected final Configuration configuration = new ConfigurationImpl(); - - private final ODataWriter writer = new ODataWriterImpl(this); - - @Override - public Configuration getConfiguration() { - return configuration; - } - - @Override - public ODataPreferences newPreferences() { - return new ODataPreferences(getServiceVersion()); - } - - @Override - public ODataWriter getWriter() { - return writer; - } - -} diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java index e4cf2e75e..8fce369d7 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java @@ -26,7 +26,7 @@ import org.apache.olingo.commons.api.format.ODataFormat; public final class ODataClientFactory { public static ODataClient getV4() { - return new org.apache.olingo.client.core.ODataClientImpl(); + return new ODataClientImpl(); } public static EdmEnabledODataClient getEdmEnabledV4(final String serviceRoot) { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientImpl.java index 6d05785e3..a01ccfb71 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientImpl.java @@ -18,18 +18,20 @@ */ package org.apache.olingo.client.core; +import org.apache.olingo.client.api.Configuration; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.header.HeaderName; import org.apache.olingo.client.api.communication.header.ODataHeaders; +import org.apache.olingo.client.api.communication.header.ODataPreferences; import org.apache.olingo.client.api.communication.request.AsyncRequestFactory; import org.apache.olingo.client.api.communication.request.batch.BatchRequestFactory; import org.apache.olingo.client.api.communication.request.cud.CUDRequestFactory; -import org.apache.olingo.client.api.communication.request.cud.UpdateType; import org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory; import org.apache.olingo.client.api.communication.request.retrieve.RetrieveRequestFactory; import org.apache.olingo.client.api.serialization.ClientODataDeserializer; import org.apache.olingo.client.api.serialization.ODataBinder; import org.apache.olingo.client.api.serialization.ODataReader; +import org.apache.olingo.client.api.serialization.ODataWriter; import org.apache.olingo.client.api.uri.FilterFactory; import org.apache.olingo.client.api.uri.SearchFactory; import org.apache.olingo.client.api.uri.URIBuilder; @@ -42,6 +44,7 @@ import org.apache.olingo.client.core.communication.request.retrieve.RetrieveRequ import org.apache.olingo.client.core.serialization.ClientODataDeserializerImpl; import org.apache.olingo.client.core.serialization.ODataBinderImpl; import org.apache.olingo.client.core.serialization.ODataReaderImpl; +import org.apache.olingo.client.core.serialization.ODataWriterImpl; import org.apache.olingo.client.core.uri.FilterFactoryImpl; import org.apache.olingo.client.core.uri.URIBuilderImpl; import org.apache.olingo.commons.api.domain.ODataObjectFactory; @@ -52,7 +55,7 @@ import org.apache.olingo.commons.core.domain.ODataObjectFactoryImpl; import org.apache.olingo.commons.core.serialization.AtomSerializer; import org.apache.olingo.commons.core.serialization.JsonSerializer; -public class ODataClientImpl extends AbstractODataClient implements ODataClient { +public class ODataClientImpl implements ODataClient { private final FilterFactory filterFactory = new FilterFactoryImpl(getServiceVersion()); @@ -74,6 +77,25 @@ public class ODataClientImpl extends AbstractODataClient implements private final BatchRequestFactory batchReqFact = new BatchRequestFactoryImpl(this); + protected final Configuration configuration = new ConfigurationImpl(); + + private final ODataWriter writer = new ODataWriterImpl(this); + + @Override + public Configuration getConfiguration() { + return configuration; + } + + @Override + public ODataPreferences newPreferences() { + return new ODataPreferences(getServiceVersion()); + } + + @Override + public ODataWriter getWriter() { + return writer; + } + @Override public ODataServiceVersion getServiceVersion() { return ODataServiceVersion.V40; diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataErrorResponseChecker.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataErrorResponseChecker.java index e81be7926..f1cc64a42 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataErrorResponseChecker.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataErrorResponseChecker.java @@ -21,7 +21,7 @@ package org.apache.olingo.client.core.communication.header; import java.io.InputStream; import org.apache.http.StatusLine; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.ODataClientErrorException; import org.apache.olingo.client.api.communication.ODataServerErrorException; import org.apache.olingo.commons.api.ODataRuntimeException; @@ -43,7 +43,7 @@ public final class ODataErrorResponseChecker { } public static ODataRuntimeException checkResponse( - final CommonODataClient odataClient, final StatusLine statusLine, final InputStream entity, + final ODataClient odataClient, final StatusLine statusLine, final InputStream entity, final String accept) { ODataRuntimeException result = null; diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java index 456602077..bbd521559 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java @@ -26,11 +26,11 @@ import java.util.concurrent.Future; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.olingo.client.api.CommonODataClient; import org.apache.olingo.client.api.ODataBatchConstants; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.ODataBasicRequest; import org.apache.olingo.client.api.communication.request.ODataStreamer; -import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest; +import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest; import org.apache.olingo.client.api.communication.response.ODataResponse; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpMethod; @@ -50,7 +50,7 @@ public abstract class AbstractODataBasicRequest * @param method request method. * @param uri OData request URI. */ - public AbstractODataBasicRequest(final CommonODataClient odataClient, final HttpMethod method, final URI uri) { + public AbstractODataBasicRequest(final ODataClient odataClient, final HttpMethod method, final URI uri) { super(odataClient, method, uri); } @@ -85,7 +85,7 @@ public abstract class AbstractODataBasicRequest * * @param req destination batch request. */ - public void batch(final CommonODataBatchRequest req) { + public void batch(final ODataBatchRequest req) { batch(req, null); } @@ -97,7 +97,7 @@ public abstract class AbstractODataBasicRequest * @param req destination batch request. * @param contentId contentId of the changeset item. */ - public void batch(final CommonODataBatchRequest req, final String contentId) { + public void batch(final ODataBatchRequest req, final String contentId) { try { req.rawAppend(toByteArray()); if (StringUtils.isNotBlank(contentId)) { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java index a5b267cad..0b250b067 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java @@ -33,7 +33,7 @@ import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.impl.client.DecompressingHttpClient; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.header.HeaderName; import org.apache.olingo.client.api.communication.header.ODataHeaders; import org.apache.olingo.client.api.communication.request.ODataRequest; @@ -55,7 +55,7 @@ import org.apache.olingo.commons.api.http.HttpMethod; */ public abstract class AbstractODataRequest extends AbstractRequest implements ODataRequest { - protected final CommonODataClient odataClient; + protected final ODataClient odataClient; /** * OData request method. @@ -89,7 +89,7 @@ public abstract class AbstractODataRequest extends AbstractRequest implements OD * @param method HTTP request method. If configured X-HTTP-METHOD header will be used. * @param uri OData request URI. */ - protected AbstractODataRequest(final CommonODataClient odataClient, final HttpMethod method, final URI uri) { + protected AbstractODataRequest(final ODataClient odataClient, final HttpMethod method, final URI uri) { super(); this.odataClient = odataClient; @@ -344,7 +344,7 @@ public abstract class AbstractODataRequest extends AbstractRequest implements OD if (ODataResponse.class.isAssignableFrom(clazz)) { try { final Constructor constructor = clazz.getDeclaredConstructor( - this.getClass(), CommonODataClient.class, HttpClient.class, HttpResponse.class); + this.getClass(), ODataClient.class, HttpClient.class, HttpResponse.class); constructor.setAccessible(true); return (V) constructor.newInstance(this, odataClient, httpClient, null); } catch (Exception e) { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractRequest.java index 5fb417eff..9c004e240 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractRequest.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractRequest.java @@ -19,8 +19,8 @@ import java.io.IOException; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpUriRequest; -import org.apache.olingo.client.api.CommonEdmEnabledODataClient; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.EdmEnabledODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.core.communication.header.ODataErrorResponseChecker; import org.apache.olingo.commons.api.ODataRuntimeException; import org.slf4j.Logger; @@ -33,21 +33,21 @@ public abstract class AbstractRequest { */ protected static final Logger LOG = LoggerFactory.getLogger(AbstractRequest.class); - protected void checkRequest(final CommonODataClient odataClient, final HttpUriRequest request) { + protected void checkRequest(final ODataClient odataClient, final HttpUriRequest request) { // If using and Edm enabled client, checks that the cached service root matches the request URI - if (odataClient instanceof CommonEdmEnabledODataClient + if (odataClient instanceof EdmEnabledODataClient && !request.getURI().toASCIIString().startsWith( - ((CommonEdmEnabledODataClient) odataClient).getServiceRoot())) { + ((EdmEnabledODataClient) odataClient).getServiceRoot())) { throw new IllegalArgumentException( String.format("The current request URI %s does not match the configured service root %s", request.getURI().toASCIIString(), - ((CommonEdmEnabledODataClient) odataClient).getServiceRoot())); + ((EdmEnabledODataClient) odataClient).getServiceRoot())); } } protected void checkResponse( - final CommonODataClient odataClient, final HttpResponse response, final String accept) { + final ODataClient odataClient, final HttpResponse response, final String accept) { if (response.getStatusLine().getStatusCode() >= 400) { try { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchManager.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchManager.java index 0aa6ea74d..5609363f1 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchManager.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchManager.java @@ -23,7 +23,7 @@ import java.util.concurrent.TimeUnit; import org.apache.http.HttpResponse; import org.apache.olingo.client.api.communication.request.ODataBatchableRequest; -import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest; +import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest; import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequestItem; import org.apache.olingo.client.api.communication.request.batch.ODataChangeset; import org.apache.olingo.client.api.communication.request.batch.ODataSingleRequest; @@ -46,9 +46,9 @@ public abstract class AbstractBatchManager extends AbstractODataStreamManager> futureWrap, final boolean continueOnError) { super(futureWrap); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchRequestFactory.java deleted file mode 100644 index e0cbac7ac..000000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchRequestFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE - * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.olingo.client.core.communication.request.batch; - -import org.apache.olingo.client.api.CommonODataClient; -import org.apache.olingo.client.api.communication.request.batch.CommonBatchRequestFactory; - -/** - * OData batch request factory class. - */ -public abstract class AbstractBatchRequestFactory implements CommonBatchRequestFactory { - - protected final CommonODataClient client; - - protected AbstractBatchRequestFactory(final CommonODataClient client) { - this.client = client; - } -} diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractODataBatchRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractODataBatchRequest.java index ce2d8392b..d99cf9c72 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractODataBatchRequest.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractODataBatchRequest.java @@ -24,10 +24,10 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; -import org.apache.olingo.client.api.CommonODataClient; import org.apache.olingo.client.api.ODataBatchConstants; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.ODataPayloadManager; -import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest; +import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest; import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem; import org.apache.olingo.client.api.communication.response.ODataResponse; import org.apache.olingo.client.core.communication.request.streamed.AbstractODataStreamedRequest; @@ -56,7 +56,7 @@ public abstract class AbstractODataBatchRequest odataClient, final URI uri) { + protected AbstractODataBatchRequest(final ODataClient odataClient, final URI uri) { super(odataClient, HttpMethod.POST, uri); // create a random UUID value for boundary @@ -80,7 +80,7 @@ public abstract class AbstractODataBatchRequest odataClient, final HttpClient httpClient, final HttpResponse res) { + final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataChangesetImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataChangesetImpl.java index 6053520b0..ce6155aaf 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataChangesetImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataChangesetImpl.java @@ -22,7 +22,7 @@ import java.util.UUID; import org.apache.olingo.client.api.communication.header.HeaderName; import org.apache.olingo.client.api.communication.request.ODataBatchableRequest; -import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest; +import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest; import org.apache.olingo.client.api.communication.request.batch.ODataChangeset; import org.apache.olingo.client.core.communication.request.AbstractODataRequest; import org.apache.olingo.commons.api.format.ContentType; @@ -55,7 +55,7 @@ public class ODataChangesetImpl extends AbstractODataBatchRequestItem * @param req batch request. * @param expectedResItem expected OData response items. */ - ODataChangesetImpl(final CommonODataBatchRequest req, final ODataChangesetResponseItem expectedResItem) { + ODataChangesetImpl(final ODataBatchRequest req, final ODataChangesetResponseItem expectedResItem) { super(req); this.expectedResItem = expectedResItem; diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataSingleRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataSingleRequestImpl.java index a82e1154a..af1c7154c 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataSingleRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataSingleRequestImpl.java @@ -19,7 +19,7 @@ package org.apache.olingo.client.core.communication.request.batch; import org.apache.olingo.client.api.communication.request.ODataBatchableRequest; -import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest; +import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest; import org.apache.olingo.client.api.communication.request.batch.ODataSingleRequest; import org.apache.olingo.client.core.communication.request.AbstractODataRequest; import org.apache.olingo.commons.api.http.HttpMethod; @@ -37,7 +37,7 @@ public class ODataSingleRequestImpl extends AbstractODataBatchRequestItem implem * @param req batch request. * @param expectedResItem expected batch response item. */ - ODataSingleRequestImpl(final CommonODataBatchRequest req, final ODataSingleResponseItem expectedResItem) { + ODataSingleRequestImpl(final ODataBatchRequest req, final ODataSingleResponseItem expectedResItem) { super(req); this.expectedResItem = expectedResItem; } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java deleted file mode 100644 index d73162fc1..000000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.client.core.communication.request.cud; - -import java.io.InputStream; -import java.net.URI; - -import org.apache.olingo.client.api.CommonODataClient; -import org.apache.olingo.client.api.communication.request.cud.CommonCUDRequestFactory; -import org.apache.olingo.client.api.communication.request.cud.CommonUpdateType; -import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest; -import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest; -import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest; -import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest; -import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest; -import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest; -import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest; -import org.apache.olingo.client.api.communication.request.streamed.ODataStreamUpdateRequest; -import org.apache.olingo.client.core.communication.request.streamed.ODataMediaEntityCreateRequestImpl; -import org.apache.olingo.client.core.communication.request.streamed.ODataMediaEntityUpdateRequestImpl; -import org.apache.olingo.client.core.communication.request.streamed.ODataStreamUpdateRequestImpl; -import org.apache.olingo.client.core.uri.URIUtils; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.http.HttpMethod; - -public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFactory { - - protected final CommonODataClient client; - - protected AbstractCUDRequestFactory(final CommonODataClient client) { - this.client = client; - } - - @Override - public ODataEntityCreateRequest getEntityCreateRequest( - final URI targetURI, final E entity) { - - return new ODataEntityCreateRequestImpl(client, targetURI, entity); - } - - @Override - public ODataEntityUpdateRequest getEntityUpdateRequest( - final URI targetURI, final UT type, final E changes) { - - final ODataEntityUpdateRequest req; - - if (client.getConfiguration().isUseXHTTPMethod()) { - req = new ODataEntityUpdateRequestImpl(client, HttpMethod.POST, targetURI, changes); - req.setXHTTPMethod(type.getMethod().name()); - } else { - req = new ODataEntityUpdateRequestImpl(client, type.getMethod(), targetURI, changes); - } - - return req; - } - - @Override - public ODataEntityUpdateRequest getEntityUpdateRequest( - final UT type, final E entity) { - - if (entity.getEditLink() == null) { - throw new IllegalArgumentException("No edit link found"); - } - - final ODataEntityUpdateRequest req; - - if (client.getConfiguration().isUseXHTTPMethod()) { - req = new ODataEntityUpdateRequestImpl(client, HttpMethod.POST, entity.getEditLink(), entity); - req.setXHTTPMethod(type.getMethod().name()); - } else { - req = new ODataEntityUpdateRequestImpl(client, type.getMethod(), entity.getEditLink(), entity); - } - - return req; - } - - @Override - public ODataValueUpdateRequest getValueUpdateRequest( - final URI targetURI, final UT type, final ODataPrimitiveValue value) { - - final ODataValueUpdateRequest req; - - if (client.getConfiguration().isUseXHTTPMethod()) { - req = new ODataValueUpdateRequestImpl(client, HttpMethod.POST, URIUtils.addValueSegment(targetURI), value); - req.setXHTTPMethod(type.getMethod().name()); - } else { - req = new ODataValueUpdateRequestImpl(client, type.getMethod(), URIUtils.addValueSegment(targetURI), value); - } - - return req; - } - - @Override - public ODataPropertyUpdateRequest getPropertyPrimitiveValueUpdateRequest( - final URI targetURI, final ODataProperty property) { - - if (!property.hasPrimitiveValue()) { - throw new IllegalArgumentException("A primitive value is required"); - } - - final ODataPropertyUpdateRequest req; - - if (client.getConfiguration().isUseXHTTPMethod()) { - req = new ODataPropertyUpdateRequestImpl(client, HttpMethod.POST, targetURI, property); - req.setXHTTPMethod(HttpMethod.PUT.name()); - } else { - req = new ODataPropertyUpdateRequestImpl(client, HttpMethod.PUT, targetURI, property); - } - - return req; - } - - @Override - public ODataPropertyUpdateRequest getPropertyComplexValueUpdateRequest( - final URI targetURI, final UT type, final ODataProperty property) { - - if (!property.hasComplexValue()) { - throw new IllegalArgumentException("A complex value is required"); - } - - final ODataPropertyUpdateRequest req; - - if (client.getConfiguration().isUseXHTTPMethod()) { - req = new ODataPropertyUpdateRequestImpl(client, HttpMethod.POST, targetURI, property); - req.setXHTTPMethod(type.getMethod().name()); - } else { - req = new ODataPropertyUpdateRequestImpl(client, type.getMethod(), targetURI, property); - } - - return req; - } - - @Override - public ODataPropertyUpdateRequest getPropertyCollectionValueUpdateRequest( - final URI targetURI, final ODataProperty property) { - - if (!property.hasCollectionValue()) { - throw new IllegalArgumentException("A collection value is required"); - } - - final ODataPropertyUpdateRequest req; - - if (client.getConfiguration().isUseXHTTPMethod()) { - req = new ODataPropertyUpdateRequestImpl(client, HttpMethod.POST, targetURI, property); - req.setXHTTPMethod(HttpMethod.PUT.name()); - } else { - req = new ODataPropertyUpdateRequestImpl(client, HttpMethod.PUT, targetURI, property); - } - - return req; - } - - @Override - public ODataDeleteRequest getDeleteRequest(final URI targetURI) { - final ODataDeleteRequest req; - - if (client.getConfiguration().isUseXHTTPMethod()) { - req = new ODataDeleteRequestImpl(client, HttpMethod.POST, targetURI); - req.setXHTTPMethod(HttpMethod.DELETE.name()); - } else { - req = new ODataDeleteRequestImpl(client, HttpMethod.DELETE, targetURI); - } - - return req; - } - - @Override - public ODataMediaEntityCreateRequest getMediaEntityCreateRequest( - final URI targetURI, final InputStream media) { - - return new ODataMediaEntityCreateRequestImpl(client, targetURI, media); - } - - @Override - public ODataStreamUpdateRequest getStreamUpdateRequest(final URI targetURI, final InputStream stream) { - final ODataStreamUpdateRequest req; - - if (client.getConfiguration().isUseXHTTPMethod()) { - req = new ODataStreamUpdateRequestImpl(client, HttpMethod.POST, targetURI, stream); - req.setXHTTPMethod(HttpMethod.PUT.name()); - } else { - req = new ODataStreamUpdateRequestImpl(client, HttpMethod.PUT, targetURI, stream); - } - - return req; - } - - @Override - public ODataMediaEntityUpdateRequest getMediaEntityUpdateRequest( - final URI editURI, final InputStream media) { - - final ODataMediaEntityUpdateRequest req; - - if (client.getConfiguration().isUseXHTTPMethod()) { - req = new ODataMediaEntityUpdateRequestImpl(client, HttpMethod.POST, URIUtils.addValueSegment(editURI), media); - req.setXHTTPMethod(HttpMethod.PUT.name()); - } else { - req = new ODataMediaEntityUpdateRequestImpl(client, HttpMethod.PUT, URIUtils.addValueSegment(editURI), media); - } - - return req; - } -} diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/CUDRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/CUDRequestFactoryImpl.java index b0b48ba49..89a0449dd 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/CUDRequestFactoryImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/CUDRequestFactoryImpl.java @@ -18,35 +18,222 @@ */ package org.apache.olingo.client.core.communication.request.cud; +import java.io.InputStream; import java.net.URI; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.cud.CUDRequestFactory; +import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest; +import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest; import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest; +import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest; import org.apache.olingo.client.api.communication.request.cud.ODataReferenceAddingRequest; +import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest; import org.apache.olingo.client.api.communication.request.cud.UpdateType; +import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest; +import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest; +import org.apache.olingo.client.api.communication.request.streamed.ODataStreamUpdateRequest; +import org.apache.olingo.client.core.communication.request.streamed.ODataMediaEntityCreateRequestImpl; +import org.apache.olingo.client.core.communication.request.streamed.ODataMediaEntityUpdateRequestImpl; +import org.apache.olingo.client.core.communication.request.streamed.ODataStreamUpdateRequestImpl; +import org.apache.olingo.client.core.uri.URIUtils; import org.apache.olingo.commons.api.data.ResWrap; +import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; +import org.apache.olingo.commons.api.domain.ODataProperty; import org.apache.olingo.commons.api.domain.ODataSingleton; import org.apache.olingo.commons.api.http.HttpMethod; -public class CUDRequestFactoryImpl extends AbstractCUDRequestFactory implements CUDRequestFactory { +public class CUDRequestFactoryImpl implements CUDRequestFactory { + + protected final ODataClient client; public CUDRequestFactoryImpl(final ODataClient client) { - super(client); + this.client = client; + } + + @Override + public ODataEntityCreateRequest getEntityCreateRequest( + final URI targetURI, final E entity) { + + return new ODataEntityCreateRequestImpl(client, targetURI, entity); + } + + @Override + public ODataEntityUpdateRequest getEntityUpdateRequest( + final URI targetURI, final UpdateType type, final E changes) { + + final ODataEntityUpdateRequest req; + + if (client.getConfiguration().isUseXHTTPMethod()) { + req = new ODataEntityUpdateRequestImpl(client, HttpMethod.POST, targetURI, changes); + req.setXHTTPMethod(type.getMethod().name()); + } else { + req = new ODataEntityUpdateRequestImpl(client, type.getMethod(), targetURI, changes); + } + + return req; + } + + @Override + public ODataEntityUpdateRequest getEntityUpdateRequest( + final UpdateType type, final E entity) { + + if (entity.getEditLink() == null) { + throw new IllegalArgumentException("No edit link found"); + } + + final ODataEntityUpdateRequest req; + + if (client.getConfiguration().isUseXHTTPMethod()) { + req = new ODataEntityUpdateRequestImpl(client, HttpMethod.POST, entity.getEditLink(), entity); + req.setXHTTPMethod(type.getMethod().name()); + } else { + req = new ODataEntityUpdateRequestImpl(client, type.getMethod(), entity.getEditLink(), entity); + } + + return req; + } + + @Override + public ODataValueUpdateRequest getValueUpdateRequest( + final URI targetURI, final UpdateType type, final ODataPrimitiveValue value) { + + final ODataValueUpdateRequest req; + + if (client.getConfiguration().isUseXHTTPMethod()) { + req = new ODataValueUpdateRequestImpl(client, HttpMethod.POST, URIUtils.addValueSegment(targetURI), value); + req.setXHTTPMethod(type.getMethod().name()); + } else { + req = new ODataValueUpdateRequestImpl(client, type.getMethod(), URIUtils.addValueSegment(targetURI), value); + } + + return req; + } + + @Override + public ODataPropertyUpdateRequest getPropertyPrimitiveValueUpdateRequest( + final URI targetURI, final ODataProperty property) { + + if (!property.hasPrimitiveValue()) { + throw new IllegalArgumentException("A primitive value is required"); + } + + final ODataPropertyUpdateRequest req; + + if (client.getConfiguration().isUseXHTTPMethod()) { + req = new ODataPropertyUpdateRequestImpl(client, HttpMethod.POST, targetURI, property); + req.setXHTTPMethod(HttpMethod.PUT.name()); + } else { + req = new ODataPropertyUpdateRequestImpl(client, HttpMethod.PUT, targetURI, property); + } + + return req; + } + + @Override + public ODataPropertyUpdateRequest getPropertyComplexValueUpdateRequest( + final URI targetURI, final UpdateType type, final ODataProperty property) { + + if (!property.hasComplexValue()) { + throw new IllegalArgumentException("A complex value is required"); + } + + final ODataPropertyUpdateRequest req; + + if (client.getConfiguration().isUseXHTTPMethod()) { + req = new ODataPropertyUpdateRequestImpl(client, HttpMethod.POST, targetURI, property); + req.setXHTTPMethod(type.getMethod().name()); + } else { + req = new ODataPropertyUpdateRequestImpl(client, type.getMethod(), targetURI, property); + } + + return req; + } + + @Override + public ODataPropertyUpdateRequest getPropertyCollectionValueUpdateRequest( + final URI targetURI, final ODataProperty property) { + + if (!property.hasCollectionValue()) { + throw new IllegalArgumentException("A collection value is required"); + } + + final ODataPropertyUpdateRequest req; + + if (client.getConfiguration().isUseXHTTPMethod()) { + req = new ODataPropertyUpdateRequestImpl(client, HttpMethod.POST, targetURI, property); + req.setXHTTPMethod(HttpMethod.PUT.name()); + } else { + req = new ODataPropertyUpdateRequestImpl(client, HttpMethod.PUT, targetURI, property); + } + + return req; + } + + @Override + public ODataDeleteRequest getDeleteRequest(final URI targetURI) { + final ODataDeleteRequest req; + + if (client.getConfiguration().isUseXHTTPMethod()) { + req = new ODataDeleteRequestImpl(client, HttpMethod.POST, targetURI); + req.setXHTTPMethod(HttpMethod.DELETE.name()); + } else { + req = new ODataDeleteRequestImpl(client, HttpMethod.DELETE, targetURI); + } + + return req; + } + + @Override + public ODataMediaEntityCreateRequest getMediaEntityCreateRequest( + final URI targetURI, final InputStream media) { + + return new ODataMediaEntityCreateRequestImpl(client, targetURI, media); + } + + @Override + public ODataStreamUpdateRequest getStreamUpdateRequest(final URI targetURI, final InputStream stream) { + final ODataStreamUpdateRequest req; + + if (client.getConfiguration().isUseXHTTPMethod()) { + req = new ODataStreamUpdateRequestImpl(client, HttpMethod.POST, targetURI, stream); + req.setXHTTPMethod(HttpMethod.PUT.name()); + } else { + req = new ODataStreamUpdateRequestImpl(client, HttpMethod.PUT, targetURI, stream); + } + + return req; + } + + @Override + public ODataMediaEntityUpdateRequest getMediaEntityUpdateRequest( + final URI editURI, final InputStream media) { + + final ODataMediaEntityUpdateRequest req; + + if (client.getConfiguration().isUseXHTTPMethod()) { + req = new ODataMediaEntityUpdateRequestImpl(client, HttpMethod.POST, URIUtils.addValueSegment(editURI), media); + req.setXHTTPMethod(HttpMethod.PUT.name()); + } else { + req = new ODataMediaEntityUpdateRequestImpl(client, HttpMethod.PUT, URIUtils.addValueSegment(editURI), media); + } + + return req; } @Override public ODataEntityUpdateRequest getSingletonUpdateRequest( - final UpdateType type, final ODataSingleton entity) { + final UpdateType type, final ODataSingleton entity) { - return super.getEntityUpdateRequest(type, entity); + return getEntityUpdateRequest(type, entity); } @Override public ODataEntityUpdateRequest getSingletonUpdateRequest( - final URI targetURI, final UpdateType type, final ODataSingleton changes) { + final URI targetURI, final UpdateType type, final ODataSingleton changes) { - return super.getEntityUpdateRequest(targetURI, type, changes); + return getEntityUpdateRequest(targetURI, type, changes); } @Override @@ -56,14 +243,14 @@ public class CUDRequestFactoryImpl extends AbstractCUDRequestFactory ResWrap wrappedPayload = new ResWrap(contextURI, null, reference); return new ODataReferenceAddingRequestImpl(client, HttpMethod.POST, targetURI, wrappedPayload); - } - - public ODataReferenceAddingRequest getReferenceSingleChangeRequest(final URI serviceRoot, final URI targetURI, + } + + public ODataReferenceAddingRequest getReferenceSingleChangeRequest(final URI serviceRoot, final URI targetURI, final URI reference) { - // See OData Protocol 11.4.6.3 + // See OData Protocol 11.4.6.3 final URI contextURI = client.newURIBuilder(serviceRoot.toASCIIString()).appendMetadataSegment().build(); ResWrap wrappedPayload = new ResWrap(contextURI, null, reference); return new ODataReferenceAddingRequestImpl(client, HttpMethod.PUT, targetURI, wrappedPayload); - } + } } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java index 658caa431..35f51185a 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java @@ -23,7 +23,7 @@ import java.net.URI; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest; import org.apache.olingo.client.api.communication.response.ODataDeleteResponse; import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest; @@ -37,7 +37,7 @@ import org.apache.olingo.commons.api.http.HttpMethod; public class ODataDeleteRequestImpl extends AbstractODataBasicRequest implements ODataDeleteRequest { - ODataDeleteRequestImpl(final CommonODataClient odataClient, final HttpMethod method, final URI uri) { + ODataDeleteRequestImpl(final ODataClient odataClient, final HttpMethod method, final URI uri) { super(odataClient, method, uri); } @@ -64,7 +64,7 @@ public class ODataDeleteRequestImpl extends AbstractODataBasicRequest odataClient, final HttpClient httpClient, + private ODataDeleteResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java index 4e261a391..cb8c29549 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java @@ -25,7 +25,7 @@ import org.apache.commons.io.IOUtils; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest; import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse; import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest; @@ -60,7 +60,7 @@ public class ODataEntityCreateRequestImpl * @param targetURI entity set URI. * @param entity entity to be created. */ - ODataEntityCreateRequestImpl(final CommonODataClient odataClient, final URI targetURI, final E entity) { + ODataEntityCreateRequestImpl(final ODataClient odataClient, final URI targetURI, final E entity) { super(odataClient, HttpMethod.POST, targetURI); this.entity = entity; } @@ -98,7 +98,7 @@ public class ODataEntityCreateRequestImpl private E entity = null; - private ODataEntityCreateResponseImpl(final CommonODataClient odataClient, final HttpClient httpClient, + private ODataEntityCreateResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java index 8c52fafdf..d40149620 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java @@ -26,7 +26,7 @@ import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest; import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse; import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest; @@ -62,7 +62,7 @@ public class ODataEntityUpdateRequestImpl * @param uri URI of the entity to be updated. * @param changes changes to be applied. */ - public ODataEntityUpdateRequestImpl(final CommonODataClient odataClient, + public ODataEntityUpdateRequestImpl(final ODataClient odataClient, final HttpMethod method, final URI uri, final E changes) { super(odataClient, method, uri); @@ -111,7 +111,7 @@ public class ODataEntityUpdateRequestImpl */ private E entity = null; - private ODataEntityUpdateResponseImpl(final CommonODataClient odataClient, final HttpClient httpClient, + private ODataEntityUpdateResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java index d1ee5afb1..2fb84846d 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java @@ -25,7 +25,7 @@ import org.apache.commons.io.IOUtils; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest; import org.apache.olingo.client.api.communication.response.ODataPropertyUpdateResponse; import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest; @@ -58,7 +58,7 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest odataClient, + ODataPropertyUpdateRequestImpl(final ODataClient odataClient, final HttpMethod method, final URI targetURI, final ODataProperty property) { super(odataClient, method, targetURI); @@ -99,7 +99,7 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest odataClient, final HttpClient httpClient, + private ODataPropertyUpdateResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataReferenceAddingRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataReferenceAddingRequestImpl.java index f5d59a102..477a91a89 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataReferenceAddingRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataReferenceAddingRequestImpl.java @@ -25,7 +25,7 @@ import org.apache.commons.io.IOUtils; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.cud.ODataReferenceAddingRequest; import org.apache.olingo.client.api.communication.response.ODataReferenceAddingResponse; import org.apache.olingo.client.api.serialization.ODataWriter; @@ -48,7 +48,7 @@ public class ODataReferenceAddingRequestImpl extends AbstractODataBasicRequest reference; ODataReferenceAddingRequestImpl( - final CommonODataClient odataClient, final HttpMethod method, final URI uri, final ResWrap reference) { + final ODataClient odataClient, final HttpMethod method, final URI uri, final ResWrap reference) { super(odataClient, method, uri); this.reference = reference; } @@ -94,7 +94,7 @@ public class ODataReferenceAddingRequestImpl extends AbstractODataBasicRequest odataClient, final HttpClient httpClient, final HttpResponse res) { + final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); this.close(); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java index cd71a8111..2ad54cb53 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java @@ -25,7 +25,7 @@ import org.apache.commons.io.IOUtils; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest; import org.apache.olingo.client.api.communication.response.ODataValueUpdateResponse; import org.apache.olingo.client.api.http.HttpClientException; @@ -56,7 +56,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest odataClient, + ODataValueUpdateRequestImpl(final ODataClient odataClient, final HttpMethod method, final URI targetURI, final ODataPrimitiveValue value) { super(odataClient, method, targetURI); @@ -96,7 +96,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest odataClient, final HttpClient httpClient, + private ODataValueUpdateResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractEdmEnabledInvokeRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractEdmEnabledInvokeRequestFactory.java index 39b34a3fa..789223943 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractEdmEnabledInvokeRequestFactory.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractEdmEnabledInvokeRequestFactory.java @@ -22,7 +22,7 @@ import java.net.URI; import java.util.ArrayList; import java.util.Map; -import org.apache.olingo.client.api.CommonEdmEnabledODataClient; +import org.apache.olingo.client.api.EdmEnabledODataClient; import org.apache.olingo.client.api.communication.request.invoke.EdmEnabledInvokeRequestFactory; import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest; import org.apache.olingo.commons.api.domain.ODataInvokeResult; @@ -39,9 +39,9 @@ import org.apache.olingo.commons.api.http.HttpMethod; public abstract class AbstractEdmEnabledInvokeRequestFactory extends AbstractInvokeRequestFactory implements EdmEnabledInvokeRequestFactory { - private final CommonEdmEnabledODataClient edmClient; + private final EdmEnabledODataClient edmClient; - public AbstractEdmEnabledInvokeRequestFactory(final CommonEdmEnabledODataClient edmClient) { + public AbstractEdmEnabledInvokeRequestFactory(final EdmEnabledODataClient edmClient) { this.edmClient = edmClient; } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java index d813ba988..cebf12db2 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java @@ -29,7 +29,6 @@ import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpRequestBase; -import org.apache.olingo.client.api.CommonODataClient; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.ODataBatchableRequest; import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest; @@ -41,8 +40,8 @@ import org.apache.olingo.client.core.communication.response.AbstractODataRespons import org.apache.olingo.client.core.uri.URIUtils; import org.apache.olingo.commons.api.domain.ODataEntity; import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataProperty; import org.apache.olingo.commons.api.domain.ODataInvokeResult; +import org.apache.olingo.commons.api.domain.ODataProperty; import org.apache.olingo.commons.api.domain.ODataValue; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpMethod; @@ -72,7 +71,7 @@ public abstract class AbstractODataInvokeRequest * @param uri URI that identifies the operation. */ public AbstractODataInvokeRequest( - final CommonODataClient odataClient, + final ODataClient odataClient, final Class reference, final HttpMethod method, final URI uri) { @@ -183,7 +182,7 @@ public abstract class AbstractODataInvokeRequest private T invokeResult = null; - private ODataInvokeResponseImpl(final CommonODataClient odataClient, final HttpClient httpClient, + private ODataInvokeResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java index d40deba86..ce49d47bb 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java @@ -20,7 +20,7 @@ package org.apache.olingo.client.core.communication.request.invoke; import java.net.URI; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.commons.api.domain.ODataInvokeResult; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpMethod; @@ -29,7 +29,7 @@ public class ODataInvokeRequestImpl extends Abstrac private ODataFormat format; - public ODataInvokeRequestImpl(final CommonODataClient odataClient, final Class reference, + public ODataInvokeRequestImpl(final ODataClient odataClient, final Class reference, final HttpMethod method, final URI uri) { super(odataClient, reference, method, uri); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractMetadataRequestImpl.java index 243bc5894..3cdd34963 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractMetadataRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractMetadataRequestImpl.java @@ -20,14 +20,14 @@ package org.apache.olingo.client.core.communication.request.retrieve; import java.net.URI; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.ODataRequest; import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.commons.api.format.ODataFormat; public abstract class AbstractMetadataRequestImpl extends AbstractODataRetrieveRequest { - public AbstractMetadataRequestImpl(final CommonODataClient odataClient, final URI query) { + public AbstractMetadataRequestImpl(final ODataClient odataClient, final URI query) { super(odataClient, query); super.setAccept(ContentType.APPLICATION_XML.toContentTypeString()); super.setContentType(ContentType.APPLICATION_XML.toContentTypeString()); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java index 9cabf3d74..1896dcd31 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java @@ -23,7 +23,7 @@ import java.net.URI; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.retrieve.ODataRetrieveRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest; @@ -43,7 +43,7 @@ public abstract class AbstractODataRetrieveRequest * @param odataClient client instance getting this request * @param query query to be executed. */ - public AbstractODataRetrieveRequest(final CommonODataClient odataClient, final URI query) { + public AbstractODataRetrieveRequest(final ODataClient odataClient, final URI query) { super(odataClient, HttpMethod.GET, query); } @@ -64,7 +64,7 @@ public abstract class AbstractODataRetrieveRequest protected abstract class AbstractODataRetrieveResponse extends AbstractODataResponse implements ODataRetrieveResponse { - protected AbstractODataRetrieveResponse(final CommonODataClient odataClient, final HttpClient httpClient, + protected AbstractODataRetrieveResponse(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/EdmMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/EdmMetadataRequestImpl.java index 5ad865e7e..836630423 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/EdmMetadataRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/EdmMetadataRequestImpl.java @@ -21,7 +21,7 @@ package org.apache.olingo.client.core.communication.request.retrieve; import java.net.URI; import org.apache.http.client.HttpClient; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.edm.xml.XMLMetadata; @@ -36,7 +36,7 @@ class EdmMetadataRequestImpl extends AbstractMetadataRequestImpl implements private EdmMetadataResponseImpl privateResponse; - EdmMetadataRequestImpl(final CommonODataClient odataClient, final String serviceRoot, final URI uri) { + EdmMetadataRequestImpl(final ODataClient odataClient, final String serviceRoot, final URI uri) { super(odataClient, uri); this.serviceRoot = serviceRoot; } @@ -67,7 +67,7 @@ class EdmMetadataRequestImpl extends AbstractMetadataRequestImpl implements private XMLMetadata metadata = null; - private EdmMetadataResponseImpl(final CommonODataClient odataClient, final HttpClient httpClient, + private EdmMetadataResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final ODataRetrieveResponse xmlMetadataResponse) { super(odataClient, httpClient, null); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataDeltaRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataDeltaRequestImpl.java index 7b818e17e..bb3ccd923 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataDeltaRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataDeltaRequestImpl.java @@ -23,7 +23,6 @@ import java.net.URI; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; -import org.apache.olingo.client.api.CommonODataClient; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.retrieve.ODataDeltaRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; @@ -37,7 +36,7 @@ import org.apache.olingo.commons.api.serialization.ODataDeserializerException; public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest implements ODataDeltaRequest { - public ODataDeltaRequestImpl(final CommonODataClient odataClient, final URI query) { + public ODataDeltaRequestImpl(final ODataClient odataClient, final URI query) { super(odataClient, query); } @@ -56,7 +55,7 @@ public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest odataClient, final HttpClient httpClient, + private ODataDeltaResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java index f867bc690..f247ec944 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java @@ -22,7 +22,7 @@ import java.net.URI; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.commons.api.data.Entity; @@ -43,7 +43,7 @@ public class ODataEntityRequestImpl * @param odataClient client instance getting this request * @param query query to be executed. */ - public ODataEntityRequestImpl(final CommonODataClient odataClient, final URI query) { + public ODataEntityRequestImpl(final ODataClient odataClient, final URI query) { super(odataClient, query); } @@ -64,7 +64,7 @@ public class ODataEntityRequestImpl private E entity = null; - private ODataEntityResponseImpl(final CommonODataClient odataClient, final HttpClient httpClient, + private ODataEntityResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java index 8b99b4467..737305beb 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java @@ -22,7 +22,7 @@ import java.net.URI; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.domain.ODataEntitySetIterator; @@ -45,7 +45,7 @@ public class ODataEntitySetIteratorRequestImpl odataClient, final URI query) { + public ODataEntitySetIteratorRequestImpl(final ODataClient odataClient, final URI query) { super(odataClient, query); } @@ -65,7 +65,7 @@ public class ODataEntitySetIteratorRequestImpl odataClient, final HttpClient httpClient, + private ODataEntitySetIteratorResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java index 0214dec43..d552e75fa 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java @@ -22,7 +22,7 @@ import java.net.URI; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.commons.api.data.EntitySet; @@ -47,7 +47,7 @@ public class ODataEntitySetRequestImpl * @param odataClient client instance getting this request * @param query query to be executed. */ - public ODataEntitySetRequestImpl(final CommonODataClient odataClient, final URI query) { + public ODataEntitySetRequestImpl(final ODataClient odataClient, final URI query) { super(odataClient, query); } @@ -67,7 +67,7 @@ public class ODataEntitySetRequestImpl */ protected class ODataEntitySetResponseImpl extends AbstractODataRetrieveResponse { - private ODataEntitySetResponseImpl(final CommonODataClient odataClient, final HttpClient httpClient, + private ODataEntitySetResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java index c24f80a7b..bcffc59ad 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java @@ -24,7 +24,7 @@ import java.net.URI; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.header.HeaderName; import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; @@ -42,7 +42,7 @@ public class ODataMediaRequestImpl extends AbstractODataRetrieveRequest odataClient, final URI query) { + ODataMediaRequestImpl(final ODataClient odataClient, final URI query) { super(odataClient, query); setAccept(ODataFormat.APPLICATION_OCTET_STREAM.toString()); @@ -71,7 +71,7 @@ public class ODataMediaRequestImpl extends AbstractODataRetrieveRequest odataClient, final HttpClient httpClient, + private ODataMediaResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java index e8c679780..07f753b66 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java @@ -23,7 +23,7 @@ import java.net.URI; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.http.HttpClientException; @@ -45,7 +45,7 @@ public class ODataPropertyRequestImpl * @param odataClient client instance getting this request * @param query query to be executed. */ - public ODataPropertyRequestImpl(final CommonODataClient odataClient, final URI query) { + public ODataPropertyRequestImpl(final ODataClient odataClient, final URI query) { super(odataClient, query); } @@ -64,7 +64,7 @@ public class ODataPropertyRequestImpl private T property = null; - private ODataPropertyResponseImpl(final CommonODataClient odataClient, final HttpClient httpClient, + private ODataPropertyResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java index 646cd6a86..4c22c312f 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java @@ -25,7 +25,7 @@ import java.net.URI; import org.apache.commons.io.IOUtils; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest; import org.apache.olingo.client.api.communication.response.ODataRawResponse; import org.apache.olingo.client.core.communication.request.AbstractODataRequest; @@ -46,7 +46,7 @@ public class ODataRawRequestImpl extends AbstractODataRequest implements ODataRa * @param odataClient client instance getting this request * @param uri request URI. */ - ODataRawRequestImpl(final CommonODataClient odataClient, final URI uri) { + ODataRawRequestImpl(final ODataClient odataClient, final URI uri) { super(odataClient, HttpMethod.GET, uri); } @@ -70,7 +70,7 @@ public class ODataRawRequestImpl extends AbstractODataRequest implements ODataRa private byte[] obj = null; - private ODataRawResponseImpl(final CommonODataClient odataClient, final HttpClient httpClient, + private ODataRawResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java index 21dabf9be..ce2f477e6 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java @@ -22,7 +22,7 @@ import java.net.URI; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.data.ServiceDocument; @@ -43,7 +43,7 @@ public class ODataServiceDocumentRequestImpl extends AbstractODataRetrieveReques * @param odataClient client instance getting this request * @param uri request URI. */ - ODataServiceDocumentRequestImpl(final CommonODataClient odataClient, final URI uri) { + ODataServiceDocumentRequestImpl(final ODataClient odataClient, final URI uri) { super(odataClient, uri); } @@ -65,7 +65,7 @@ public class ODataServiceDocumentRequestImpl extends AbstractODataRetrieveReques private ODataServiceDocument serviceDocument = null; - private ODataServiceResponseImpl(final CommonODataClient odataClient, final HttpClient httpClient, + private ODataServiceResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java index f417e5d4c..ffb2caf4e 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java @@ -23,7 +23,7 @@ import java.net.URI; import org.apache.commons.io.IOUtils; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.http.HttpClientException; @@ -43,7 +43,7 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest odataClient, final URI query) { + ODataValueRequestImpl(final ODataClient odataClient, final URI query) { super(odataClient, query); } @@ -65,7 +65,7 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest odataClient, final HttpClient httpClient, + private ODataValueResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java index ff2b0eaab..1f418876e 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java @@ -24,7 +24,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpUriRequest; -import org.apache.olingo.client.api.CommonODataClient; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; @@ -133,7 +132,7 @@ public class XMLMetadataRequestImpl * main metadata document's URI but don't have to start with the service root * as all other OData request URIs. */ @Override - protected void checkRequest(final CommonODataClient odataClient, final HttpUriRequest request) { + protected void checkRequest(final ODataClient odataClient, final HttpUriRequest request) { if (parentURI == null) { super.checkRequest(odataClient, request); } else { @@ -173,7 +172,7 @@ public class XMLMetadataRequestImpl private final XMLMetadata metadata; - private XMLMetadataResponseImpl(final CommonODataClient odataClient, final HttpClient httpClient, + private XMLMetadataResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res, final XMLMetadata metadata) { super(odataClient, httpClient, null); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java index e0969d2a1..024267493 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java @@ -20,7 +20,7 @@ package org.apache.olingo.client.core.communication.request.streamed; import java.net.URI; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.ODataPayloadManager; import org.apache.olingo.client.api.communication.request.streamed.ODataStreamedEntityRequest; import org.apache.olingo.client.api.communication.response.ODataResponse; @@ -46,7 +46,7 @@ public abstract class AbstractODataStreamedEntityRequest odataClient, final HttpMethod method, + public AbstractODataStreamedEntityRequest(final ODataClient odataClient, final HttpMethod method, final URI uri) { super(odataClient, method, uri); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java index 52b992d8d..e01e508fe 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java @@ -28,12 +28,12 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; -import org.apache.olingo.client.api.CommonODataClient; import org.apache.olingo.client.api.ODataBatchConstants; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.ODataPayloadManager; import org.apache.olingo.client.api.communication.request.ODataStreamedRequest; import org.apache.olingo.client.api.communication.request.ODataStreamer; -import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest; +import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest; import org.apache.olingo.client.api.communication.response.ODataResponse; import org.apache.olingo.client.core.communication.request.AbstractODataRequest; import org.apache.olingo.client.core.communication.request.Wrapper; @@ -69,7 +69,7 @@ public abstract class AbstractODataStreamedRequest odataClient, + public AbstractODataStreamedRequest(final ODataClient odataClient, final HttpMethod method, final URI uri) { super(odataClient, method, uri); @@ -130,7 +130,7 @@ public abstract class AbstractODataStreamedRequest * @param targetURI target entity set. * @param media media entity blob to be created. */ - public ODataMediaEntityCreateRequestImpl(final CommonODataClient odataClient, final URI targetURI, + public ODataMediaEntityCreateRequestImpl(final ODataClient odataClient, final URI targetURI, final InputStream media) { super(odataClient, HttpMethod.POST, targetURI); @@ -99,7 +99,7 @@ public class ODataMediaEntityCreateRequestImpl private E entity = null; - private ODataMediaEntityCreateResponseImpl(final CommonODataClient odataClient, final HttpClient httpClient, + private ODataMediaEntityCreateResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java index aa79b36ef..5e98d4303 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java @@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.streamed.MediaEntityUpdateStreamManager; import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest; import org.apache.olingo.client.api.communication.response.ODataMediaEntityUpdateResponse; @@ -55,7 +55,7 @@ public class ODataMediaEntityUpdateRequestImpl * @param editURI edit URI of the entity to be updated. * @param media media entity blob to be created. */ - public ODataMediaEntityUpdateRequestImpl(final CommonODataClient odataClient, + public ODataMediaEntityUpdateRequestImpl(final ODataClient odataClient, final HttpMethod method, final URI editURI, final InputStream media) { super(odataClient, method, editURI); @@ -100,7 +100,7 @@ public class ODataMediaEntityUpdateRequestImpl private E entity = null; - private ODataMediaEntityUpdateResponseImpl(final CommonODataClient odataClient, final HttpClient httpClient, + private ODataMediaEntityUpdateResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataStreamUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataStreamUpdateRequestImpl.java index 3e9b6e14d..ca385a9cc 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataStreamUpdateRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataStreamUpdateRequestImpl.java @@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.streamed.ODataStreamUpdateRequest; import org.apache.olingo.client.api.communication.request.streamed.StreamUpdateStreamManager; import org.apache.olingo.client.api.communication.response.ODataStreamUpdateResponse; @@ -49,7 +49,7 @@ public class ODataStreamUpdateRequestImpl * @param targetURI target URI. * @param stream stream to be updated. */ - public ODataStreamUpdateRequestImpl(final CommonODataClient odataClient, + public ODataStreamUpdateRequestImpl(final ODataClient odataClient, final HttpMethod method, final URI targetURI, final InputStream stream) { super(odataClient, method, targetURI); @@ -97,7 +97,7 @@ public class ODataStreamUpdateRequestImpl private InputStream input = null; - private ODataStreamUpdateResponseImpl(final CommonODataClient odataClient, final HttpClient httpClient, + private ODataStreamUpdateResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java index 4e8ba4924..210ae7c88 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java @@ -34,7 +34,7 @@ import org.apache.http.Header; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.HttpClient; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.header.HeaderName; import org.apache.olingo.client.api.communication.request.ODataStreamer; import org.apache.olingo.client.api.communication.request.batch.ODataBatchLineIterator; @@ -58,7 +58,7 @@ public abstract class AbstractODataResponse implements ODataResponse { */ protected static final Logger LOG = LoggerFactory.getLogger(ODataResponse.class); - protected final CommonODataClient odataClient; + protected final ODataClient odataClient; /** * HTTP client. @@ -102,7 +102,7 @@ public abstract class AbstractODataResponse implements ODataResponse { protected ODataBatchController batchInfo = null; public AbstractODataResponse( - final CommonODataClient odataClient, final HttpClient httpclient, final HttpResponse res) { + final ODataClient odataClient, final HttpClient httpclient, final HttpResponse res) { this.odataClient = odataClient; this.httpClient = httpclient; diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AsyncResponseImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AsyncResponseImpl.java index 6f012c834..9ca884cc8 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AsyncResponseImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AsyncResponseImpl.java @@ -23,7 +23,7 @@ import java.util.Map; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.batch.ODataBatchLineIterator; import org.apache.olingo.client.api.communication.response.AsyncResponse; import org.apache.olingo.client.core.communication.request.batch.ODataBatchController; @@ -33,7 +33,7 @@ import org.apache.olingo.client.core.communication.request.batch.ODataBatchContr */ public class AsyncResponseImpl extends AbstractODataResponse implements AsyncResponse { - public AsyncResponseImpl(final CommonODataClient odataClient, final HttpClient httpClient, + public AsyncResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { super(odataClient, httpClient, res); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java index 22b1798cb..c6a517172 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java @@ -23,7 +23,6 @@ import java.net.URI; import java.util.Map; import org.apache.commons.io.IOUtils; -import org.apache.olingo.client.api.CommonODataClient; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.data.ServiceDocument; import org.apache.olingo.client.api.domain.ODataEntitySetIterator; @@ -55,9 +54,9 @@ public class ODataReaderImpl implements ODataReader { */ protected static final Logger LOG = LoggerFactory.getLogger(ODataReaderImpl.class); - protected final CommonODataClient client; + protected final ODataClient client; - public ODataReaderImpl(final CommonODataClient client) { + public ODataReaderImpl(final ODataClient client) { this.client = client; } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java index 4a8827dad..79f1f075b 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java @@ -28,21 +28,21 @@ import java.util.Collection; import java.util.Collections; import org.apache.commons.io.IOUtils; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.serialization.ODataWriter; import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataProperty; import org.apache.olingo.commons.api.domain.ODataLink; +import org.apache.olingo.commons.api.domain.ODataProperty; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataSerializerException; public class ODataWriterImpl implements ODataWriter { - protected final CommonODataClient client; + protected final ODataClient client; - public ODataWriterImpl(final CommonODataClient client) { + public ODataWriterImpl(final ODataClient client) { this.client = client; } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java index 6a8323985..f60104ee9 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java @@ -44,7 +44,7 @@ import org.apache.http.client.utils.URIBuilder; import org.apache.http.entity.AbstractHttpEntity; import org.apache.http.entity.ByteArrayEntity; import org.apache.http.entity.InputStreamEntity; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.http.HttpClientFactory; import org.apache.olingo.client.api.http.WrappingHttpClientFactory; import org.apache.olingo.client.api.uri.SegmentType; @@ -351,7 +351,7 @@ public final class URIUtils { return value; } - public static boolean shouldUseRepeatableHttpBodyEntry(final CommonODataClient client) { + public static boolean shouldUseRepeatableHttpBodyEntry(final ODataClient client) { // returns true for authentication request in case of http401 which needs retry so requires being repeatable. HttpClientFactory httpclientFactory = client.getConfiguration().getHttpClientFactory(); if (httpclientFactory instanceof BasicAuthHttpClientFactory) { @@ -366,7 +366,7 @@ public final class URIUtils { return false; } - public static HttpEntity buildInputStreamEntity(final CommonODataClient client, final InputStream input) { + public static HttpEntity buildInputStreamEntity(final ODataClient client, final InputStream input) { AbstractHttpEntity entity; boolean useChunked = client.getConfiguration().isUseChuncked(); diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java index 0dc980b43..dc644940e 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java @@ -18,16 +18,16 @@ */ package org.apache.olingo.client.core; -import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.commons.api.format.ODataFormat; import org.custommonkey.xmlunit.XMLUnit; import org.junit.BeforeClass; public abstract class AbstractTest { - protected static org.apache.olingo.client.api.ODataClient v4Client; + protected static ODataClient v4Client; - protected abstract CommonODataClient getClient(); + protected abstract ODataClient getClient(); @BeforeClass public static void setUp() { diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/ODataClientTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/ODataClientTest.java index 309fc508f..f18e36d8f 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/ODataClientTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/ODataClientTest.java @@ -18,18 +18,18 @@ */ package org.apache.olingo.client.core; -import org.apache.olingo.client.api.CommonODataClient; -import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import org.apache.olingo.client.api.ODataClient; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; +import org.junit.Test; + public class ODataClientTest { @Test public void before() { - CommonODataClient client = ODataClientFactory.getV4(); + ODataClient client = ODataClientFactory.getV4(); assertNotNull(client); assertEquals(ODataServiceVersion.V40, client.getServiceVersion()); }