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 44236dab31f46617108697270ded0348a3af8fe1
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Wed Jul 3 14:58:56 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.
---
 ...rt.java => AbstractLocationPropertiesSource.java} |  7 +++++--
 .../properties/ClasspathPropertiesSource.java        |  2 +-
 .../component/properties/FilePropertiesSource.java   |  2 +-
 .../component/properties/PropertiesComponent.java    | 20 ++++++--------------
 4 files changed, 13 insertions(+), 18 deletions(-)

diff --git 
a/components/camel-properties/src/main/java/org/apache/camel/component/properties/LocationPropertiesSourceSupport.java
 
b/components/camel-properties/src/main/java/org/apache/camel/component/properties/AbstractLocationPropertiesSource.java
similarity index 90%
rename from 
components/camel-properties/src/main/java/org/apache/camel/component/properties/LocationPropertiesSourceSupport.java
rename to 
components/camel-properties/src/main/java/org/apache/camel/component/properties/AbstractLocationPropertiesSource.java
index 73bd40a..0a7a010 100644
--- 
a/components/camel-properties/src/main/java/org/apache/camel/component/properties/LocationPropertiesSourceSupport.java
+++ 
b/components/camel-properties/src/main/java/org/apache/camel/component/properties/AbstractLocationPropertiesSource.java
@@ -22,14 +22,17 @@ import java.util.Properties;
 import org.apache.camel.support.service.ServiceSupport;
 import org.apache.camel.util.OrderedProperties;
 
-public abstract class LocationPropertiesSourceSupport extends ServiceSupport 
implements LoadablePropertiesSource, LocationPropertiesSource {
+/**
+ * Base class for {@link LoadablePropertiesSource} which can load properties 
from a source such as classpath or file system.
+ */
+public abstract class AbstractLocationPropertiesSource extends ServiceSupport 
implements LoadablePropertiesSource, LocationPropertiesSource {
 
     private final Properties properties = new OrderedProperties();
     private final PropertiesComponent propertiesComponent;
     private final PropertiesLocation location;
     private final boolean ignoreMissingLocation;
 
-    protected LocationPropertiesSourceSupport(PropertiesComponent 
propertiesComponent, PropertiesLocation location, boolean 
ignoreMissingLocation) {
+    protected AbstractLocationPropertiesSource(PropertiesComponent 
propertiesComponent, PropertiesLocation location, boolean 
ignoreMissingLocation) {
         this.propertiesComponent = propertiesComponent;
         this.location = location;
         this.ignoreMissingLocation = ignoreMissingLocation;
diff --git 
a/components/camel-properties/src/main/java/org/apache/camel/component/properties/ClasspathPropertiesSource.java
 
b/components/camel-properties/src/main/java/org/apache/camel/component/properties/ClasspathPropertiesSource.java
index a69e836..2971411 100644
--- 
a/components/camel-properties/src/main/java/org/apache/camel/component/properties/ClasspathPropertiesSource.java
+++ 
b/components/camel-properties/src/main/java/org/apache/camel/component/properties/ClasspathPropertiesSource.java
@@ -28,7 +28,7 @@ import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.OrderedProperties;
 
-public class ClasspathPropertiesSource extends LocationPropertiesSourceSupport 
{
+public class ClasspathPropertiesSource extends 
AbstractLocationPropertiesSource {
 
     public ClasspathPropertiesSource(PropertiesComponent propertiesComponent, 
PropertiesLocation location, boolean ignoreMissingLocation) {
         super(propertiesComponent, location, ignoreMissingLocation);
diff --git 
a/components/camel-properties/src/main/java/org/apache/camel/component/properties/FilePropertiesSource.java
 
b/components/camel-properties/src/main/java/org/apache/camel/component/properties/FilePropertiesSource.java
index 3ac9810..ea74da1 100644
--- 
a/components/camel-properties/src/main/java/org/apache/camel/component/properties/FilePropertiesSource.java
+++ 
b/components/camel-properties/src/main/java/org/apache/camel/component/properties/FilePropertiesSource.java
@@ -29,7 +29,7 @@ import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.OrderedProperties;
 
-public class FilePropertiesSource extends LocationPropertiesSourceSupport {
+public class FilePropertiesSource extends AbstractLocationPropertiesSource {
 
     protected FilePropertiesSource(PropertiesComponent propertiesComponent, 
PropertiesLocation location, boolean ignoreMissingLocation) {
         super(propertiesComponent, location, ignoreMissingLocation);
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 74af64f..35debf7 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
@@ -16,16 +16,13 @@
  */
 package org.apache.camel.component.properties;
 
-import java.io.Serializable;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import java.util.stream.Collectors;
 
 import org.apache.camel.CamelContextAware;
 import org.apache.camel.Endpoint;
@@ -39,7 +36,6 @@ import org.apache.camel.spi.FactoryFinder;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.DefaultComponent;
-import org.apache.camel.support.EndpointHelper;
 import org.apache.camel.support.OrderedComparator;
 import org.apache.camel.support.service.ServiceHelper;
 import org.apache.camel.util.FilePathResolver;
@@ -56,6 +52,12 @@ import org.slf4j.LoggerFactory;
 @ManagedResource(description = "Managed PropertiesComponent")
 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: cache to DefaultPropertiesLookup
+    // TODO: API on PropertiesComponent in SPI to Optional<String> 
lookupProperty(String name);
+    // TODO: Remove PropertiesResolver
+
     /**
      *  Never check system properties.
      */
@@ -143,16 +145,6 @@ public class PropertiesComponent extends DefaultComponent 
implements org.apache.
         addFunction(new ServicePortPropertiesFunction());
     }
 
-    public PropertiesComponent(String location) {
-        this();
-        setLocation(location);
-    }
-
-    public PropertiesComponent(String... locations) {
-        this();
-        setLocations(locations);
-    }
-
     @Override
     protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
         String endpointUri = parseUri(remaining);

Reply via email to