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 a7be9adfc9ca8e9858be8ecec8078b9b1179d149
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Thu Jul 4 10:00:34 2019 +0200

    CAMEL-13708: Properties component should have API to make it easier to 
lookup a property on-demand or from all pre-loaded properties.
---
 .../src/main/docs/properties-component.adoc         | 21 ++-------------------
 .../properties/DefaultPropertiesLookup.java         |  3 ++-
 .../properties/LocationPropertiesSource.java        |  9 +++++++++
 .../component/properties/PropertiesComponent.java   |  3 ++-
 4 files changed, 15 insertions(+), 21 deletions(-)

diff --git 
a/components/camel-properties/src/main/docs/properties-component.adoc 
b/components/camel-properties/src/main/docs/properties-component.adoc
index cfe96df..734abf4 100644
--- a/components/camel-properties/src/main/docs/properties-component.adoc
+++ b/components/camel-properties/src/main/docs/properties-component.adoc
@@ -91,7 +91,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 16 options, which are listed below.
 
 
 
@@ -114,7 +114,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
 
@@ -173,25 +172,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:
diff --git 
a/components/camel-properties/src/main/java/org/apache/camel/component/properties/DefaultPropertiesLookup.java
 
b/components/camel-properties/src/main/java/org/apache/camel/component/properties/DefaultPropertiesLookup.java
index c2debeb..1d9a065 100644
--- 
a/components/camel-properties/src/main/java/org/apache/camel/component/properties/DefaultPropertiesLookup.java
+++ 
b/components/camel-properties/src/main/java/org/apache/camel/component/properties/DefaultPropertiesLookup.java
@@ -45,12 +45,13 @@ public class DefaultPropertiesLookup implements 
PropertiesLookup {
             }
         }
         if (answer == null) {
-            // try till first found location source
+            // then try till first found location source
             Iterator<LocationPropertiesSource> it = 
component.getLocationSources().iterator();
             while (answer == null && it.hasNext()) {
                 answer = it.next().getProperty(name);
             }
         }
+        // initial properties are last
         if (answer == null && component.getInitialProperties() != null) {
             answer = component.getInitialProperties().getProperty(name);
         }
diff --git 
a/components/camel-properties/src/main/java/org/apache/camel/component/properties/LocationPropertiesSource.java
 
b/components/camel-properties/src/main/java/org/apache/camel/component/properties/LocationPropertiesSource.java
index 4fbf5ca..7ec3f89 100644
--- 
a/components/camel-properties/src/main/java/org/apache/camel/component/properties/LocationPropertiesSource.java
+++ 
b/components/camel-properties/src/main/java/org/apache/camel/component/properties/LocationPropertiesSource.java
@@ -16,7 +16,16 @@
  */
 package org.apache.camel.component.properties;
 
+/**
+ * A {@link PropertiesSource} which was created from a {@link 
PropertiesLocation}.
+ */
 public interface LocationPropertiesSource extends PropertiesSource {
 
+    // TODO: We can make some special for this and remove this interface
+    // as this is an implementation details only internally
+
+    /**
+     * Gets the location of the properties
+     */
     PropertiesLocation getLocation();
 }
diff --git 
a/components/camel-properties/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
 
b/components/camel-properties/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
index 84a00c8..a3e298d 100644
--- 
a/components/camel-properties/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
+++ 
b/components/camel-properties/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
@@ -53,9 +53,10 @@ import org.slf4j.LoggerFactory;
 public class PropertiesComponent extends DefaultComponent implements 
org.apache.camel.spi.PropertiesComponent, StaticService {
 
     // TODO: PropertySource / LoadablePropertySource to camel-api
-    // TODO: sources and locationSources merged into 1
+    // TODO: Remove LocationPropertiesSource
     // TODO: cache to DefaultPropertiesLookup
     // TODO: API on PropertiesComponent in SPI to Optional<String> 
lookupProperty(String name);
+    // TODO: Add docs about `PropertiesSource`
 
     /**
      *  Never check system properties.

Reply via email to