This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch properties in repository https://gitbox.apache.org/repos/asf/camel.git
commit 6c22c5db07f87a665d3fb1d26dbc49d169f73811 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Thu Jul 4 13:01:40 2019 +0200 Regen --- .../src/main/docs/properties-component.adoc | 3 +- .../modules/ROOT/pages/properties-component.adoc | 55 +++++++++++++--------- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/components/camel-properties/src/main/docs/properties-component.adoc b/components/camel-properties/src/main/docs/properties-component.adoc index 3fb7cd3..977ec11 100644 --- a/components/camel-properties/src/main/docs/properties-component.adoc +++ b/components/camel-properties/src/main/docs/properties-component.adoc @@ -90,7 +90,7 @@ When using Spring Boot make sure to use the following Maven dependency to have s ---- -The component supports 16 options, which are listed below. +The component supports 15 options, which are listed below. @@ -98,7 +98,6 @@ The component supports 16 options, which are listed below. |=== | Name | Description | Default | Type | *camel.component.properties.basic-property-binding* | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | Boolean -| *camel.component.properties.cache* | Whether or not to cache loaded properties. The default value is true. | true | Boolean | *camel.component.properties.default-fallback-enabled* | If false, the component does not attempt to find a default for the key by looking after the colon separator. | true | Boolean | *camel.component.properties.enabled* | Whether to enable auto configuration of the properties component. This is enabled by default. | | Boolean | *camel.component.properties.encoding* | Encoding to use when loading properties file from the file system or classpath. If no encoding has been set, then the properties files is loaded using ISO-8859-1 encoding (latin-1) as documented by java.util.Properties#load(java.io.InputStream) | | String diff --git a/docs/components/modules/ROOT/pages/properties-component.adoc b/docs/components/modules/ROOT/pages/properties-component.adoc index ae8154c..977ec11 100644 --- a/docs/components/modules/ROOT/pages/properties-component.adoc +++ b/docs/components/modules/ROOT/pages/properties-component.adoc @@ -15,7 +15,7 @@ Where *key* is the key for the property to lookup === Options // component options: START -The Properties component supports 16 options, which are listed below. +The Properties component supports 14 options, which are listed below. @@ -25,9 +25,7 @@ The Properties component supports 16 options, which are listed below. | *locations* (common) | A list of locations to load properties. This option will override any default locations and only use the locations from this option. | | List | *location* (common) | A list of locations to load properties. You can use comma to separate multiple locations. This option will override any default locations and only use the locations from this option. | | String | *encoding* (common) | Encoding to use when loading properties file from the file system or classpath. If no encoding has been set, then the properties files is loaded using ISO-8859-1 encoding (latin-1) as documented by java.util.Properties#load(java.io.InputStream) | | String -| *propertiesResolver* (common) | *Deprecated* 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 | *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* (advanced) | Sets the value of the prefix token used to identify properties to replace. Setting a value of null restores the default token (link DEFAULT_PREFIX_TOKEN). | {{ | String @@ -92,7 +90,7 @@ When using Spring Boot make sure to use the following Maven dependency to have s ---- -The component supports 17 options, which are listed below. +The component supports 15 options, which are listed below. @@ -100,7 +98,6 @@ The component supports 17 options, which are listed below. |=== | Name | Description | Default | Type | *camel.component.properties.basic-property-binding* | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | Boolean -| *camel.component.properties.cache* | Whether or not to cache loaded properties. The default value is true. | true | Boolean | *camel.component.properties.default-fallback-enabled* | If false, the component does not attempt to find a default for the key by looking after the colon separator. | true | Boolean | *camel.component.properties.enabled* | Whether to enable auto configuration of the properties component. This is enabled by default. | | Boolean | *camel.component.properties.encoding* | Encoding to use when loading properties file from the file system or classpath. If no encoding has been set, then the properties files is loaded using ISO-8859-1 encoding (latin-1) as documented by java.util.Properties#load(java.io.InputStream) | | String @@ -115,7 +112,6 @@ The component supports 17 options, which are listed below. | *camel.component.properties.resolve-property-placeholders* | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | Boolean | *camel.component.properties.suffix-token* | Sets the value of the suffix token used to identify properties to replace. Setting a value of null restores the default token (link DEFAULT_SUFFIX_TOKEN). | }} | String | *camel.component.properties.system-properties-mode* | Sets the system property mode. The default mode (override) is to use system properties if present, and override any existing properties. | 2 | Integer -| *camel.component.properties.properties-resolver* | *Deprecated* To use a custom PropertiesResolver. The option is a org.apache.camel.component.properties.PropertiesResolver type. | | String |=== // spring-boot-auto-configure options: END @@ -174,25 +170,9 @@ the default value is the text after the colon (eg /some/path). NOTE: Do not use colon in the property key. The colon is used as a separator token when you are providing a default value. -=== PropertyResolver - -Camel provides a pluggable mechanism which allows 3rd part to provide -their own resolver to lookup properties. Camel provides a default -implementation -`org.apache.camel.component.properties.DefaultPropertiesResolver` which -is capable of loading properties from the file system, classpath or -Registry. You can prefix the locations with either: - -* `ref:` to lookup in the Registry -* `file:` to load the from file system -* `classpath:` to load from classpath (this is also the default if no -prefix is provided) -* `blueprint:` to use a specific OSGi blueprint placeholder -service - === Defining location -The `PropertiesResolver` need to know a location(s) where to resolve the +The properties component need to know a location(s) where to resolve the properties. You can define 1 to many locations. If you define the location in a single String property you can separate multiple locations with comma such as: @@ -944,6 +924,35 @@ pc.addFunction(new MyBeerFunction()); ---- +=== Using 3rd-party properties sources + +The properties component allows to plugin 3rd party sources to load and lookup properties via the `PropertySource` +API from camel-api. For example the `camel-microprofile-config` component is implemented using this. +The 3rd-party `PropertySource` can automatic be discoverd from classpath when Camel is starting up. +This is done by include the file `META-INF/services/org/apache/camel/property-source-factory` file +which refers to the fully qualified class name of the `PropertySource` implementation. +See the `camel-microprofile-config` for an example. + +You can also register 3rd-part property sources via Java API + +[source,java] +---- +PropertiesComponent pc = ... +pc.addPropertySource(myPropertySource); +---- + +==== LoadablePropertySource + +A `PropertySource` can define that it supports loading all its properties from the source at once, +for example from file system. This allows Camel properties component to load these properties at once +during startup. + +==== PropertySource + +The regular `PropertySource` will lookup the property on-demand, for example to lookup +values from a backend source such as a database or HashiCorp Vault etc. + + === See Also * xref:properties-component.adoc[Properties] component