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 1fadc4f CAMEL-15624 : Refactoring WordpressComponentConfiguration.java to WordpressConfiguration.java 1fadc4f is described below commit 1fadc4f3a8be5e375ca97ff86335cdcf85a55a4f Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sun Oct 4 09:14:17 2020 +0200 CAMEL-15624 : Refactoring WordpressComponentConfiguration.java to WordpressConfiguration.java --- .../apache/camel/catalog/components/wordpress.json | 34 ++++++++++---------- .../camel/catalog/docs/wordpress-component.adoc | 4 +-- .../wordpress/WordpressComponentConfigurer.java | 2 +- .../camel/component/wordpress/wordpress.json | 36 +++++++++++----------- .../src/main/docs/wordpress-component.adoc | 2 +- .../component/wordpress/WordpressComponent.java | 6 ++-- .../dsl/WordpressComponentBuilderFactory.java | 32 +++++++++---------- .../modules/ROOT/pages/wordpress-component.adoc | 4 +-- 8 files changed, 59 insertions(+), 61 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/wordpress.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/wordpress.json index be66671..e94c251 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/wordpress.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/wordpress.json @@ -22,30 +22,30 @@ "lenientProperties": false }, "componentProperties": { - "apiVersion": { "kind": "property", "displayName": "Api Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "2", "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "The Wordpress REST API version" }, - "criteria": { "kind": "property", "displayName": "Criteria", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "criteria.", "multiValue": true, "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "The criteria to use with complex searches." }, - "force": { "kind": "property", "displayName": "Force", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "Whether to bypass trash and force deletion." }, - "id": { "kind": "property", "displayName": "Id", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "The entity ID. Should be passed when the operation performed requires a specific entity, e.g. deleting a post" }, - "password": { "kind": "property", "displayName": "Password", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "Password from authorized user" }, - "searchCriteria": { "kind": "property", "displayName": "Search Criteria", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.wordpress.api.model.SearchCriteria", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "Search criteria" }, - "url": { "kind": "property", "displayName": "Url", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "The Wordpress API URL from your site, e.g. http:\/\/myblog.com\/wp-json\/" }, - "user": { "kind": "property", "displayName": "User", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "Authorized user to perform writing operations" }, + "apiVersion": { "kind": "property", "displayName": "Api Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "2", "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "The Wordpress REST API version" }, + "criteria": { "kind": "property", "displayName": "Criteria", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "criteria.", "multiValue": true, "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "The criteria to use with complex searches." }, + "force": { "kind": "property", "displayName": "Force", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "Whether to bypass trash and force deletion." }, + "id": { "kind": "property", "displayName": "Id", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "The entity ID. Should be passed when the operation performed requires a specific entity, e.g. deleting a post" }, + "password": { "kind": "property", "displayName": "Password", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "Password from authorized user" }, + "searchCriteria": { "kind": "property", "displayName": "Search Criteria", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.wordpress.api.model.SearchCriteria", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "Search criteria" }, + "url": { "kind": "property", "displayName": "Url", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "The Wordpress API URL from your site, e.g. http:\/\/myblog.com\/wp-json\/" }, + "user": { "kind": "property", "displayName": "User", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "Authorized user to perform writing operations" }, "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "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 [...] "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the r [...] "basicPropertyBinding": { "kind": "property", "displayName": "Basic Property Binding", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": true, "secret": false, "defaultValue": false, "description": "Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities" }, - "configuration": { "kind": "property", "displayName": "Configuration", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "deprecated": false, "secret": false, "description": "Wordpress component configuration" } + "configuration": { "kind": "property", "displayName": "Configuration", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.wordpress.WordpressConfiguration", "deprecated": false, "secret": false, "description": "Wordpress component configuration" } }, "properties": { "operation": { "kind": "path", "displayName": "Operation", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "enum": [ "post", "user" ], "deprecated": false, "deprecationNote": "", "secret": false, "description": "The endpoint operation." }, "operationDetail": { "kind": "path", "displayName": "Operation Detail", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "enum": [ "delete" ], "deprecated": false, "secret": false, "description": "The second part of an endpoint operation. Needed only when endpoint semantic is not enough, like wordpress:post:delete" }, - "apiVersion": { "kind": "parameter", "displayName": "Api Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "2", "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "The Wordpress REST API version" }, - "criteria": { "kind": "parameter", "displayName": "Criteria", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "criteria.", "multiValue": true, "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "The criteria to use with complex searches." }, - "force": { "kind": "parameter", "displayName": "Force", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "Whether to bypass trash and force deletion." }, - "id": { "kind": "parameter", "displayName": "Id", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "The entity ID. Should be passed when the operation performed requires a specific entity, e.g. deleting a post" }, - "password": { "kind": "parameter", "displayName": "Password", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "Password from authorized user" }, - "searchCriteria": { "kind": "parameter", "displayName": "Search Criteria", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.wordpress.api.model.SearchCriteria", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "Search criteria" }, - "url": { "kind": "parameter", "displayName": "Url", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "The Wordpress API URL from your site, e.g. http:\/\/myblog.com\/wp-json\/" }, - "user": { "kind": "parameter", "displayName": "User", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "Authorized user to perform writing operations" }, + "apiVersion": { "kind": "parameter", "displayName": "Api Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "2", "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "The Wordpress REST API version" }, + "criteria": { "kind": "parameter", "displayName": "Criteria", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "criteria.", "multiValue": true, "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "The criteria to use with complex searches." }, + "force": { "kind": "parameter", "displayName": "Force", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "Whether to bypass trash and force deletion." }, + "id": { "kind": "parameter", "displayName": "Id", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "The entity ID. Should be passed when the operation performed requires a specific entity, e.g. deleting a post" }, + "password": { "kind": "parameter", "displayName": "Password", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "Password from authorized user" }, + "searchCriteria": { "kind": "parameter", "displayName": "Search Criteria", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.wordpress.api.model.SearchCriteria", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "Search criteria" }, + "url": { "kind": "parameter", "displayName": "Url", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "The Wordpress API URL from your site, e.g. http:\/\/myblog.com\/wp-json\/" }, + "user": { "kind": "parameter", "displayName": "User", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "Authorized user to perform writing operations" }, "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "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 b [...] "exceptionHandler": { "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "secret": false, "description": "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 [...] "exchangePattern": { "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut", "InOptionalOut" ], "deprecated": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/wordpress-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/wordpress-component.adoc index 15cb2c5..98b0ae7 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/wordpress-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/wordpress-component.adoc @@ -27,6 +27,7 @@ The Wordpress component supports 12 options, which are listed below. |=== | Name | Description | Default | Type | *apiVersion* (common) | The Wordpress REST API version | 2 | String +| *configuration* (common) | Wordpress configuration | | WordpressConfiguration | *criteria* (common) | The criteria to use with complex searches. | | Map | *force* (common) | Whether to bypass trash and force deletion. | false | boolean | *id* (common) | The entity ID. Should be passed when the operation performed requires a specific entity, e.g. deleting a post | | Integer @@ -37,7 +38,6 @@ The Wordpress component supports 12 options, which are listed below. | *bridgeErrorHandler* (consumer) | 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. | false | boolean | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] | *basicPropertyBinding* (advanced) | *Deprecated* Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean -| *configuration* (advanced) | Wordpress component configuration | | WordpressComponentConfiguration |=== // component options: END @@ -100,7 +100,7 @@ The `WordpressConfiguration` class can be used to set initial properties configu ---- public void configure() { final WordpressConfiguration configuration = new WordpressConfiguration(); - final WordpressComponentConfiguration component = new WordpressComponentConfiguration(); + final WordpressComponent component = new WordpressComponent(); configuration.setApiVersion("2"); configuration.setUrl("http://yoursite.com/wp-json/"); component.setConfiguration(configuration); diff --git a/components/camel-wordpress/src/generated/java/org/apache/camel/component/wordpress/WordpressComponentConfigurer.java b/components/camel-wordpress/src/generated/java/org/apache/camel/component/wordpress/WordpressComponentConfigurer.java index af7ce7a..35d0e97 100644 --- a/components/camel-wordpress/src/generated/java/org/apache/camel/component/wordpress/WordpressComponentConfigurer.java +++ b/components/camel-wordpress/src/generated/java/org/apache/camel/component/wordpress/WordpressComponentConfigurer.java @@ -19,6 +19,7 @@ public class WordpressComponentConfigurer extends PropertyConfigurerSupport impl static { Map<String, Object> map = new CaseInsensitiveMap(); map.put("apiVersion", java.lang.String.class); + map.put("configuration", org.apache.camel.component.wordpress.WordpressConfiguration.class); map.put("criteria", java.util.Map.class); map.put("force", boolean.class); map.put("id", java.lang.Integer.class); @@ -29,7 +30,6 @@ public class WordpressComponentConfigurer extends PropertyConfigurerSupport impl map.put("bridgeErrorHandler", boolean.class); map.put("lazyStartProducer", boolean.class); map.put("basicPropertyBinding", boolean.class); - map.put("configuration", org.apache.camel.component.wordpress.WordpressConfiguration.class); ALL_OPTIONS = map; } diff --git a/components/camel-wordpress/src/generated/resources/org/apache/camel/component/wordpress/wordpress.json b/components/camel-wordpress/src/generated/resources/org/apache/camel/component/wordpress/wordpress.json index be66671..45a5201 100644 --- a/components/camel-wordpress/src/generated/resources/org/apache/camel/component/wordpress/wordpress.json +++ b/components/camel-wordpress/src/generated/resources/org/apache/camel/component/wordpress/wordpress.json @@ -22,30 +22,30 @@ "lenientProperties": false }, "componentProperties": { - "apiVersion": { "kind": "property", "displayName": "Api Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "2", "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "The Wordpress REST API version" }, - "criteria": { "kind": "property", "displayName": "Criteria", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "criteria.", "multiValue": true, "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "The criteria to use with complex searches." }, - "force": { "kind": "property", "displayName": "Force", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "Whether to bypass trash and force deletion." }, - "id": { "kind": "property", "displayName": "Id", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "The entity ID. Should be passed when the operation performed requires a specific entity, e.g. deleting a post" }, - "password": { "kind": "property", "displayName": "Password", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "Password from authorized user" }, - "searchCriteria": { "kind": "property", "displayName": "Search Criteria", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.wordpress.api.model.SearchCriteria", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "Search criteria" }, - "url": { "kind": "property", "displayName": "Url", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "The Wordpress API URL from your site, e.g. http:\/\/myblog.com\/wp-json\/" }, - "user": { "kind": "property", "displayName": "User", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "Authorized user to perform writing operations" }, + "apiVersion": { "kind": "property", "displayName": "Api Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "2", "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "The Wordpress REST API version" }, + "configuration": { "kind": "property", "displayName": "Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.wordpress.WordpressConfiguration", "deprecated": false, "secret": false, "description": "Wordpress configuration" }, + "criteria": { "kind": "property", "displayName": "Criteria", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "criteria.", "multiValue": true, "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "The criteria to use with complex searches." }, + "force": { "kind": "property", "displayName": "Force", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "Whether to bypass trash and force deletion." }, + "id": { "kind": "property", "displayName": "Id", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "The entity ID. Should be passed when the operation performed requires a specific entity, e.g. deleting a post" }, + "password": { "kind": "property", "displayName": "Password", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "Password from authorized user" }, + "searchCriteria": { "kind": "property", "displayName": "Search Criteria", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.wordpress.api.model.SearchCriteria", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "Search criteria" }, + "url": { "kind": "property", "displayName": "Url", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "The Wordpress API URL from your site, e.g. http:\/\/myblog.com\/wp-json\/" }, + "user": { "kind": "property", "displayName": "User", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "Authorized user to perform writing operations" }, "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "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 [...] "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the r [...] - "basicPropertyBinding": { "kind": "property", "displayName": "Basic Property Binding", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": true, "secret": false, "defaultValue": false, "description": "Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities" }, - "configuration": { "kind": "property", "displayName": "Configuration", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "deprecated": false, "secret": false, "description": "Wordpress component configuration" } + "basicPropertyBinding": { "kind": "property", "displayName": "Basic Property Binding", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": true, "secret": false, "defaultValue": false, "description": "Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities" } }, "properties": { "operation": { "kind": "path", "displayName": "Operation", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "enum": [ "post", "user" ], "deprecated": false, "deprecationNote": "", "secret": false, "description": "The endpoint operation." }, "operationDetail": { "kind": "path", "displayName": "Operation Detail", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "enum": [ "delete" ], "deprecated": false, "secret": false, "description": "The second part of an endpoint operation. Needed only when endpoint semantic is not enough, like wordpress:post:delete" }, - "apiVersion": { "kind": "parameter", "displayName": "Api Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "2", "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "The Wordpress REST API version" }, - "criteria": { "kind": "parameter", "displayName": "Criteria", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "criteria.", "multiValue": true, "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "The criteria to use with complex searches." }, - "force": { "kind": "parameter", "displayName": "Force", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "Whether to bypass trash and force deletion." }, - "id": { "kind": "parameter", "displayName": "Id", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "The entity ID. Should be passed when the operation performed requires a specific entity, e.g. deleting a post" }, - "password": { "kind": "parameter", "displayName": "Password", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "Password from authorized user" }, - "searchCriteria": { "kind": "parameter", "displayName": "Search Criteria", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.wordpress.api.model.SearchCriteria", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "Search criteria" }, - "url": { "kind": "parameter", "displayName": "Url", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "The Wordpress API URL from your site, e.g. http:\/\/myblog.com\/wp-json\/" }, - "user": { "kind": "parameter", "displayName": "User", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressComponentConfiguration", "configurationField": "configuration", "description": "Authorized user to perform writing operations" }, + "apiVersion": { "kind": "parameter", "displayName": "Api Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "2", "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "The Wordpress REST API version" }, + "criteria": { "kind": "parameter", "displayName": "Criteria", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "criteria.", "multiValue": true, "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "The criteria to use with complex searches." }, + "force": { "kind": "parameter", "displayName": "Force", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "Whether to bypass trash and force deletion." }, + "id": { "kind": "parameter", "displayName": "Id", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "The entity ID. Should be passed when the operation performed requires a specific entity, e.g. deleting a post" }, + "password": { "kind": "parameter", "displayName": "Password", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "Password from authorized user" }, + "searchCriteria": { "kind": "parameter", "displayName": "Search Criteria", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.wordpress.api.model.SearchCriteria", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "Search criteria" }, + "url": { "kind": "parameter", "displayName": "Url", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "The Wordpress API URL from your site, e.g. http:\/\/myblog.com\/wp-json\/" }, + "user": { "kind": "parameter", "displayName": "User", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.wordpress.WordpressConfiguration", "configurationField": "configuration", "description": "Authorized user to perform writing operations" }, "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "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 b [...] "exceptionHandler": { "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "secret": false, "description": "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 [...] "exchangePattern": { "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut", "InOptionalOut" ], "deprecated": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, diff --git a/components/camel-wordpress/src/main/docs/wordpress-component.adoc b/components/camel-wordpress/src/main/docs/wordpress-component.adoc index 1f8ecc3..98b0ae7 100644 --- a/components/camel-wordpress/src/main/docs/wordpress-component.adoc +++ b/components/camel-wordpress/src/main/docs/wordpress-component.adoc @@ -27,6 +27,7 @@ The Wordpress component supports 12 options, which are listed below. |=== | Name | Description | Default | Type | *apiVersion* (common) | The Wordpress REST API version | 2 | String +| *configuration* (common) | Wordpress configuration | | WordpressConfiguration | *criteria* (common) | The criteria to use with complex searches. | | Map | *force* (common) | Whether to bypass trash and force deletion. | false | boolean | *id* (common) | The entity ID. Should be passed when the operation performed requires a specific entity, e.g. deleting a post | | Integer @@ -37,7 +38,6 @@ The Wordpress component supports 12 options, which are listed below. | *bridgeErrorHandler* (consumer) | 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. | false | boolean | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] | *basicPropertyBinding* (advanced) | *Deprecated* Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean -| *configuration* (advanced) | Wordpress component configuration | | WordpressConfiguration |=== // component options: END diff --git a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressComponent.java b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressComponent.java index ad1bda3..84ae781 100644 --- a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressComponent.java +++ b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressComponent.java @@ -27,15 +27,12 @@ import org.apache.camel.spi.Metadata; import org.apache.camel.spi.annotations.Component; import org.apache.camel.support.DefaultComponent; -/** - * Represents the component that manages {@link WordpressEndpoint}. - */ @Component("wordpress") public class WordpressComponent extends DefaultComponent { private static final String OP_SEPARATOR = ":"; - @Metadata(label = "advanced", description = "Wordpress component configuration") + @Metadata(description = "Wordpress configuration") private WordpressConfiguration configuration; public WordpressComponent() { @@ -62,6 +59,7 @@ public class WordpressComponent extends DefaultComponent { @Override protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { if (configuration != null) { + // TODO: Better to make WordpressConfiguration cloneable Map<String, Object> properties = new HashMap<>(); BeanIntrospection beanIntrospection = getCamelContext().adapt(ExtendedCamelContext.class).getBeanIntrospection(); beanIntrospection.getProperties(configuration, properties, null, false); diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/WordpressComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/WordpressComponentBuilderFactory.java index af6df04..8c2d196 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/WordpressComponentBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/WordpressComponentBuilderFactory.java @@ -61,6 +61,19 @@ public interface WordpressComponentBuilderFactory { return this; } /** + * Wordpress configuration. + * + * The option is a: + * <code>org.apache.camel.component.wordpress.WordpressConfiguration</code> type. + * + * Group: common + */ + default WordpressComponentBuilder configuration( + org.apache.camel.component.wordpress.WordpressConfiguration configuration) { + doSetProperty("configuration", configuration); + return this; + } + /** * The criteria to use with complex searches. * * The option is a: <code>java.util.Map<java.lang.String, @@ -199,19 +212,6 @@ public interface WordpressComponentBuilderFactory { doSetProperty("basicPropertyBinding", basicPropertyBinding); return this; } - /** - * Wordpress component configuration. - * - * The option is a: - * <code>org.apache.camel.component.wordpress.WordpressComponentConfiguration</code> type. - * - * Group: advanced - */ - default WordpressComponentBuilder configuration( - org.apache.camel.component.wordpress.WordpressComponentConfiguration configuration) { - doSetProperty("configuration", configuration); - return this; - } } class WordpressComponentBuilderImpl @@ -223,10 +223,10 @@ public interface WordpressComponentBuilderFactory { protected WordpressComponent buildConcreteComponent() { return new WordpressComponent(); } - private org.apache.camel.component.wordpress.WordpressComponentConfiguration getOrCreateConfiguration( + private org.apache.camel.component.wordpress.WordpressConfiguration getOrCreateConfiguration( org.apache.camel.component.wordpress.WordpressComponent component) { if (component.getConfiguration() == null) { - component.setConfiguration(new org.apache.camel.component.wordpress.WordpressComponentConfiguration()); + component.setConfiguration(new org.apache.camel.component.wordpress.WordpressConfiguration()); } return component.getConfiguration(); } @@ -237,6 +237,7 @@ public interface WordpressComponentBuilderFactory { Object value) { switch (name) { case "apiVersion": getOrCreateConfiguration((WordpressComponent) component).setApiVersion((java.lang.String) value); return true; + case "configuration": ((WordpressComponent) component).setConfiguration((org.apache.camel.component.wordpress.WordpressConfiguration) value); return true; case "criteria": getOrCreateConfiguration((WordpressComponent) component).setCriteria((java.util.Map) value); return true; case "force": getOrCreateConfiguration((WordpressComponent) component).setForce((boolean) value); return true; case "id": getOrCreateConfiguration((WordpressComponent) component).setId((java.lang.Integer) value); return true; @@ -247,7 +248,6 @@ public interface WordpressComponentBuilderFactory { case "bridgeErrorHandler": ((WordpressComponent) component).setBridgeErrorHandler((boolean) value); return true; case "lazyStartProducer": ((WordpressComponent) component).setLazyStartProducer((boolean) value); return true; case "basicPropertyBinding": ((WordpressComponent) component).setBasicPropertyBinding((boolean) value); return true; - case "configuration": ((WordpressComponent) component).setConfiguration((org.apache.camel.component.wordpress.WordpressComponentConfiguration) value); return true; default: return false; } } diff --git a/docs/components/modules/ROOT/pages/wordpress-component.adoc b/docs/components/modules/ROOT/pages/wordpress-component.adoc index 32793b2..1955e5d 100644 --- a/docs/components/modules/ROOT/pages/wordpress-component.adoc +++ b/docs/components/modules/ROOT/pages/wordpress-component.adoc @@ -29,6 +29,7 @@ The Wordpress component supports 12 options, which are listed below. |=== | Name | Description | Default | Type | *apiVersion* (common) | The Wordpress REST API version | 2 | String +| *configuration* (common) | Wordpress configuration | | WordpressConfiguration | *criteria* (common) | The criteria to use with complex searches. | | Map | *force* (common) | Whether to bypass trash and force deletion. | false | boolean | *id* (common) | The entity ID. Should be passed when the operation performed requires a specific entity, e.g. deleting a post | | Integer @@ -39,7 +40,6 @@ The Wordpress component supports 12 options, which are listed below. | *bridgeErrorHandler* (consumer) | 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. | false | boolean | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] | *basicPropertyBinding* (advanced) | *Deprecated* Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean -| *configuration* (advanced) | Wordpress component configuration | | WordpressComponentConfiguration |=== // component options: END @@ -102,7 +102,7 @@ The `WordpressConfiguration` class can be used to set initial properties configu ---- public void configure() { final WordpressConfiguration configuration = new WordpressConfiguration(); - final WordpressComponentConfiguration component = new WordpressComponentConfiguration(); + final WordpressComponent component = new WordpressComponent(); configuration.setApiVersion("2"); configuration.setUrl("http://yoursite.com/wp-json/"); component.setConfiguration(configuration);