You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2014/02/19 17:53:50 UTC
git commit: [CXF-5568] Optionally disabling the selection of bean
services
Repository: cxf
Updated Branches:
refs/heads/2.7.x-fixes 7815a15c2 -> 449abe830
[CXF-5568] Optionally disabling the selection of bean services
git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1569383 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/449abe83
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/449abe83
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/449abe83
Branch: refs/heads/2.7.x-fixes
Commit: 449abe830c52533e79035365a7126e87fc948fb5
Parents: 7815a15
Author: Sergey Beryozkin <se...@apache.org>
Authored: Tue Feb 18 15:27:10 2014 +0000
Committer: Sergey Beryozkin <sb...@talend.com>
Committed: Wed Feb 19 16:52:59 2014 +0000
----------------------------------------------------------------------
.../java/org/apache/cxf/bus/osgi/OSGiBeanLocator.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/449abe83/rt/core/src/main/java/org/apache/cxf/bus/osgi/OSGiBeanLocator.java
----------------------------------------------------------------------
diff --git a/rt/core/src/main/java/org/apache/cxf/bus/osgi/OSGiBeanLocator.java b/rt/core/src/main/java/org/apache/cxf/bus/osgi/OSGiBeanLocator.java
index aa40113..61631cc 100644
--- a/rt/core/src/main/java/org/apache/cxf/bus/osgi/OSGiBeanLocator.java
+++ b/rt/core/src/main/java/org/apache/cxf/bus/osgi/OSGiBeanLocator.java
@@ -24,18 +24,26 @@ import java.util.List;
import java.util.logging.Logger;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.PropertyUtils;
import org.apache.cxf.configuration.ConfiguredBeanLocator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
public class OSGiBeanLocator implements ConfiguredBeanLocator {
private static final Logger LOG = LogUtils.getL7dLogger(OSGiBeanLocator.class);
+ private static final String COMPATIBLE_LOCATOR_PROP = "org.apache.cxf.bus.osgi.locator";
+ private static final String COMPATIBLE_LOCATOR_PROP_CHECK = COMPATIBLE_LOCATOR_PROP + ".check";
final ConfiguredBeanLocator cbl;
final BundleContext context;
+ private boolean checkCompatibleLocators;
+
public OSGiBeanLocator(ConfiguredBeanLocator c, BundleContext ctx) {
cbl = c;
context = ctx;
+
+ Object checkProp = context.getProperty(COMPATIBLE_LOCATOR_PROP_CHECK);
+ checkCompatibleLocators = checkProp == null || PropertyUtils.isTrue(checkProp);
}
public <T> T getBeanOfType(String name, Class<T> type) {
return cbl.getBeanOfType(name, type);
@@ -56,6 +64,10 @@ public class OSGiBeanLocator implements ConfiguredBeanLocator {
ServiceReference refs[] = context.getServiceReferences(type.getName(), null);
if (refs != null) {
for (ServiceReference r : refs) {
+ if (checkCompatibleLocators
+ && !PropertyUtils.isTrue(r.getProperty(COMPATIBLE_LOCATOR_PROP))) {
+ continue;
+ }
list.add(type.cast(context.getService(r)));
}
}