You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/01/17 09:16:29 UTC

[4/4] camel git commit: CAMEL-10546: renamed CamelContext.getProperties to getGlobalOptions

CAMEL-10546: renamed CamelContext.getProperties to getGlobalOptions


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7b8f19d6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7b8f19d6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7b8f19d6

Branch: refs/heads/master
Commit: 7b8f19d662d35b4ccfeb8584a10db1e805e69e3f
Parents: 4093fe5
Author: aldettinger <al...@gmail.com>
Authored: Thu Jan 12 19:00:14 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jan 17 10:11:02 2017 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/CamelContext.java     | 43 ++++++++++++++------
 .../apache/camel/impl/DefaultCamelContext.java  | 32 +++++++++++----
 2 files changed, 55 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7b8f19d6/camel-core/src/main/java/org/apache/camel/CamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/CamelContext.java b/camel-core/src/main/java/org/apache/camel/CamelContext.java
index e37aa17..a2beea1 100644
--- a/camel-core/src/main/java/org/apache/camel/CamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/CamelContext.java
@@ -1265,41 +1265,58 @@ public interface CamelContext extends SuspendableService, RuntimeConfiguration {
     TransformerRegistry getTransformerRegistry();
 
     /**
-     * Sets the properties that can be referenced in the camel context
+     * @deprecated use {@link #setGlobalOptions(Map) setGlobalOptions(Map<String,String>) instead}.
+     */
+    @Deprecated
+    void setProperties(Map<String, String> properties);
+
+    /**
+     * Sets global options that can be referenced in the camel context
      * <p/>
      * <b>Important:</b> This has nothing to do with property placeholders, and is just a plain set of key/value pairs
-     * which are used to configure global settings on CamelContext, such as a maximum debug logging length etc.
+     * which are used to configure global options on CamelContext, such as a maximum debug logging length etc.
      * For property placeholders use {@link #resolvePropertyPlaceholders(String)} method and see more details
      * at the <a href="http://camel.apache.org/using-propertyplaceholder.html">property placeholder</a> documentation.
      *
-     * @param properties properties
+     * @param globalOptions global options that can be referenced in the camel context
      */
-    void setProperties(Map<String, String> properties);
+    void setGlobalOptions(Map<String, String> globalOptions);
 
     /**
-     * Gets the properties that can be referenced in the camel context.
+     * @deprecated use {@link #getGlobalOptions()} instead.
+     */
+    @Deprecated
+    Map<String, String> getProperties();
+
+    /**
+     * Gets global options that can be referenced in the camel context.
      * <p/>
      * <b>Important:</b> This has nothing to do with property placeholders, and is just a plain set of key/value pairs
-     * which are used to configure global settings on CamelContext, such as a maximum debug logging length etc.
+     * which are used to configure global options on CamelContext, such as a maximum debug logging length etc.
      * For property placeholders use {@link #resolvePropertyPlaceholders(String)} method and see more details
      * at the <a href="http://camel.apache.org/using-propertyplaceholder.html">property placeholder</a> documentation.
      *
-     * @return the properties
+     * @return global options for this context
      */
-    Map<String, String> getProperties();
+    Map<String, String> getGlobalOptions();
 
     /**
-     * Gets the property value that can be referenced in the camel context
+     * @deprecated use {@link #getGlobalOption(String)} instead.
+     */
+    String getProperty(String name);
+
+    /**
+     * Gets the global option value that can be referenced in the camel context
      * <p/>
      * <b>Important:</b> This has nothing to do with property placeholders, and is just a plain set of key/value pairs
-     * which are used to configure global settings on CamelContext, such as a maximum debug logging length etc.
+     * which are used to configure global options on CamelContext, such as a maximum debug logging length etc.
      * For property placeholders use {@link #resolvePropertyPlaceholders(String)} method and see more details
      * at the <a href="http://camel.apache.org/using-propertyplaceholder.html">property placeholder</a> documentation.
      *
-     * @return the string value of property
+     * @return the string value of the global option
      */
-    String getProperty(String name);
-    
+    String getGlobalOption(String name);
+
     /**
      * Gets the default FactoryFinder which will be used for the loading the factory class from META-INF
      *

http://git-wip-us.apache.org/repos/asf/camel/blob/7b8f19d6/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index dc41670..2e94289 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -247,7 +247,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
     private ScheduledExecutorService errorHandlerExecutorService;
     private Map<String, DataFormatDefinition> dataFormats = new HashMap<String, DataFormatDefinition>();
     private DataFormatResolver dataFormatResolver = new DefaultDataFormatResolver();
-    private Map<String, String> properties = new HashMap<String, String>();
+    private Map<String, String> globalOptions = new HashMap<String, String>();
     private FactoryFinderResolver factoryFinderResolver = new DefaultFactoryFinderResolver();
     private FactoryFinder defaultFactoryFinder;
     private PropertiesComponent propertiesComponent;
@@ -3029,8 +3029,8 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
     private void doStartCamel() throws Exception {
 
         // custom properties may use property placeholders so resolve those early on
-        if (properties != null && !properties.isEmpty()) {
-            for (Map.Entry<String, String> entry : properties.entrySet()) {
+        if (globalOptions != null && !globalOptions.isEmpty()) {
+            for (Map.Entry<String, String> entry : globalOptions.entrySet()) {
                 String key = entry.getKey();
                 String value = entry.getValue();
                 if (value != null) {
@@ -3926,12 +3926,24 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
         return dataFormats;
     }
 
+    @Deprecated
     public Map<String, String> getProperties() {
-        return properties;
+        return getGlobalOptions();
+    }
+
+    @Override
+    public Map<String, String> getGlobalOptions() {
+        return globalOptions;
     }
 
+    @Deprecated
     public void setProperties(Map<String, String> properties) {
-        this.properties = properties;
+        this.setGlobalOptions(properties);
+    }
+
+    @Override
+    public void setGlobalOptions(Map<String, String> globalOptions) {
+        this.globalOptions = globalOptions;
     }
 
     public FactoryFinder getDefaultFactoryFinder() {
@@ -4268,14 +4280,20 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
         this.restRegistry = restRegistry;
     }
 
+    @Deprecated
     @Override
     public String getProperty(String name) {
-        String value = getProperties().get(name);
+        return getGlobalOption(name);
+    }
+
+    @Override
+    public String getGlobalOption(String name) {
+        String value = getGlobalOptions().get(name);
         if (ObjectHelper.isNotEmpty(value)) {
             try {
                 value = resolvePropertyPlaceholders(value);
             } catch (Exception e) {
-                throw new RuntimeCamelException("Error getting property: " + name, e);
+                throw new RuntimeCamelException("Error getting global option: " + name, e);
             }
         }
         return value;