Repository: camel Updated Branches: refs/heads/master d4fd3b7df -> 22383f498
Fixed some minor component docs issues Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/22383f49 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/22383f49 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/22383f49 Branch: refs/heads/master Commit: 22383f49842887bde1a68f6d34d1480f2fe6510a Parents: d4fd3b7 Author: Claus Ibsen <davscl...@apache.org> Authored: Fri Sep 8 14:38:17 2017 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Fri Sep 8 14:40:15 2017 +0200 ---------------------------------------------------------------------- .../src/main/docs/direct-vm-component.adoc | 2 +- .../src/main/docs/properties-component.adoc | 14 ++++++------- camel-core/src/main/docs/xslt-component.adoc | 10 +++++----- .../component/directvm/DirectVmComponent.java | 1 + .../properties/PropertiesComponent.java | 16 +++++++++------ .../camel/component/seda/SedaComponent.java | 10 ++++++---- .../component/validator/ValidatorComponent.java | 21 +++++++++++--------- .../camel/component/xslt/XsltComponent.java | 20 +++++++------------ .../springboot/XsltComponentConfiguration.java | 20 ++++++++----------- .../tools/apt/EndpointAnnotationProcessor.java | 5 +++++ .../java/org/apache/camel/spi/Metadata.java | 7 +++++++ 11 files changed, 69 insertions(+), 57 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/22383f49/camel-core/src/main/docs/direct-vm-component.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/direct-vm-component.adoc b/camel-core/src/main/docs/direct-vm-component.adoc index 62a5231..b06f8e0 100644 --- a/camel-core/src/main/docs/direct-vm-component.adoc +++ b/camel-core/src/main/docs/direct-vm-component.adoc @@ -49,7 +49,7 @@ The Direct VM component supports 5 options which are listed below. | Name | Description | Default | Type | **block** (producer) | If sending a message to a direct endpoint which has no active consumer then we can tell the producer to block and wait for the consumer to become active. | false | boolean | **timeout** (producer) | The timeout value to use if block is enabled. | 30000 | long -| **headerFilterStrategy** (common) | Sets a HeaderFilterStrategy that will only be applied on producer endpoints (on both directions: request and response). Default value: none. | | HeaderFilterStrategy +| **headerFilterStrategy** (advanced) | Sets a HeaderFilterStrategy that will only be applied on producer endpoints (on both directions: request and response). Default value: none. | | HeaderFilterStrategy | **propagateProperties** (advanced) | Whether to propagate or not properties from the producer side to the consumer side and vice versa. Default value: true. | true | boolean | **resolveProperty Placeholders** (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean |======================================================================= http://git-wip-us.apache.org/repos/asf/camel/blob/22383f49/camel-core/src/main/docs/properties-component.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/properties-component.adoc b/camel-core/src/main/docs/properties-component.adoc index a43b18b..bbd7768 100644 --- a/camel-core/src/main/docs/properties-component.adoc +++ b/camel-core/src/main/docs/properties-component.adoc @@ -27,15 +27,15 @@ The Properties component supports 17 options which are listed below. | **propertiesResolver** (common) | To use a custom PropertiesResolver | | PropertiesResolver | **propertiesParser** (common) | To use a custom PropertiesParser | | PropertiesParser | **cache** (common) | Whether or not to cache loaded properties. The default value is true. | true | boolean -| **propertyPrefix** (common) | Optional prefix prepended to property names before resolution. | | String -| **propertySuffix** (common) | Optional suffix appended to property names before resolution. | | String -| **fallbackToUnaugmented Property** (common) | If true first attempt resolution of property name augmented with propertyPrefix and propertySuffix before falling back the plain property name specified. If false only the augmented property name is searched. | true | boolean +| **propertyPrefix** (advanced) | Optional prefix prepended to property names before resolution. | | String +| **propertySuffix** (advanced) | Optional suffix appended to property names before resolution. | | String +| **fallbackToUnaugmented Property** (advanced) | If true first attempt resolution of property name augmented with propertyPrefix and propertySuffix before falling back the plain property name specified. If false only the augmented property name is searched. | true | boolean | **defaultFallbackEnabled** (common) | If false the component does not attempt to find a default for the key by looking after the colon separator. | true | boolean | **ignoreMissingLocation** (common) | Whether to silently ignore if a location cannot be located such as a properties file not found. | false | boolean -| **prefixToken** (common) | Sets the value of the prefix token used to identify properties to replace. Setting a value of null restores the default token (link link DEFAULT_PREFIX_TOKEN). | {{ | String -| **suffixToken** (common) | Sets the value of the suffix token used to identify properties to replace. Setting a value of null restores the default token (link link DEFAULT_SUFFIX_TOKEN). | }} | String -| **initialProperties** (common) | Sets initial properties which will be used before any locations are resolved. | | Properties -| **overrideProperties** (common) | Sets a special list of override properties that take precedence and will use first if a property exist. | | Properties +| **prefixToken** (advanced) | Sets the value of the prefix token used to identify properties to replace. Setting a value of null restores the default token (link link DEFAULT_PREFIX_TOKEN). | {{ | String +| **suffixToken** (advanced) | Sets the value of the suffix token used to identify properties to replace. Setting a value of null restores the default token (link link DEFAULT_SUFFIX_TOKEN). | }} | String +| **initialProperties** (advanced) | Sets initial properties which will be used before any locations are resolved. | | Properties +| **overrideProperties** (advanced) | Sets a special list of override properties that take precedence and will use first if a property exist. | | Properties | **systemPropertiesMode** (common) | Sets the system property mode. | 2 | int | **resolveProperty Placeholders** (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean |======================================================================= http://git-wip-us.apache.org/repos/asf/camel/blob/22383f49/camel-core/src/main/docs/xslt-component.adoc ---------------------------------------------------------------------- diff --git a/camel-core/src/main/docs/xslt-component.adoc b/camel-core/src/main/docs/xslt-component.adoc index 59dec74..37fcb01 100644 --- a/camel-core/src/main/docs/xslt-component.adoc +++ b/camel-core/src/main/docs/xslt-component.adoc @@ -75,12 +75,12 @@ The XSLT component supports 9 options which are listed below. |======================================================================= | Name | Description | Default | Type | **xmlConverter** (advanced) | To use a custom implementation of org.apache.camel.converter.jaxp.XmlConverter | | XmlConverter -| **uriResolverFactory** (advanced) | To use a custom javax.xml.transform.URIResolver which depends on a dynamic endpoint resource URI or which is a subclass of XsltUriResolver. Do not use in combination with uriResolver. See also link setUriResolver(URIResolver). | | XsltUriResolverFactory -| **uriResolver** (advanced) | To use a custom javax.xml.transform.URIResolver. Do not use in combination with uriResolverFactory. See also link setUriResolverFactory(XsltUriResolverFactory). | | URIResolver -| **contentCache** (producer) | Cache for the resource content (the stylesheet file) when it is loaded. If set to false Camel will reload the stylesheet file on each message processing. This is good for development. A cached stylesheet can be forced to reload at runtime via JMX using the clearCachedStylesheet operation. | false | boolean +| **uriResolverFactory** (advanced) | To use a custom UriResolver which depends on a dynamic endpoint resource URI. Should not be used together with the option 'uriResolver'. | | XsltUriResolverFactory +| **uriResolver** (advanced) | To use a custom UriResolver. Should not be used together with the option 'uriResolverFactory'. | | URIResolver +| **contentCache** (producer) | Cache for the resource content (the stylesheet file) when it is loaded. If set to false Camel will reload the stylesheet file on each message processing. This is good for development. A cached stylesheet can be forced to reload at runtime via JMX using the clearCachedStylesheet operation. | true | boolean | **saxon** (producer) | Whether to use Saxon as the transformerFactoryClass. If enabled then the class net.sf.saxon.TransformerFactoryImpl. You would need to add Saxon to the classpath. | false | boolean -| **saxonExtensionFunctions** (producer) | Allows you to use a custom net.sf.saxon.lib.ExtensionFunctionDefinition. You would need to add camel-saxon to the classpath. The function is looked up in the registry where you can comma to separate multiple values to lookup. | | List -| **saxonConfiguration** (producer) | To use a custom Saxon configuration | true | Object +| **saxonExtensionFunctions** (advanced) | Allows you to use a custom net.sf.saxon.lib.ExtensionFunctionDefinition. You would need to add camel-saxon to the classpath. The function is looked up in the registry where you can comma to separate multiple values to lookup. | | String +| **saxonConfiguration** (advanced) | To use a custom Saxon configuration | | Object | **saxonConfiguration Properties** (advanced) | To set custom Saxon configuration properties | | Map | **resolveProperty Placeholders** (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean |======================================================================= http://git-wip-us.apache.org/repos/asf/camel/blob/22383f49/camel-core/src/main/java/org/apache/camel/component/directvm/DirectVmComponent.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/component/directvm/DirectVmComponent.java b/camel-core/src/main/java/org/apache/camel/component/directvm/DirectVmComponent.java index 9404f0f..26ecca8 100644 --- a/camel-core/src/main/java/org/apache/camel/component/directvm/DirectVmComponent.java +++ b/camel-core/src/main/java/org/apache/camel/component/directvm/DirectVmComponent.java @@ -43,6 +43,7 @@ public class DirectVmComponent extends UriEndpointComponent { private boolean block; @Metadata(label = "producer", defaultValue = "30000") private long timeout = 30000L; + @Metadata(label = "advanced") private HeaderFilterStrategy headerFilterStrategy; @Metadata(label = "advanced", defaultValue = "true") private boolean propagateProperties = true; http://git-wip-us.apache.org/repos/asf/camel/blob/22383f49/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java b/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java index 82ef4c9..f6cf803 100644 --- a/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java +++ b/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java @@ -102,21 +102,25 @@ public class PropertiesComponent extends UriEndpointComponent { private String encoding; @Metadata(defaultValue = "true") private boolean cache = true; + @Metadata(label = "advanced") private String propertyPrefix; - private String propertyPrefixResolved; + private transient String propertyPrefixResolved; + @Metadata(label = "advanced") private String propertySuffix; - private String propertySuffixResolved; - @Metadata(defaultValue = "true") + private transient String propertySuffixResolved; + @Metadata(label = "advanced", defaultValue = "true") private boolean fallbackToUnaugmentedProperty = true; @Metadata(defaultValue = "true") private boolean defaultFallbackEnabled = true; - @Metadata(defaultValue = DEFAULT_PREFIX_TOKEN) + @Metadata(label = "advanced", defaultValue = DEFAULT_PREFIX_TOKEN) private String prefixToken = DEFAULT_PREFIX_TOKEN; - @Metadata(defaultValue = DEFAULT_SUFFIX_TOKEN) + @Metadata(label = "advanced", defaultValue = DEFAULT_SUFFIX_TOKEN) private String suffixToken = DEFAULT_SUFFIX_TOKEN; + @Metadata(label = "advanced") private Properties initialProperties; + @Metadata(label = "advanced") private Properties overrideProperties; - @Metadata(defaultValue = "" + SYSTEM_PROPERTIES_MODE_OVERRIDE) + @Metadata(defaultValue = "" + SYSTEM_PROPERTIES_MODE_OVERRIDE, enums = "0,1,2") private int systemPropertiesMode = SYSTEM_PROPERTIES_MODE_OVERRIDE; public PropertiesComponent() { http://git-wip-us.apache.org/repos/asf/camel/blob/22383f49/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java b/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java index b968119..1dc1cae 100644 --- a/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java +++ b/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java @@ -36,13 +36,15 @@ import org.slf4j.LoggerFactory; public class SedaComponent extends UriEndpointComponent { protected final Logger log = LoggerFactory.getLogger(getClass()); protected final int maxConcurrentConsumers = 500; - @Metadata(label = "advanced") - protected int queueSize; + @Metadata(label = "consumer", defaultValue = "1") protected int concurrentConsumers = 1; - private final Map<String, QueueReference> queues = new HashMap<String, QueueReference>(); @Metadata(label = "advanced") - private BlockingQueueFactory<Exchange> defaultQueueFactory = new LinkedBlockingQueueFactory<Exchange>(); + protected int queueSize; + @Metadata(label = "advanced") + protected BlockingQueueFactory<Exchange> defaultQueueFactory = new LinkedBlockingQueueFactory<Exchange>(); + + private final Map<String, QueueReference> queues = new HashMap<String, QueueReference>(); public SedaComponent() { super(SedaEndpoint.class); http://git-wip-us.apache.org/repos/asf/camel/blob/22383f49/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorComponent.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorComponent.java b/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorComponent.java index 6756530..fdc5cde 100644 --- a/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorComponent.java +++ b/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorComponent.java @@ -29,7 +29,7 @@ import org.apache.camel.spi.Metadata; */ public class ValidatorComponent extends UriEndpointComponent { - @Metadata(label = "advanced", description = "To use a custom LSResourceResolver which depends on a dynamic endpoint resource URI") + @Metadata(label = "advanced") private ValidatorResourceResolverFactory resourceResolverFactory; public ValidatorComponent() { @@ -40,14 +40,6 @@ public class ValidatorComponent extends UriEndpointComponent { super(endpointClass); } - public ValidatorResourceResolverFactory getResourceResolverFactory() { - return resourceResolverFactory; - } - - public void setResourceResolverFactory(ValidatorResourceResolverFactory resourceResolverFactory) { - this.resourceResolverFactory = resourceResolverFactory; - } - protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { ValidatorEndpoint endpoint = new ValidatorEndpoint(uri, this, remaining); // lookup custom resolver to use @@ -65,4 +57,15 @@ public class ValidatorComponent extends UriEndpointComponent { return endpoint; } + public ValidatorResourceResolverFactory getResourceResolverFactory() { + return resourceResolverFactory; + } + + /** + * To use a custom LSResourceResolver which depends on a dynamic endpoint resource URI + */ + public void setResourceResolverFactory(ValidatorResourceResolverFactory resourceResolverFactory) { + this.resourceResolverFactory = resourceResolverFactory; + } + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/22383f49/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java index 846c1fd..433f04a 100644 --- a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java +++ b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java @@ -26,7 +26,6 @@ import org.apache.camel.builder.xml.XsltUriResolver; import org.apache.camel.converter.jaxp.XmlConverter; import org.apache.camel.impl.UriEndpointComponent; import org.apache.camel.spi.Metadata; -import org.apache.camel.spi.UriParam; import org.apache.camel.util.EndpointHelper; import org.apache.camel.util.ResourceHelper; import org.slf4j.Logger; @@ -41,17 +40,17 @@ public class XsltComponent extends UriEndpointComponent { @Metadata(label = "advanced") private XmlConverter xmlConverter; - @Metadata(label = "advanced", description = "To use a custom UriResolver. Should not be used together with the option 'uriResolverFactory'.") + @Metadata(label = "advanced") private URIResolver uriResolver; - @Metadata(label = "advanced", description = "To use a custom UriResolver which depends on a dynamic endpoint resource URI. Should not be used together with the option 'uriResolver'.") + @Metadata(label = "advanced") private XsltUriResolverFactory uriResolverFactory; - @Metadata(defaultValue = "true") - @UriParam(label = "advanced") + @Metadata(label = "advanced") private Object saxonConfiguration; @Metadata(label = "advanced") private Map<String, Object> saxonConfigurationProperties = new HashMap<>(); - @UriParam(label = "advanced", javaType = "java.lang.String") + @Metadata(label = "advanced", javaType = "java.lang.String") private List<Object> saxonExtensionFunctions; + @Metadata(defaultValue = "true") private boolean contentCache = true; private boolean saxon; @@ -69,17 +68,13 @@ public class XsltComponent extends UriEndpointComponent { public void setXmlConverter(XmlConverter xmlConverter) { this.xmlConverter = xmlConverter; } - - public XsltUriResolverFactory getUriResolverFactory() { return uriResolverFactory; } /** - * To use a custom javax.xml.transform.URIResolver which depends on a dynamic endpoint resource URI or which is a subclass of {@link XsltUriResolver}. - * Do not use in combination with uriResolver. - * See also {@link #setUriResolver(URIResolver)}. + * To use a custom UriResolver which depends on a dynamic endpoint resource URI. Should not be used together with the option 'uriResolver'. */ public void setUriResolverFactory(XsltUriResolverFactory uriResolverFactory) { this.uriResolverFactory = uriResolverFactory; @@ -90,8 +85,7 @@ public class XsltComponent extends UriEndpointComponent { } /** - * To use a custom javax.xml.transform.URIResolver. Do not use in combination with uriResolverFactory. - * See also {@link #setUriResolverFactory(XsltUriResolverFactory)}. + * To use a custom UriResolver. Should not be used together with the option 'uriResolverFactory'. */ public void setUriResolver(URIResolver uriResolver) { this.uriResolver = uriResolver; http://git-wip-us.apache.org/repos/asf/camel/blob/22383f49/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentConfiguration.java index 1079eee..aee46c5 100644 --- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentConfiguration.java @@ -16,7 +16,6 @@ */ package org.apache.camel.component.xslt.springboot; -import java.util.List; import java.util.Map; import javax.annotation.Generated; import javax.xml.parsers.DocumentBuilderFactory; @@ -44,17 +43,14 @@ public class XsltComponentConfiguration */ private XmlConverterNestedConfiguration xmlConverter; /** - * To use a custom javax.xml.transform.URIResolver which depends on a - * dynamic endpoint resource URI or which is a subclass of XsltUriResolver. - * Do not use in combination with uriResolver. See also link - * setUriResolver(URIResolver). + * To use a custom UriResolver which depends on a dynamic endpoint resource + * URI. Should not be used together with the option 'uriResolver'. */ @NestedConfigurationProperty private XsltUriResolverFactory uriResolverFactory; /** - * To use a custom javax.xml.transform.URIResolver. Do not use in - * combination with uriResolverFactory. See also link - * setUriResolverFactory(XsltUriResolverFactory). + * To use a custom UriResolver. Should not be used together with the option + * 'uriResolverFactory'. */ private URIResolver uriResolver; /** @@ -64,7 +60,7 @@ public class XsltComponentConfiguration * forced to reload at runtime via JMX using the clearCachedStylesheet * operation. */ - private Boolean contentCache = false; + private Boolean contentCache = true; /** * Whether to use Saxon as the transformerFactoryClass. If enabled then the * class net.sf.saxon.TransformerFactoryImpl. You would need to add Saxon to @@ -77,7 +73,7 @@ public class XsltComponentConfiguration * looked up in the registry where you can comma to separate multiple values * to lookup. */ - private List<Object> saxonExtensionFunctions; + private String saxonExtensionFunctions; /** * To use a custom Saxon configuration */ @@ -133,11 +129,11 @@ public class XsltComponentConfiguration this.saxon = saxon; } - public List<Object> getSaxonExtensionFunctions() { + public String getSaxonExtensionFunctions() { return saxonExtensionFunctions; } - public void setSaxonExtensionFunctions(List<Object> saxonExtensionFunctions) { + public void setSaxonExtensionFunctions(String saxonExtensionFunctions) { this.saxonExtensionFunctions = saxonExtensionFunctions; } http://git-wip-us.apache.org/repos/asf/camel/blob/22383f49/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java ---------------------------------------------------------------------- diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java index a8088da..6c7ecec 100644 --- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java +++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java @@ -535,6 +535,11 @@ public class EndpointAnnotationProcessor extends AbstractProcessor { } } + // the field type may be overloaded by another type + if (metadata != null && !Strings.isNullOrEmpty(metadata.javaType())) { + fieldTypeName = metadata.javaType(); + } + String group = EndpointHelper.labelAsGroupName(label, componentModel.isConsumerOnly(), componentModel.isProducerOnly()); ComponentOption option = new ComponentOption(name, displayName, fieldTypeName, required, defaultValue, defaultValueNote, docComment.trim(), deprecated, deprecationNote, secret, group, label, isEnum, enums); http://git-wip-us.apache.org/repos/asf/camel/blob/22383f49/tooling/spi-annotations/src/main/java/org/apache/camel/spi/Metadata.java ---------------------------------------------------------------------- diff --git a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/Metadata.java b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/Metadata.java index adef691..23c83b6 100644 --- a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/Metadata.java +++ b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/Metadata.java @@ -84,6 +84,13 @@ public @interface Metadata { boolean secret() default false; /** + * To re-associate the preferred Java type of this parameter. + * <p/> + * This is used for parameters which are of a specialized type but can be configured by another Java type, such as from a String. + */ + String javaType() default ""; + + /** * The first version this functionality was added to Apache Camel. */ String firstVersion() default "";