This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 381b053701863958c4cd4ca285e0a4932cad171e Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Mon Mar 2 18:01:01 2020 +0100 Rename Spark(Component|Endpoint) to SparkRest\1 to avoid conflicts in the endpoint dsl --- .../sparkrest/SparkComponentConfigurer.java | 4 +- .../sparkrest/SparkEndpointConfigurer.java | 2 +- ...urer.java => SparkRestComponentConfigurer.java} | 6 +- ...gurer.java => SparkRestEndpointConfigurer.java} | 4 +- .../services/org/apache/camel/component/spark-rest | 2 +- .../apache/camel/configurer/spark-rest-component | 2 +- .../apache/camel/configurer/spark-rest-endpoint | 2 +- .../camel/component/sparkrest/spark-rest.json | 2 +- .../camel/component/sparkrest/CamelSparkRoute.java | 4 +- .../component/sparkrest/DefaultSparkBinding.java | 2 +- .../camel/component/sparkrest/SparkConsumer.java | 4 +- ...SparkComponent.java => SparkRestComponent.java} | 6 +- .../{SparkEndpoint.java => SparkRestEndpoint.java} | 8 +- .../camel/component/sparkrest/BaseSparkTest.java | 2 +- .../sparkrest/DefaultSparkBindingTest.java | 2 +- .../dsl/SparkRestComponentBuilderFactory.java | 48 +-- .../src/generated/resources/metadata.json | 2 +- .../builder/endpoint/EndpointBuilderFactory.java | 1 + .../camel/builder/endpoint/EndpointBuilders.java | 1 + .../dsl/SparkRestEndpointBuilderFactory.java | 468 +++++++++++++++++++++ 20 files changed, 521 insertions(+), 51 deletions(-) diff --git a/components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkComponentConfigurer.java b/components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkComponentConfigurer.java index e272afa..d60c1b1 100644 --- a/components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkComponentConfigurer.java +++ b/components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkComponentConfigurer.java @@ -11,7 +11,7 @@ import org.apache.camel.support.component.PropertyConfigurerSupport; @SuppressWarnings("unchecked") public class SparkComponentConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer { - private org.apache.camel.component.sparkrest.SparkConfiguration getOrCreateConfiguration(SparkComponent target) { + private org.apache.camel.component.sparkrest.SparkConfiguration getOrCreateConfiguration(SparkRestComponent target) { if (target.getSparkConfiguration() == null) { target.setSparkConfiguration(new org.apache.camel.component.sparkrest.SparkConfiguration()); } @@ -20,7 +20,7 @@ public class SparkComponentConfigurer extends PropertyConfigurerSupport implemen @Override public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { - SparkComponent target = (SparkComponent) obj; + SparkRestComponent target = (SparkRestComponent) obj; switch (ignoreCase ? name.toLowerCase() : name) { case "basicpropertybinding": case "basicPropertyBinding": target.setBasicPropertyBinding(property(camelContext, boolean.class, value)); return true; diff --git a/components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkEndpointConfigurer.java b/components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkEndpointConfigurer.java index 17ad8be..5210d4a 100644 --- a/components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkEndpointConfigurer.java +++ b/components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkEndpointConfigurer.java @@ -13,7 +13,7 @@ public class SparkEndpointConfigurer extends PropertyConfigurerSupport implement @Override public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { - SparkEndpoint target = (SparkEndpoint) obj; + SparkRestEndpoint target = (SparkRestEndpoint) obj; switch (ignoreCase ? name.toLowerCase() : name) { case "accept": target.setAccept(property(camelContext, java.lang.String.class, value)); return true; case "basicpropertybinding": diff --git a/components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkComponentConfigurer.java b/components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkRestComponentConfigurer.java similarity index 94% copy from components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkComponentConfigurer.java copy to components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkRestComponentConfigurer.java index e272afa..67dd606 100644 --- a/components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkComponentConfigurer.java +++ b/components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkRestComponentConfigurer.java @@ -9,9 +9,9 @@ import org.apache.camel.support.component.PropertyConfigurerSupport; * Generated by camel build tools - do NOT edit this file! */ @SuppressWarnings("unchecked") -public class SparkComponentConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer { +public class SparkRestComponentConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer { - private org.apache.camel.component.sparkrest.SparkConfiguration getOrCreateConfiguration(SparkComponent target) { + private org.apache.camel.component.sparkrest.SparkConfiguration getOrCreateConfiguration(SparkRestComponent target) { if (target.getSparkConfiguration() == null) { target.setSparkConfiguration(new org.apache.camel.component.sparkrest.SparkConfiguration()); } @@ -20,7 +20,7 @@ public class SparkComponentConfigurer extends PropertyConfigurerSupport implemen @Override public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { - SparkComponent target = (SparkComponent) obj; + SparkRestComponent target = (SparkRestComponent) obj; switch (ignoreCase ? name.toLowerCase() : name) { case "basicpropertybinding": case "basicPropertyBinding": target.setBasicPropertyBinding(property(camelContext, boolean.class, value)); return true; diff --git a/components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkEndpointConfigurer.java b/components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkRestEndpointConfigurer.java similarity index 93% copy from components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkEndpointConfigurer.java copy to components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkRestEndpointConfigurer.java index 17ad8be..05ba284 100644 --- a/components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkEndpointConfigurer.java +++ b/components/camel-spark-rest/src/generated/java/org/apache/camel/component/sparkrest/SparkRestEndpointConfigurer.java @@ -9,11 +9,11 @@ import org.apache.camel.support.component.PropertyConfigurerSupport; * Generated by camel build tools - do NOT edit this file! */ @SuppressWarnings("unchecked") -public class SparkEndpointConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer { +public class SparkRestEndpointConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer { @Override public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { - SparkEndpoint target = (SparkEndpoint) obj; + SparkRestEndpoint target = (SparkRestEndpoint) obj; switch (ignoreCase ? name.toLowerCase() : name) { case "accept": target.setAccept(property(camelContext, java.lang.String.class, value)); return true; case "basicpropertybinding": diff --git a/components/camel-spark-rest/src/generated/resources/META-INF/services/org/apache/camel/component/spark-rest b/components/camel-spark-rest/src/generated/resources/META-INF/services/org/apache/camel/component/spark-rest index 3d27088..54acead 100644 --- a/components/camel-spark-rest/src/generated/resources/META-INF/services/org/apache/camel/component/spark-rest +++ b/components/camel-spark-rest/src/generated/resources/META-INF/services/org/apache/camel/component/spark-rest @@ -1,2 +1,2 @@ # Generated by camel build tools - do NOT edit this file! -class=org.apache.camel.component.sparkrest.SparkComponent +class=org.apache.camel.component.sparkrest.SparkRestComponent diff --git a/components/camel-spark-rest/src/generated/resources/META-INF/services/org/apache/camel/configurer/spark-rest-component b/components/camel-spark-rest/src/generated/resources/META-INF/services/org/apache/camel/configurer/spark-rest-component index 3ce84e7..110f602 100644 --- a/components/camel-spark-rest/src/generated/resources/META-INF/services/org/apache/camel/configurer/spark-rest-component +++ b/components/camel-spark-rest/src/generated/resources/META-INF/services/org/apache/camel/configurer/spark-rest-component @@ -1,2 +1,2 @@ # Generated by camel build tools - do NOT edit this file! -class=org.apache.camel.component.sparkrest.SparkComponentConfigurer +class=org.apache.camel.component.sparkrest.SparkRestComponentConfigurer diff --git a/components/camel-spark-rest/src/generated/resources/META-INF/services/org/apache/camel/configurer/spark-rest-endpoint b/components/camel-spark-rest/src/generated/resources/META-INF/services/org/apache/camel/configurer/spark-rest-endpoint index ba949e4..6696388 100644 --- a/components/camel-spark-rest/src/generated/resources/META-INF/services/org/apache/camel/configurer/spark-rest-endpoint +++ b/components/camel-spark-rest/src/generated/resources/META-INF/services/org/apache/camel/configurer/spark-rest-endpoint @@ -1,2 +1,2 @@ # Generated by camel build tools - do NOT edit this file! -class=org.apache.camel.component.sparkrest.SparkEndpointConfigurer +class=org.apache.camel.component.sparkrest.SparkRestEndpointConfigurer diff --git a/components/camel-spark-rest/src/generated/resources/org/apache/camel/component/sparkrest/spark-rest.json b/components/camel-spark-rest/src/generated/resources/org/apache/camel/component/sparkrest/spark-rest.json index ec233e3..28e7d22 100644 --- a/components/camel-spark-rest/src/generated/resources/org/apache/camel/component/sparkrest/spark-rest.json +++ b/components/camel-spark-rest/src/generated/resources/org/apache/camel/component/sparkrest/spark-rest.json @@ -12,7 +12,7 @@ "consumerOnly": true, "producerOnly": false, "lenientProperties": false, - "javaType": "org.apache.camel.component.sparkrest.SparkComponent", + "javaType": "org.apache.camel.component.sparkrest.SparkRestComponent", "firstVersion": "2.14.0", "groupId": "org.apache.camel", "artifactId": "camel-spark-rest", diff --git a/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/CamelSparkRoute.java b/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/CamelSparkRoute.java index 6a3691f..24f2443 100644 --- a/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/CamelSparkRoute.java +++ b/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/CamelSparkRoute.java @@ -27,10 +27,10 @@ import spark.Route; public class CamelSparkRoute implements Route { - private final SparkEndpoint endpoint; + private final SparkRestEndpoint endpoint; private final Processor processor; - public CamelSparkRoute(SparkEndpoint endpoint, Processor processor) { + public CamelSparkRoute(SparkRestEndpoint endpoint, Processor processor) { this.endpoint = endpoint; this.processor = processor; } diff --git a/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/DefaultSparkBinding.java b/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/DefaultSparkBinding.java index eb8bcbc..b4fd1f0 100644 --- a/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/DefaultSparkBinding.java +++ b/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/DefaultSparkBinding.java @@ -66,7 +66,7 @@ public class DefaultSparkBinding implements SparkBinding { @Override public void populateCamelHeaders(Request request, Map<String, Object> headers, Exchange exchange, SparkConfiguration configuration) throws Exception { String path = request.raw().getPathInfo(); - SparkEndpoint endpoint = (SparkEndpoint) exchange.getFromEndpoint(); + SparkRestEndpoint endpoint = (SparkRestEndpoint) exchange.getFromEndpoint(); if (endpoint.getPath() != null) { // need to match by lower case as we want to ignore case on context-path String endpointPath = endpoint.getPath(); diff --git a/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkConsumer.java b/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkConsumer.java index aa0216b..bda244f 100644 --- a/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkConsumer.java +++ b/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkConsumer.java @@ -36,8 +36,8 @@ public class SparkConsumer extends DefaultConsumer { } @Override - public SparkEndpoint getEndpoint() { - return (SparkEndpoint) super.getEndpoint(); + public SparkRestEndpoint getEndpoint() { + return (SparkRestEndpoint) super.getEndpoint(); } public boolean isEnableCors() { diff --git a/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkComponent.java b/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkRestComponent.java similarity index 97% rename from components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkComponent.java rename to components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkRestComponent.java index 6c7b694..0e3df18 100644 --- a/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkComponent.java +++ b/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkRestComponent.java @@ -39,7 +39,7 @@ import org.apache.camel.util.StringHelper; import spark.Service; @Component("spark-rest") -public class SparkComponent extends DefaultComponent implements RestConsumerFactory, RestApiConsumerFactory { +public class SparkRestComponent extends DefaultComponent implements RestConsumerFactory, RestApiConsumerFactory { private static final Pattern PATTERN = Pattern.compile("\\{(.*?)\\}"); @@ -205,7 +205,7 @@ public class SparkComponent extends DefaultComponent implements RestConsumerFact protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { SparkConfiguration config = getSparkConfiguration().copy(); - SparkEndpoint answer = new SparkEndpoint(uri, this); + SparkRestEndpoint answer = new SparkRestEndpoint(uri, this); answer.setSparkConfiguration(config); answer.setSparkBinding(getSparkBinding()); setProperties(answer, parameters); @@ -343,7 +343,7 @@ public class SparkComponent extends DefaultComponent implements RestConsumerFact String url = RestComponentHelper.createRestConsumerUrl("spark-rest", verb, path, map); // get the endpoint - SparkEndpoint endpoint = camelContext.getEndpoint(url, SparkEndpoint.class); + SparkRestEndpoint endpoint = camelContext.getEndpoint(url, SparkRestEndpoint.class); setProperties(endpoint, parameters); // configure consumer properties diff --git a/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkEndpoint.java b/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkRestEndpoint.java similarity index 94% rename from components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkEndpoint.java rename to components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkRestEndpoint.java index 9cd19f5..1797c27 100644 --- a/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkEndpoint.java +++ b/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkRestEndpoint.java @@ -32,7 +32,7 @@ import spark.route.HttpMethod; * The spark-rest component is used for hosting REST services which has been defined using Camel rest-dsl. */ @UriEndpoint(firstVersion = "2.14.0", scheme = "spark-rest", title = "Spark Rest", syntax = "spark-rest:verb:path", consumerOnly = true, label = "rest") -public class SparkEndpoint extends DefaultEndpoint { +public class SparkRestEndpoint extends DefaultEndpoint { @UriPath(enums = "get,post,put,patch,delete,head,trace,connect,options") @Metadata(required = true) private String verb; @UriPath @Metadata(required = true) @@ -44,7 +44,7 @@ public class SparkEndpoint extends DefaultEndpoint { @UriParam(label = "advanced") private SparkBinding sparkBinding; - public SparkEndpoint(String endpointUri, Component component) { + public SparkRestEndpoint(String endpointUri, Component component) { super(endpointUri, component); } @@ -129,7 +129,7 @@ public class SparkEndpoint extends DefaultEndpoint { } @Override - public SparkComponent getComponent() { - return (SparkComponent) super.getComponent(); + public SparkRestComponent getComponent() { + return (SparkRestComponent) super.getComponent(); } } diff --git a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/BaseSparkTest.java b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/BaseSparkTest.java index 4034359..47ea149 100644 --- a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/BaseSparkTest.java +++ b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/BaseSparkTest.java @@ -41,7 +41,7 @@ public abstract class BaseSparkTest extends CamelTestSupport { protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); - SparkComponent spark = context.getComponent("spark-rest", SparkComponent.class); + SparkRestComponent spark = context.getComponent("spark-rest", SparkRestComponent.class); spark.setPort(port); return context; diff --git a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/DefaultSparkBindingTest.java b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/DefaultSparkBindingTest.java index 1801a0b..8ddbfe4 100644 --- a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/DefaultSparkBindingTest.java +++ b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/DefaultSparkBindingTest.java @@ -70,7 +70,7 @@ public class DefaultSparkBindingTest { when(httpServletRequest.getRequestURI()).thenReturn("http://localhost?query=value"); when(httpServletRequest.getContentType()).thenReturn("application/json"); - when(camelExchange.getFromEndpoint()).thenReturn(new SparkEndpoint("/", null)); + when(camelExchange.getFromEndpoint()).thenReturn(new SparkRestEndpoint("/", null)); } @DataPoints("exchangeHeaderScenarios") diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SparkRestComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SparkRestComponentBuilderFactory.java index 4f35519..b2f70f9 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SparkRestComponentBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SparkRestComponentBuilderFactory.java @@ -20,7 +20,7 @@ import javax.annotation.Generated; import org.apache.camel.Component; import org.apache.camel.builder.component.AbstractComponentBuilder; import org.apache.camel.builder.component.ComponentBuilder; -import org.apache.camel.component.sparkrest.SparkComponent; +import org.apache.camel.component.sparkrest.SparkRestComponent; /** * The spark-rest component is used for hosting REST services which has been @@ -49,7 +49,7 @@ public interface SparkRestComponentBuilderFactory { */ interface SparkRestComponentBuilder extends - ComponentBuilder<SparkComponent> { + ComponentBuilder<SparkRestComponent> { /** * Allows for bridging the consumer to the Camel routing Error Handler, * which mean any exceptions occurred while the consumer is trying to @@ -308,15 +308,15 @@ public interface SparkRestComponentBuilderFactory { class SparkRestComponentBuilderImpl extends - AbstractComponentBuilder<SparkComponent> + AbstractComponentBuilder<SparkRestComponent> implements SparkRestComponentBuilder { @Override - protected SparkComponent buildConcreteComponent() { - return new SparkComponent(); + protected SparkRestComponent buildConcreteComponent() { + return new SparkRestComponent(); } private org.apache.camel.component.sparkrest.SparkConfiguration getOrCreateConfiguration( - org.apache.camel.component.sparkrest.SparkComponent component) { + org.apache.camel.component.sparkrest.SparkRestComponent component) { if (component.getSparkConfiguration() == null) { component.setSparkConfiguration(new org.apache.camel.component.sparkrest.SparkConfiguration()); } @@ -328,24 +328,24 @@ public interface SparkRestComponentBuilderFactory { String name, Object value) { switch (name) { - case "bridgeErrorHandler": ((SparkComponent) component).setBridgeErrorHandler((boolean) value); return true; - case "disableStreamCache": getOrCreateConfiguration((SparkComponent) component).setDisableStreamCache((boolean) value); return true; - case "ipAddress": ((SparkComponent) component).setIpAddress((java.lang.String) value); return true; - case "mapHeaders": getOrCreateConfiguration((SparkComponent) component).setMapHeaders((boolean) value); return true; - case "port": ((SparkComponent) component).setPort((int) value); return true; - case "transferException": getOrCreateConfiguration((SparkComponent) component).setTransferException((boolean) value); return true; - case "urlDecodeHeaders": getOrCreateConfiguration((SparkComponent) component).setUrlDecodeHeaders((boolean) value); return true; - case "basicPropertyBinding": ((SparkComponent) component).setBasicPropertyBinding((boolean) value); return true; - case "matchOnUriPrefix": getOrCreateConfiguration((SparkComponent) component).setMatchOnUriPrefix((boolean) value); return true; - case "maxThreads": ((SparkComponent) component).setMaxThreads((int) value); return true; - case "minThreads": ((SparkComponent) component).setMinThreads((int) value); return true; - case "sparkBinding": ((SparkComponent) component).setSparkBinding((org.apache.camel.component.sparkrest.SparkBinding) value); return true; - case "sparkConfiguration": ((SparkComponent) component).setSparkConfiguration((org.apache.camel.component.sparkrest.SparkConfiguration) value); return true; - case "timeOutMillis": ((SparkComponent) component).setTimeOutMillis((int) value); return true; - case "keystoreFile": ((SparkComponent) component).setKeystoreFile((java.lang.String) value); return true; - case "keystorePassword": ((SparkComponent) component).setKeystorePassword((java.lang.String) value); return true; - case "truststoreFile": ((SparkComponent) component).setTruststoreFile((java.lang.String) value); return true; - case "truststorePassword": ((SparkComponent) component).setTruststorePassword((java.lang.String) value); return true; + case "bridgeErrorHandler": ((SparkRestComponent) component).setBridgeErrorHandler((boolean) value); return true; + case "disableStreamCache": getOrCreateConfiguration((SparkRestComponent) component).setDisableStreamCache((boolean) value); return true; + case "ipAddress": ((SparkRestComponent) component).setIpAddress((java.lang.String) value); return true; + case "mapHeaders": getOrCreateConfiguration((SparkRestComponent) component).setMapHeaders((boolean) value); return true; + case "port": ((SparkRestComponent) component).setPort((int) value); return true; + case "transferException": getOrCreateConfiguration((SparkRestComponent) component).setTransferException((boolean) value); return true; + case "urlDecodeHeaders": getOrCreateConfiguration((SparkRestComponent) component).setUrlDecodeHeaders((boolean) value); return true; + case "basicPropertyBinding": ((SparkRestComponent) component).setBasicPropertyBinding((boolean) value); return true; + case "matchOnUriPrefix": getOrCreateConfiguration((SparkRestComponent) component).setMatchOnUriPrefix((boolean) value); return true; + case "maxThreads": ((SparkRestComponent) component).setMaxThreads((int) value); return true; + case "minThreads": ((SparkRestComponent) component).setMinThreads((int) value); return true; + case "sparkBinding": ((SparkRestComponent) component).setSparkBinding((org.apache.camel.component.sparkrest.SparkBinding) value); return true; + case "sparkConfiguration": ((SparkRestComponent) component).setSparkConfiguration((org.apache.camel.component.sparkrest.SparkConfiguration) value); return true; + case "timeOutMillis": ((SparkRestComponent) component).setTimeOutMillis((int) value); return true; + case "keystoreFile": ((SparkRestComponent) component).setKeystoreFile((java.lang.String) value); return true; + case "keystorePassword": ((SparkRestComponent) component).setKeystorePassword((java.lang.String) value); return true; + case "truststoreFile": ((SparkRestComponent) component).setTruststoreFile((java.lang.String) value); return true; + case "truststorePassword": ((SparkRestComponent) component).setTruststorePassword((java.lang.String) value); return true; default: return false; } } diff --git a/core/camel-componentdsl/src/generated/resources/metadata.json b/core/camel-componentdsl/src/generated/resources/metadata.json index cbca26f..0c61454 100644 --- a/core/camel-componentdsl/src/generated/resources/metadata.json +++ b/core/camel-componentdsl/src/generated/resources/metadata.json @@ -6008,7 +6008,7 @@ "consumerOnly": true, "producerOnly": false, "lenientProperties": false, - "javaType": "org.apache.camel.component.sparkrest.SparkComponent", + "javaType": "org.apache.camel.component.sparkrest.SparkRestComponent", "firstVersion": "2.14.0", "groupId": "org.apache.camel", "artifactId": "camel-spark-rest", diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java index 79523d6..1b52ae1 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java @@ -308,6 +308,7 @@ public interface EndpointBuilderFactory org.apache.camel.builder.endpoint.dsl.SolrEndpointBuilderFactory.SolrBuilders, org.apache.camel.builder.endpoint.dsl.SoroushBotEndpointBuilderFactory.SoroushBotBuilders, org.apache.camel.builder.endpoint.dsl.SparkEndpointBuilderFactory.SparkBuilders, + org.apache.camel.builder.endpoint.dsl.SparkRestEndpointBuilderFactory.SparkRestBuilders, org.apache.camel.builder.endpoint.dsl.SplunkEndpointBuilderFactory.SplunkBuilders, org.apache.camel.builder.endpoint.dsl.SpringBatchEndpointBuilderFactory.SpringBatchBuilders, org.apache.camel.builder.endpoint.dsl.SpringIntegrationEndpointBuilderFactory.SpringIntegrationBuilders, diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java index f5b519f..23d192d 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java @@ -305,6 +305,7 @@ public interface EndpointBuilders org.apache.camel.builder.endpoint.dsl.SolrEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.SoroushBotEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.SparkEndpointBuilderFactory, + org.apache.camel.builder.endpoint.dsl.SparkRestEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.SplunkEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.SpringBatchEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.SpringIntegrationEndpointBuilderFactory, diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SparkRestEndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SparkRestEndpointBuilderFactory.java new file mode 100644 index 0000000..a60e999 --- /dev/null +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SparkRestEndpointBuilderFactory.java @@ -0,0 +1,468 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.builder.endpoint.dsl; + +import javax.annotation.Generated; +import org.apache.camel.ExchangePattern; +import org.apache.camel.builder.EndpointConsumerBuilder; +import org.apache.camel.builder.EndpointProducerBuilder; +import org.apache.camel.builder.endpoint.AbstractEndpointBuilder; +import org.apache.camel.spi.ExceptionHandler; + +/** + * The spark-rest component is used for hosting REST services which has been + * defined using Camel rest-dsl. + * + * Generated by camel build tools - do NOT edit this file! + */ +@Generated("org.apache.camel.maven.packaging.EndpointDslMojo") +public interface SparkRestEndpointBuilderFactory { + + + /** + * Builder for endpoint for the Spark Rest component. + */ + public interface SparkRestEndpointBuilder extends EndpointConsumerBuilder { + default AdvancedSparkRestEndpointBuilder advanced() { + return (AdvancedSparkRestEndpointBuilder) this; + } + /** + * Accept type such as: 'text/xml', or 'application/json'. By default we + * accept all kinds of types. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: consumer + */ + default SparkRestEndpointBuilder accept(String accept) { + doSetProperty("accept", accept); + return this; + } + /** + * Allows for bridging the consumer to the Camel routing Error Handler, + * which mean any exceptions occurred while the consumer is trying to + * pickup incoming messages, or the likes, will now be processed as a + * message and handled by the routing Error Handler. By default the + * 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 + */ + default SparkRestEndpointBuilder bridgeErrorHandler( + boolean bridgeErrorHandler) { + doSetProperty("bridgeErrorHandler", bridgeErrorHandler); + return this; + } + /** + * Allows for bridging the consumer to the Camel routing Error Handler, + * which mean any exceptions occurred while the consumer is trying to + * pickup incoming messages, or the likes, will now be processed as a + * message and handled by the routing Error Handler. By default the + * 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 + */ + default SparkRestEndpointBuilder bridgeErrorHandler( + String bridgeErrorHandler) { + doSetProperty("bridgeErrorHandler", bridgeErrorHandler); + return this; + } + /** + * Determines whether or not the raw input stream from Spark + * HttpRequest#getContent() is cached or not (Camel will read the stream + * into a in light-weight memory based Stream caching) cache. By default + * Camel will cache the Netty input stream to support reading it + * multiple times to ensure Camel can retrieve all data from the stream. + * However you can set this option to true when you for example need to + * access the raw stream, such as streaming it directly to a file or + * other persistent store. Mind that if you enable this option, then you + * cannot read the Netty stream multiple times out of the box, and you + * would need manually to reset the reader index on the Spark raw + * stream. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: consumer + */ + default SparkRestEndpointBuilder disableStreamCache( + boolean disableStreamCache) { + doSetProperty("disableStreamCache", disableStreamCache); + return this; + } + /** + * Determines whether or not the raw input stream from Spark + * HttpRequest#getContent() is cached or not (Camel will read the stream + * into a in light-weight memory based Stream caching) cache. By default + * Camel will cache the Netty input stream to support reading it + * multiple times to ensure Camel can retrieve all data from the stream. + * However you can set this option to true when you for example need to + * access the raw stream, such as streaming it directly to a file or + * other persistent store. Mind that if you enable this option, then you + * cannot read the Netty stream multiple times out of the box, and you + * would need manually to reset the reader index on the Spark raw + * stream. + * + * The option will be converted to a <code>boolean</code> type. + * + * Default: false + * Group: consumer + */ + default SparkRestEndpointBuilder disableStreamCache( + String disableStreamCache) { + doSetProperty("disableStreamCache", disableStreamCache); + return this; + } + /** + * If this option is enabled, then during binding from Spark to Camel + * Message then the headers will be mapped as well (eg added as header + * to the Camel Message as well). You can turn off this option to + * disable this. The headers can still be accessed from the + * org.apache.camel.component.sparkrest.SparkMessage message with the + * method getRequest() that returns the Spark HTTP request instance. + * + * The option is a: <code>boolean</code> type. + * + * Default: true + * Group: consumer + */ + default SparkRestEndpointBuilder mapHeaders(boolean mapHeaders) { + doSetProperty("mapHeaders", mapHeaders); + return this; + } + /** + * If this option is enabled, then during binding from Spark to Camel + * Message then the headers will be mapped as well (eg added as header + * to the Camel Message as well). You can turn off this option to + * disable this. The headers can still be accessed from the + * org.apache.camel.component.sparkrest.SparkMessage message with the + * method getRequest() that returns the Spark HTTP request instance. + * + * The option will be converted to a <code>boolean</code> type. + * + * Default: true + * Group: consumer + */ + default SparkRestEndpointBuilder mapHeaders(String mapHeaders) { + doSetProperty("mapHeaders", mapHeaders); + return this; + } + /** + * If enabled and an Exchange failed processing on the consumer side, + * and if the caused Exception was send back serialized in the response + * as a application/x-java-serialized-object content type. This is by + * default turned off. If you enable this then be aware that Java will + * deserialize the incoming data from the request to Java and that can + * be a potential security risk. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: consumer + */ + default SparkRestEndpointBuilder transferException( + boolean transferException) { + doSetProperty("transferException", transferException); + return this; + } + /** + * If enabled and an Exchange failed processing on the consumer side, + * and if the caused Exception was send back serialized in the response + * as a application/x-java-serialized-object content type. This is by + * default turned off. If you enable this then be aware that Java will + * deserialize the incoming data from the request to Java and that can + * be a potential security risk. + * + * The option will be converted to a <code>boolean</code> type. + * + * Default: false + * Group: consumer + */ + default SparkRestEndpointBuilder transferException( + String transferException) { + doSetProperty("transferException", transferException); + return this; + } + /** + * If this option is enabled, then during binding from Spark to Camel + * Message then the header values will be URL decoded (eg %20 will be a + * space character.). + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: consumer + */ + default SparkRestEndpointBuilder urlDecodeHeaders( + boolean urlDecodeHeaders) { + doSetProperty("urlDecodeHeaders", urlDecodeHeaders); + return this; + } + /** + * If this option is enabled, then during binding from Spark to Camel + * Message then the header values will be URL decoded (eg %20 will be a + * space character.). + * + * The option will be converted to a <code>boolean</code> type. + * + * Default: false + * Group: consumer + */ + default SparkRestEndpointBuilder urlDecodeHeaders( + String urlDecodeHeaders) { + doSetProperty("urlDecodeHeaders", urlDecodeHeaders); + return this; + } + } + + /** + * Advanced builder for endpoint for the Spark Rest component. + */ + public interface AdvancedSparkRestEndpointBuilder + extends + EndpointConsumerBuilder { + default SparkRestEndpointBuilder basic() { + return (SparkRestEndpointBuilder) this; + } + /** + * To let the consumer use a custom ExceptionHandler. Notice if the + * 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 AdvancedSparkRestEndpointBuilder exceptionHandler( + ExceptionHandler exceptionHandler) { + doSetProperty("exceptionHandler", exceptionHandler); + return this; + } + /** + * To let the consumer use a custom ExceptionHandler. Notice if the + * 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 AdvancedSparkRestEndpointBuilder exceptionHandler( + String exceptionHandler) { + doSetProperty("exceptionHandler", exceptionHandler); + return this; + } + /** + * 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 AdvancedSparkRestEndpointBuilder exchangePattern( + ExchangePattern exchangePattern) { + doSetProperty("exchangePattern", exchangePattern); + return this; + } + /** + * 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 AdvancedSparkRestEndpointBuilder exchangePattern( + String exchangePattern) { + doSetProperty("exchangePattern", exchangePattern); + return this; + } + /** + * 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 + */ + default AdvancedSparkRestEndpointBuilder basicPropertyBinding( + boolean basicPropertyBinding) { + doSetProperty("basicPropertyBinding", basicPropertyBinding); + return this; + } + /** + * 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 + */ + default AdvancedSparkRestEndpointBuilder basicPropertyBinding( + String basicPropertyBinding) { + doSetProperty("basicPropertyBinding", basicPropertyBinding); + return this; + } + /** + * Whether or not the consumer should try to find a target consumer by + * matching the URI prefix if no exact match is found. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: advanced + */ + default AdvancedSparkRestEndpointBuilder matchOnUriPrefix( + boolean matchOnUriPrefix) { + doSetProperty("matchOnUriPrefix", matchOnUriPrefix); + return this; + } + /** + * Whether or not the consumer should try to find a target consumer by + * matching the URI prefix if no exact match is found. + * + * The option will be converted to a <code>boolean</code> type. + * + * Default: false + * Group: advanced + */ + default AdvancedSparkRestEndpointBuilder matchOnUriPrefix( + String matchOnUriPrefix) { + doSetProperty("matchOnUriPrefix", matchOnUriPrefix); + return this; + } + /** + * To use a custom SparkBinding to map to/from Camel message. + * + * The option is a: + * <code>org.apache.camel.component.sparkrest.SparkBinding</code> type. + * + * Group: advanced + */ + default AdvancedSparkRestEndpointBuilder sparkBinding( + Object sparkBinding) { + doSetProperty("sparkBinding", sparkBinding); + return this; + } + /** + * To use a custom SparkBinding to map to/from Camel message. + * + * The option will be converted to a + * <code>org.apache.camel.component.sparkrest.SparkBinding</code> type. + * + * Group: advanced + */ + default AdvancedSparkRestEndpointBuilder sparkBinding( + String sparkBinding) { + doSetProperty("sparkBinding", sparkBinding); + return this; + } + /** + * 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 + */ + default AdvancedSparkRestEndpointBuilder synchronous(boolean synchronous) { + doSetProperty("synchronous", synchronous); + return this; + } + /** + * 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 + */ + default AdvancedSparkRestEndpointBuilder synchronous(String synchronous) { + doSetProperty("synchronous", synchronous); + return this; + } + } + + public interface SparkRestBuilders { + /** + * Spark Rest (camel-spark-rest) + * The spark-rest component is used for hosting REST services which has + * been defined using Camel rest-dsl. + * + * Category: rest + * Since: 2.14 + * Maven coordinates: org.apache.camel:camel-spark-rest + * + * Syntax: <code>spark-rest:verb:path</code> + * + * Path parameter: verb (required) + * get, post, put, patch, delete, head, trace, connect, or options. + * The value can be one of: get, post, put, patch, delete, head, trace, + * connect, options + * + * Path parameter: path (required) + * The content path which support Spark syntax. + */ + default SparkRestEndpointBuilder sparkRest(String path) { + return SparkRestEndpointBuilderFactory.sparkRest(path); + } + } + /** + * Spark Rest (camel-spark-rest) + * The spark-rest component is used for hosting REST services which has been + * defined using Camel rest-dsl. + * + * Category: rest + * Since: 2.14 + * Maven coordinates: org.apache.camel:camel-spark-rest + * + * Syntax: <code>spark-rest:verb:path</code> + * + * Path parameter: verb (required) + * get, post, put, patch, delete, head, trace, connect, or options. + * The value can be one of: get, post, put, patch, delete, head, trace, + * connect, options + * + * Path parameter: path (required) + * The content path which support Spark syntax. + */ + static SparkRestEndpointBuilder sparkRest(String path) { + class SparkRestEndpointBuilderImpl extends AbstractEndpointBuilder implements SparkRestEndpointBuilder, AdvancedSparkRestEndpointBuilder { + public SparkRestEndpointBuilderImpl(String path) { + super("spark-rest", path); + } + } + return new SparkRestEndpointBuilderImpl(path); + } +} \ No newline at end of file