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 2013/11/14 18:39:55 UTC
git commit: CAMEL-6769: Fixed the find methods in JndiRegistry to
return the instance and not its class
Updated Branches:
refs/heads/camel-2.12.x 8fe198d01 -> f4e8d9aa0
CAMEL-6769: Fixed the find methods in JndiRegistry to return the instance and not its class
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f4e8d9aa
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f4e8d9aa
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f4e8d9aa
Branch: refs/heads/camel-2.12.x
Commit: f4e8d9aa0ac59605465bb660dbc27d53d753913a
Parents: 8fe198d
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Nov 14 17:06:23 2013 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Nov 14 18:41:14 2013 +0100
----------------------------------------------------------------------
.../src/main/java/org/apache/camel/impl/JndiRegistry.java | 10 ++++++----
.../src/main/java/org/apache/camel/spi/Registry.java | 6 ------
2 files changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/f4e8d9aa/camel-core/src/main/java/org/apache/camel/impl/JndiRegistry.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/JndiRegistry.java b/camel-core/src/main/java/org/apache/camel/impl/JndiRegistry.java
index 173587d..dc663e3 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/JndiRegistry.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/JndiRegistry.java
@@ -78,8 +78,9 @@ public class JndiRegistry implements Registry {
NamingEnumeration<NameClassPair> list = getContext().list("");
while (list.hasMore()) {
NameClassPair pair = list.next();
- if (type.isInstance(pair.getClass())) {
- answer.put(pair.getName(), type.cast(pair.getClass()));
+ if (type.isInstance(pair.getClass()) || type.getName().equals(pair.getClassName())) {
+ Object instance = context.lookup(pair.getName());
+ answer.put(pair.getName(), type.cast(instance));
}
}
} catch (NamingException e) {
@@ -95,8 +96,9 @@ public class JndiRegistry implements Registry {
NamingEnumeration<NameClassPair> list = getContext().list("");
while (list.hasMore()) {
NameClassPair pair = list.next();
- if (type.isInstance(pair.getClass())) {
- answer.add(type.cast(pair.getClass()));
+ if (type.isInstance(pair.getClass()) || type.getName().equals(pair.getClassName())) {
+ Object instance = context.lookup(pair.getName());
+ answer.add(type.cast(instance));
}
}
} catch (NamingException e) {
http://git-wip-us.apache.org/repos/asf/camel/blob/f4e8d9aa/camel-core/src/main/java/org/apache/camel/spi/Registry.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/spi/Registry.java b/camel-core/src/main/java/org/apache/camel/spi/Registry.java
index aac763d..1af6daa 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/Registry.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/Registry.java
@@ -47,9 +47,6 @@ public interface Registry {
/**
* Finds services in the registry by their type.
- * <p/>
- * <b>Note:</b> Not all registry implementations support this feature,
- * such as the {@link org.apache.camel.impl.JndiRegistry}.
*
* @param type the type of the registered services
* @return the types found, with their ids as the key. Returns an empty Map if none found.
@@ -58,9 +55,6 @@ public interface Registry {
/**
* Finds services in the registry by their type.
- * <p/>
- * <b>Note:</b> Not all registry implementations support this feature,
- * such as the {@link org.apache.camel.impl.JndiRegistry}.
*
* @param type the type of the registered services
* @return the types found. Returns an empty Set if none found.