http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/CUDRequestFactoryImpl.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..cb5d5d6 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/CUDRequestFactoryImpl.java @@ -0,0 +1,69 @@ +/* + * 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.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.ODataEntityUpdateRequest; +import org.apache.olingo.client.api.communication.request.cud.ODataReferenceAddingRequest; +import org.apache.olingo.client.api.communication.request.cud.UpdateType; +import org.apache.olingo.commons.api.data.ResWrap; +import org.apache.olingo.commons.api.domain.v4.ODataSingleton; +import org.apache.olingo.commons.api.http.HttpMethod; + +public class CUDRequestFactoryImpl extends AbstractCUDRequestFactory<UpdateType> implements CUDRequestFactory { + + public CUDRequestFactoryImpl(final ODataClient client) { + super(client); + } + + @Override + public ODataEntityUpdateRequest<ODataSingleton> getSingletonUpdateRequest( + final UpdateType type, final ODataSingleton entity) { + + return super.getEntityUpdateRequest(type, entity); + } + + @Override + public ODataEntityUpdateRequest<ODataSingleton> getSingletonUpdateRequest( + final URI targetURI, final UpdateType type, final ODataSingleton changes) { + + return super.getEntityUpdateRequest(targetURI, type, changes); + } + + @Override + public ODataReferenceAddingRequest getReferenceAddingRequest(final URI serviceRoot, final URI targetURI, + final URI reference) { + final URI contextURI = client.newURIBuilder(serviceRoot.toASCIIString()).appendMetadataSegment().build(); + ResWrap<URI> wrappedPayload = new ResWrap<URI>(contextURI, null, reference); + + return new ODataReferenceAddingRequestImpl(client, HttpMethod.POST, targetURI, wrappedPayload); + } + + public ODataReferenceAddingRequest getReferenceSingleChangeRequest(final URI serviceRoot, final URI targetURI, + final URI reference) { + // See OData Protocol 11.4.6.3 + final URI contextURI = client.newURIBuilder(serviceRoot.toASCIIString()).appendMetadataSegment().build(); + ResWrap<URI> wrappedPayload = new ResWrap<URI>(contextURI, null, reference); + + return new ODataReferenceAddingRequestImpl(client, HttpMethod.PUT, targetURI, wrappedPayload); + } +}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataReferenceAddingRequestImpl.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..f5d59a1 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataReferenceAddingRequestImpl.java @@ -0,0 +1,103 @@ +/* + * 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.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.communication.request.cud.ODataReferenceAddingRequest; +import org.apache.olingo.client.api.communication.response.ODataReferenceAddingResponse; +import org.apache.olingo.client.api.serialization.ODataWriter; +import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest; +import org.apache.olingo.client.core.communication.response.AbstractODataResponse; +import org.apache.olingo.client.core.uri.URIUtils; +import org.apache.olingo.commons.api.data.ResWrap; +import org.apache.olingo.commons.api.format.ODataFormat; +import org.apache.olingo.commons.api.http.HttpMethod; +import org.apache.olingo.commons.api.serialization.ODataSerializerException; + +/** + * See {@link ODataReferenceAddingRequest} + * + * Will be used, for single-valued navigation properties as was well as collection navigation properties + */ +public class ODataReferenceAddingRequestImpl extends AbstractODataBasicRequest<ODataReferenceAddingResponse> + implements ODataReferenceAddingRequest { + + final ResWrap<URI> reference; + + ODataReferenceAddingRequestImpl( + final CommonODataClient<?> odataClient, final HttpMethod method, final URI uri, final ResWrap<URI> reference) { + super(odataClient, method, uri); + this.reference = reference; + } + + @Override + public ODataFormat getDefaultFormat() { + return odataClient.getConfiguration().getDefaultPubFormat(); + } + + /** + * No payload: null will be returned. + */ + @Override + protected InputStream getPayload() { + if (reference == null) { + return null; + } else { + ODataWriter writer = odataClient.getWriter(); + try { + return writer.writeReference(reference, ODataFormat.fromString(getContentType())); + } catch (ODataSerializerException e) { + LOG.warn("Error serializing reference {}", reference); + throw new IllegalArgumentException(e); + } + } + } + + @Override + public ODataReferenceAddingResponse execute() { + final InputStream input = getPayload(); + ((HttpEntityEnclosingRequestBase) request).setEntity(URIUtils.buildInputStreamEntity(odataClient, input)); + + try { + return new ODataReferenceAddingResponseImpl(odataClient, httpClient, doExecute()); + } finally { + IOUtils.closeQuietly(input); + } + } + + /** + * Response class about an ODataReferenceAddingRequest. + */ + private class ODataReferenceAddingResponseImpl extends AbstractODataResponse implements ODataReferenceAddingResponse { + + private ODataReferenceAddingResponseImpl( + final CommonODataClient<?> odataClient, final HttpClient httpClient, final HttpResponse res) { + + super(odataClient, httpClient, res); + this.close(); + } + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/CUDRequestFactoryImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/CUDRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/CUDRequestFactoryImpl.java deleted file mode 100644 index fdf0cd7..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/CUDRequestFactoryImpl.java +++ /dev/null @@ -1,70 +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.v4; - -import java.net.URI; - -import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest; -import org.apache.olingo.client.api.communication.request.cud.v4.CUDRequestFactory; -import org.apache.olingo.client.api.communication.request.cud.v4.ODataReferenceAddingRequest; -import org.apache.olingo.client.api.communication.request.cud.v4.UpdateType; -import org.apache.olingo.client.api.v4.ODataClient; -import org.apache.olingo.client.core.communication.request.cud.AbstractCUDRequestFactory; -import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.v4.ODataSingleton; -import org.apache.olingo.commons.api.http.HttpMethod; - -public class CUDRequestFactoryImpl extends AbstractCUDRequestFactory<UpdateType> implements CUDRequestFactory { - - public CUDRequestFactoryImpl(final ODataClient client) { - super(client); - } - - @Override - public ODataEntityUpdateRequest<ODataSingleton> getSingletonUpdateRequest( - final UpdateType type, final ODataSingleton entity) { - - return super.getEntityUpdateRequest(type, entity); - } - - @Override - public ODataEntityUpdateRequest<ODataSingleton> getSingletonUpdateRequest( - final URI targetURI, final UpdateType type, final ODataSingleton changes) { - - return super.getEntityUpdateRequest(targetURI, type, changes); - } - - @Override - public ODataReferenceAddingRequest getReferenceAddingRequest(final URI serviceRoot, final URI targetURI, - final URI reference) { - final URI contextURI = client.newURIBuilder(serviceRoot.toASCIIString()).appendMetadataSegment().build(); - ResWrap<URI> wrappedPayload = new ResWrap<URI>(contextURI, null, reference); - - return new ODataReferenceAddingRequestImpl(client, HttpMethod.POST, targetURI, wrappedPayload); - } - - public ODataReferenceAddingRequest getReferenceSingleChangeRequest(final URI serviceRoot, final URI targetURI, - final URI reference) { - // See OData Protocol 11.4.6.3 - final URI contextURI = client.newURIBuilder(serviceRoot.toASCIIString()).appendMetadataSegment().build(); - ResWrap<URI> wrappedPayload = new ResWrap<URI>(contextURI, null, reference); - - return new ODataReferenceAddingRequestImpl(client, HttpMethod.PUT, targetURI, wrappedPayload); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/ODataReferenceAddingRequestImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/ODataReferenceAddingRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/ODataReferenceAddingRequestImpl.java deleted file mode 100644 index df4fb6d..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/ODataReferenceAddingRequestImpl.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.client.core.communication.request.cud.v4; - -import java.io.InputStream; -import java.net.URI; - -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.communication.request.cud.v4.ODataReferenceAddingRequest; -import org.apache.olingo.client.api.communication.response.v4.ODataReferenceAddingResponse; -import org.apache.olingo.client.api.serialization.ODataWriter; -import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest; -import org.apache.olingo.client.core.communication.response.AbstractODataResponse; -import org.apache.olingo.client.core.uri.URIUtils; -import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.format.ODataFormat; -import org.apache.olingo.commons.api.http.HttpMethod; -import org.apache.olingo.commons.api.serialization.ODataSerializerException; - -/** - * See {@link ODataReferenceAddingRequest} - * - * Will be used, for single-valued navigation properties as was well as collection navigation properties - */ -public class ODataReferenceAddingRequestImpl extends AbstractODataBasicRequest<ODataReferenceAddingResponse> - implements ODataReferenceAddingRequest { - - final ResWrap<URI> reference; - - ODataReferenceAddingRequestImpl( - final CommonODataClient<?> odataClient, final HttpMethod method, final URI uri, final ResWrap<URI> reference) { - super(odataClient, method, uri); - this.reference = reference; - } - - @Override - public ODataFormat getDefaultFormat() { - return odataClient.getConfiguration().getDefaultPubFormat(); - } - - /** - * No payload: null will be returned. - */ - @Override - protected InputStream getPayload() { - if (reference == null) { - return null; - } else { - ODataWriter writer = odataClient.getWriter(); - try { - return writer.writeReference(reference, ODataFormat.fromString(getContentType())); - } catch (ODataSerializerException e) { - LOG.warn("Error serializing reference {}", reference); - throw new IllegalArgumentException(e); - } - } - } - - @Override - public ODataReferenceAddingResponse execute() { - final InputStream input = getPayload(); - ((HttpEntityEnclosingRequestBase) request).setEntity(URIUtils.buildInputStreamEntity(odataClient, input)); - - try { - return new ODataReferenceAddingResponseImpl(odataClient, httpClient, doExecute()); - } finally { - IOUtils.closeQuietly(input); - } - } - - /** - * Response class about an ODataReferenceAddingRequest. - */ - private class ODataReferenceAddingResponseImpl extends AbstractODataResponse implements ODataReferenceAddingResponse { - - private ODataReferenceAddingResponseImpl( - final CommonODataClient<?> odataClient, final HttpClient httpClient, final HttpResponse res) { - - super(odataClient, httpClient, res); - this.close(); - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java ---------------------------------------------------------------------- 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 f2c74a6..43c271a 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 @@ -30,12 +30,12 @@ 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; import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent; import org.apache.olingo.client.api.communication.response.ODataInvokeResponse; import org.apache.olingo.client.api.http.HttpClientException; -import org.apache.olingo.client.api.v4.ODataClient; import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest; import org.apache.olingo.client.core.communication.response.AbstractODataResponse; import org.apache.olingo.client.core.uri.URIUtils; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/EdmEnabledInvokeRequestFactoryImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/EdmEnabledInvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/EdmEnabledInvokeRequestFactoryImpl.java new file mode 100644 index 0000000..9f1aaae --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/EdmEnabledInvokeRequestFactoryImpl.java @@ -0,0 +1,51 @@ +/* + * 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.invoke; + +import java.net.URI; +import java.util.Map; + +import org.apache.olingo.client.api.EdmEnabledODataClient; +import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest; +import org.apache.olingo.commons.api.domain.ODataInvokeResult; +import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.http.HttpMethod; + +public class EdmEnabledInvokeRequestFactoryImpl extends AbstractEdmEnabledInvokeRequestFactory { + + private final EdmEnabledODataClient edmClient; + + public EdmEnabledInvokeRequestFactoryImpl(final EdmEnabledODataClient client) { + super(client); + this.edmClient = client; + } + + @Override + public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest( + final HttpMethod method, final URI uri, final Class<RES> resultRef, + final Map<String, ODataValue> parameters) { + + final ODataInvokeRequest<RES> request = new ODataInvokeRequestImpl<RES>(edmClient, resultRef, method, uri); + if (parameters != null) { + request.setParameters(parameters); + } + + return request; + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/InvokeRequestFactoryImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/InvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/InvokeRequestFactoryImpl.java new file mode 100644 index 0000000..315071e --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/InvokeRequestFactoryImpl.java @@ -0,0 +1,50 @@ +/* + * 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.invoke; + +import java.net.URI; +import java.util.Map; + +import org.apache.olingo.client.api.ODataClient; +import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest; +import org.apache.olingo.commons.api.domain.ODataInvokeResult; +import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.http.HttpMethod; + +public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory { + + private final ODataClient client; + + public InvokeRequestFactoryImpl(final ODataClient client) { + this.client = client; + } + + @Override + public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest( + final HttpMethod method, final URI uri, final Class<RES> resultRef, + final Map<String, ODataValue> parameters) { + + final ODataInvokeRequest<RES> request = new ODataInvokeRequestImpl<RES>(client, resultRef, method, uri); + if (parameters != null) { + request.setParameters(parameters); + } + + return request; + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..d40deba --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java @@ -0,0 +1,48 @@ +/* + * 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.invoke; + +import java.net.URI; + +import org.apache.olingo.client.api.CommonODataClient; +import org.apache.olingo.commons.api.domain.ODataInvokeResult; +import org.apache.olingo.commons.api.format.ODataFormat; +import org.apache.olingo.commons.api.http.HttpMethod; + +public class ODataInvokeRequestImpl<T extends ODataInvokeResult> extends AbstractODataInvokeRequest<T> { + + private ODataFormat format; + + public ODataInvokeRequestImpl(final CommonODataClient<?> odataClient, final Class<T> reference, + final HttpMethod method, final URI uri) { + + super(odataClient, reference, method, uri); + } + + @Override + public void setFormat(final ODataFormat format) { + super.setFormat(format); + this.format = format; + } + + @Override + protected ODataFormat getPOSTParameterFormat() { + return format == null ? getDefaultFormat() : format; + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/EdmEnabledInvokeRequestFactoryImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/EdmEnabledInvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/EdmEnabledInvokeRequestFactoryImpl.java deleted file mode 100644 index d29e533..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/EdmEnabledInvokeRequestFactoryImpl.java +++ /dev/null @@ -1,52 +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.invoke.v4; - -import java.net.URI; -import java.util.Map; - -import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest; -import org.apache.olingo.client.api.v4.EdmEnabledODataClient; -import org.apache.olingo.client.core.communication.request.invoke.AbstractEdmEnabledInvokeRequestFactory; -import org.apache.olingo.commons.api.domain.ODataInvokeResult; -import org.apache.olingo.commons.api.domain.ODataValue; -import org.apache.olingo.commons.api.http.HttpMethod; - -public class EdmEnabledInvokeRequestFactoryImpl extends AbstractEdmEnabledInvokeRequestFactory { - - private final EdmEnabledODataClient edmClient; - - public EdmEnabledInvokeRequestFactoryImpl(final EdmEnabledODataClient client) { - super(client); - this.edmClient = client; - } - - @Override - public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest( - final HttpMethod method, final URI uri, final Class<RES> resultRef, - final Map<String, ODataValue> parameters) { - - final ODataInvokeRequest<RES> request = new ODataInvokeRequestImpl<RES>(edmClient, resultRef, method, uri); - if (parameters != null) { - request.setParameters(parameters); - } - - return request; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java deleted file mode 100644 index 6f366f2..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java +++ /dev/null @@ -1,51 +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.invoke.v4; - -import java.net.URI; -import java.util.Map; - -import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest; -import org.apache.olingo.client.api.v4.ODataClient; -import org.apache.olingo.client.core.communication.request.invoke.AbstractInvokeRequestFactory; -import org.apache.olingo.commons.api.domain.ODataInvokeResult; -import org.apache.olingo.commons.api.domain.ODataValue; -import org.apache.olingo.commons.api.http.HttpMethod; - -public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory { - - private final ODataClient client; - - public InvokeRequestFactoryImpl(final ODataClient client) { - this.client = client; - } - - @Override - public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest( - final HttpMethod method, final URI uri, final Class<RES> resultRef, - final Map<String, ODataValue> parameters) { - - final ODataInvokeRequest<RES> request = new ODataInvokeRequestImpl<RES>(client, resultRef, method, uri); - if (parameters != null) { - request.setParameters(parameters); - } - - return request; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/ODataInvokeRequestImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/ODataInvokeRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/ODataInvokeRequestImpl.java deleted file mode 100644 index 6163cdd..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/ODataInvokeRequestImpl.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.communication.request.invoke.v4; - -import java.net.URI; - -import org.apache.olingo.client.api.CommonODataClient; -import org.apache.olingo.client.core.communication.request.invoke.AbstractODataInvokeRequest; -import org.apache.olingo.commons.api.domain.ODataInvokeResult; -import org.apache.olingo.commons.api.format.ODataFormat; -import org.apache.olingo.commons.api.http.HttpMethod; - -public class ODataInvokeRequestImpl<T extends ODataInvokeResult> extends AbstractODataInvokeRequest<T> { - - private ODataFormat format; - - public ODataInvokeRequestImpl(final CommonODataClient<?> odataClient, final Class<T> reference, - final HttpMethod method, final URI uri) { - - super(odataClient, reference, method, uri); - } - - @Override - public void setFormat(final ODataFormat format) { - super.setFormat(format); - this.format = format; - } - - @Override - protected ODataFormat getPOSTParameterFormat() { - return format == null ? getDefaultFormat() : format; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataDeltaRequestImpl.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..4112221 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataDeltaRequestImpl.java @@ -0,0 +1,86 @@ +/* + * 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.retrieve; + +import java.io.IOException; +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; +import org.apache.olingo.client.api.http.HttpClientException; +import org.apache.olingo.commons.api.data.Delta; +import org.apache.olingo.commons.api.data.ResWrap; +import org.apache.olingo.commons.api.domain.v4.ODataDelta; +import org.apache.olingo.commons.api.format.ODataFormat; +import org.apache.olingo.commons.api.serialization.ODataDeserializerException; + +public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest<ODataDelta> + implements ODataDeltaRequest { + + public ODataDeltaRequestImpl(final CommonODataClient<?> odataClient, final URI query) { + super(odataClient, query); + } + + @Override + public ODataFormat getDefaultFormat() { + return odataClient.getConfiguration().getDefaultPubFormat(); + } + + @Override + public ODataRetrieveResponse<ODataDelta> execute() { + final HttpResponse res = doExecute(); + return new ODataDeltaResponseImpl(odataClient, httpClient, res); + } + + protected class ODataDeltaResponseImpl extends AbstractODataRetrieveResponse { + + private ODataDelta delta = null; + + private ODataDeltaResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient, + final HttpResponse res) { + + super(odataClient, httpClient, res); + } + + @Override + public ODataDelta getBody() { + if (delta == null) { + try { + final ResWrap<Delta> resource = ((ODataClient) odataClient). + getDeserializer(ODataFormat.fromString(getContentType())). + toDelta(res.getEntity().getContent()); + + delta = ((ODataClient) odataClient).getBinder().getODataDelta(resource); + } catch (IOException e) { + throw new HttpClientException(e); + } catch (final ODataDeserializerException e) { + throw new IllegalArgumentException(e); + } finally { + this.close(); + } + } + return delta; + } + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/RetrieveRequestFactoryImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/RetrieveRequestFactoryImpl.java new file mode 100644 index 0000000..781dc10 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/RetrieveRequestFactoryImpl.java @@ -0,0 +1,78 @@ +/* + * 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.retrieve; + +import java.net.URI; + +import org.apache.olingo.client.api.ODataClient; +import org.apache.olingo.client.api.communication.request.retrieve.ODataDeltaRequest; +import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest; +import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest; +import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest; +import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest; +import org.apache.olingo.client.api.communication.request.retrieve.RetrieveRequestFactory; +import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest; +import org.apache.olingo.commons.api.domain.v4.ODataEntity; +import org.apache.olingo.commons.api.domain.v4.ODataEntitySet; +import org.apache.olingo.commons.api.domain.v4.ODataProperty; +import org.apache.olingo.commons.api.domain.v4.ODataSingleton; + +public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory + implements RetrieveRequestFactory { + + public RetrieveRequestFactoryImpl(final ODataClient client) { + super(client); + } + + @Override + public XMLMetadataRequest getXMLMetadataRequest(final String serviceRoot) { + return new XMLMetadataRequestImpl(((ODataClient) client), + client.newURIBuilder(serviceRoot).appendMetadataSegment().build()); + } + + @Override + public ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(final URI uri) { + return new ODataEntitySetRequestImpl<ODataEntitySet>(client, uri); + } + + @Override + public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(final URI uri) { + return new ODataEntitySetIteratorRequestImpl<ODataEntitySet, ODataEntity>(client, uri); + } + + @Override + public ODataEntityRequest<ODataSingleton> getSingletonRequest(final URI uri) { + return new ODataEntityRequestImpl<ODataSingleton>(client, uri); + } + + @Override + public ODataEntityRequest<ODataEntity> getEntityRequest(final URI uri) { + return new ODataEntityRequestImpl<ODataEntity>(client, uri); + } + + @Override + public ODataPropertyRequest<ODataProperty> getPropertyRequest(final URI uri) { + return new ODataPropertyRequestImpl<ODataProperty>(client, uri); + } + + @Override + public ODataDeltaRequest getDeltaRequest(final URI uri) { + return new ODataDeltaRequestImpl(client, uri); + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..30682f7 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java @@ -0,0 +1,195 @@ +/* + * 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.retrieve; + +import java.net.URI; + +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; +import org.apache.olingo.client.api.edm.xml.Annotation; +import org.apache.olingo.client.api.edm.xml.Annotations; +import org.apache.olingo.client.api.edm.xml.Include; +import org.apache.olingo.client.api.edm.xml.IncludeAnnotations; +import org.apache.olingo.client.api.edm.xml.Reference; +import org.apache.olingo.client.api.edm.xml.Schema; +import org.apache.olingo.client.api.edm.xml.XMLMetadata; +import org.apache.olingo.client.core.edm.xml.AbstractSchema; +import org.apache.olingo.client.core.edm.xml.AnnotationsImpl; +import org.apache.olingo.client.core.edm.xml.SchemaImpl; +import org.apache.olingo.commons.api.format.ODataFormat; + +public class XMLMetadataRequestImpl + extends AbstractMetadataRequestImpl<org.apache.olingo.client.api.edm.xml.XMLMetadata> + implements XMLMetadataRequest { + + XMLMetadataRequestImpl(final ODataClient odataClient, final URI uri) { + super(odataClient, uri); + } + + @Override + public ODataRetrieveResponse<org.apache.olingo.client.api.edm.xml.XMLMetadata> execute() { + final SingleXMLMetadatRequestImpl rootReq = new SingleXMLMetadatRequestImpl((ODataClient) odataClient, uri, null); + final ODataRetrieveResponse<XMLMetadata> rootRes = rootReq.execute(); + + final XMLMetadataResponseImpl response = + new XMLMetadataResponseImpl(odataClient, httpClient, rootReq.getHttpResponse(), rootRes.getBody()); + + // process external references + for (Reference reference : rootRes.getBody().getReferences()) { + final SingleXMLMetadatRequestImpl includeReq = new SingleXMLMetadatRequestImpl( + (ODataClient) odataClient, + odataClient.newURIBuilder(uri.resolve(reference.getUri()).toASCIIString()).build(), + uri); + final XMLMetadata includeMetadata = includeReq.execute().getBody(); + + // edmx:Include + for (Include include : reference.getIncludes()) { + final Schema includedSchema = includeMetadata.getSchema(include.getNamespace()); + if (includedSchema != null) { + response.getBody().getSchemas().add(includedSchema); + if (StringUtils.isNotBlank(include.getAlias())) { + ((AbstractSchema) includedSchema).setAlias(include.getAlias()); + } + } + } + + // edmx:IncludeAnnotations + for (IncludeAnnotations include : reference.getIncludeAnnotations()) { + for (Schema schema : includeMetadata.getSchemas()) { + // create empty schema that will be fed with edm:Annotations that match the criteria in IncludeAnnotations + final SchemaImpl forInclusion = new SchemaImpl(); + forInclusion.setNamespace(schema.getNamespace()); + forInclusion.setAlias(schema.getAlias()); + + // process all edm:Annotations in each schema of the included document + for (Annotations annotationGroup : ((SchemaImpl) schema).getAnnotationGroups()) { + // take into account only when (TargetNamespace was either not provided or matches) and + // (Qualifier was either not provided or matches) + if ((StringUtils.isBlank(include.getTargetNamespace()) + || include.getTargetNamespace().equals( + StringUtils.substringBeforeLast(annotationGroup.getTarget(), "."))) + && (StringUtils.isBlank(include.getQualifier()) + || include.getQualifier().equals(annotationGroup.getQualifier()))) { + + final AnnotationsImpl toBeIncluded = new AnnotationsImpl(); + toBeIncluded.setTarget(annotationGroup.getTarget()); + toBeIncluded.setQualifier(annotationGroup.getQualifier()); + // only import annotations with terms matching the given TermNamespace + for (Annotation annotation : annotationGroup.getAnnotations()) { + if (include.getTermNamespace().equals(StringUtils.substringBeforeLast(annotation.getTerm(), "."))) { + toBeIncluded.getAnnotations().add(annotation); + } + } + forInclusion.getAnnotationGroups().add(toBeIncluded); + } + } + + if (!forInclusion.getAnnotationGroups().isEmpty()) { + response.getBody().getSchemas().add(forInclusion); + } + } + } + } + + return response; + } + + private class SingleXMLMetadatRequestImpl extends AbstractMetadataRequestImpl<XMLMetadata> { + + private final URI parentURI; + private HttpResponse httpResponse; + + public SingleXMLMetadatRequestImpl(final ODataClient odataClient, final URI uri, final URI parent) { + super(odataClient, uri); + parentURI = parent; + } + + public HttpResponse getHttpResponse() { + return httpResponse; + } + + /** Referenced document's URIs must only have the same scheme, host, and port as the + * 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) { + if (parentURI == null) { + super.checkRequest(odataClient, request); + } else { + if (!parentURI.getScheme().equals(uri.getScheme()) + || !parentURI.getAuthority().equals(uri.getAuthority())) { + throw new IllegalArgumentException( + String.format("The referenced EDMX document has the URI '%s'" + + " where scheme, host, or port is different from the main metadata document URI '%s'.", + uri.toASCIIString(), parentURI.toASCIIString())); + } + } + } + + @Override + public ODataRetrieveResponse<XMLMetadata> execute() { + httpResponse = doExecute(); + return new AbstractODataRetrieveResponse(odataClient, httpClient, httpResponse) { + + private XMLMetadata metadata = null; + + @Override + public XMLMetadata getBody() { + if (metadata == null) { + try { + metadata = ((ODataClient) odataClient).getDeserializer(ODataFormat.XML).toMetadata(getRawResponse()); + } finally { + this.close(); + } + } + return metadata; + } + }; + } + } + + private class XMLMetadataResponseImpl extends AbstractODataRetrieveResponse { + + private final XMLMetadata metadata; + + private XMLMetadataResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient, + final HttpResponse res, final XMLMetadata metadata) { + + super(odataClient, httpClient, null); + this.metadata = metadata; + + statusCode = res.getStatusLine().getStatusCode(); + statusMessage = res.getStatusLine().getReasonPhrase(); + + hasBeenInitialized = true; + } + + @Override + public XMLMetadata getBody() { + return metadata; + } + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/ODataDeltaRequestImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/ODataDeltaRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/ODataDeltaRequestImpl.java deleted file mode 100644 index dbcfd4a..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/ODataDeltaRequestImpl.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.client.core.communication.request.retrieve.v4; - -import java.io.IOException; -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.communication.request.retrieve.v4.ODataDeltaRequest; -import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; -import org.apache.olingo.client.api.http.HttpClientException; -import org.apache.olingo.client.api.v4.ODataClient; -import org.apache.olingo.client.core.communication.request.retrieve.AbstractODataRetrieveRequest; -import org.apache.olingo.commons.api.data.Delta; -import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.v4.ODataDelta; -import org.apache.olingo.commons.api.format.ODataFormat; -import org.apache.olingo.commons.api.serialization.ODataDeserializerException; - -public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest<ODataDelta> - implements ODataDeltaRequest { - - public ODataDeltaRequestImpl(final CommonODataClient<?> odataClient, final URI query) { - super(odataClient, query); - } - - @Override - public ODataFormat getDefaultFormat() { - return odataClient.getConfiguration().getDefaultPubFormat(); - } - - @Override - public ODataRetrieveResponse<ODataDelta> execute() { - final HttpResponse res = doExecute(); - return new ODataDeltaResponseImpl(odataClient, httpClient, res); - } - - protected class ODataDeltaResponseImpl extends AbstractODataRetrieveResponse { - - private ODataDelta delta = null; - - private ODataDeltaResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient, - final HttpResponse res) { - - super(odataClient, httpClient, res); - } - - @Override - public ODataDelta getBody() { - if (delta == null) { - try { - final ResWrap<Delta> resource = ((ODataClient) odataClient). - getDeserializer(ODataFormat.fromString(getContentType())). - toDelta(res.getEntity().getContent()); - - delta = ((ODataClient) odataClient).getBinder().getODataDelta(resource); - } catch (IOException e) { - throw new HttpClientException(e); - } catch (final ODataDeserializerException e) { - throw new IllegalArgumentException(e); - } finally { - this.close(); - } - } - return delta; - } - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java deleted file mode 100644 index 3798240..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.client.core.communication.request.retrieve.v4; - -import java.net.URI; - -import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest; -import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest; -import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest; -import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest; -import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest; -import org.apache.olingo.client.api.communication.request.retrieve.v4.ODataDeltaRequest; -import org.apache.olingo.client.api.communication.request.retrieve.v4.RetrieveRequestFactory; -import org.apache.olingo.client.api.v4.ODataClient; -import org.apache.olingo.client.core.communication.request.retrieve.AbstractRetrieveRequestFactory; -import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl; -import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetIteratorRequestImpl; -import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetRequestImpl; -import org.apache.olingo.client.core.communication.request.retrieve.ODataPropertyRequestImpl; -import org.apache.olingo.commons.api.domain.v4.ODataEntity; -import org.apache.olingo.commons.api.domain.v4.ODataEntitySet; -import org.apache.olingo.commons.api.domain.v4.ODataProperty; -import org.apache.olingo.commons.api.domain.v4.ODataSingleton; - -public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory - implements RetrieveRequestFactory { - - public RetrieveRequestFactoryImpl(final ODataClient client) { - super(client); - } - - @Override - public XMLMetadataRequest getXMLMetadataRequest(final String serviceRoot) { - return new XMLMetadataRequestImpl(((ODataClient) client), - client.newURIBuilder(serviceRoot).appendMetadataSegment().build()); - } - - @Override - public ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(final URI uri) { - return new ODataEntitySetRequestImpl<ODataEntitySet>(client, uri); - } - - @Override - public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(final URI uri) { - return new ODataEntitySetIteratorRequestImpl<ODataEntitySet, ODataEntity>(client, uri); - } - - @Override - public ODataEntityRequest<ODataSingleton> getSingletonRequest(final URI uri) { - return new ODataEntityRequestImpl<ODataSingleton>(client, uri); - } - - @Override - public ODataEntityRequest<ODataEntity> getEntityRequest(final URI uri) { - return new ODataEntityRequestImpl<ODataEntity>(client, uri); - } - - @Override - public ODataPropertyRequest<ODataProperty> getPropertyRequest(final URI uri) { - return new ODataPropertyRequestImpl<ODataProperty>(client, uri); - } - - @Override - public ODataDeltaRequest getDeltaRequest(final URI uri) { - return new ODataDeltaRequestImpl(client, uri); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/XMLMetadataRequestImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/XMLMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/XMLMetadataRequestImpl.java deleted file mode 100644 index f299732..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/XMLMetadataRequestImpl.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.client.core.communication.request.retrieve.v4; - -import java.net.URI; - -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.communication.request.retrieve.XMLMetadataRequest; -import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; -import org.apache.olingo.client.api.edm.xml.Schema; -import org.apache.olingo.client.api.edm.xml.v4.Annotation; -import org.apache.olingo.client.api.edm.xml.v4.Annotations; -import org.apache.olingo.client.api.edm.xml.v4.Include; -import org.apache.olingo.client.api.edm.xml.v4.IncludeAnnotations; -import org.apache.olingo.client.api.edm.xml.v4.Reference; -import org.apache.olingo.client.api.edm.xml.v4.XMLMetadata; -import org.apache.olingo.client.api.v4.ODataClient; -import org.apache.olingo.client.core.communication.request.retrieve.AbstractMetadataRequestImpl; -import org.apache.olingo.client.core.edm.xml.AbstractSchema; -import org.apache.olingo.client.core.edm.xml.v4.AnnotationsImpl; -import org.apache.olingo.client.core.edm.xml.v4.SchemaImpl; -import org.apache.olingo.commons.api.format.ODataFormat; - -public class XMLMetadataRequestImpl - extends AbstractMetadataRequestImpl<org.apache.olingo.client.api.edm.xml.XMLMetadata> - implements XMLMetadataRequest { - - XMLMetadataRequestImpl(final ODataClient odataClient, final URI uri) { - super(odataClient, uri); - } - - @Override - public ODataRetrieveResponse<org.apache.olingo.client.api.edm.xml.XMLMetadata> execute() { - final SingleXMLMetadatRequestImpl rootReq = new SingleXMLMetadatRequestImpl((ODataClient) odataClient, uri, null); - final ODataRetrieveResponse<XMLMetadata> rootRes = rootReq.execute(); - - final XMLMetadataResponseImpl response = - new XMLMetadataResponseImpl(odataClient, httpClient, rootReq.getHttpResponse(), rootRes.getBody()); - - // process external references - for (Reference reference : rootRes.getBody().getReferences()) { - final SingleXMLMetadatRequestImpl includeReq = new SingleXMLMetadatRequestImpl( - (ODataClient) odataClient, - odataClient.newURIBuilder(uri.resolve(reference.getUri()).toASCIIString()).build(), - uri); - final XMLMetadata includeMetadata = includeReq.execute().getBody(); - - // edmx:Include - for (Include include : reference.getIncludes()) { - final Schema includedSchema = includeMetadata.getSchema(include.getNamespace()); - if (includedSchema != null) { - response.getBody().getSchemas().add((org.apache.olingo.client.api.edm.xml.v4.Schema) includedSchema); - if (StringUtils.isNotBlank(include.getAlias())) { - ((AbstractSchema) includedSchema).setAlias(include.getAlias()); - } - } - } - - // edmx:IncludeAnnotations - for (IncludeAnnotations include : reference.getIncludeAnnotations()) { - for (Schema schema : includeMetadata.getSchemas()) { - // create empty schema that will be fed with edm:Annotations that match the criteria in IncludeAnnotations - final SchemaImpl forInclusion = new SchemaImpl(); - forInclusion.setNamespace(schema.getNamespace()); - forInclusion.setAlias(schema.getAlias()); - - // process all edm:Annotations in each schema of the included document - for (Annotations annotationGroup : ((SchemaImpl) schema).getAnnotationGroups()) { - // take into account only when (TargetNamespace was either not provided or matches) and - // (Qualifier was either not provided or matches) - if ((StringUtils.isBlank(include.getTargetNamespace()) - || include.getTargetNamespace().equals( - StringUtils.substringBeforeLast(annotationGroup.getTarget(), "."))) - && (StringUtils.isBlank(include.getQualifier()) - || include.getQualifier().equals(annotationGroup.getQualifier()))) { - - final AnnotationsImpl toBeIncluded = new AnnotationsImpl(); - toBeIncluded.setTarget(annotationGroup.getTarget()); - toBeIncluded.setQualifier(annotationGroup.getQualifier()); - // only import annotations with terms matching the given TermNamespace - for (Annotation annotation : annotationGroup.getAnnotations()) { - if (include.getTermNamespace().equals(StringUtils.substringBeforeLast(annotation.getTerm(), "."))) { - toBeIncluded.getAnnotations().add(annotation); - } - } - forInclusion.getAnnotationGroups().add(toBeIncluded); - } - } - - if (!forInclusion.getAnnotationGroups().isEmpty()) { - response.getBody().getSchemas().add(forInclusion); - } - } - } - } - - return response; - } - - private class SingleXMLMetadatRequestImpl extends AbstractMetadataRequestImpl<XMLMetadata> { - - private final URI parentURI; - private HttpResponse httpResponse; - - public SingleXMLMetadatRequestImpl(final ODataClient odataClient, final URI uri, final URI parent) { - super(odataClient, uri); - parentURI = parent; - } - - public HttpResponse getHttpResponse() { - return httpResponse; - } - - /** Referenced document's URIs must only have the same scheme, host, and port as the - * 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) { - if (parentURI == null) { - super.checkRequest(odataClient, request); - } else { - if (!parentURI.getScheme().equals(uri.getScheme()) - || !parentURI.getAuthority().equals(uri.getAuthority())) { - throw new IllegalArgumentException( - String.format("The referenced EDMX document has the URI '%s'" - + " where scheme, host, or port is different from the main metadata document URI '%s'.", - uri.toASCIIString(), parentURI.toASCIIString())); - } - } - } - - @Override - public ODataRetrieveResponse<XMLMetadata> execute() { - httpResponse = doExecute(); - return new AbstractODataRetrieveResponse(odataClient, httpClient, httpResponse) { - - private XMLMetadata metadata = null; - - @Override - public XMLMetadata getBody() { - if (metadata == null) { - try { - metadata = ((ODataClient) odataClient).getDeserializer(ODataFormat.XML).toMetadata(getRawResponse()); - } finally { - this.close(); - } - } - return metadata; - } - }; - } - } - - private class XMLMetadataResponseImpl extends AbstractODataRetrieveResponse { - - private final XMLMetadata metadata; - - private XMLMetadataResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient, - final HttpResponse res, final XMLMetadata metadata) { - - super(odataClient, httpClient, null); - this.metadata = metadata; - - statusCode = res.getStatusLine().getStatusCode(); - statusMessage = res.getStatusLine().getReasonPhrase(); - - hasBeenInitialized = true; - } - - @Override - public XMLMetadata getBody() { - return metadata; - } - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/v4/AsyncBatchRequestWrapperImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/v4/AsyncBatchRequestWrapperImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/v4/AsyncBatchRequestWrapperImpl.java deleted file mode 100644 index a3763bf..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/v4/AsyncBatchRequestWrapperImpl.java +++ /dev/null @@ -1,119 +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.v4; - -import java.net.URI; -import java.util.Collection; - -import org.apache.commons.io.IOUtils; -import org.apache.olingo.client.api.communication.header.HeaderName; -import org.apache.olingo.client.api.communication.header.ODataPreferences; -import org.apache.olingo.client.api.communication.request.ODataBatchableRequest; -import org.apache.olingo.client.api.communication.request.batch.BatchManager; -import org.apache.olingo.client.api.communication.request.batch.ODataChangeset; -import org.apache.olingo.client.api.communication.request.batch.v4.ODataBatchRequest; -import org.apache.olingo.client.api.communication.request.v4.AsyncBatchRequestWrapper; -import org.apache.olingo.client.api.communication.response.ODataBatchResponse; -import org.apache.olingo.client.api.communication.response.v4.AsyncResponseWrapper; -import org.apache.olingo.client.api.v4.ODataClient; -import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; - -public class AsyncBatchRequestWrapperImpl extends AsyncRequestWrapperImpl<ODataBatchResponse> - implements AsyncBatchRequestWrapper { - - private BatchManager batchManager; - - protected AsyncBatchRequestWrapperImpl(final ODataClient odataClient, final ODataBatchRequest odataRequest) { - super(odataClient, odataRequest); - batchManager = odataRequest.payloadManager(); - } - - /** - * {@inheritDoc} - */ - @Override - public ODataChangeset addChangeset() { - return batchManager.addChangeset(); - } - - /** - * {@inheritDoc} - */ - @Override - public void addRetrieve(final ODataBatchableRequest request) { - batchManager.addRequest(request); - } - - /** - * {@inheritDoc} - */ - @Override - public void addOutsideUpdate(final ODataBatchableRequest request) { - batchManager.addRequest(request); - } - - @Override - public AsyncResponseWrapper<ODataBatchResponse> execute() { - return new AsyncResponseWrapperImpl(batchManager.getResponse()); - } - - public class AsyncResponseWrapperImpl - extends AsyncRequestWrapperImpl<ODataBatchResponse>.AsyncResponseWrapperImpl { - - /** - * Constructor. - * - * @param res OData batch response. - */ - public AsyncResponseWrapperImpl(final ODataBatchResponse res) { - super(); - - if (res.getStatusCode() == 202) { - retrieveMonitorDetails(res); - } else { - response = res; - } - } - - private void retrieveMonitorDetails(final ODataBatchResponse res) { - Collection<String> headers = res.getHeader(HeaderName.location.toString()); - if (headers == null || headers.isEmpty()) { - throw new AsyncRequestException("Invalid async request response. Monitor URL not found"); - } else { - this.location = URI.create(headers.iterator().next()); - } - - headers = res.getHeader(HeaderName.retryAfter.toString()); - if (headers != null && !headers.isEmpty()) { - this.retryAfter = Integer.parseInt(headers.iterator().next()); - } - - headers = res.getHeader(HeaderName.preferenceApplied.toString()); - if (headers != null && !headers.isEmpty()) { - for (String header : headers) { - if (header.equalsIgnoreCase(new ODataPreferences(ODataServiceVersion.V40).respondAsync())) { - preferenceApplied = true; - } - } - } - - IOUtils.closeQuietly(res.getRawResponse()); - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/v4/AsyncRequestException.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/v4/AsyncRequestException.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/v4/AsyncRequestException.java deleted file mode 100644 index a3f3651..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/v4/AsyncRequestException.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.v4; - -public class AsyncRequestException extends RuntimeException { - - private static final long serialVersionUID = -6080844898544654406L; - - public AsyncRequestException(final String message) { - super(message); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/109c33ba/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/v4/AsyncRequestFactoryImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/v4/AsyncRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/v4/AsyncRequestFactoryImpl.java deleted file mode 100644 index 851ce95..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/v4/AsyncRequestFactoryImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.client.core.communication.request.v4; - -import org.apache.olingo.client.api.communication.request.ODataRequest; -import org.apache.olingo.client.api.communication.request.batch.v4.ODataBatchRequest; -import org.apache.olingo.client.api.communication.request.v4.AsyncBatchRequestWrapper; -import org.apache.olingo.client.api.communication.request.v4.AsyncRequestFactory; -import org.apache.olingo.client.api.communication.request.v4.AsyncRequestWrapper; -import org.apache.olingo.client.api.communication.response.ODataResponse; -import org.apache.olingo.client.api.v4.ODataClient; - -public class AsyncRequestFactoryImpl implements AsyncRequestFactory { - - private final ODataClient client; - - public AsyncRequestFactoryImpl(final ODataClient client) { - this.client = client; - } - - @Override - public <R extends ODataResponse> AsyncRequestWrapper<R> getAsyncRequestWrapper(final ODataRequest odataRequest) { - return new AsyncRequestWrapperImpl<R>(client, odataRequest); - } - - @Override - public AsyncBatchRequestWrapper getAsyncBatchRequestWrapper(final ODataBatchRequest odataRequest) { - return new AsyncBatchRequestWrapperImpl(client, odataRequest); - } -}
