Updated Branches:
  refs/heads/master 2964825ef -> b5c6dbe66

CAMEL-6388 support to load properties as the map


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

Branch: refs/heads/master
Commit: b5c6dbe66c478b07dc977def03875e90a01085d8
Parents: c3c94da
Author: Willem Jiang <[email protected]>
Authored: Thu May 23 15:01:13 2013 +0800
Committer: Willem Jiang <[email protected]>
Committed: Thu May 23 15:04:03 2013 +0800

----------------------------------------------------------------------
 .../properties/DefaultPropertiesResolver.java      |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b5c6dbe6/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java
 
b/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java
index 16db851..8b3a202 100644
--- 
a/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java
+++ 
b/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java
@@ -105,11 +105,20 @@ public class DefaultPropertiesResolver implements 
PropertiesResolver {
         return answer;
     }
 
+    @SuppressWarnings({"rawtypes", "unchecked"})
     protected Properties loadPropertiesFromRegistry(CamelContext context, 
boolean ignoreMissingLocation, String path) throws IOException {
         if (path.startsWith("ref:")) {
             path = ObjectHelper.after(path, "ref:");
         }
-        Properties answer = context.getRegistry().lookupByNameAndType(path, 
Properties.class);
+        Properties answer = null;
+        try {
+            answer = context.getRegistry().lookupByNameAndType(path, 
Properties.class);
+        } catch (Exception ex) {
+            // just look up the Map as a fault back
+            Map map = context.getRegistry().lookupByNameAndType(path, 
Map.class);
+            answer = new Properties();
+            answer.putAll(map);
+        }
         if (answer == null && (!ignoreMissingLocation)) {
             throw new FileNotFoundException("Properties " + path + " not found 
in registry");
         }

Reply via email to