This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 26392df camel-olingo2 improvements (#4098) 26392df is described below commit 26392dfd37f7bd079a11bb48defb587d827df5b5 Author: Christoph Deppisch <cdeppi...@redhat.com> AuthorDate: Wed Aug 19 08:57:06 2020 +0200 camel-olingo2 improvements (#4098) * fix(CAMEL-15405): Propagate inline count in camel-olingo2 component Add result count (coming from system query option $inlinecount) to OData entries when using splitResults * fix(CAMEL-15406): Configure entity provider properties on camel-olingo2 Add uri param configuration settings for read/write entity provider properties. The entity provider properties are used for each read/write operation and specify the way to serialize OData entries as Json/Xml/Atom data. * fix(CAMEL-15407): Fix merge operation in camel-olingo2 Merge operation must enable isDataBasedPropertySerialization setting in the entity provider write properties in order to not overwrite unspecified fields with null values. --- .../apache/camel/catalog/components/olingo2.json | 4 + .../camel/catalog/docs/olingo2-component.adoc | 8 +- .../camel/component/olingo2/api/Olingo2App.java | 58 +- .../component/olingo2/api/impl/Olingo2AppImpl.java | 95 ++- .../Olingo2AppEndpointConfigurationConfigurer.java | 11 +- .../olingo2/Olingo2ComponentConfigurer.java | 10 + .../olingo2/Olingo2ConfigurationConfigurer.java | 10 + .../olingo2/Olingo2EndpointConfigurer.java | 10 + .../apache/camel/component/olingo2/olingo2.json | 4 + .../src/main/docs/olingo2-component.adoc | 8 +- .../camel/component/olingo2/Olingo2Component.java | 6 +- .../component/olingo2/Olingo2Configuration.java | 51 +- .../camel/component/olingo2/Olingo2Consumer.java | 7 + .../olingo2/Olingo2ComponentConsumerTest.java | 42 +- .../olingo2/Olingo2ComponentProducerTest.java | 59 +- .../dsl/Olingo2ComponentBuilderFactory.java | 35 ++ .../dsl/Olingo2EndpointBuilderFactory.java | 665 +++++++++++++-------- .../modules/ROOT/pages/olingo2-component.adoc | 8 +- 18 files changed, 792 insertions(+), 299 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/olingo2.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/olingo2.json index 73ea43d..c477291 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/olingo2.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/olingo2.json @@ -24,6 +24,8 @@ "configuration": { "kind": "property", "displayName": "Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.olingo2.Olingo2Configuration", "deprecated": false, "secret": false, "description": "To use the shared configuration" }, "connectTimeout": { "kind": "property", "displayName": "Connect Timeout", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "secret": false, "defaultValue": "30000", "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "HTTP connection creation timeout in milliseconds, defaults to 30,000 (30 seconds)" }, "contentType": { "kind": "property", "displayName": "Content Type", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "application\/json;charset=utf-8", "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Content-Type header value can be used to specify JSON or XML message format, defaults to appli [...] + "entityProviderReadProperties": { "kind": "property", "displayName": "Entity Provider Read Properties", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.olingo.odata2.api.ep.EntityProviderReadProperties", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Custom entity provider read properties applied to all read operat [...] + "entityProviderWriteProperties": { "kind": "property", "displayName": "Entity Provider Write Properties", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Custom entity provider write properties applied to create, upd [...] "filterAlreadySeen": { "kind": "property", "displayName": "Filter Already Seen", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Set this to true to filter out results that have already been communicated by this component." }, "httpHeaders": { "kind": "property", "displayName": "Http Headers", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.String>", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Custom HTTP headers to inject into every request, this could include OAuth tokens, etc." }, "proxy": { "kind": "property", "displayName": "Proxy", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.http.HttpHost", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "HTTP proxy server configuration" }, @@ -43,6 +45,8 @@ "methodName": { "kind": "path", "displayName": "Method Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "What sub operation to use for the selected operation" }, "connectTimeout": { "kind": "parameter", "displayName": "Connect Timeout", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "secret": false, "defaultValue": "30000", "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "HTTP connection creation timeout in milliseconds, defaults to 30,000 (30 seconds)" }, "contentType": { "kind": "parameter", "displayName": "Content Type", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "application\/json;charset=utf-8", "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Content-Type header value can be used to specify JSON or XML message format, defaults to appl [...] + "entityProviderReadProperties": { "kind": "parameter", "displayName": "Entity Provider Read Properties", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.olingo.odata2.api.ep.EntityProviderReadProperties", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Custom entity provider read properties applied to all read opera [...] + "entityProviderWriteProperties": { "kind": "parameter", "displayName": "Entity Provider Write Properties", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Custom entity provider write properties applied to create, up [...] "filterAlreadySeen": { "kind": "parameter", "displayName": "Filter Already Seen", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Set this to true to filter out results that have already been communicated by this component." }, "httpHeaders": { "kind": "parameter", "displayName": "Http Headers", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.String>", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Custom HTTP headers to inject into every request, this could include OAuth tokens, etc." }, "inBody": { "kind": "parameter", "displayName": "In Body", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Sets the name of a parameter to be passed in the exchange In Body" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/olingo2-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/olingo2-component.adoc index c81dad4..09b70ee 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/olingo2-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/olingo2-component.adoc @@ -52,7 +52,7 @@ for this component: // component options: START -The Olingo2 component supports 16 options, which are listed below. +The Olingo2 component supports 18 options, which are listed below. @@ -62,6 +62,8 @@ The Olingo2 component supports 16 options, which are listed below. | *configuration* (common) | To use the shared configuration | | Olingo2Configuration | *connectTimeout* (common) | HTTP connection creation timeout in milliseconds, defaults to 30,000 (30 seconds) | 30000 | int | *contentType* (common) | Content-Type header value can be used to specify JSON or XML message format, defaults to application/json;charset=utf-8 | application/json;charset=utf-8 | String +| *entityProviderReadProperties* (common) | Custom entity provider read properties applied to all read operations. | | EntityProviderReadProperties +| *entityProviderWriteProperties* (common) | Custom entity provider write properties applied to create, update and merge operations. For instance users can enable content only settings and skip meta data wrappers when sending request data. | | EntityProviderWriteProperties | *filterAlreadySeen* (common) | Set this to true to filter out results that have already been communicated by this component. | false | boolean | *httpHeaders* (common) | Custom HTTP headers to inject into every request, this could include OAuth tokens, etc. | | Map | *proxy* (common) | HTTP proxy server configuration | | HttpHost @@ -103,7 +105,7 @@ with the following path and query parameters: |=== -=== Query Parameters (34 parameters): +=== Query Parameters (36 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -111,6 +113,8 @@ with the following path and query parameters: | Name | Description | Default | Type | *connectTimeout* (common) | HTTP connection creation timeout in milliseconds, defaults to 30,000 (30 seconds) | 30000 | int | *contentType* (common) | Content-Type header value can be used to specify JSON or XML message format, defaults to application/json;charset=utf-8 | application/json;charset=utf-8 | String +| *entityProviderReadProperties* (common) | Custom entity provider read properties applied to all read operations. | | EntityProviderReadProperties +| *entityProviderWriteProperties* (common) | Custom entity provider write properties applied to create, update and merge operations. For instance users can enable content only settings and skip meta data wrappers when sending request data. | | EntityProviderWriteProperties | *filterAlreadySeen* (common) | Set this to true to filter out results that have already been communicated by this component. | false | boolean | *httpHeaders* (common) | Custom HTTP headers to inject into every request, this could include OAuth tokens, etc. | | Map | *inBody* (common) | Sets the name of a parameter to be passed in the exchange In Body | | String diff --git a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/Olingo2App.java b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/Olingo2App.java index cc9dfa5..c132c6a 100644 --- a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/Olingo2App.java +++ b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/Olingo2App.java @@ -23,6 +23,8 @@ import java.util.Map; import org.apache.camel.component.olingo2.api.batch.Olingo2BatchResponse; import org.apache.olingo.odata2.api.commons.HttpStatusCodes; import org.apache.olingo.odata2.api.edm.Edm; +import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; +import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties; /** * Olingo2 Client Api Interface. @@ -31,42 +33,70 @@ public interface Olingo2App { /** * Sets Service base URI. - * + * * @param serviceUri */ void setServiceUri(String serviceUri); /** * Returns Service base URI. - * + * * @return service base URI. */ String getServiceUri(); /** * Sets custom Http headers to add to every service request. - * + * * @param httpHeaders custom Http headers. */ void setHttpHeaders(Map<String, String> httpHeaders); /** + * Specify custom entity provider read properties. + * + * @param entityProviderReadProperties the custom properties to set. + */ + void setEntityProviderReadProperties(EntityProviderReadProperties entityProviderReadProperties); + + /** + * Obtains the custom entity provider read properties. + * + * @return the custom read properties. + */ + EntityProviderReadProperties getEntityProviderReadProperties(); + + /** + * Specify custom entity provider write properties. + * + * @param entityProviderWriteProperties the custom properties to set. + */ + void setEntityProviderWriteProperties(EntityProviderWriteProperties entityProviderWriteProperties); + + /** + * Obtains the custom entity provider write properties. + * + * @return the custom write properties. + */ + EntityProviderWriteProperties getEntityProviderWriteProperties(); + + /** * Returns custom Http headers. - * + * * @return custom Http headers. */ Map<String, String> getHttpHeaders(); /** * Returns content type for service calls. Defaults to <code>application/json;charset=utf-8</code>. - * + * * @return content type. */ String getContentType(); /** * Set default service call content type. - * + * * @param contentType content type. */ void setContentType(String contentType); @@ -78,7 +108,7 @@ public interface Olingo2App { /** * Reads an OData resource and invokes callback with appropriate result. - * + * * @param edm Service Edm, read from calling * <code>read(null, "$metdata", null, responseHandler)</code> * @param resourcePath OData Resource path @@ -93,7 +123,7 @@ public interface Olingo2App { /** * Reads an OData resource and invokes callback with the unparsed input stream. - * + * * @param edm Service Edm, read from calling * <code>read(null, "$metdata", null, responseHandler)</code> * @param resourcePath OData Resource path @@ -109,7 +139,7 @@ public interface Olingo2App { /** * Deletes an OData resource and invokes callback with {@link org.apache.olingo.odata2.api.commons.HttpStatusCodes} * on success, or with exception on failure. - * + * * @param resourcePath resource path for Entry * @param endpointHttpHeaders HTTP Headers to add/override the component versions * @param responseHandler {@link org.apache.olingo.odata2.api.commons.HttpStatusCodes} callback handler @@ -120,7 +150,7 @@ public interface Olingo2App { /** * Creates a new OData resource. - * + * * @param edm service Edm * @param resourcePath resource path to create * @param endpointHttpHeaders HTTP Headers to add/override the component versions @@ -133,7 +163,7 @@ public interface Olingo2App { /** * Updates an OData resource. - * + * * @param edm service Edm * @param resourcePath resource path to update * @param endpointHttpHeaders HTTP Headers to add/override the component versions @@ -146,7 +176,7 @@ public interface Olingo2App { /** * Patches/merges an OData resource using HTTP PATCH. - * + * * @param edm service Edm * @param resourcePath resource path to update * @param endpointHttpHeaders HTTP Headers to add/override the component versions @@ -159,7 +189,7 @@ public interface Olingo2App { /** * Patches/merges an OData resource using HTTP MERGE. - * + * * @param edm service Edm * @param resourcePath resource path to update * @param endpointHttpHeaders HTTP Headers to add/override the component versions @@ -172,7 +202,7 @@ public interface Olingo2App { /** * Executes a batch request. - * + * * @param edm service Edm * @param endpointHttpHeaders HTTP Headers to add/override the component versions * @param data ordered {@link org.apache.camel.component.olingo2.api.batch.Olingo2BatchRequest} list diff --git a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java index 928bf53..f074d9f 100644 --- a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java +++ b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java @@ -129,6 +129,8 @@ public final class Olingo2AppImpl implements Olingo2App { private String serviceUri; private ContentType contentType; private Map<String, String> httpHeaders; + private EntityProviderReadProperties entityProviderReadProperties; + private EntityProviderWriteProperties entityProviderWriteProperties; /** * Create Olingo2 Application with default HTTP configuration. @@ -198,6 +200,34 @@ public final class Olingo2AppImpl implements Olingo2App { } @Override + public void setEntityProviderReadProperties(EntityProviderReadProperties entityProviderReadProperties) { + this.entityProviderReadProperties = entityProviderReadProperties; + } + + @Override + public EntityProviderReadProperties getEntityProviderReadProperties() { + if (entityProviderReadProperties == null) { + entityProviderReadProperties = EntityProviderReadProperties.init().build(); + } + + return entityProviderReadProperties; + } + + @Override + public void setEntityProviderWriteProperties(EntityProviderWriteProperties entityProviderWriteProperties) { + this.entityProviderWriteProperties = entityProviderWriteProperties; + } + + @Override + public EntityProviderWriteProperties getEntityProviderWriteProperties() { + if (entityProviderWriteProperties == null) { + entityProviderWriteProperties = EntityProviderWriteProperties.serviceRoot(null).build(); + } + + return entityProviderWriteProperties; + } + + @Override public String getContentType() { return contentType.toString(); } @@ -310,7 +340,8 @@ public final class Olingo2AppImpl implements Olingo2App { final Olingo2ResponseHandler<T> responseHandler) { final UriInfoWithType uriInfo = parseUri(edm, resourcePath, null); - writeContent(edm, new HttpPost(createUri(resourcePath, null)), uriInfo, endpointHttpHeaders, data, responseHandler); + writeContent(edm, new HttpPost(createUri(resourcePath, null)), uriInfo, + endpointHttpHeaders, data, responseHandler, getEntityProviderWriteProperties()); } @Override @@ -320,7 +351,8 @@ public final class Olingo2AppImpl implements Olingo2App { final UriInfoWithType uriInfo = parseUri(edm, resourcePath, null); augmentWithETag(edm, resourcePath, endpointHttpHeaders, new HttpPut(createUri(resourcePath, null)), - request -> writeContent(edm, (HttpPut) request, uriInfo, endpointHttpHeaders, data, responseHandler), + request -> writeContent(edm, (HttpPut) request, uriInfo, + endpointHttpHeaders, data, responseHandler, getEntityProviderWriteProperties()), responseHandler); } @@ -331,7 +363,8 @@ public final class Olingo2AppImpl implements Olingo2App { final UriInfoWithType uriInfo = parseUri(edm, resourcePath, null); augmentWithETag(edm, resourcePath, endpointHttpHeaders, new HttpPatch(createUri(resourcePath, null)), - request -> writeContent(edm, (HttpPatch) request, uriInfo, endpointHttpHeaders, data, responseHandler), + request -> writeContent(edm, (HttpPatch) request, uriInfo, + endpointHttpHeaders, data, responseHandler, getEntityProviderWriteProperties()), responseHandler); } @@ -341,8 +374,14 @@ public final class Olingo2AppImpl implements Olingo2App { final Olingo2ResponseHandler<T> responseHandler) { final UriInfoWithType uriInfo = parseUri(edm, resourcePath, null); + // merge operation must use data based property serialization in order to not overwrite + // unspecified properties with null values + EntityProviderWriteProperties entityProviderWriteProperties = + EntityProviderWriteProperties.fromProperties(getEntityProviderWriteProperties()) + .isDataBasedPropertySerialization(true).build(); augmentWithETag(edm, resourcePath, endpointHttpHeaders, new HttpMerge(createUri(resourcePath, null)), - request -> writeContent(edm, (HttpMerge) request, uriInfo, endpointHttpHeaders, data, responseHandler), + request -> writeContent(edm, (HttpMerge) request, uriInfo, + endpointHttpHeaders, data, responseHandler, entityProviderWriteProperties), responseHandler); } @@ -352,7 +391,8 @@ public final class Olingo2AppImpl implements Olingo2App { final Olingo2ResponseHandler<List<Olingo2BatchResponse>> responseHandler) { final UriInfoWithType uriInfo = parseUri(edm, BATCH, null); - writeContent(edm, new HttpPost(createUri(BATCH, null)), uriInfo, endpointHttpHeaders, data, responseHandler); + writeContent(edm, new HttpPost(createUri(BATCH, null)), uriInfo, + endpointHttpHeaders, data, responseHandler, getEntityProviderWriteProperties()); } @Override @@ -506,7 +546,7 @@ public final class Olingo2AppImpl implements Olingo2App { final List<EdmProperty> complexPropertyPath = uriInfo.getPropertyPath(); final EdmProperty complexProperty = complexPropertyPath.get(complexPropertyPath.size() - 1); response = (T) EntityProvider.readProperty(getContentType(), complexProperty, content, - EntityProviderReadProperties.init().build()); + getEntityProviderReadProperties()); break; case URI4: @@ -518,7 +558,7 @@ public final class Olingo2AppImpl implements Olingo2App { response = (T) EntityProvider.readPropertyValue(simpleProperty, content); } else { response = (T) EntityProvider.readProperty(getContentType(), simpleProperty, content, - EntityProviderReadProperties.init().build()); + getEntityProviderReadProperties()); } break; @@ -536,18 +576,18 @@ public final class Olingo2AppImpl implements Olingo2App { if (uriInfo.getCustomQueryOptions().containsKey("!deltatoken")) { // ODataDeltaFeed response = (T) EntityProvider.readDeltaFeed(getContentType(), uriInfo.getTargetEntitySet(), content, - EntityProviderReadProperties.init().build()); + getEntityProviderReadProperties()); } else { // ODataFeed response = (T) EntityProvider.readFeed(getContentType(), uriInfo.getTargetEntitySet(), content, - EntityProviderReadProperties.init().build()); + getEntityProviderReadProperties()); } break; case URI2: case URI6A: response = (T) EntityProvider.readEntry(getContentType(), uriInfo.getTargetEntitySet(), content, - EntityProviderReadProperties.init().build()); + getEntityProviderReadProperties()); break; // Function Imports @@ -557,7 +597,7 @@ public final class Olingo2AppImpl implements Olingo2App { case URI13: case URI14: response = (T) EntityProvider.readFunctionImport(getContentType(), uriInfo.getFunctionImport(), content, - EntityProviderReadProperties.init().build()); + getEntityProviderReadProperties()); break; default: @@ -570,11 +610,11 @@ public final class Olingo2AppImpl implements Olingo2App { private <T> void writeContent( final Edm edm, final HttpEntityEnclosingRequestBase httpEntityRequest, final UriInfoWithType uriInfo, final Map<String, String> endpointHttpHeaders, final Object content, - final Olingo2ResponseHandler<T> responseHandler) { + final Olingo2ResponseHandler<T> responseHandler, EntityProviderWriteProperties entityProviderWriteProperties) { try { // process resource by UriType - final ODataResponse response = writeContent(edm, uriInfo, content); + final ODataResponse response = writeContent(edm, uriInfo, content, entityProviderWriteProperties); // copy all response headers for (String header : response.getHeaderNames()) { @@ -672,7 +712,7 @@ public final class Olingo2AppImpl implements Olingo2App { responseHandler.onResponse( (T) EntityProvider.readProperty(getContentType(), simpleProperty, result.getEntity().getContent(), - EntityProviderReadProperties.init().build()), + getEntityProviderReadProperties()), headersToMap(result.getAllHeaders())); } break; @@ -685,7 +725,7 @@ public final class Olingo2AppImpl implements Olingo2App { responseHandler.onResponse( (T) EntityProvider.readProperty(getContentType(), complexProperty, result.getEntity().getContent(), - EntityProviderReadProperties.init().build()), + getEntityProviderReadProperties()), headersToMap(result.getAllHeaders())); break; @@ -719,7 +759,7 @@ public final class Olingo2AppImpl implements Olingo2App { responseHandler.onResponse( (T) EntityProvider.readEntry(response.getContentHeader(), uriInfo.getTargetEntitySet(), result.getEntity().getContent(), - EntityProviderReadProperties.init().build()), + getEntityProviderReadProperties()), headersToMap(result.getAllHeaders())); break; @@ -738,7 +778,8 @@ public final class Olingo2AppImpl implements Olingo2App { } } - private ODataResponse writeContent(Edm edm, UriInfoWithType uriInfo, Object content) + private ODataResponse writeContent(Edm edm, UriInfoWithType uriInfo, + Object content, EntityProviderWriteProperties entityProviderWriteProperties) throws ODataApplicationException, EdmException, EntityProviderException, URISyntaxException, IOException { String responseContentType = getContentType(); @@ -770,7 +811,8 @@ public final class Olingo2AppImpl implements Olingo2App { // $links with 0..1 cardinality property final EdmEntitySet targetLinkEntitySet = uriInfo.getTargetEntitySet(); EntityProviderWriteProperties linkProperties - = EntityProviderWriteProperties.serviceRoot(new URI(serviceUri + SEPARATOR)).build(); + = EntityProviderWriteProperties.fromProperties(entityProviderWriteProperties) + .serviceRoot(new URI(serviceUri + SEPARATOR)).build(); @SuppressWarnings("unchecked") final Map<String, Object> linkMap = (Map<String, Object>) content; response = EntityProvider.writeLink(responseContentType, targetLinkEntitySet, linkMap, linkProperties); @@ -780,7 +822,8 @@ public final class Olingo2AppImpl implements Olingo2App { // $links with * cardinality property final EdmEntitySet targetLinksEntitySet = uriInfo.getTargetEntitySet(); EntityProviderWriteProperties linksProperties - = EntityProviderWriteProperties.serviceRoot(new URI(serviceUri + SEPARATOR)).build(); + = EntityProviderWriteProperties.fromProperties(entityProviderWriteProperties) + .serviceRoot(new URI(serviceUri + SEPARATOR)).build(); @SuppressWarnings("unchecked") final List<Map<String, Object>> linksMap = (List<Map<String, Object>>) content; response = EntityProvider.writeLinks(responseContentType, targetLinksEntitySet, linksMap, linksProperties); @@ -793,7 +836,8 @@ public final class Olingo2AppImpl implements Olingo2App { // Entity final EdmEntitySet targetEntitySet = uriInfo.getTargetEntitySet(); EntityProviderWriteProperties properties - = EntityProviderWriteProperties.serviceRoot(new URI(serviceUri + SEPARATOR)).build(); + = EntityProviderWriteProperties.fromProperties(entityProviderWriteProperties) + .serviceRoot(new URI(serviceUri + SEPARATOR)).build(); @SuppressWarnings("unchecked") final Map<String, Object> objectMap = (Map<String, Object>) content; response = EntityProvider.writeEntry(responseContentType, targetEntitySet, objectMap, properties); @@ -888,7 +932,8 @@ public final class Olingo2AppImpl implements Olingo2App { if (batchRequest.getBody() != null && !Operation.DELETE.equals(batchRequest.getOperation())) { - final ODataResponse response = writeContent(edm, uriInfo, batchRequest.getBody()); + final ODataResponse response = writeContent(edm, uriInfo, batchRequest.getBody(), + getEntityProviderWriteProperties()); // copy response headers for (String header : response.getHeaderNames()) { headers.put(header, response.getHeader(header)); @@ -1024,9 +1069,7 @@ public final class Olingo2AppImpl implements Olingo2App { } AbstractFutureCallback.checkStatus(httpResponse); - } catch (ODataApplicationException e) { - return new Olingo2BatchResponse(statusCode, statusInfo, response.getContentId(), response.getHeaders(), e); - } catch (UnsupportedEncodingException e) { + } catch (ODataApplicationException | UnsupportedEncodingException e) { return new Olingo2BatchResponse(statusCode, statusInfo, response.getContentId(), response.getHeaders(), e); } @@ -1141,9 +1184,7 @@ public final class Olingo2AppImpl implements Olingo2App { } } result = new UriInfoWithType(UriParser.parse(edm, pathSegments, queryParams), resourcePath); - } catch (URISyntaxException e) { - throw new IllegalArgumentException("resourcePath: " + e.getMessage(), e); - } catch (ODataException e) { + } catch (URISyntaxException | ODataException e) { throw new IllegalArgumentException("resourcePath: " + e.getMessage(), e); } diff --git a/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2AppEndpointConfigurationConfigurer.java b/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2AppEndpointConfigurationConfigurer.java index b2d477d..ea448a4 100644 --- a/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2AppEndpointConfigurationConfigurer.java +++ b/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2AppEndpointConfigurationConfigurer.java @@ -7,7 +7,6 @@ import org.apache.camel.CamelContext; import org.apache.camel.spi.GeneratedPropertyConfigurer; import org.apache.camel.spi.PropertyConfigurerGetter; import org.apache.camel.util.CaseInsensitiveMap; -import org.apache.camel.component.olingo2.Olingo2AppEndpointConfiguration; /** * Generated by camel build tools - do NOT edit this file! @@ -31,6 +30,10 @@ public class Olingo2AppEndpointConfigurationConfigurer extends org.apache.camel. case "Edm": target.setEdm(property(camelContext, org.apache.olingo.odata2.api.edm.Edm.class, value)); return true; case "endpointhttpheaders": case "EndpointHttpHeaders": target.setEndpointHttpHeaders(property(camelContext, java.util.Map.class, value)); return true; + case "entityproviderreadproperties": + case "EntityProviderReadProperties": target.setEntityProviderReadProperties(property(camelContext, org.apache.olingo.odata2.api.ep.EntityProviderReadProperties.class, value)); return true; + case "entityproviderwriteproperties": + case "EntityProviderWriteProperties": target.setEntityProviderWriteProperties(property(camelContext, org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.class, value)); return true; case "filteralreadyseen": case "FilterAlreadySeen": target.setFilterAlreadySeen(property(camelContext, boolean.class, value)); return true; case "httpasyncclientbuilder": @@ -72,6 +75,8 @@ public class Olingo2AppEndpointConfigurationConfigurer extends org.apache.camel. answer.put("Data", java.lang.Object.class); answer.put("Edm", org.apache.olingo.odata2.api.edm.Edm.class); answer.put("EndpointHttpHeaders", java.util.Map.class); + answer.put("EntityProviderReadProperties", org.apache.olingo.odata2.api.ep.EntityProviderReadProperties.class); + answer.put("EntityProviderWriteProperties", org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.class); answer.put("FilterAlreadySeen", boolean.class); answer.put("HttpAsyncClientBuilder", org.apache.http.impl.nio.client.HttpAsyncClientBuilder.class); answer.put("HttpClientBuilder", org.apache.http.impl.client.HttpClientBuilder.class); @@ -105,6 +110,10 @@ public class Olingo2AppEndpointConfigurationConfigurer extends org.apache.camel. case "Edm": return target.getEdm(); case "endpointhttpheaders": case "EndpointHttpHeaders": return target.getEndpointHttpHeaders(); + case "entityproviderreadproperties": + case "EntityProviderReadProperties": return target.getEntityProviderReadProperties(); + case "entityproviderwriteproperties": + case "EntityProviderWriteProperties": return target.getEntityProviderWriteProperties(); case "filteralreadyseen": case "FilterAlreadySeen": return target.isFilterAlreadySeen(); case "httpasyncclientbuilder": diff --git a/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2ComponentConfigurer.java b/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2ComponentConfigurer.java index 9fe3d6e..c3469aa 100644 --- a/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2ComponentConfigurer.java +++ b/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2ComponentConfigurer.java @@ -35,6 +35,10 @@ public class Olingo2ComponentConfigurer extends PropertyConfigurerSupport implem case "connectTimeout": getOrCreateConfiguration(target).setConnectTimeout(property(camelContext, int.class, value)); return true; case "contenttype": case "contentType": getOrCreateConfiguration(target).setContentType(property(camelContext, java.lang.String.class, value)); return true; + case "entityproviderreadproperties": + case "entityProviderReadProperties": getOrCreateConfiguration(target).setEntityProviderReadProperties(property(camelContext, org.apache.olingo.odata2.api.ep.EntityProviderReadProperties.class, value)); return true; + case "entityproviderwriteproperties": + case "entityProviderWriteProperties": getOrCreateConfiguration(target).setEntityProviderWriteProperties(property(camelContext, org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.class, value)); return true; case "filteralreadyseen": case "filterAlreadySeen": getOrCreateConfiguration(target).setFilterAlreadySeen(property(camelContext, boolean.class, value)); return true; case "httpasyncclientbuilder": @@ -68,6 +72,8 @@ public class Olingo2ComponentConfigurer extends PropertyConfigurerSupport implem answer.put("configuration", org.apache.camel.component.olingo2.Olingo2Configuration.class); answer.put("connectTimeout", int.class); answer.put("contentType", java.lang.String.class); + answer.put("entityProviderReadProperties", org.apache.olingo.odata2.api.ep.EntityProviderReadProperties.class); + answer.put("entityProviderWriteProperties", org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.class); answer.put("filterAlreadySeen", boolean.class); answer.put("httpAsyncClientBuilder", org.apache.http.impl.nio.client.HttpAsyncClientBuilder.class); answer.put("httpClientBuilder", org.apache.http.impl.client.HttpClientBuilder.class); @@ -95,6 +101,10 @@ public class Olingo2ComponentConfigurer extends PropertyConfigurerSupport implem case "connectTimeout": return getOrCreateConfiguration(target).getConnectTimeout(); case "contenttype": case "contentType": return getOrCreateConfiguration(target).getContentType(); + case "entityproviderreadproperties": + case "entityProviderReadProperties": return getOrCreateConfiguration(target).getEntityProviderReadProperties(); + case "entityproviderwriteproperties": + case "entityProviderWriteProperties": return getOrCreateConfiguration(target).getEntityProviderWriteProperties(); case "filteralreadyseen": case "filterAlreadySeen": return getOrCreateConfiguration(target).isFilterAlreadySeen(); case "httpasyncclientbuilder": diff --git a/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2ConfigurationConfigurer.java b/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2ConfigurationConfigurer.java index 6889d23..f95a885 100644 --- a/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2ConfigurationConfigurer.java +++ b/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2ConfigurationConfigurer.java @@ -25,6 +25,10 @@ public class Olingo2ConfigurationConfigurer extends org.apache.camel.support.com case "ConnectTimeout": target.setConnectTimeout(property(camelContext, int.class, value)); return true; case "contenttype": case "ContentType": target.setContentType(property(camelContext, java.lang.String.class, value)); return true; + case "entityproviderreadproperties": + case "EntityProviderReadProperties": target.setEntityProviderReadProperties(property(camelContext, org.apache.olingo.odata2.api.ep.EntityProviderReadProperties.class, value)); return true; + case "entityproviderwriteproperties": + case "EntityProviderWriteProperties": target.setEntityProviderWriteProperties(property(camelContext, org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.class, value)); return true; case "filteralreadyseen": case "FilterAlreadySeen": target.setFilterAlreadySeen(property(camelContext, boolean.class, value)); return true; case "httpasyncclientbuilder": @@ -55,6 +59,8 @@ public class Olingo2ConfigurationConfigurer extends org.apache.camel.support.com answer.put("ApiName", org.apache.camel.component.olingo2.internal.Olingo2ApiName.class); answer.put("ConnectTimeout", int.class); answer.put("ContentType", java.lang.String.class); + answer.put("EntityProviderReadProperties", org.apache.olingo.odata2.api.ep.EntityProviderReadProperties.class); + answer.put("EntityProviderWriteProperties", org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.class); answer.put("FilterAlreadySeen", boolean.class); answer.put("HttpAsyncClientBuilder", org.apache.http.impl.nio.client.HttpAsyncClientBuilder.class); answer.put("HttpClientBuilder", org.apache.http.impl.client.HttpClientBuilder.class); @@ -78,6 +84,10 @@ public class Olingo2ConfigurationConfigurer extends org.apache.camel.support.com case "ConnectTimeout": return target.getConnectTimeout(); case "contenttype": case "ContentType": return target.getContentType(); + case "entityproviderreadproperties": + case "EntityProviderReadProperties": return target.getEntityProviderReadProperties(); + case "entityproviderwriteproperties": + case "EntityProviderWriteProperties": return target.getEntityProviderWriteProperties(); case "filteralreadyseen": case "FilterAlreadySeen": return target.isFilterAlreadySeen(); case "httpasyncclientbuilder": diff --git a/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2EndpointConfigurer.java b/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2EndpointConfigurer.java index dcde97e..25c616e 100644 --- a/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2EndpointConfigurer.java +++ b/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2EndpointConfigurer.java @@ -34,6 +34,10 @@ public class Olingo2EndpointConfigurer extends PropertyConfigurerSupport impleme case "contenttype": case "contentType": target.getConfiguration().setContentType(property(camelContext, java.lang.String.class, value)); return true; case "delay": target.setDelay(property(camelContext, long.class, value)); return true; + case "entityproviderreadproperties": + case "entityProviderReadProperties": target.getConfiguration().setEntityProviderReadProperties(property(camelContext, org.apache.olingo.odata2.api.ep.EntityProviderReadProperties.class, value)); return true; + case "entityproviderwriteproperties": + case "entityProviderWriteProperties": target.getConfiguration().setEntityProviderWriteProperties(property(camelContext, org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.class, value)); return true; case "exceptionhandler": case "exceptionHandler": target.setExceptionHandler(property(camelContext, org.apache.camel.spi.ExceptionHandler.class, value)); return true; case "exchangepattern": @@ -97,6 +101,8 @@ public class Olingo2EndpointConfigurer extends PropertyConfigurerSupport impleme answer.put("connectTimeout", int.class); answer.put("contentType", java.lang.String.class); answer.put("delay", long.class); + answer.put("entityProviderReadProperties", org.apache.olingo.odata2.api.ep.EntityProviderReadProperties.class); + answer.put("entityProviderWriteProperties", org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties.class); answer.put("exceptionHandler", org.apache.camel.spi.ExceptionHandler.class); answer.put("exchangePattern", org.apache.camel.ExchangePattern.class); answer.put("filterAlreadySeen", boolean.class); @@ -145,6 +151,10 @@ public class Olingo2EndpointConfigurer extends PropertyConfigurerSupport impleme case "contenttype": case "contentType": return target.getConfiguration().getContentType(); case "delay": return target.getDelay(); + case "entityproviderreadproperties": + case "entityProviderReadProperties": return target.getConfiguration().getEntityProviderReadProperties(); + case "entityproviderwriteproperties": + case "entityProviderWriteProperties": return target.getConfiguration().getEntityProviderWriteProperties(); case "exceptionhandler": case "exceptionHandler": return target.getExceptionHandler(); case "exchangepattern": diff --git a/components/camel-olingo2/camel-olingo2-component/src/generated/resources/org/apache/camel/component/olingo2/olingo2.json b/components/camel-olingo2/camel-olingo2-component/src/generated/resources/org/apache/camel/component/olingo2/olingo2.json index 73ea43d..f07ed5a 100644 --- a/components/camel-olingo2/camel-olingo2-component/src/generated/resources/org/apache/camel/component/olingo2/olingo2.json +++ b/components/camel-olingo2/camel-olingo2-component/src/generated/resources/org/apache/camel/component/olingo2/olingo2.json @@ -24,6 +24,8 @@ "configuration": { "kind": "property", "displayName": "Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.olingo2.Olingo2Configuration", "deprecated": false, "secret": false, "description": "To use the shared configuration" }, "connectTimeout": { "kind": "property", "displayName": "Connect Timeout", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "secret": false, "defaultValue": "30000", "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "HTTP connection creation timeout in milliseconds, defaults to 30,000 (30 seconds)" }, "contentType": { "kind": "property", "displayName": "Content Type", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "application\/json;charset=utf-8", "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Content-Type header value can be used to specify JSON or XML message format, defaults to appli [...] + "entityProviderReadProperties": { "kind": "property", "displayName": "Entity Provider Read Properties", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.olingo.odata2.api.ep.EntityProviderReadProperties", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Custom entity provider read properties applied to all read operat [...] + "entityProviderWriteProperties": { "kind": "property", "displayName": "Entity Provider Write Properties", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Custom entity provider write properties applied to create, upd [...] "filterAlreadySeen": { "kind": "property", "displayName": "Filter Already Seen", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Set this to true to filter out results that have already been communicated by this component." }, "httpHeaders": { "kind": "property", "displayName": "Http Headers", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.String>", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Custom HTTP headers to inject into every request, this could include OAuth tokens, etc." }, "proxy": { "kind": "property", "displayName": "Proxy", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.http.HttpHost", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "HTTP proxy server configuration" }, @@ -43,6 +45,8 @@ "methodName": { "kind": "path", "displayName": "Method Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "What sub operation to use for the selected operation" }, "connectTimeout": { "kind": "parameter", "displayName": "Connect Timeout", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "secret": false, "defaultValue": "30000", "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "HTTP connection creation timeout in milliseconds, defaults to 30,000 (30 seconds)" }, "contentType": { "kind": "parameter", "displayName": "Content Type", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "application\/json;charset=utf-8", "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Content-Type header value can be used to specify JSON or XML message format, defaults to appl [...] + "entityProviderReadProperties": { "kind": "parameter", "displayName": "Entity Provider Read Properties", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.olingo.odata2.api.ep.EntityProviderReadProperties", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Custom entity provider read properties applied to all read opera [...] + "entityProviderWriteProperties": { "kind": "parameter", "displayName": "Entity Provider Write Properties", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Custom entity provider write properties applied to create, up [...] "filterAlreadySeen": { "kind": "parameter", "displayName": "Filter Already Seen", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Set this to true to filter out results that have already been communicated by this component." }, "httpHeaders": { "kind": "parameter", "displayName": "Http Headers", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.String>", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.olingo2.Olingo2Configuration", "configurationField": "configuration", "description": "Custom HTTP headers to inject into every request, this could include OAuth tokens, etc." }, "inBody": { "kind": "parameter", "displayName": "In Body", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Sets the name of a parameter to be passed in the exchange In Body" }, diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/docs/olingo2-component.adoc b/components/camel-olingo2/camel-olingo2-component/src/main/docs/olingo2-component.adoc index c81dad4..bd2e800 100644 --- a/components/camel-olingo2/camel-olingo2-component/src/main/docs/olingo2-component.adoc +++ b/components/camel-olingo2/camel-olingo2-component/src/main/docs/olingo2-component.adoc @@ -52,7 +52,7 @@ for this component: // component options: START -The Olingo2 component supports 16 options, which are listed below. +The Olingo2 component supports 18 options, which are listed below. @@ -62,6 +62,8 @@ The Olingo2 component supports 16 options, which are listed below. | *configuration* (common) | To use the shared configuration | | Olingo2Configuration | *connectTimeout* (common) | HTTP connection creation timeout in milliseconds, defaults to 30,000 (30 seconds) | 30000 | int | *contentType* (common) | Content-Type header value can be used to specify JSON or XML message format, defaults to application/json;charset=utf-8 | application/json;charset=utf-8 | String +| *entityProviderReadProperties* (common) | Custom entity provider read properties applied to all read operations. | | EntityProviderReadProperties +| *entityProviderWriteProperties* (common) | Custom entity provider write properties applied to create, update, patch, batch and merge operations. For instance users can skip the Json object wrapper or enable content only mode when sending request data. A service URI set in the properties will always be overwritten by the serviceUri configuration parameter. Please consider to using the serviceUri configuration parameter instead of setting the respective write property here. | | EntityPr [...] | *filterAlreadySeen* (common) | Set this to true to filter out results that have already been communicated by this component. | false | boolean | *httpHeaders* (common) | Custom HTTP headers to inject into every request, this could include OAuth tokens, etc. | | Map | *proxy* (common) | HTTP proxy server configuration | | HttpHost @@ -103,7 +105,7 @@ with the following path and query parameters: |=== -=== Query Parameters (34 parameters): +=== Query Parameters (36 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -111,6 +113,8 @@ with the following path and query parameters: | Name | Description | Default | Type | *connectTimeout* (common) | HTTP connection creation timeout in milliseconds, defaults to 30,000 (30 seconds) | 30000 | int | *contentType* (common) | Content-Type header value can be used to specify JSON or XML message format, defaults to application/json;charset=utf-8 | application/json;charset=utf-8 | String +| *entityProviderReadProperties* (common) | Custom entity provider read properties applied to all read operations. | | EntityProviderReadProperties +| *entityProviderWriteProperties* (common) | Custom entity provider write properties applied to create, update, patch, batch and merge operations. For instance users can skip the Json object wrapper or enable content only mode when sending request data. A service URI set in the properties will always be overwritten by the serviceUri configuration parameter. Please consider to using the serviceUri configuration parameter instead of setting the respective write property here. | | EntityPr [...] | *filterAlreadySeen* (common) | Set this to true to filter out results that have already been communicated by this component. | false | boolean | *httpHeaders* (common) | Custom HTTP headers to inject into every request, this could include OAuth tokens, etc. | | Map | *inBody* (common) | Sets the name of a parameter to be passed in the exchange In Body | | String diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java index 2fb1728..6302d50 100644 --- a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java +++ b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java @@ -174,9 +174,7 @@ public class Olingo2Component extends AbstractApiComponent<Olingo2ApiName, Oling } try { asyncClientBuilder.setSSLContext(sslContextParameters.createSSLContext(getCamelContext())); - } catch (GeneralSecurityException e) { - throw RuntimeCamelException.wrapRuntimeCamelException(e); - } catch (IOException e) { + } catch (GeneralSecurityException | IOException e) { throw RuntimeCamelException.wrapRuntimeCamelException(e); } @@ -192,6 +190,8 @@ public class Olingo2Component extends AbstractApiComponent<Olingo2ApiName, Oling apiProxy = new Olingo2AppWrapper(olingo2App); apiProxy.getOlingo2App().setContentType(configuration.getContentType()); apiProxy.getOlingo2App().setHttpHeaders(configuration.getHttpHeaders()); + apiProxy.getOlingo2App().setEntityProviderReadProperties(configuration.getEntityProviderReadProperties()); + apiProxy.getOlingo2App().setEntityProviderWriteProperties(configuration.getEntityProviderWriteProperties()); return apiProxy; } diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java index 41bcdfb..f33b4fd 100644 --- a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java +++ b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java @@ -30,6 +30,8 @@ import org.apache.http.HttpHost; import org.apache.http.entity.ContentType; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.nio.client.HttpAsyncClientBuilder; +import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; +import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties; /** * Component configuration for Olingo2 component. @@ -53,6 +55,10 @@ public class Olingo2Configuration { private String contentType = DEFAULT_CONTENT_TYPE; @UriParam private Map<String, String> httpHeaders; + @UriParam + private EntityProviderReadProperties entityProviderReadProperties; + @UriParam + private EntityProviderWriteProperties entityProviderWriteProperties; @UriParam(defaultValue = "" + DEFAULT_TIMEOUT) private int connectTimeout = DEFAULT_TIMEOUT; @UriParam(defaultValue = "" + DEFAULT_TIMEOUT) @@ -126,6 +132,31 @@ public class Olingo2Configuration { this.httpHeaders = httpHeaders; } + public EntityProviderReadProperties getEntityProviderReadProperties() { + return entityProviderReadProperties; + } + + /** + * Custom entity provider read properties applied to all read operations. + */ + public void setEntityProviderReadProperties(EntityProviderReadProperties entityProviderReadProperties) { + this.entityProviderReadProperties = entityProviderReadProperties; + } + + public EntityProviderWriteProperties getEntityProviderWriteProperties() { + return entityProviderWriteProperties; + } + + /** + * Custom entity provider write properties applied to create, update, patch, batch and merge operations. For + * instance users can skip the Json object wrapper or enable content only mode when sending request data. A service + * URI set in the properties will always be overwritten by the serviceUri configuration parameter. Please consider + * to using the serviceUri configuration parameter instead of setting the respective write property here. + */ + public void setEntityProviderWriteProperties(EntityProviderWriteProperties entityProviderWriteProperties) { + this.entityProviderWriteProperties = entityProviderWriteProperties; + } + public int getConnectTimeout() { return connectTimeout; } @@ -205,8 +236,6 @@ public class Olingo2Configuration { /** * Set this to true to filter out results that have already been communicated by this component. - * - * @param filterAlreadySeen */ public void setFilterAlreadySeen(boolean filterAlreadySeen) { this.filterAlreadySeen = filterAlreadySeen; @@ -226,8 +255,11 @@ public class Olingo2Configuration { @Override public int hashCode() { - return new HashCodeBuilder().append(serviceUri).append(contentType).append(httpHeaders).append(connectTimeout) + return new HashCodeBuilder().append(serviceUri).append(contentType) + .append(httpHeaders).append(connectTimeout) .append(socketTimeout).append(proxy) + .append(entityProviderReadProperties).append(entityProviderWriteProperties) + .append(filterAlreadySeen).append(splitResult) .append(sslContextParameters).append(httpAsyncClientBuilder).append(httpClientBuilder).hashCode(); } @@ -235,16 +267,21 @@ public class Olingo2Configuration { public boolean equals(Object obj) { if (obj instanceof Olingo2Configuration) { Olingo2Configuration other = (Olingo2Configuration) obj; - return serviceUri == null + return connectTimeout == other.connectTimeout && filterAlreadySeen == other.filterAlreadySeen + && splitResult == other.splitResult && socketTimeout == other.socketTimeout && serviceUri == null ? other.serviceUri == null : serviceUri.equals(other.serviceUri) && contentType == null ? other.contentType == null : contentType.equals(other.contentType) && httpHeaders == null ? other.httpHeaders == null - : httpHeaders.equals(other.httpHeaders) && connectTimeout == other.connectTimeout - && socketTimeout == other.socketTimeout && proxy == null + : httpHeaders.equals(other.httpHeaders) && entityProviderReadProperties == null + ? other.entityProviderReadProperties == null + : entityProviderReadProperties.equals(other.entityProviderReadProperties) && proxy == null ? other.proxy == null - : proxy.equals(other.proxy) && sslContextParameters == null + : proxy.equals(other.proxy) && entityProviderWriteProperties == null + ? other.entityProviderWriteProperties == null + : entityProviderWriteProperties.equals(other.entityProviderWriteProperties) + && sslContextParameters == null ? other.sslContextParameters == null : sslContextParameters.equals(other.sslContextParameters) && httpAsyncClientBuilder == null ? other.httpAsyncClientBuilder == null diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Consumer.java b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Consumer.java index c5a6236..a7bc29cb 100644 --- a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Consumer.java +++ b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Consumer.java @@ -145,6 +145,13 @@ public class Olingo2Consumer extends AbstractApiConsumer<Olingo2ApiName, Olingo2 if (result instanceof ODataFeed) { ODataFeed odataFeed = (ODataFeed) result; for (ODataEntry entry : odataFeed.getEntries()) { + if (odataFeed.getFeedMetadata().getInlineCount() != null) { + // + // If $inlinecount was set to true in the query then + // need to include the count in the entities + // + entry.getProperties().put("ResultCount", odataFeed.getFeedMetadata().getInlineCount()); + } splitResult.add(entry); } } else if (result instanceof List) { diff --git a/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2ComponentConsumerTest.java b/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2ComponentConsumerTest.java index 8cc71e7..f8b1bdd 100644 --- a/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2ComponentConsumerTest.java +++ b/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2ComponentConsumerTest.java @@ -274,7 +274,7 @@ public class Olingo2ComponentConsumerTest extends AbstractOlingo2TestSupport { } /** - * Read value of the People object and split the results into individual messages + * Read value of the Address object and split the results into individual messages */ @SuppressWarnings("unchecked") @Test @@ -341,4 +341,44 @@ public class Olingo2ComponentConsumerTest extends AbstractOlingo2TestSupport { assertTrue(name.toString().contains("Powered Racing")); } } + + /** + * Read entity set of the Manufacturers object and split the results into individual messages. Auto add inline count + * or results to entities. + */ + @Test + public void testConsumerReadSplitResultsWithInlineCount() throws Exception { + int expectedMsgCount = 2; + MockEndpoint mockEndpoint = getMockEndpoint("mock:consumer-splitresult-with-count"); + mockEndpoint.expectedMinimumMessageCount(expectedMsgCount); + + RouteBuilder builder = new RouteBuilder() { + public void configure() { + from("olingo2://read/Manufacturers/?$inlinecount=allpages&splitResult=true") + .to("mock:consumer-splitresult-with-count"); + } + }; + + addRouteAndStartContext(builder); + + mockEndpoint.assertIsSatisfied(); + + // + // 2 individual messages in the exchange, + // each containing a different entity. + // + for (int i = 0; i < expectedMsgCount; ++i) { + Object body = mockEndpoint.getExchanges().get(i).getIn().getBody(); + assertTrue(body instanceof ODataEntry); + ODataEntry entry = (ODataEntry) body; + Map<String, Object> properties = entry.getProperties(); + assertNotNull(properties); + + Object name = properties.get("Name"); + assertNotNull(name); + assertTrue(name.toString().contains("Powered Racing")); + Object resultCount = properties.get("ResultCount"); + assertTrue(((Integer) resultCount) > 0); + } + } } diff --git a/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2ComponentProducerTest.java b/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2ComponentProducerTest.java index f2a7952..a67577f 100644 --- a/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2ComponentProducerTest.java +++ b/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2ComponentProducerTest.java @@ -68,7 +68,10 @@ public class Olingo2ComponentProducerTest extends AbstractOlingo2TestSupport { private static final String ADDRESS = "Address"; private static final String TEST_RESOURCE = "$1"; private static final String TEST_RESOURCE_ADDRESS = TEST_RESOURCE + "/Address"; - private static final String TEST_CREATE_MANUFACTURER = "DefaultContainer.Manufacturers('123')"; + private static final String TEST_MERGE_MANUFACTURER_ID = "124"; + private static final String TEST_CREATE_MANUFACTURER_ID = "123"; + private static final String TEST_CREATE_MANUFACTURER + = String.format("DefaultContainer.Manufacturers('%s')", TEST_CREATE_MANUFACTURER_ID); private static final String TEST_SERVICE_URL = "http://localhost:" + PORT + "/MyFormula.svc"; private static Olingo2SampleServer server; @@ -136,7 +139,7 @@ public class Olingo2ComponentProducerTest extends AbstractOlingo2TestSupport { final ODataEntry manufacturer = requestBody("direct:CREATE", data); assertNotNull(manufacturer, "Created Manufacturer"); final Map<String, Object> properties = manufacturer.getProperties(); - assertEquals("123", properties.get(ID_PROPERTY), "Created Manufacturer Id"); + assertEquals(TEST_CREATE_MANUFACTURER_ID, properties.get(ID_PROPERTY), "Created Manufacturer Id"); LOG.info("Created Manufacturer: {}", properties); // update @@ -149,6 +152,15 @@ public class Olingo2ComponentProducerTest extends AbstractOlingo2TestSupport { assertEquals(HttpStatusCodes.NO_CONTENT.getStatusCode(), status.getStatusCode(), "Update status"); LOG.info("Update status: {}", status); + final Map<String, Object> headers = new HashMap<>(); + headers.put(Olingo2Constants.PROPERTY_PREFIX + "keyPredicate", String.format("'%s'", TEST_CREATE_MANUFACTURER_ID)); + final ODataEntry updatedManufacturer = requestBodyAndHeaders("direct:READENTRY", null, headers); + assertNotNull(updatedManufacturer); + final Map<String, Object> updatedProperties = updatedManufacturer.getProperties(); + assertEquals(TEST_CREATE_MANUFACTURER_ID, updatedProperties.get(ID_PROPERTY), "Manufacturer Id"); + assertEquals("MyCarManufacturer Renamed", updatedProperties.get("Name"), "Manufacturer Name"); + LOG.info("Updated Manufacturer: {}", updatedProperties); + // delete status = requestBody("direct:DELETE", null); assertNotNull(status, "Delete status"); @@ -156,9 +168,40 @@ public class Olingo2ComponentProducerTest extends AbstractOlingo2TestSupport { LOG.info("Delete status: {}", status); } + @Test + public void testCreateMerge() throws Exception { + final Map<String, Object> data = getEntityData(); + data.put(ID_PROPERTY, TEST_MERGE_MANUFACTURER_ID); + + final ODataEntry manufacturer = requestBody("direct:CREATE", data); + assertNotNull(manufacturer, "Created Manufacturer"); + final Map<String, Object> properties = manufacturer.getProperties(); + assertEquals(TEST_MERGE_MANUFACTURER_ID, properties.get(ID_PROPERTY), "Created Manufacturer Id"); + LOG.info("Created Manufacturer: {}", properties); + + final Map<String, Object> propertiesToUpdate = new HashMap<>(); + propertiesToUpdate.put(ID_PROPERTY, TEST_MERGE_MANUFACTURER_ID); + propertiesToUpdate.put("Name", "MyCarManufacturer Updated"); + + HttpStatusCodes status = requestBody("direct:MERGE", propertiesToUpdate); + assertNotNull(status, "Merge status"); + assertEquals(HttpStatusCodes.NO_CONTENT.getStatusCode(), status.getStatusCode(), "Merge status"); + LOG.info("Merge status: {}", status); + + final Map<String, Object> headers = new HashMap<>(); + headers.put(Olingo2Constants.PROPERTY_PREFIX + "keyPredicate", String.format("'%s'", TEST_MERGE_MANUFACTURER_ID)); + final ODataEntry mergedManufacturer = requestBodyAndHeaders("direct:READENTRY", null, headers); + assertNotNull(mergedManufacturer); + final Map<String, Object> mergedProperties = mergedManufacturer.getProperties(); + assertEquals(TEST_MERGE_MANUFACTURER_ID, mergedProperties.get(ID_PROPERTY), "Manufacturer Id"); + assertEquals("MyCarManufacturer Updated", mergedProperties.get("Name"), "Manufacturer Name"); + assertNotNull(mergedProperties.get("Address"), "Manufacturer Address"); + LOG.info("Merged Manufacturer: {}", mergedProperties); + } + private Map<String, Object> getEntityData() { final Map<String, Object> data = new HashMap<>(); - data.put("Id", "123"); + data.put(ID_PROPERTY, TEST_CREATE_MANUFACTURER_ID); data.put("Name", "MyCarManufacturer"); data.put("Founded", new Date()); Map<String, Object> address = new HashMap<>(); @@ -349,14 +392,16 @@ public class Olingo2ComponentProducerTest extends AbstractOlingo2TestSupport { from("direct:CREATE").to("olingo2://create/Manufacturers"); // test route for update - from("direct:UPDATE").to("olingo2://update/Manufacturers('123')"); + from("direct:UPDATE").to(String.format("olingo2://update/Manufacturers('%s')", TEST_CREATE_MANUFACTURER_ID)); // test route for delete - from("direct:DELETE").to("olingo2://delete/Manufacturers('123')"); + from("direct:DELETE").to(String.format("olingo2://delete/Manufacturers('%s')", TEST_CREATE_MANUFACTURER_ID)); + + // test route for merge + from("direct:MERGE").to(String.format("olingo2://merge/Manufacturers('%s')", TEST_MERGE_MANUFACTURER_ID)); /* - * // test route for merge from("direct:MERGE") - * .to("olingo2://merge"); // test route for patch + * // test route for patch * from("direct:PATCH") .to("olingo2://patch"); */ diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Olingo2ComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Olingo2ComponentBuilderFactory.java index 04f042c..96a7fed 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Olingo2ComponentBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Olingo2ComponentBuilderFactory.java @@ -89,6 +89,39 @@ public interface Olingo2ComponentBuilderFactory { return this; } /** + * Custom entity provider read properties applied to all read + * operations. + * + * The option is a: + * <code>org.apache.olingo.odata2.api.ep.EntityProviderReadProperties</code> type. + * + * Group: common + */ + default Olingo2ComponentBuilder entityProviderReadProperties( + org.apache.olingo.odata2.api.ep.EntityProviderReadProperties entityProviderReadProperties) { + doSetProperty("entityProviderReadProperties", entityProviderReadProperties); + return this; + } + /** + * Custom entity provider write properties applied to create, update, + * patch, batch and merge operations. For instance users can skip the + * Json object wrapper or enable content only mode when sending request + * data. A service URI set in the properties will always be overwritten + * by the serviceUri configuration parameter. Please consider to using + * the serviceUri configuration parameter instead of setting the + * respective write property here. + * + * The option is a: + * <code>org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties</code> type. + * + * Group: common + */ + default Olingo2ComponentBuilder entityProviderWriteProperties( + org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties entityProviderWriteProperties) { + doSetProperty("entityProviderWriteProperties", entityProviderWriteProperties); + return this; + } + /** * Set this to true to filter out results that have already been * communicated by this component. * @@ -306,6 +339,8 @@ public interface Olingo2ComponentBuilderFactory { case "configuration": ((Olingo2Component) component).setConfiguration((org.apache.camel.component.olingo2.Olingo2Configuration) value); return true; case "connectTimeout": getOrCreateConfiguration((Olingo2Component) component).setConnectTimeout((int) value); return true; case "contentType": getOrCreateConfiguration((Olingo2Component) component).setContentType((java.lang.String) value); return true; + case "entityProviderReadProperties": getOrCreateConfiguration((Olingo2Component) component).setEntityProviderReadProperties((org.apache.olingo.odata2.api.ep.EntityProviderReadProperties) value); return true; + case "entityProviderWriteProperties": getOrCreateConfiguration((Olingo2Component) component).setEntityProviderWriteProperties((org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties) value); return true; case "filterAlreadySeen": getOrCreateConfiguration((Olingo2Component) component).setFilterAlreadySeen((boolean) value); return true; case "httpHeaders": getOrCreateConfiguration((Olingo2Component) component).setHttpHeaders((java.util.Map) value); return true; case "proxy": getOrCreateConfiguration((Olingo2Component) component).setProxy((org.apache.http.HttpHost) value); return true; diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Olingo2EndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Olingo2EndpointBuilderFactory.java index c51467f..04ce270 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Olingo2EndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Olingo2EndpointBuilderFactory.java @@ -16,10 +16,11 @@ */ package org.apache.camel.builder.endpoint.dsl; +import javax.annotation.Generated; import java.util.Map; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; + import org.apache.camel.ExchangePattern; import org.apache.camel.LoggingLevel; import org.apache.camel.builder.EndpointConsumerBuilder; @@ -30,7 +31,7 @@ import org.apache.camel.spi.PollingConsumerPollStrategy; /** * Communicate with OData 2.0 services using Apache Olingo. - * + * * Generated by camel build tools - do NOT edit this file! */ @Generated("org.apache.camel.maven.packaging.EndpointDslMojo") @@ -49,9 +50,9 @@ public interface Olingo2EndpointBuilderFactory { /** * HTTP connection creation timeout in milliseconds, defaults to 30,000 * (30 seconds). - * + * * The option is a: <code>int</code> type. - * + * * Default: 30000 * Group: common */ @@ -62,9 +63,9 @@ public interface Olingo2EndpointBuilderFactory { /** * HTTP connection creation timeout in milliseconds, defaults to 30,000 * (30 seconds). - * + * * The option will be converted to a <code>int</code> type. - * + * * Default: 30000 * Group: common */ @@ -76,9 +77,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Content-Type header value can be used to specify JSON or XML message * format, defaults to application/json;charset=utf-8. - * + * * The option is a: <code>java.lang.String</code> type. - * + * * Default: application/json;charset=utf-8 * Group: common */ @@ -87,11 +88,77 @@ public interface Olingo2EndpointBuilderFactory { return this; } /** + * Custom entity provider read properties applied to all read + * operations. + * + * The option is a: + * <code>org.apache.olingo.odata2.api.ep.EntityProviderReadProperties</code> type. + * + * Group: common + */ + default Olingo2EndpointConsumerBuilder entityProviderReadProperties( + Object entityProviderReadProperties) { + doSetProperty("entityProviderReadProperties", entityProviderReadProperties); + return this; + } + /** + * Custom entity provider read properties applied to all read + * operations. + * + * The option will be converted to a + * <code>org.apache.olingo.odata2.api.ep.EntityProviderReadProperties</code> type. + * + * Group: common + */ + default Olingo2EndpointConsumerBuilder entityProviderReadProperties( + String entityProviderReadProperties) { + doSetProperty("entityProviderReadProperties", entityProviderReadProperties); + return this; + } + /** + * Custom entity provider write properties applied to create, update, + * patch, batch and merge operations. For instance users can skip the + * Json object wrapper or enable content only mode when sending request + * data. A service URI set in the properties will always be overwritten + * by the serviceUri configuration parameter. Please consider to using + * the serviceUri configuration parameter instead of setting the + * respective write property here. + * + * The option is a: + * <code>org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties</code> type. + * + * Group: common + */ + default Olingo2EndpointConsumerBuilder entityProviderWriteProperties( + Object entityProviderWriteProperties) { + doSetProperty("entityProviderWriteProperties", entityProviderWriteProperties); + return this; + } + /** + * Custom entity provider write properties applied to create, update, + * patch, batch and merge operations. For instance users can skip the + * Json object wrapper or enable content only mode when sending request + * data. A service URI set in the properties will always be overwritten + * by the serviceUri configuration parameter. Please consider to using + * the serviceUri configuration parameter instead of setting the + * respective write property here. + * + * The option will be converted to a + * <code>org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties</code> type. + * + * Group: common + */ + default Olingo2EndpointConsumerBuilder entityProviderWriteProperties( + String entityProviderWriteProperties) { + doSetProperty("entityProviderWriteProperties", entityProviderWriteProperties); + return this; + } + /** * Set this to true to filter out results that have already been * communicated by this component. - * + * * The option is a: <code>boolean</code> type. - * + * * Default: false * Group: common */ @@ -103,9 +170,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Set this to true to filter out results that have already been * communicated by this component. - * + * * The option will be converted to a <code>boolean</code> type. - * + * * Default: false * Group: common */ @@ -117,10 +184,10 @@ public interface Olingo2EndpointBuilderFactory { /** * Custom HTTP headers to inject into every request, this could include * OAuth tokens, etc. - * + * * The option is a: <code>java.util.Map<java.lang.String, * java.lang.String></code> type. - * + * * Group: common */ default Olingo2EndpointConsumerBuilder httpHeaders( @@ -131,11 +198,11 @@ public interface Olingo2EndpointBuilderFactory { /** * Custom HTTP headers to inject into every request, this could include * OAuth tokens, etc. - * + * * The option will be converted to a * <code>java.util.Map<java.lang.String, java.lang.String></code> * type. - * + * * Group: common */ default Olingo2EndpointConsumerBuilder httpHeaders(String httpHeaders) { @@ -144,9 +211,9 @@ public interface Olingo2EndpointBuilderFactory { } /** * Sets the name of a parameter to be passed in the exchange In Body. - * + * * The option is a: <code>java.lang.String</code> type. - * + * * Group: common */ default Olingo2EndpointConsumerBuilder inBody(String inBody) { @@ -155,9 +222,9 @@ public interface Olingo2EndpointBuilderFactory { } /** * HTTP proxy server configuration. - * + * * The option is a: <code>org.apache.http.HttpHost</code> type. - * + * * Group: common */ default Olingo2EndpointConsumerBuilder proxy(Object proxy) { @@ -166,10 +233,10 @@ public interface Olingo2EndpointBuilderFactory { } /** * HTTP proxy server configuration. - * + * * The option will be converted to a * <code>org.apache.http.HttpHost</code> type. - * + * * Group: common */ default Olingo2EndpointConsumerBuilder proxy(String proxy) { @@ -179,9 +246,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Target OData service base URI, e.g. * http://services.odata.org/OData/OData.svc. - * + * * The option is a: <code>java.lang.String</code> type. - * + * * Group: common */ default Olingo2EndpointConsumerBuilder serviceUri(String serviceUri) { @@ -191,9 +258,9 @@ public interface Olingo2EndpointBuilderFactory { /** * HTTP request timeout in milliseconds, defaults to 30,000 (30 * seconds). - * + * * The option is a: <code>int</code> type. - * + * * Default: 30000 * Group: common */ @@ -204,9 +271,9 @@ public interface Olingo2EndpointBuilderFactory { /** * HTTP request timeout in milliseconds, defaults to 30,000 (30 * seconds). - * + * * The option will be converted to a <code>int</code> type. - * + * * Default: 30000 * Group: common */ @@ -223,9 +290,9 @@ public interface Olingo2EndpointBuilderFactory { * consumer will use the org.apache.camel.spi.ExceptionHandler to deal * with exceptions, that will be logged at WARN or ERROR level and * ignored. - * + * * The option is a: <code>boolean</code> type. - * + * * Default: false * Group: consumer */ @@ -242,9 +309,9 @@ public interface Olingo2EndpointBuilderFactory { * consumer will use the org.apache.camel.spi.ExceptionHandler to deal * with exceptions, that will be logged at WARN or ERROR level and * ignored. - * + * * The option will be converted to a <code>boolean</code> type. - * + * * Default: false * Group: consumer */ @@ -256,9 +323,9 @@ public interface Olingo2EndpointBuilderFactory { /** * If the polling consumer did not poll any files, you can enable this * option to send an empty message (no body) instead. - * + * * The option is a: <code>boolean</code> type. - * + * * Default: false * Group: consumer */ @@ -270,9 +337,9 @@ public interface Olingo2EndpointBuilderFactory { /** * If the polling consumer did not poll any files, you can enable this * option to send an empty message (no body) instead. - * + * * The option will be converted to a <code>boolean</code> type. - * + * * Default: false * Group: consumer */ @@ -285,9 +352,9 @@ public interface Olingo2EndpointBuilderFactory { * For endpoints that return an array or collection, a consumer endpoint * will map every element to distinct messages, unless splitResult is * set to false. - * + * * The option is a: <code>boolean</code> type. - * + * * Default: true * Group: consumer */ @@ -299,9 +366,9 @@ public interface Olingo2EndpointBuilderFactory { * For endpoints that return an array or collection, a consumer endpoint * will map every element to distinct messages, unless splitResult is * set to false. - * + * * The option will be converted to a <code>boolean</code> type. - * + * * Default: true * Group: consumer */ @@ -312,9 +379,9 @@ public interface Olingo2EndpointBuilderFactory { /** * The number of subsequent error polls (failed due some error) that * should happen before the backoffMultipler should kick-in. - * + * * The option is a: <code>int</code> type. - * + * * Group: scheduler */ default Olingo2EndpointConsumerBuilder backoffErrorThreshold( @@ -325,9 +392,9 @@ public interface Olingo2EndpointBuilderFactory { /** * The number of subsequent error polls (failed due some error) that * should happen before the backoffMultipler should kick-in. - * + * * The option will be converted to a <code>int</code> type. - * + * * Group: scheduler */ default Olingo2EndpointConsumerBuilder backoffErrorThreshold( @@ -338,9 +405,9 @@ public interface Olingo2EndpointBuilderFactory { /** * The number of subsequent idle polls that should happen before the * backoffMultipler should kick-in. - * + * * The option is a: <code>int</code> type. - * + * * Group: scheduler */ default Olingo2EndpointConsumerBuilder backoffIdleThreshold( @@ -351,9 +418,9 @@ public interface Olingo2EndpointBuilderFactory { /** * The number of subsequent idle polls that should happen before the * backoffMultipler should kick-in. - * + * * The option will be converted to a <code>int</code> type. - * + * * Group: scheduler */ default Olingo2EndpointConsumerBuilder backoffIdleThreshold( @@ -368,9 +435,9 @@ public interface Olingo2EndpointBuilderFactory { * attempt is happening again. When this option is in use then * backoffIdleThreshold and/or backoffErrorThreshold must also be * configured. - * + * * The option is a: <code>int</code> type. - * + * * Group: scheduler */ default Olingo2EndpointConsumerBuilder backoffMultiplier( @@ -385,9 +452,9 @@ public interface Olingo2EndpointBuilderFactory { * attempt is happening again. When this option is in use then * backoffIdleThreshold and/or backoffErrorThreshold must also be * configured. - * + * * The option will be converted to a <code>int</code> type. - * + * * Group: scheduler */ default Olingo2EndpointConsumerBuilder backoffMultiplier( @@ -397,9 +464,9 @@ public interface Olingo2EndpointBuilderFactory { } /** * Milliseconds before the next poll. - * + * * The option is a: <code>long</code> type. - * + * * Default: 500 * Group: scheduler */ @@ -409,9 +476,9 @@ public interface Olingo2EndpointBuilderFactory { } /** * Milliseconds before the next poll. - * + * * The option will be converted to a <code>long</code> type. - * + * * Default: 500 * Group: scheduler */ @@ -422,9 +489,9 @@ public interface Olingo2EndpointBuilderFactory { /** * If greedy is enabled, then the ScheduledPollConsumer will run * immediately again, if the previous run polled 1 or more messages. - * + * * The option is a: <code>boolean</code> type. - * + * * Default: false * Group: scheduler */ @@ -435,9 +502,9 @@ public interface Olingo2EndpointBuilderFactory { /** * If greedy is enabled, then the ScheduledPollConsumer will run * immediately again, if the previous run polled 1 or more messages. - * + * * The option will be converted to a <code>boolean</code> type. - * + * * Default: false * Group: scheduler */ @@ -447,9 +514,9 @@ public interface Olingo2EndpointBuilderFactory { } /** * Milliseconds before the first poll starts. - * + * * The option is a: <code>long</code> type. - * + * * Default: 1000 * Group: scheduler */ @@ -459,9 +526,9 @@ public interface Olingo2EndpointBuilderFactory { } /** * Milliseconds before the first poll starts. - * + * * The option will be converted to a <code>long</code> type. - * + * * Default: 1000 * Group: scheduler */ @@ -473,9 +540,9 @@ public interface Olingo2EndpointBuilderFactory { * Specifies a maximum limit of number of fires. So if you set it to 1, * the scheduler will only fire once. If you set it to 5, it will only * fire five times. A value of zero or negative means fire forever. - * + * * The option is a: <code>long</code> type. - * + * * Default: 0 * Group: scheduler */ @@ -487,9 +554,9 @@ public interface Olingo2EndpointBuilderFactory { * Specifies a maximum limit of number of fires. So if you set it to 1, * the scheduler will only fire once. If you set it to 5, it will only * fire five times. A value of zero or negative means fire forever. - * + * * The option will be converted to a <code>long</code> type. - * + * * Default: 0 * Group: scheduler */ @@ -500,9 +567,9 @@ public interface Olingo2EndpointBuilderFactory { /** * The consumer logs a start/complete log line when it polls. This * option allows you to configure the logging level for that. - * + * * The option is a: <code>org.apache.camel.LoggingLevel</code> type. - * + * * Default: TRACE * Group: scheduler */ @@ -514,10 +581,10 @@ public interface Olingo2EndpointBuilderFactory { /** * The consumer logs a start/complete log line when it polls. This * option allows you to configure the logging level for that. - * + * * The option will be converted to a * <code>org.apache.camel.LoggingLevel</code> type. - * + * * Default: TRACE * Group: scheduler */ @@ -530,10 +597,10 @@ public interface Olingo2EndpointBuilderFactory { * Allows for configuring a custom/shared thread pool to use for the * consumer. By default each consumer has its own single threaded thread * pool. - * + * * The option is a: * <code>java.util.concurrent.ScheduledExecutorService</code> type. - * + * * Group: scheduler */ default Olingo2EndpointConsumerBuilder scheduledExecutorService( @@ -545,10 +612,10 @@ public interface Olingo2EndpointBuilderFactory { * Allows for configuring a custom/shared thread pool to use for the * consumer. By default each consumer has its own single threaded thread * pool. - * + * * The option will be converted to a * <code>java.util.concurrent.ScheduledExecutorService</code> type. - * + * * Group: scheduler */ default Olingo2EndpointConsumerBuilder scheduledExecutorService( @@ -559,9 +626,9 @@ public interface Olingo2EndpointBuilderFactory { /** * To use a cron scheduler from either camel-spring or camel-quartz * component. - * + * * The option is a: <code>java.lang.String</code> type. - * + * * Default: none * Group: scheduler */ @@ -572,13 +639,13 @@ public interface Olingo2EndpointBuilderFactory { /** * To configure additional properties when using a custom scheduler or * any of the Quartz, Spring based scheduler. - * + * * The option is a: <code>java.util.Map<java.lang.String, * java.lang.Object></code> type. * The option is multivalued, and you can use the * schedulerProperties(String, Object) method to add a value (call the * method multiple times to set more values). - * + * * Group: scheduler */ default Olingo2EndpointConsumerBuilder schedulerProperties( @@ -590,13 +657,13 @@ public interface Olingo2EndpointBuilderFactory { /** * To configure additional properties when using a custom scheduler or * any of the Quartz, Spring based scheduler. - * + * * The option is a: <code>java.util.Map<java.lang.String, * java.lang.Object></code> type. * The option is multivalued, and you can use the * schedulerProperties(String, Object) method to add a value (call the * method multiple times to set more values). - * + * * Group: scheduler */ default Olingo2EndpointConsumerBuilder schedulerProperties(Map values) { @@ -605,9 +672,9 @@ public interface Olingo2EndpointBuilderFactory { } /** * Whether the scheduler should be auto started. - * + * * The option is a: <code>boolean</code> type. - * + * * Default: true * Group: scheduler */ @@ -618,9 +685,9 @@ public interface Olingo2EndpointBuilderFactory { } /** * Whether the scheduler should be auto started. - * + * * The option will be converted to a <code>boolean</code> type. - * + * * Default: true * Group: scheduler */ @@ -631,9 +698,9 @@ public interface Olingo2EndpointBuilderFactory { } /** * Time unit for initialDelay and delay options. - * + * * The option is a: <code>java.util.concurrent.TimeUnit</code> type. - * + * * Default: MILLISECONDS * Group: scheduler */ @@ -643,10 +710,10 @@ public interface Olingo2EndpointBuilderFactory { } /** * Time unit for initialDelay and delay options. - * + * * The option will be converted to a * <code>java.util.concurrent.TimeUnit</code> type. - * + * * Default: MILLISECONDS * Group: scheduler */ @@ -657,9 +724,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Controls if fixed delay or fixed rate is used. See * ScheduledExecutorService in JDK for details. - * + * * The option is a: <code>boolean</code> type. - * + * * Default: true * Group: scheduler */ @@ -671,9 +738,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Controls if fixed delay or fixed rate is used. See * ScheduledExecutorService in JDK for details. - * + * * The option will be converted to a <code>boolean</code> type. - * + * * Default: true * Group: scheduler */ @@ -684,10 +751,10 @@ public interface Olingo2EndpointBuilderFactory { } /** * To configure security using SSLContextParameters. - * + * * The option is a: * <code>org.apache.camel.support.jsse.SSLContextParameters</code> type. - * + * * Group: security */ default Olingo2EndpointConsumerBuilder sslContextParameters( @@ -697,10 +764,10 @@ public interface Olingo2EndpointBuilderFactory { } /** * To configure security using SSLContextParameters. - * + * * The option will be converted to a * <code>org.apache.camel.support.jsse.SSLContextParameters</code> type. - * + * * Group: security */ default Olingo2EndpointConsumerBuilder sslContextParameters( @@ -724,10 +791,10 @@ public interface Olingo2EndpointBuilderFactory { * option bridgeErrorHandler is enabled then this option is not in use. * By default the consumer will deal with exceptions, that will be * logged at WARN or ERROR level and ignored. - * + * * The option is a: <code>org.apache.camel.spi.ExceptionHandler</code> * type. - * + * * Group: consumer (advanced) */ default AdvancedOlingo2EndpointConsumerBuilder exceptionHandler( @@ -740,10 +807,10 @@ public interface Olingo2EndpointBuilderFactory { * option bridgeErrorHandler is enabled then this option is not in use. * By default the consumer will deal with exceptions, that will be * logged at WARN or ERROR level and ignored. - * + * * The option will be converted to a * <code>org.apache.camel.spi.ExceptionHandler</code> type. - * + * * Group: consumer (advanced) */ default AdvancedOlingo2EndpointConsumerBuilder exceptionHandler( @@ -753,9 +820,9 @@ public interface Olingo2EndpointBuilderFactory { } /** * Sets the exchange pattern when the consumer creates an exchange. - * + * * The option is a: <code>org.apache.camel.ExchangePattern</code> type. - * + * * Group: consumer (advanced) */ default AdvancedOlingo2EndpointConsumerBuilder exchangePattern( @@ -765,10 +832,10 @@ public interface Olingo2EndpointBuilderFactory { } /** * Sets the exchange pattern when the consumer creates an exchange. - * + * * The option will be converted to a * <code>org.apache.camel.ExchangePattern</code> type. - * + * * Group: consumer (advanced) */ default AdvancedOlingo2EndpointConsumerBuilder exchangePattern( @@ -781,10 +848,10 @@ public interface Olingo2EndpointBuilderFactory { * you to provide your custom implementation to control error handling * usually occurred during the poll operation before an Exchange have * been created and being routed in Camel. - * + * * The option is a: * <code>org.apache.camel.spi.PollingConsumerPollStrategy</code> type. - * + * * Group: consumer (advanced) */ default AdvancedOlingo2EndpointConsumerBuilder pollStrategy( @@ -797,10 +864,10 @@ public interface Olingo2EndpointBuilderFactory { * you to provide your custom implementation to control error handling * usually occurred during the poll operation before an Exchange have * been created and being routed in Camel. - * + * * The option will be converted to a * <code>org.apache.camel.spi.PollingConsumerPollStrategy</code> type. - * + * * Group: consumer (advanced) */ default AdvancedOlingo2EndpointConsumerBuilder pollStrategy( @@ -811,9 +878,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Whether the endpoint should use basic property binding (Camel 2.x) or * the newer property binding with additional capabilities. - * + * * The option is a: <code>boolean</code> type. - * + * * Default: false * Group: advanced */ @@ -825,9 +892,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Whether the endpoint should use basic property binding (Camel 2.x) or * the newer property binding with additional capabilities. - * + * * The option will be converted to a <code>boolean</code> type. - * + * * Default: false * Group: advanced */ @@ -841,11 +908,11 @@ public interface Olingo2EndpointBuilderFactory { * configuration, overrides connectionTimeout, socketTimeout, proxy and * sslContext. Note that a socketTimeout MUST be specified in the * builder, otherwise OData requests could block indefinitely. - * + * * The option is a: * <code>org.apache.http.impl.nio.client.HttpAsyncClientBuilder</code> * type. - * + * * Group: advanced */ default AdvancedOlingo2EndpointConsumerBuilder httpAsyncClientBuilder( @@ -858,11 +925,11 @@ public interface Olingo2EndpointBuilderFactory { * configuration, overrides connectionTimeout, socketTimeout, proxy and * sslContext. Note that a socketTimeout MUST be specified in the * builder, otherwise OData requests could block indefinitely. - * + * * The option will be converted to a * <code>org.apache.http.impl.nio.client.HttpAsyncClientBuilder</code> * type. - * + * * Group: advanced */ default AdvancedOlingo2EndpointConsumerBuilder httpAsyncClientBuilder( @@ -875,10 +942,10 @@ public interface Olingo2EndpointBuilderFactory { * configuration, overrides connectionTimeout, socketTimeout, proxy and * sslContext. Note that a socketTimeout MUST be specified in the * builder, otherwise OData requests could block indefinitely. - * + * * The option is a: * <code>org.apache.http.impl.client.HttpClientBuilder</code> type. - * + * * Group: advanced */ default AdvancedOlingo2EndpointConsumerBuilder httpClientBuilder( @@ -891,10 +958,10 @@ public interface Olingo2EndpointBuilderFactory { * configuration, overrides connectionTimeout, socketTimeout, proxy and * sslContext. Note that a socketTimeout MUST be specified in the * builder, otherwise OData requests could block indefinitely. - * + * * The option will be converted to a * <code>org.apache.http.impl.client.HttpClientBuilder</code> type. - * + * * Group: advanced */ default AdvancedOlingo2EndpointConsumerBuilder httpClientBuilder( @@ -905,9 +972,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Sets whether synchronous processing should be strictly used, or Camel * is allowed to use asynchronous processing (if supported). - * + * * The option is a: <code>boolean</code> type. - * + * * Default: false * Group: advanced */ @@ -919,9 +986,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Sets whether synchronous processing should be strictly used, or Camel * is allowed to use asynchronous processing (if supported). - * + * * The option will be converted to a <code>boolean</code> type. - * + * * Default: false * Group: advanced */ @@ -944,9 +1011,9 @@ public interface Olingo2EndpointBuilderFactory { /** * HTTP connection creation timeout in milliseconds, defaults to 30,000 * (30 seconds). - * + * * The option is a: <code>int</code> type. - * + * * Default: 30000 * Group: common */ @@ -957,9 +1024,9 @@ public interface Olingo2EndpointBuilderFactory { /** * HTTP connection creation timeout in milliseconds, defaults to 30,000 * (30 seconds). - * + * * The option will be converted to a <code>int</code> type. - * + * * Default: 30000 * Group: common */ @@ -971,9 +1038,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Content-Type header value can be used to specify JSON or XML message * format, defaults to application/json;charset=utf-8. - * + * * The option is a: <code>java.lang.String</code> type. - * + * * Default: application/json;charset=utf-8 * Group: common */ @@ -982,11 +1049,77 @@ public interface Olingo2EndpointBuilderFactory { return this; } /** + * Custom entity provider read properties applied to all read + * operations. + * + * The option is a: + * <code>org.apache.olingo.odata2.api.ep.EntityProviderReadProperties</code> type. + * + * Group: common + */ + default Olingo2EndpointProducerBuilder entityProviderReadProperties( + Object entityProviderReadProperties) { + doSetProperty("entityProviderReadProperties", entityProviderReadProperties); + return this; + } + /** + * Custom entity provider read properties applied to all read + * operations. + * + * The option will be converted to a + * <code>org.apache.olingo.odata2.api.ep.EntityProviderReadProperties</code> type. + * + * Group: common + */ + default Olingo2EndpointProducerBuilder entityProviderReadProperties( + String entityProviderReadProperties) { + doSetProperty("entityProviderReadProperties", entityProviderReadProperties); + return this; + } + /** + * Custom entity provider write properties applied to create, update, + * patch, batch and merge operations. For instance users can skip the + * Json object wrapper or enable content only mode when sending request + * data. A service URI set in the properties will always be overwritten + * by the serviceUri configuration parameter. Please consider to using + * the serviceUri configuration parameter instead of setting the + * respective write property here. + * + * The option is a: + * <code>org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties</code> type. + * + * Group: common + */ + default Olingo2EndpointProducerBuilder entityProviderWriteProperties( + Object entityProviderWriteProperties) { + doSetProperty("entityProviderWriteProperties", entityProviderWriteProperties); + return this; + } + /** + * Custom entity provider write properties applied to create, update, + * patch, batch and merge operations. For instance users can skip the + * Json object wrapper or enable content only mode when sending request + * data. A service URI set in the properties will always be overwritten + * by the serviceUri configuration parameter. Please consider to using + * the serviceUri configuration parameter instead of setting the + * respective write property here. + * + * The option will be converted to a + * <code>org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties</code> type. + * + * Group: common + */ + default Olingo2EndpointProducerBuilder entityProviderWriteProperties( + String entityProviderWriteProperties) { + doSetProperty("entityProviderWriteProperties", entityProviderWriteProperties); + return this; + } + /** * Set this to true to filter out results that have already been * communicated by this component. - * + * * The option is a: <code>boolean</code> type. - * + * * Default: false * Group: common */ @@ -998,9 +1131,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Set this to true to filter out results that have already been * communicated by this component. - * + * * The option will be converted to a <code>boolean</code> type. - * + * * Default: false * Group: common */ @@ -1012,10 +1145,10 @@ public interface Olingo2EndpointBuilderFactory { /** * Custom HTTP headers to inject into every request, this could include * OAuth tokens, etc. - * + * * The option is a: <code>java.util.Map<java.lang.String, * java.lang.String></code> type. - * + * * Group: common */ default Olingo2EndpointProducerBuilder httpHeaders( @@ -1026,11 +1159,11 @@ public interface Olingo2EndpointBuilderFactory { /** * Custom HTTP headers to inject into every request, this could include * OAuth tokens, etc. - * + * * The option will be converted to a * <code>java.util.Map<java.lang.String, java.lang.String></code> * type. - * + * * Group: common */ default Olingo2EndpointProducerBuilder httpHeaders(String httpHeaders) { @@ -1039,9 +1172,9 @@ public interface Olingo2EndpointBuilderFactory { } /** * Sets the name of a parameter to be passed in the exchange In Body. - * + * * The option is a: <code>java.lang.String</code> type. - * + * * Group: common */ default Olingo2EndpointProducerBuilder inBody(String inBody) { @@ -1050,9 +1183,9 @@ public interface Olingo2EndpointBuilderFactory { } /** * HTTP proxy server configuration. - * + * * The option is a: <code>org.apache.http.HttpHost</code> type. - * + * * Group: common */ default Olingo2EndpointProducerBuilder proxy(Object proxy) { @@ -1061,10 +1194,10 @@ public interface Olingo2EndpointBuilderFactory { } /** * HTTP proxy server configuration. - * + * * The option will be converted to a * <code>org.apache.http.HttpHost</code> type. - * + * * Group: common */ default Olingo2EndpointProducerBuilder proxy(String proxy) { @@ -1074,9 +1207,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Target OData service base URI, e.g. * http://services.odata.org/OData/OData.svc. - * + * * The option is a: <code>java.lang.String</code> type. - * + * * Group: common */ default Olingo2EndpointProducerBuilder serviceUri(String serviceUri) { @@ -1086,9 +1219,9 @@ public interface Olingo2EndpointBuilderFactory { /** * HTTP request timeout in milliseconds, defaults to 30,000 (30 * seconds). - * + * * The option is a: <code>int</code> type. - * + * * Default: 30000 * Group: common */ @@ -1099,9 +1232,9 @@ public interface Olingo2EndpointBuilderFactory { /** * HTTP request timeout in milliseconds, defaults to 30,000 (30 * seconds). - * + * * The option will be converted to a <code>int</code> type. - * + * * Default: 30000 * Group: common */ @@ -1120,9 +1253,9 @@ public interface Olingo2EndpointBuilderFactory { * the first message is processed then creating and starting the * producer may take a little time and prolong the total processing time * of the processing. - * + * * The option is a: <code>boolean</code> type. - * + * * Default: false * Group: producer */ @@ -1141,9 +1274,9 @@ public interface Olingo2EndpointBuilderFactory { * the first message is processed then creating and starting the * producer may take a little time and prolong the total processing time * of the processing. - * + * * The option will be converted to a <code>boolean</code> type. - * + * * Default: false * Group: producer */ @@ -1154,10 +1287,10 @@ public interface Olingo2EndpointBuilderFactory { } /** * To configure security using SSLContextParameters. - * + * * The option is a: * <code>org.apache.camel.support.jsse.SSLContextParameters</code> type. - * + * * Group: security */ default Olingo2EndpointProducerBuilder sslContextParameters( @@ -1167,10 +1300,10 @@ public interface Olingo2EndpointBuilderFactory { } /** * To configure security using SSLContextParameters. - * + * * The option will be converted to a * <code>org.apache.camel.support.jsse.SSLContextParameters</code> type. - * + * * Group: security */ default Olingo2EndpointProducerBuilder sslContextParameters( @@ -1192,9 +1325,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Whether the endpoint should use basic property binding (Camel 2.x) or * the newer property binding with additional capabilities. - * + * * The option is a: <code>boolean</code> type. - * + * * Default: false * Group: advanced */ @@ -1206,9 +1339,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Whether the endpoint should use basic property binding (Camel 2.x) or * the newer property binding with additional capabilities. - * + * * The option will be converted to a <code>boolean</code> type. - * + * * Default: false * Group: advanced */ @@ -1222,11 +1355,11 @@ public interface Olingo2EndpointBuilderFactory { * configuration, overrides connectionTimeout, socketTimeout, proxy and * sslContext. Note that a socketTimeout MUST be specified in the * builder, otherwise OData requests could block indefinitely. - * + * * The option is a: * <code>org.apache.http.impl.nio.client.HttpAsyncClientBuilder</code> * type. - * + * * Group: advanced */ default AdvancedOlingo2EndpointProducerBuilder httpAsyncClientBuilder( @@ -1239,11 +1372,11 @@ public interface Olingo2EndpointBuilderFactory { * configuration, overrides connectionTimeout, socketTimeout, proxy and * sslContext. Note that a socketTimeout MUST be specified in the * builder, otherwise OData requests could block indefinitely. - * + * * The option will be converted to a * <code>org.apache.http.impl.nio.client.HttpAsyncClientBuilder</code> * type. - * + * * Group: advanced */ default AdvancedOlingo2EndpointProducerBuilder httpAsyncClientBuilder( @@ -1256,10 +1389,10 @@ public interface Olingo2EndpointBuilderFactory { * configuration, overrides connectionTimeout, socketTimeout, proxy and * sslContext. Note that a socketTimeout MUST be specified in the * builder, otherwise OData requests could block indefinitely. - * + * * The option is a: * <code>org.apache.http.impl.client.HttpClientBuilder</code> type. - * + * * Group: advanced */ default AdvancedOlingo2EndpointProducerBuilder httpClientBuilder( @@ -1272,10 +1405,10 @@ public interface Olingo2EndpointBuilderFactory { * configuration, overrides connectionTimeout, socketTimeout, proxy and * sslContext. Note that a socketTimeout MUST be specified in the * builder, otherwise OData requests could block indefinitely. - * + * * The option will be converted to a * <code>org.apache.http.impl.client.HttpClientBuilder</code> type. - * + * * Group: advanced */ default AdvancedOlingo2EndpointProducerBuilder httpClientBuilder( @@ -1286,9 +1419,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Sets whether synchronous processing should be strictly used, or Camel * is allowed to use asynchronous processing (if supported). - * + * * The option is a: <code>boolean</code> type. - * + * * Default: false * Group: advanced */ @@ -1300,9 +1433,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Sets whether synchronous processing should be strictly used, or Camel * is allowed to use asynchronous processing (if supported). - * + * * The option will be converted to a <code>boolean</code> type. - * + * * Default: false * Group: advanced */ @@ -1326,9 +1459,9 @@ public interface Olingo2EndpointBuilderFactory { /** * HTTP connection creation timeout in milliseconds, defaults to 30,000 * (30 seconds). - * + * * The option is a: <code>int</code> type. - * + * * Default: 30000 * Group: common */ @@ -1339,9 +1472,9 @@ public interface Olingo2EndpointBuilderFactory { /** * HTTP connection creation timeout in milliseconds, defaults to 30,000 * (30 seconds). - * + * * The option will be converted to a <code>int</code> type. - * + * * Default: 30000 * Group: common */ @@ -1352,9 +1485,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Content-Type header value can be used to specify JSON or XML message * format, defaults to application/json;charset=utf-8. - * + * * The option is a: <code>java.lang.String</code> type. - * + * * Default: application/json;charset=utf-8 * Group: common */ @@ -1363,11 +1496,77 @@ public interface Olingo2EndpointBuilderFactory { return this; } /** + * Custom entity provider read properties applied to all read + * operations. + * + * The option is a: + * <code>org.apache.olingo.odata2.api.ep.EntityProviderReadProperties</code> type. + * + * Group: common + */ + default Olingo2EndpointBuilder entityProviderReadProperties( + Object entityProviderReadProperties) { + doSetProperty("entityProviderReadProperties", entityProviderReadProperties); + return this; + } + /** + * Custom entity provider read properties applied to all read + * operations. + * + * The option will be converted to a + * <code>org.apache.olingo.odata2.api.ep.EntityProviderReadProperties</code> type. + * + * Group: common + */ + default Olingo2EndpointBuilder entityProviderReadProperties( + String entityProviderReadProperties) { + doSetProperty("entityProviderReadProperties", entityProviderReadProperties); + return this; + } + /** + * Custom entity provider write properties applied to create, update, + * patch, batch and merge operations. For instance users can skip the + * Json object wrapper or enable content only mode when sending request + * data. A service URI set in the properties will always be overwritten + * by the serviceUri configuration parameter. Please consider to using + * the serviceUri configuration parameter instead of setting the + * respective write property here. + * + * The option is a: + * <code>org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties</code> type. + * + * Group: common + */ + default Olingo2EndpointBuilder entityProviderWriteProperties( + Object entityProviderWriteProperties) { + doSetProperty("entityProviderWriteProperties", entityProviderWriteProperties); + return this; + } + /** + * Custom entity provider write properties applied to create, update, + * patch, batch and merge operations. For instance users can skip the + * Json object wrapper or enable content only mode when sending request + * data. A service URI set in the properties will always be overwritten + * by the serviceUri configuration parameter. Please consider to using + * the serviceUri configuration parameter instead of setting the + * respective write property here. + * + * The option will be converted to a + * <code>org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties</code> type. + * + * Group: common + */ + default Olingo2EndpointBuilder entityProviderWriteProperties( + String entityProviderWriteProperties) { + doSetProperty("entityProviderWriteProperties", entityProviderWriteProperties); + return this; + } + /** * Set this to true to filter out results that have already been * communicated by this component. - * + * * The option is a: <code>boolean</code> type. - * + * * Default: false * Group: common */ @@ -1379,9 +1578,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Set this to true to filter out results that have already been * communicated by this component. - * + * * The option will be converted to a <code>boolean</code> type. - * + * * Default: false * Group: common */ @@ -1393,10 +1592,10 @@ public interface Olingo2EndpointBuilderFactory { /** * Custom HTTP headers to inject into every request, this could include * OAuth tokens, etc. - * + * * The option is a: <code>java.util.Map<java.lang.String, * java.lang.String></code> type. - * + * * Group: common */ default Olingo2EndpointBuilder httpHeaders( @@ -1407,11 +1606,11 @@ public interface Olingo2EndpointBuilderFactory { /** * Custom HTTP headers to inject into every request, this could include * OAuth tokens, etc. - * + * * The option will be converted to a * <code>java.util.Map<java.lang.String, java.lang.String></code> * type. - * + * * Group: common */ default Olingo2EndpointBuilder httpHeaders(String httpHeaders) { @@ -1420,9 +1619,9 @@ public interface Olingo2EndpointBuilderFactory { } /** * Sets the name of a parameter to be passed in the exchange In Body. - * + * * The option is a: <code>java.lang.String</code> type. - * + * * Group: common */ default Olingo2EndpointBuilder inBody(String inBody) { @@ -1431,9 +1630,9 @@ public interface Olingo2EndpointBuilderFactory { } /** * HTTP proxy server configuration. - * + * * The option is a: <code>org.apache.http.HttpHost</code> type. - * + * * Group: common */ default Olingo2EndpointBuilder proxy(Object proxy) { @@ -1442,10 +1641,10 @@ public interface Olingo2EndpointBuilderFactory { } /** * HTTP proxy server configuration. - * + * * The option will be converted to a * <code>org.apache.http.HttpHost</code> type. - * + * * Group: common */ default Olingo2EndpointBuilder proxy(String proxy) { @@ -1455,9 +1654,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Target OData service base URI, e.g. * http://services.odata.org/OData/OData.svc. - * + * * The option is a: <code>java.lang.String</code> type. - * + * * Group: common */ default Olingo2EndpointBuilder serviceUri(String serviceUri) { @@ -1467,9 +1666,9 @@ public interface Olingo2EndpointBuilderFactory { /** * HTTP request timeout in milliseconds, defaults to 30,000 (30 * seconds). - * + * * The option is a: <code>int</code> type. - * + * * Default: 30000 * Group: common */ @@ -1480,9 +1679,9 @@ public interface Olingo2EndpointBuilderFactory { /** * HTTP request timeout in milliseconds, defaults to 30,000 (30 * seconds). - * + * * The option will be converted to a <code>int</code> type. - * + * * Default: 30000 * Group: common */ @@ -1492,10 +1691,10 @@ public interface Olingo2EndpointBuilderFactory { } /** * To configure security using SSLContextParameters. - * + * * The option is a: * <code>org.apache.camel.support.jsse.SSLContextParameters</code> type. - * + * * Group: security */ default Olingo2EndpointBuilder sslContextParameters( @@ -1505,10 +1704,10 @@ public interface Olingo2EndpointBuilderFactory { } /** * To configure security using SSLContextParameters. - * + * * The option will be converted to a * <code>org.apache.camel.support.jsse.SSLContextParameters</code> type. - * + * * Group: security */ default Olingo2EndpointBuilder sslContextParameters( @@ -1531,9 +1730,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Whether the endpoint should use basic property binding (Camel 2.x) or * the newer property binding with additional capabilities. - * + * * The option is a: <code>boolean</code> type. - * + * * Default: false * Group: advanced */ @@ -1545,9 +1744,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Whether the endpoint should use basic property binding (Camel 2.x) or * the newer property binding with additional capabilities. - * + * * The option will be converted to a <code>boolean</code> type. - * + * * Default: false * Group: advanced */ @@ -1561,11 +1760,11 @@ public interface Olingo2EndpointBuilderFactory { * configuration, overrides connectionTimeout, socketTimeout, proxy and * sslContext. Note that a socketTimeout MUST be specified in the * builder, otherwise OData requests could block indefinitely. - * + * * The option is a: * <code>org.apache.http.impl.nio.client.HttpAsyncClientBuilder</code> * type. - * + * * Group: advanced */ default AdvancedOlingo2EndpointBuilder httpAsyncClientBuilder( @@ -1578,11 +1777,11 @@ public interface Olingo2EndpointBuilderFactory { * configuration, overrides connectionTimeout, socketTimeout, proxy and * sslContext. Note that a socketTimeout MUST be specified in the * builder, otherwise OData requests could block indefinitely. - * + * * The option will be converted to a * <code>org.apache.http.impl.nio.client.HttpAsyncClientBuilder</code> * type. - * + * * Group: advanced */ default AdvancedOlingo2EndpointBuilder httpAsyncClientBuilder( @@ -1595,10 +1794,10 @@ public interface Olingo2EndpointBuilderFactory { * configuration, overrides connectionTimeout, socketTimeout, proxy and * sslContext. Note that a socketTimeout MUST be specified in the * builder, otherwise OData requests could block indefinitely. - * + * * The option is a: * <code>org.apache.http.impl.client.HttpClientBuilder</code> type. - * + * * Group: advanced */ default AdvancedOlingo2EndpointBuilder httpClientBuilder( @@ -1611,10 +1810,10 @@ public interface Olingo2EndpointBuilderFactory { * configuration, overrides connectionTimeout, socketTimeout, proxy and * sslContext. Note that a socketTimeout MUST be specified in the * builder, otherwise OData requests could block indefinitely. - * + * * The option will be converted to a * <code>org.apache.http.impl.client.HttpClientBuilder</code> type. - * + * * Group: advanced */ default AdvancedOlingo2EndpointBuilder httpClientBuilder( @@ -1625,9 +1824,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Sets whether synchronous processing should be strictly used, or Camel * is allowed to use asynchronous processing (if supported). - * + * * The option is a: <code>boolean</code> type. - * + * * Default: false * Group: advanced */ @@ -1638,9 +1837,9 @@ public interface Olingo2EndpointBuilderFactory { /** * Sets whether synchronous processing should be strictly used, or Camel * is allowed to use asynchronous processing (if supported). - * + * * The option will be converted to a <code>boolean</code> type. - * + * * Default: false * Group: advanced */ @@ -1654,20 +1853,20 @@ public interface Olingo2EndpointBuilderFactory { /** * Olingo2 (camel-olingo2) * Communicate with OData 2.0 services using Apache Olingo. - * + * * Category: cloud * Since: 2.14 * Maven coordinates: org.apache.camel:camel-olingo2 - * + * * Syntax: <code>olingo2:apiName/methodName</code> - * + * * Path parameter: apiName (required) * What kind of operation to perform * The value can be one of: DEFAULT - * + * * Path parameter: methodName (required) * What sub operation to use for the selected operation - * + * * @param path apiName/methodName */ default Olingo2EndpointBuilder olingo2(String path) { @@ -1676,20 +1875,20 @@ public interface Olingo2EndpointBuilderFactory { /** * Olingo2 (camel-olingo2) * Communicate with OData 2.0 services using Apache Olingo. - * + * * Category: cloud * Since: 2.14 * Maven coordinates: org.apache.camel:camel-olingo2 - * + * * Syntax: <code>olingo2:apiName/methodName</code> - * + * * Path parameter: apiName (required) * What kind of operation to perform * The value can be one of: DEFAULT - * + * * Path parameter: methodName (required) * What sub operation to use for the selected operation - * + * * @param componentName to use a custom component name for the endpoint * instead of the default name * @param path apiName/methodName @@ -1708,4 +1907,4 @@ public interface Olingo2EndpointBuilderFactory { } return new Olingo2EndpointBuilderImpl(path); } -} \ No newline at end of file +} diff --git a/docs/components/modules/ROOT/pages/olingo2-component.adoc b/docs/components/modules/ROOT/pages/olingo2-component.adoc index 588ce96..3abfd05 100644 --- a/docs/components/modules/ROOT/pages/olingo2-component.adoc +++ b/docs/components/modules/ROOT/pages/olingo2-component.adoc @@ -54,7 +54,7 @@ for this component: // component options: START -The Olingo2 component supports 16 options, which are listed below. +The Olingo2 component supports 18 options, which are listed below. @@ -64,6 +64,8 @@ The Olingo2 component supports 16 options, which are listed below. | *configuration* (common) | To use the shared configuration | | Olingo2Configuration | *connectTimeout* (common) | HTTP connection creation timeout in milliseconds, defaults to 30,000 (30 seconds) | 30000 | int | *contentType* (common) | Content-Type header value can be used to specify JSON or XML message format, defaults to application/json;charset=utf-8 | application/json;charset=utf-8 | String +| *entityProviderReadProperties* (common) | Custom entity provider read properties applied to all read operations. | | EntityProviderReadProperties +| *entityProviderWriteProperties* (common) | Custom entity provider write properties applied to create, update and merge operations. For instance users can enable content only settings and skip meta data wrappers when sending request data. | | EntityProviderWriteProperties | *filterAlreadySeen* (common) | Set this to true to filter out results that have already been communicated by this component. | false | boolean | *httpHeaders* (common) | Custom HTTP headers to inject into every request, this could include OAuth tokens, etc. | | Map | *proxy* (common) | HTTP proxy server configuration | | HttpHost @@ -105,7 +107,7 @@ with the following path and query parameters: |=== -=== Query Parameters (34 parameters): +=== Query Parameters (36 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -113,6 +115,8 @@ with the following path and query parameters: | Name | Description | Default | Type | *connectTimeout* (common) | HTTP connection creation timeout in milliseconds, defaults to 30,000 (30 seconds) | 30000 | int | *contentType* (common) | Content-Type header value can be used to specify JSON or XML message format, defaults to application/json;charset=utf-8 | application/json;charset=utf-8 | String +| *entityProviderReadProperties* (common) | Custom entity provider read properties applied to all read operations. | | EntityProviderReadProperties +| *entityProviderWriteProperties* (common) | Custom entity provider write properties applied to create, update and merge operations. For instance users can enable content only settings and skip meta data wrappers when sending request data. | | EntityProviderWriteProperties | *filterAlreadySeen* (common) | Set this to true to filter out results that have already been communicated by this component. | false | boolean | *httpHeaders* (common) | Custom HTTP headers to inject into every request, this could include OAuth tokens, etc. | | Map | *inBody* (common) | Sets the name of a parameter to be passed in the exchange In Body | | String