Author: hughesj
Date: Wed Sep 10 15:33:21 2014
New Revision: 1624034
URL: http://svn.apache.org/r1624034
Log:
ARIES-1063 ARIES-1065: ServiceFactory can now be specified as the bean class
Modified:
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ServiceRecipe.java
Modified:
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ServiceRecipe.java
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ServiceRecipe.java?rev=1624034&r1=1624033&r2=1624034&view=diff
==============================================================================
---
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ServiceRecipe.java
(original)
+++
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ServiceRecipe.java
Wed Sep 10 15:33:21 2014
@@ -288,9 +288,19 @@ public class ServiceRecipe extends Abstr
validateClasses(o);
} else if (o instanceof UnwrapperedBeanHolder) {
UnwrapperedBeanHolder holder = (UnwrapperedBeanHolder)
o;
- validateClasses(holder.unwrapperedBean);
- o = BeanRecipe.wrap(holder,
getClassesForProxying(holder.unwrapperedBean));
- } else {
+ if (holder.unwrapperedBean instanceof ServiceFactory) {
+ //If a service factory is used, make sure the
proxy classes implement this
+ //interface so that later on, internalGetService
will create the real
+ //service from it.
+ LOGGER.debug("{} implements ServiceFactory,
creating proxy that also implements this", holder.unwrapperedBean);
+ Collection<Class<?>> cls =
getClassesForProxying(holder.unwrapperedBean);
+
cls.add(blueprintContainer.loadClass("org.osgi.framework.ServiceFactory"));
+ o = BeanRecipe.wrap(holder, cls);
+ } else {
+ validateClasses(holder.unwrapperedBean);
+ o = BeanRecipe.wrap(holder,
getClassesForProxying(holder.unwrapperedBean));
+ }
+ } else if (!(o instanceof ServiceFactory)) {
validateClasses(o);
}
service = o;