You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pd...@apache.org on 2018/12/19 14:40:49 UTC
svn commit: r1849304 [1/2] - in /felix/trunk/dependencymanager: ./
org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/api/
org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/
org.apache.felix.depend...
Author: pderop
Date: Wed Dec 19 14:40:48 2018
New Revision: 1849304
URL: http://svn.apache.org/viewvc?rev=1849304&view=rev
Log:
FELIX-5996: Remove generic parameter in DM Component interface
Removed:
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/AbstractComponent.java
Modified:
felix/trunk/dependencymanager/changelog.txt
felix/trunk/dependencymanager/org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/api/DynamicScopedServiceTest.java
felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/DynamicScopedServiceTest.java
felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/bnd.bnd
felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/changelog.txt
felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ConfigurationDependencyBuilderImpl.java
felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/FactoryPidAdapterBuilderImpl.java
felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime/bnd.bnd
felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime/changelog.txt
felix/trunk/dependencymanager/org.apache.felix.dependencymanager.shell/bnd.bnd
felix/trunk/dependencymanager/org.apache.felix.dependencymanager.shell/changelog.txt
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/bnd.bnd
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/changelog.txt
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/AdapterComponent.java
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/AspectComponent.java
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/BundleComponent.java
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/Component.java
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyActivatorBase.java
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyManager.java
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/FactoryComponent.java
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/ResourceComponent.java
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/ComponentContext.java
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/packageinfo
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/BundleAdapterImpl.java
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/FilterComponent.java
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ResourceAdapterImpl.java
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/packageinfo
felix/trunk/dependencymanager/release/build.gradle
Modified: felix/trunk/dependencymanager/changelog.txt
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/changelog.txt?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/changelog.txt (original)
+++ felix/trunk/dependencymanager/changelog.txt Wed Dec 19 14:40:48 2018
@@ -1,3 +1,16 @@
+Release Notes - Felix - Version org.apache.felix.dependencymanager-r15
+======================================================================
+
+** List of bundles being part of the release:
+ * org.apache.felix.dependencymanager; version=4.6.0
+ * org.apache.felix.dependencymanager.shell; version=4.0.8
+ * org.apache.felix.dependencymanager.runtime; version=4.0.7
+ * org.apache.felix.dependencymanager.annotation; version=5.0.1
+ * org.apache.felix.dependencymanager.lambda; version=1.2.1
+
+** Task
+ * [FELIX-5996] - Remove generic parameter in DM Component interface
+
Release Notes - Felix - Version org.apache.felix.dependencymanager-r14
======================================================================
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/api/DynamicScopedServiceTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/api/DynamicScopedServiceTest.java?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/api/DynamicScopedServiceTest.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/api/DynamicScopedServiceTest.java Wed Dec 19 14:40:48 2018
@@ -89,7 +89,7 @@ public class DynamicScopedServiceTest ex
.setImplementation(new ServiceConsumer())
.add(m.createServiceDependency().setService(Service.class).setRequired(true).setCallbacks("bind", "unbind"));
- Component<?> consumer2 = m.createComponent()
+ Component consumer2 = m.createComponent()
.setImplementation(new ServiceConsumer())
.add(m.createServiceDependency().setService(Service.class).setRequired(true).setCallbacks("bind", "unbind"));
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/DynamicScopedServiceTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/DynamicScopedServiceTest.java?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/DynamicScopedServiceTest.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/DynamicScopedServiceTest.java Wed Dec 19 14:40:48 2018
@@ -99,7 +99,7 @@ public class DynamicScopedServiceTest ex
.withSvc(Service.class, svc -> svc.required().add("bind").remove("unbind"))
.build();
- Component<?> consumer2 = component(m)
+ Component consumer2 = component(m)
.impl(new ServiceConsumer())
.withSvc(Service.class, svc -> svc.required().add("bind").remove("unbind"))
.build();
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/bnd.bnd
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/bnd.bnd?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/bnd.bnd (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/bnd.bnd Wed Dec 19 14:40:48 2018
@@ -16,7 +16,7 @@
#
javac.source: 1.8
javac.target: 1.8
-Bundle-Version: 1.2.0
+Bundle-Version: 1.2.1
-buildpath: \
org.apache.felix.dependencymanager;version=latest,\
osgi.core;version=6.0,\
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/changelog.txt
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/changelog.txt?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/changelog.txt (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/changelog.txt Wed Dec 19 14:40:48 2018
@@ -1,3 +1,13 @@
+Release Notes - Felix - Version org.apache.felix.dependencymanager-r15
+======================================================================
+
+** List of bundles being part of the release:
+ * org.apache.felix.dependencymanager; version=4.6.0
+ * org.apache.felix.dependencymanager.shell; version=4.0.8
+ * org.apache.felix.dependencymanager.runtime; version=4.0.7
+ * org.apache.felix.dependencymanager.annotation; version=5.0.1
+ * org.apache.felix.dependencymanager.lambda; version=1.2.1
+
Release Notes - Felix - Version org.apache.felix.dependencymanager-r13
======================================================================
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ConfigurationDependencyBuilderImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ConfigurationDependencyBuilderImpl.java?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ConfigurationDependencyBuilderImpl.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ConfigurationDependencyBuilderImpl.java Wed Dec 19 14:40:48 2018
@@ -139,7 +139,7 @@ public class ConfigurationDependencyBuil
Class<T> componentType = Helpers.getLambdaArgType(callback, 0);
m_pid = m_pid == null ? configClass.getName() : m_pid;
return setComponentCallbackRef(componentType, (instance, component, props) -> {
- U configProxy = ((ComponentContext<?>) m_component).createConfigurationType(configClass, props);
+ U configProxy = ((ComponentContext) m_component).createConfigurationType(configClass, props);
callback.accept((T) instance, configProxy);
});
}
@@ -149,7 +149,7 @@ public class ConfigurationDependencyBuil
Class<T> componentType = Helpers.getLambdaArgType(callback, 0);
m_pid = m_pid == null ? configClass.getName() : m_pid;
return setComponentCallbackRef(componentType, (instance, component, props) -> {
- U configProxy = ((ComponentContext<?>) m_component).createConfigurationType(configClass, props);
+ U configProxy = ((ComponentContext) m_component).createConfigurationType(configClass, props);
callback.accept((T) instance, configProxy, component);
});
}
@@ -171,7 +171,7 @@ public class ConfigurationDependencyBuil
public <T> ConfigurationDependencyBuilder update(Class<T> configClass, InstanceCbConfiguration<T> updated) {
m_pid = m_pid == null ? configClass.getName() : m_pid;
return setInstanceCallbackRef((instance, component, props) -> {
- T configProxy = ((ComponentContext<?>) m_component).createConfigurationType(configClass, props);
+ T configProxy = ((ComponentContext) m_component).createConfigurationType(configClass, props);
updated.accept(configProxy);
});
}
@@ -179,7 +179,7 @@ public class ConfigurationDependencyBuil
public <T> ConfigurationDependencyBuilder update(Class<T> configClass, InstanceCbConfigurationComponent<T> updated) {
m_pid = m_pid == null ? configClass.getName() : m_pid;
return setInstanceCallbackRef((instance, component, props) -> {
- T configProxy = ((ComponentContext<?>) m_component).createConfigurationType(configClass, props);
+ T configProxy = ((ComponentContext) m_component).createConfigurationType(configClass, props);
updated.accept(configProxy, component);
});
}
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/FactoryPidAdapterBuilderImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/FactoryPidAdapterBuilderImpl.java?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/FactoryPidAdapterBuilderImpl.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/FactoryPidAdapterBuilderImpl.java Wed Dec 19 14:40:48 2018
@@ -133,7 +133,7 @@ public class FactoryPidAdapterBuilderImp
Class<T> type = Helpers.getLambdaArgType(callback, 0);
m_factoryPid = m_factoryPid == null ? configType.getName() : m_factoryPid;
return setComponentCallbackRef(type, (instance, component, props) -> {
- U configProxy = ((ComponentContext<?>) component).createConfigurationType(configType, props);
+ U configProxy = ((ComponentContext) component).createConfigurationType(configType, props);
callback.accept((T) instance, configProxy);
});
}
@@ -149,7 +149,7 @@ public class FactoryPidAdapterBuilderImp
Class<T> type = Helpers.getLambdaArgType(callback, 0);
m_factoryPid = m_factoryPid == null ? configType.getName() : m_factoryPid;
return setComponentCallbackRef(type, (instance, component, props) -> {
- U configProxy = ((ComponentContext<?>) component).createConfigurationType(configType, props);
+ U configProxy = ((ComponentContext) component).createConfigurationType(configType, props);
callback.accept((T) instance, configProxy, component);
});
}
@@ -162,7 +162,7 @@ public class FactoryPidAdapterBuilderImp
@Override
public <T> FactoryPidAdapterBuilder update(Class<T> configType, InstanceCbConfiguration<T> callback) {
return setInstanceCallbackRef((instance, component, props) -> {
- T configProxy = ((ComponentContext<?>) component).createConfigurationType(configType, props);
+ T configProxy = ((ComponentContext) component).createConfigurationType(configType, props);
callback.accept(configProxy);
});
}
@@ -175,7 +175,7 @@ public class FactoryPidAdapterBuilderImp
@Override
public <T> FactoryPidAdapterBuilder update(Class<T> configType, InstanceCbConfigurationComponent<T> callback) {
return setInstanceCallbackRef((instance, component, props) -> {
- T configProxy = ((ComponentContext<?>) component).createConfigurationType(configType, props);
+ T configProxy = ((ComponentContext) component).createConfigurationType(configType, props);
callback.accept(configProxy, component);
});
}
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime/bnd.bnd
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime/bnd.bnd?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime/bnd.bnd (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime/bnd.bnd Wed Dec 19 14:40:48 2018
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-Bundle-Version: 4.0.6
+Bundle-Version: 4.0.7
-buildpath: \
osgi.core;version=4.2,\
osgi.cmpn;version=4.2,\
@@ -34,5 +34,3 @@ Bundle-Category: osgi
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-Vendor: The Apache Software Foundation
Bundle-ContactAddress: http://felix.apache.org/documentation/subprojects/apache-felix-dependency-manager.html
-# Work around used to make sure DM api is imported using proper version range (can be removed with bndtools 3)
-Import-Package: org.apache.felix.dm;org.apache.felix.dm.context;version="[4, 5)", *
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime/changelog.txt
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime/changelog.txt?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime/changelog.txt (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime/changelog.txt Wed Dec 19 14:40:48 2018
@@ -1,3 +1,13 @@
+Release Notes - Felix - Version org.apache.felix.dependencymanager-r15
+======================================================================
+
+** List of bundles being part of the release:
+ * org.apache.felix.dependencymanager; version=4.6.0
+ * org.apache.felix.dependencymanager.shell; version=4.0.8
+ * org.apache.felix.dependencymanager.runtime; version=4.0.7
+ * org.apache.felix.dependencymanager.annotation; version=5.0.1
+ * org.apache.felix.dependencymanager.lambda; version=1.2.1
+
Release Notes - Felix - Version org.apache.felix.dependencymanager-r13
======================================================================
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.shell/bnd.bnd
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.shell/bnd.bnd?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.shell/bnd.bnd (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.shell/bnd.bnd Wed Dec 19 14:40:48 2018
@@ -24,7 +24,7 @@
Private-Package: \
org.apache.felix.dm.shell
Bundle-Activator:org.apache.felix.dm.shell.Activator
-Bundle-Version: 4.0.7
+Bundle-Version: 4.0.8
Include-Resource: META-INF/=resources/,META-INF/changelog.txt=changelog.txt
Bundle-Name: Apache Felix Dependency Manager Shell
Bundle-Description: Gogo Shell commands for Apache Felix Dependency Manager
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.shell/changelog.txt
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.shell/changelog.txt?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.shell/changelog.txt (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.shell/changelog.txt Wed Dec 19 14:40:48 2018
@@ -1,3 +1,13 @@
+Release Notes - Felix - Version org.apache.felix.dependencymanager-r15
+======================================================================
+
+** List of bundles being part of the release:
+ * org.apache.felix.dependencymanager; version=4.6.0
+ * org.apache.felix.dependencymanager.shell; version=4.0.8
+ * org.apache.felix.dependencymanager.runtime; version=4.0.7
+ * org.apache.felix.dependencymanager.annotation; version=5.0.1
+ * org.apache.felix.dependencymanager.lambda; version=1.2.1
+
Release Notes - Felix - Version org.apache.felix.dependencymanager-r13
======================================================================
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/bnd.bnd
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/bnd.bnd?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/bnd.bnd (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/bnd.bnd Wed Dec 19 14:40:48 2018
@@ -34,7 +34,7 @@ Export-Package: \
Include-Resource: META-INF/=resources/,META-INF/changelog.txt=changelog.txt
Import-Package: !org.junit,!org.mockito.*,org.osgi.framework;version="[1.8, 2)",*
Bundle-Activator: org.apache.felix.dm.impl.Activator
-Bundle-Version: 4.5.1
+Bundle-Version: 4.6.0
Bundle-Name: Apache Felix Dependency Manager
Bundle-Description: Provides dynamic service and component dependency management
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
@@ -46,3 +46,11 @@ Bundle-Category: osgi
${junit},\
${mockito},\
org.objenesis;version=2.2
+
+-fixupmessages.baselining-error-to-warning: \
+ "Baseline mismatch for package org.apache.felix.dm, MAJOR change. Current is 4.6.0, repo is 4.5.0...";is:=warning,\
+ "Baseline mismatch for package org.apache.felix.dm.context, MAJOR change. Current is 4.4.1, repo is 4.4.0...";is:=warning,\
+ "The bundle version \\(4.5.1/4.6.0\\) is too low, must be at least 5.0.0";is:=warning
+
+
+
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/changelog.txt
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/changelog.txt?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/changelog.txt (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/changelog.txt Wed Dec 19 14:40:48 2018
@@ -1,3 +1,16 @@
+Release Notes - Felix - Version org.apache.felix.dependencymanager-r15
+======================================================================
+
+** List of bundles being part of the release:
+ * org.apache.felix.dependencymanager; version=4.6.0
+ * org.apache.felix.dependencymanager.shell; version=4.0.8
+ * org.apache.felix.dependencymanager.runtime; version=4.0.7
+ * org.apache.felix.dependencymanager.annotation; version=5.0.1
+ * org.apache.felix.dependencymanager.lambda; version=1.2.1
+
+** Task
+ * [FELIX-5996] - Remove generic parameter in DM Component interface
+
Release Notes - Felix - Version org.apache.felix.dependencymanager-r14
======================================================================
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/AdapterComponent.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/AdapterComponent.java?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/AdapterComponent.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/AdapterComponent.java Wed Dec 19 14:40:48 2018
@@ -18,6 +18,10 @@
*/
package org.apache.felix.dm;
+import java.util.Dictionary;
+
+import org.apache.felix.dm.Component.ServiceScope;
+
/**
* Interface used to configure the various parameters needed when defining
* a Dependency Manager adapter component.
@@ -40,7 +44,7 @@ package org.apache.felix.dm;
* public class Activator extends DependencyActivatorBase {
* &Override
* public void init(BundleContext context, DependencyManager dm) throws Exception {
- * Component adapterComponent = createAdapterComponent()
+ * AdapterComponent adapterComponent = createAdapterComponent()
* .setAdaptee(HelloService.class, "(foo=bar)")
* .setInterface(HttpServlet.class.getName(), null)
* .setImplementation(HelloServlet.class);
@@ -101,8 +105,247 @@ package org.apache.felix.dm;
*
* @see DependencyManager#createAdapterComponent()
*/
-public interface AdapterComponent extends Component<AdapterComponent> {
+public interface AdapterComponent extends Component {
+
+ /**
+ * Sets the component scope.
+ * @param scope the component scope (default=SINGLETON)
+ *
+ * @return this component
+ */
+ AdapterComponent setScope(ServiceScope scope);
+ /**
+ * Sets the implementation for this component. You can actually specify
+ * an instance you have instantiated manually, or a <code>Class</code>
+ * that will be instantiated using its default constructor when the
+ * required dependencies are resolved, effectively giving you a lazy
+ * instantiation mechanism.
+ *
+ * There are four special methods that are called when found through
+ * reflection to give you life cycle management options:
+ * <ol>
+ * <li><code>init()</code> is invoked after the instance has been
+ * created and dependencies have been resolved, and can be used to
+ * initialize the internal state of the instance or even to add more
+ * dependencies based on runtime state</li>
+ * <li><code>start()</code> is invoked right before the service is
+ * registered</li>
+ * <li><code>stop()</code> is invoked right after the service is
+ * unregistered</li>
+ * <li><code>destroy()</code> is invoked after all dependencies are
+ * removed</li>
+ * </ol>
+ * In short, this allows you to initialize your instance before it is
+ * registered, perform some post-initialization and pre-destruction code
+ * as well as final cleanup. If a method is not defined, it simply is not
+ * called, so you can decide which one(s) you need. If you need even more
+ * fine-grained control, you can register as a service state listener too.
+ *
+ * @param implementation the implementation
+ * @return this component
+ * @see ComponentStateListener
+ */
+ AdapterComponent setImplementation(Object implementation);
+
+ /**
+ * Adds dependency(ies) to this component, atomically. If the component is already active or if you add
+ * dependencies from the init method, then you should add all the dependencies in one single add method call
+ * (using the varargs argument), because this method may trigger component activation (like
+ * the ServiceTracker.open() method does).
+ *
+ * @param dependencies the dependencies to add.
+ * @return this component
+ */
+ AdapterComponent add(Dependency ... dependencies);
+
+ /**
+ * Removes a dependency from the component.
+ * @param d the dependency to remove
+ * @return this component
+ */
+ AdapterComponent remove(Dependency d);
+
+ /**
+ * Adds a component state listener to this component.
+ *
+ * @param listener the state listener
+ */
+ AdapterComponent add(ComponentStateListener listener);
+
+ /**
+ * Removes a component state listener from this component.
+ *
+ * @param listener the state listener
+ */
+ AdapterComponent remove(ComponentStateListener listener);
+
+ /**
+ * Sets the public interface under which this component should be registered
+ * in the OSGi service registry.
+ *
+ * @param serviceName the name of the service interface
+ * @param properties the properties for this service
+ * @return this component
+ */
+ AdapterComponent setInterface(String serviceName, Dictionary<?,?> properties);
+
+ /**
+ * Sets the public interfaces under which this component should be registered
+ * in the OSGi service registry.
+ *
+ * @param serviceNames the names of the service interface
+ * @param properties the properties for these services
+ * @return this component
+ */
+ AdapterComponent setInterface(String[] serviceNames, Dictionary<?, ?> properties);
+
+ /**
+ * Sets the public interface under which this component should be registered
+ * in the OSGi service registry.
+ *
+ * @param serviceName the name of the service interface
+ * @param properties the properties for this service
+ * @return this component
+ */
+ AdapterComponent setInterface(Class<?> serviceName, Dictionary<?,?> properties);
+
+ /**
+ * Sets the public interfaces under which this component should be registered
+ * in the OSGi service registry.
+ *
+ * @param serviceNames the names of the service interface
+ * @param properties the properties for these services
+ * @return this component
+ */
+ AdapterComponent setInterface(Class<?>[] serviceNames, Dictionary<?, ?> properties);
+
+ /**
+ * Configures auto configuration of injected classes in the component instance.
+ * The following injections are currently performed, unless you explicitly
+ * turn them off:
+ * <dl>
+ * <dt>BundleContext</dt><dd>the bundle context of the bundle</dd>
+ * <dt>ServiceRegistration</dt><dd>the service registration used to register your service</dd>
+ * <dt>DependencyManager</dt><dd>the dependency manager instance</dd>
+ * <dt>Component</dt><dd>the component instance of the dependency manager</dd>
+ * </dl>
+ *
+ * @param clazz the class (from the list above)
+ * @param autoConfig <code>false</code> to turn off auto configuration
+ */
+ AdapterComponent setAutoConfig(Class<?> clazz, boolean autoConfig);
+
+ /**
+ * Configures auto configuration of injected classes in the component instance.
+ *
+ * @param clazz the class (from the list above)
+ * @param instanceName the name of the instance to inject the class into
+ * @see #setAutoConfig(Class, boolean)
+ */
+ AdapterComponent setAutoConfig(Class<?> clazz, String instanceName);
+
+ /**
+ * Sets the service properties associated with the component. If the service
+ * was already registered, it will be updated.
+ *
+ * @param serviceProperties the properties
+ */
+ AdapterComponent setServiceProperties(Dictionary<?, ?> serviceProperties);
+
+ /**
+ * Sets the names of the methods used as callbacks. These methods, when found, are
+ * invoked as part of the life cycle management of the component implementation. The
+ * dependency manager will look for a method of this name with the following signatures,
+ * in this order:
+ * <ol>
+ * <li>method(Component component)</li>
+ * <li>method()</li>
+ * </ol>
+ *
+ * @param init the name of the init method
+ * @param start the name of the start method
+ * @param stop the name of the stop method
+ * @param destroy the name of the destroy method
+ * @return the component
+ */
+ AdapterComponent setCallbacks(String init, String start, String stop, String destroy);
+
+ /**
+ * Sets the names of the methods used as callbacks. These methods, when found, are
+ * invoked on the specified instance as part of the life cycle management of the component
+ * implementation.
+ * <p>
+ * See setCallbacks(String init, String start, String stop, String destroy) for more
+ * information on the signatures. Specifying an instance means you can create a manager
+ * that will be invoked whenever the life cycle of a component changes and this manager
+ * can then decide how to expose this life cycle to the actual component, offering an
+ * important indirection when developing your own component models.
+ *
+ * @return this component
+ */
+ AdapterComponent setCallbacks(Object instance, String init, String start, String stop, String destroy);
+
+ /**
+ * Sets the factory to use to create the implementation. You can specify
+ * both the factory class and method to invoke. The method should return
+ * the implementation, and can use any method to create it. Actually, this
+ * can be used together with <code>setComposition</code> to create a
+ * composition of instances that work together to implement a component. The
+ * factory itself can also be instantiated lazily by not specifying an
+ * instance, but a <code>Class</code>.
+ *
+ * @param factory the factory instance or class
+ * @param createMethod the name of the create method
+ * @return this component
+ */
+ AdapterComponent setFactory(Object factory, String createMethod);
+
+ /**
+ * Sets the factory to use to create the implementation. You specify the
+ * method to invoke. The method should return the implementation, and can
+ * use any method to create it. Actually, this can be used together with
+ * <code>setComposition</code> to create a composition of instances that
+ * work together to implement a component.
+ * <p>
+ * Note that currently, there is no default for the factory, so please use
+ * <code>setFactory(factory, createMethod)</code> instead.
+ *
+ * @param createMethod the name of the create method
+ * @return this component
+ */
+ AdapterComponent setFactory(String createMethod);
+
+ /**
+ * Sets the instance and method to invoke to get back all instances that
+ * are part of a composition and need dependencies injected. All of them
+ * will be searched for any of the dependencies. The method that is
+ * invoked must return an <code>Object[]</code>.
+ *
+ * @param instance the instance that has the method
+ * @param getMethod the method to invoke
+ * @return this component
+ */
+ AdapterComponent setComposition(Object instance, String getMethod);
+
+ /**
+ * Sets the method to invoke on the service implementation to get back all
+ * instances that are part of a composition and need dependencies injected.
+ * All of them will be searched for any of the dependencies. The method that
+ * is invoked must return an <code>Object[]</code>.
+ *
+ * @param getMethod the method to invoke
+ * @return this component
+ */
+ AdapterComponent setComposition(String getMethod);
+
+ /**
+ * Activate debug for this component. Informations related to dependency processing will be displayed
+ * using osgi log service, our to standard output if no log service is currently available.
+ * @param label
+ */
+ AdapterComponent setDebug(String label);
+
/**
* Sets the service interface to apply the adapter to
* @param service the service interface to apply the adapter to
@@ -144,5 +387,5 @@ public interface AdapterComponent extend
* @return this adapter parameter instance
*/
AdapterComponent setPropagate(boolean propagate);
-
+
}
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/AspectComponent.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/AspectComponent.java?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/AspectComponent.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/AspectComponent.java Wed Dec 19 14:40:48 2018
@@ -18,6 +18,10 @@
*/
package org.apache.felix.dm;
+import java.util.Dictionary;
+
+import org.apache.felix.dm.Component.ServiceScope;
+
/**
* Interface used to configure the various parameters needed when defining
* a Dependency Manager aspect component.
@@ -38,7 +42,7 @@ package org.apache.felix.dm;
* public class Activator extends DependencyActivatorBase {
* &Override
* public void init(BundleContext context, DependencyManager dm) throws Exception {
- * Component aspectComponent = createAspectComponent()
+ * AspectComponent aspectComponent = createAspectComponent()
* .setAspect(Database.class, null, 10)
* .setImplementation(DatabaseCache.class);
* dm.add(aspectComponent);
@@ -100,7 +104,246 @@ package org.apache.felix.dm;
* (Component comp, ServiceReference old, ServiceReference replace)
* }</pre>
*/
-public interface AspectComponent extends Component<AspectComponent> {
+public interface AspectComponent extends Component {
+
+ /**
+ * Sets the component scope.
+ * @param scope the component scope (default=SINGLETON)
+ *
+ * @return this component
+ */
+ AspectComponent setScope(ServiceScope scope);
+
+ /**
+ * Sets the implementation for this component. You can actually specify
+ * an instance you have instantiated manually, or a <code>Class</code>
+ * that will be instantiated using its default constructor when the
+ * required dependencies are resolved, effectively giving you a lazy
+ * instantiation mechanism.
+ *
+ * There are four special methods that are called when found through
+ * reflection to give you life cycle management options:
+ * <ol>
+ * <li><code>init()</code> is invoked after the instance has been
+ * created and dependencies have been resolved, and can be used to
+ * initialize the internal state of the instance or even to add more
+ * dependencies based on runtime state</li>
+ * <li><code>start()</code> is invoked right before the service is
+ * registered</li>
+ * <li><code>stop()</code> is invoked right after the service is
+ * unregistered</li>
+ * <li><code>destroy()</code> is invoked after all dependencies are
+ * removed</li>
+ * </ol>
+ * In short, this allows you to initialize your instance before it is
+ * registered, perform some post-initialization and pre-destruction code
+ * as well as final cleanup. If a method is not defined, it simply is not
+ * called, so you can decide which one(s) you need. If you need even more
+ * fine-grained control, you can register as a service state listener too.
+ *
+ * @param implementation the implementation
+ * @return this component
+ * @see ComponentStateListener
+ */
+ AspectComponent setImplementation(Object implementation);
+
+ /**
+ * Adds dependency(ies) to this component, atomically. If the component is already active or if you add
+ * dependencies from the init method, then you should add all the dependencies in one single add method call
+ * (using the varargs argument), because this method may trigger component activation (like
+ * the ServiceTracker.open() method does).
+ *
+ * @param dependencies the dependencies to add.
+ * @return this component
+ */
+ AspectComponent add(Dependency ... dependencies);
+
+ /**
+ * Removes a dependency from the component.
+ * @param d the dependency to remove
+ * @return this component
+ */
+ AspectComponent remove(Dependency d);
+
+ /**
+ * Adds a component state listener to this component.
+ *
+ * @param listener the state listener
+ */
+ AspectComponent add(ComponentStateListener listener);
+
+ /**
+ * Removes a component state listener from this component.
+ *
+ * @param listener the state listener
+ */
+ AspectComponent remove(ComponentStateListener listener);
+
+ /**
+ * Sets the public interface under which this component should be registered
+ * in the OSGi service registry.
+ *
+ * @param serviceName the name of the service interface
+ * @param properties the properties for this service
+ * @return this component
+ */
+ AspectComponent setInterface(String serviceName, Dictionary<?,?> properties);
+
+ /**
+ * Sets the public interfaces under which this component should be registered
+ * in the OSGi service registry.
+ *
+ * @param serviceNames the names of the service interface
+ * @param properties the properties for these services
+ * @return this component
+ */
+ AspectComponent setInterface(String[] serviceNames, Dictionary<?, ?> properties);
+
+ /**
+ * Sets the public interface under which this component should be registered
+ * in the OSGi service registry.
+ *
+ * @param serviceName the name of the service interface
+ * @param properties the properties for this service
+ * @return this component
+ */
+ AspectComponent setInterface(Class<?> serviceName, Dictionary<?,?> properties);
+
+ /**
+ * Sets the public interfaces under which this component should be registered
+ * in the OSGi service registry.
+ *
+ * @param serviceNames the names of the service interface
+ * @param properties the properties for these services
+ * @return this component
+ */
+ AspectComponent setInterface(Class<?>[] serviceNames, Dictionary<?, ?> properties);
+
+ /**
+ * Configures auto configuration of injected classes in the component instance.
+ * The following injections are currently performed, unless you explicitly
+ * turn them off:
+ * <dl>
+ * <dt>BundleContext</dt><dd>the bundle context of the bundle</dd>
+ * <dt>ServiceRegistration</dt><dd>the service registration used to register your service</dd>
+ * <dt>DependencyManager</dt><dd>the dependency manager instance</dd>
+ * <dt>Component</dt><dd>the component instance of the dependency manager</dd>
+ * </dl>
+ *
+ * @param clazz the class (from the list above)
+ * @param autoConfig <code>false</code> to turn off auto configuration
+ */
+ AspectComponent setAutoConfig(Class<?> clazz, boolean autoConfig);
+
+ /**
+ * Configures auto configuration of injected classes in the component instance.
+ *
+ * @param clazz the class (from the list above)
+ * @param instanceName the name of the instance to inject the class into
+ * @see #setAutoConfig(Class, boolean)
+ */
+ AspectComponent setAutoConfig(Class<?> clazz, String instanceName);
+
+ /**
+ * Sets the service properties associated with the component. If the service
+ * was already registered, it will be updated.
+ *
+ * @param serviceProperties the properties
+ */
+ AspectComponent setServiceProperties(Dictionary<?, ?> serviceProperties);
+
+ /**
+ * Sets the names of the methods used as callbacks. These methods, when found, are
+ * invoked as part of the life cycle management of the component implementation. The
+ * dependency manager will look for a method of this name with the following signatures,
+ * in this order:
+ * <ol>
+ * <li>method(Component component)</li>
+ * <li>method()</li>
+ * </ol>
+ *
+ * @param init the name of the init method
+ * @param start the name of the start method
+ * @param stop the name of the stop method
+ * @param destroy the name of the destroy method
+ * @return the component
+ */
+ AspectComponent setCallbacks(String init, String start, String stop, String destroy);
+
+ /**
+ * Sets the names of the methods used as callbacks. These methods, when found, are
+ * invoked on the specified instance as part of the life cycle management of the component
+ * implementation.
+ * <p>
+ * See setCallbacks(String init, String start, String stop, String destroy) for more
+ * information on the signatures. Specifying an instance means you can create a manager
+ * that will be invoked whenever the life cycle of a component changes and this manager
+ * can then decide how to expose this life cycle to the actual component, offering an
+ * important indirection when developing your own component models.
+ *
+ * @return this component
+ */
+ AspectComponent setCallbacks(Object instance, String init, String start, String stop, String destroy);
+
+ /**
+ * Sets the factory to use to create the implementation. You can specify
+ * both the factory class and method to invoke. The method should return
+ * the implementation, and can use any method to create it. Actually, this
+ * can be used together with <code>setComposition</code> to create a
+ * composition of instances that work together to implement a component. The
+ * factory itself can also be instantiated lazily by not specifying an
+ * instance, but a <code>Class</code>.
+ *
+ * @param factory the factory instance or class
+ * @param createMethod the name of the create method
+ * @return this component
+ */
+ AspectComponent setFactory(Object factory, String createMethod);
+
+ /**
+ * Sets the factory to use to create the implementation. You specify the
+ * method to invoke. The method should return the implementation, and can
+ * use any method to create it. Actually, this can be used together with
+ * <code>setComposition</code> to create a composition of instances that
+ * work together to implement a component.
+ * <p>
+ * Note that currently, there is no default for the factory, so please use
+ * <code>setFactory(factory, createMethod)</code> instead.
+ *
+ * @param createMethod the name of the create method
+ * @return this component
+ */
+ AspectComponent setFactory(String createMethod);
+
+ /**
+ * Sets the instance and method to invoke to get back all instances that
+ * are part of a composition and need dependencies injected. All of them
+ * will be searched for any of the dependencies. The method that is
+ * invoked must return an <code>Object[]</code>.
+ *
+ * @param instance the instance that has the method
+ * @param getMethod the method to invoke
+ * @return this component
+ */
+ AspectComponent setComposition(Object instance, String getMethod);
+
+ /**
+ * Sets the method to invoke on the service implementation to get back all
+ * instances that are part of a composition and need dependencies injected.
+ * All of them will be searched for any of the dependencies. The method that
+ * is invoked must return an <code>Object[]</code>.
+ *
+ * @param getMethod the method to invoke
+ * @return this component
+ */
+ AspectComponent setComposition(String getMethod);
+
+ /**
+ * Activate debug for this component. Informations related to dependency processing will be displayed
+ * using osgi log service, our to standard output if no log service is currently available.
+ * @param label
+ */
+ AspectComponent setDebug(String label);
/**
* Sets the service interface to apply the aspect to (required parameter)
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/BundleComponent.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/BundleComponent.java?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/BundleComponent.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/BundleComponent.java Wed Dec 19 14:40:48 2018
@@ -18,6 +18,10 @@
*/
package org.apache.felix.dm;
+import java.util.Dictionary;
+
+import org.apache.felix.dm.Component.ServiceScope;
+
/**
* Interface used to configure the various parameters needed when defining
* a Dependency Manager bundle adapter component.
@@ -43,7 +47,7 @@ package org.apache.felix.dm;
* public class Activator extends DependencyActivatorBase {
* &Override
* public void init(BundleContext context, DependencyManager dm) throws Exception {
- * Component bundleComponent = createBundleComponent()
+ * BundleComponent bundleComponent = createBundleComponent()
* .setFilter(Bundle.ACTIVE, "(Video-Path=*)")
* .setInterface(VideoPlayer.class.getName(), null)
* .setImplementation(VideoPlayerImpl.class);
@@ -80,9 +84,248 @@ package org.apache.felix.dm;
*
* @see DependencyManager#createBundleComponent()
*/
-public interface BundleComponent extends Component<BundleComponent> {
+public interface BundleComponent extends Component {
+
+ /**
+ * Sets the component scope.
+ * @param scope the component scope (default=SINGLETON)
+ *
+ * @return this component
+ */
+ BundleComponent setScope(ServiceScope scope);
+ /**
+ * Sets the implementation for this component. You can actually specify
+ * an instance you have instantiated manually, or a <code>Class</code>
+ * that will be instantiated using its default constructor when the
+ * required dependencies are resolved, effectively giving you a lazy
+ * instantiation mechanism.
+ *
+ * There are four special methods that are called when found through
+ * reflection to give you life cycle management options:
+ * <ol>
+ * <li><code>init()</code> is invoked after the instance has been
+ * created and dependencies have been resolved, and can be used to
+ * initialize the internal state of the instance or even to add more
+ * dependencies based on runtime state</li>
+ * <li><code>start()</code> is invoked right before the service is
+ * registered</li>
+ * <li><code>stop()</code> is invoked right after the service is
+ * unregistered</li>
+ * <li><code>destroy()</code> is invoked after all dependencies are
+ * removed</li>
+ * </ol>
+ * In short, this allows you to initialize your instance before it is
+ * registered, perform some post-initialization and pre-destruction code
+ * as well as final cleanup. If a method is not defined, it simply is not
+ * called, so you can decide which one(s) you need. If you need even more
+ * fine-grained control, you can register as a service state listener too.
+ *
+ * @param implementation the implementation
+ * @return this component
+ * @see ComponentStateListener
+ */
+ BundleComponent setImplementation(Object implementation);
+
+ /**
+ * Adds dependency(ies) to this component, atomically. If the component is already active or if you add
+ * dependencies from the init method, then you should add all the dependencies in one single add method call
+ * (using the varargs argument), because this method may trigger component activation (like
+ * the ServiceTracker.open() method does).
+ *
+ * @param dependencies the dependencies to add.
+ * @return this component
+ */
+ BundleComponent add(Dependency ... dependencies);
+
+ /**
+ * Removes a dependency from the component.
+ * @param d the dependency to remove
+ * @return this component
+ */
+ BundleComponent remove(Dependency d);
+
+ /**
+ * Adds a component state listener to this component.
+ *
+ * @param listener the state listener
+ */
+ BundleComponent add(ComponentStateListener listener);
+
+ /**
+ * Removes a component state listener from this component.
+ *
+ * @param listener the state listener
+ */
+ BundleComponent remove(ComponentStateListener listener);
+
+ /**
+ * Sets the public interface under which this component should be registered
+ * in the OSGi service registry.
+ *
+ * @param serviceName the name of the service interface
+ * @param properties the properties for this service
+ * @return this component
+ */
+ BundleComponent setInterface(String serviceName, Dictionary<?,?> properties);
+
+ /**
+ * Sets the public interfaces under which this component should be registered
+ * in the OSGi service registry.
+ *
+ * @param serviceNames the names of the service interface
+ * @param properties the properties for these services
+ * @return this component
+ */
+ BundleComponent setInterface(String[] serviceNames, Dictionary<?, ?> properties);
+
+ /**
+ * Sets the public interface under which this component should be registered
+ * in the OSGi service registry.
+ *
+ * @param serviceName the name of the service interface
+ * @param properties the properties for this service
+ * @return this component
+ */
+ BundleComponent setInterface(Class<?> serviceName, Dictionary<?,?> properties);
+
+ /**
+ * Sets the public interfaces under which this component should be registered
+ * in the OSGi service registry.
+ *
+ * @param serviceNames the names of the service interface
+ * @param properties the properties for these services
+ * @return this component
+ */
+ BundleComponent setInterface(Class<?>[] serviceNames, Dictionary<?, ?> properties);
+
+ /**
+ * Configures auto configuration of injected classes in the component instance.
+ * The following injections are currently performed, unless you explicitly
+ * turn them off:
+ * <dl>
+ * <dt>BundleContext</dt><dd>the bundle context of the bundle</dd>
+ * <dt>ServiceRegistration</dt><dd>the service registration used to register your service</dd>
+ * <dt>DependencyManager</dt><dd>the dependency manager instance</dd>
+ * <dt>Component</dt><dd>the component instance of the dependency manager</dd>
+ * </dl>
+ *
+ * @param clazz the class (from the list above)
+ * @param autoConfig <code>false</code> to turn off auto configuration
+ */
+ BundleComponent setAutoConfig(Class<?> clazz, boolean autoConfig);
+
+ /**
+ * Configures auto configuration of injected classes in the component instance.
+ *
+ * @param clazz the class (from the list above)
+ * @param instanceName the name of the instance to inject the class into
+ * @see #setAutoConfig(Class, boolean)
+ */
+ BundleComponent setAutoConfig(Class<?> clazz, String instanceName);
+
+ /**
+ * Sets the service properties associated with the component. If the service
+ * was already registered, it will be updated.
+ *
+ * @param serviceProperties the properties
+ */
+ BundleComponent setServiceProperties(Dictionary<?, ?> serviceProperties);
+
+ /**
+ * Sets the names of the methods used as callbacks. These methods, when found, are
+ * invoked as part of the life cycle management of the component implementation. The
+ * dependency manager will look for a method of this name with the following signatures,
+ * in this order:
+ * <ol>
+ * <li>method(Component component)</li>
+ * <li>method()</li>
+ * </ol>
+ *
+ * @param init the name of the init method
+ * @param start the name of the start method
+ * @param stop the name of the stop method
+ * @param destroy the name of the destroy method
+ * @return the component
+ */
+ BundleComponent setCallbacks(String init, String start, String stop, String destroy);
+
+ /**
+ * Sets the names of the methods used as callbacks. These methods, when found, are
+ * invoked on the specified instance as part of the life cycle management of the component
+ * implementation.
+ * <p>
+ * See setCallbacks(String init, String start, String stop, String destroy) for more
+ * information on the signatures. Specifying an instance means you can create a manager
+ * that will be invoked whenever the life cycle of a component changes and this manager
+ * can then decide how to expose this life cycle to the actual component, offering an
+ * important indirection when developing your own component models.
+ *
+ * @return this component
+ */
+ BundleComponent setCallbacks(Object instance, String init, String start, String stop, String destroy);
+
/**
+ * Sets the factory to use to create the implementation. You can specify
+ * both the factory class and method to invoke. The method should return
+ * the implementation, and can use any method to create it. Actually, this
+ * can be used together with <code>setComposition</code> to create a
+ * composition of instances that work together to implement a component. The
+ * factory itself can also be instantiated lazily by not specifying an
+ * instance, but a <code>Class</code>.
+ *
+ * @param factory the factory instance or class
+ * @param createMethod the name of the create method
+ * @return this component
+ */
+ BundleComponent setFactory(Object factory, String createMethod);
+
+ /**
+ * Sets the factory to use to create the implementation. You specify the
+ * method to invoke. The method should return the implementation, and can
+ * use any method to create it. Actually, this can be used together with
+ * <code>setComposition</code> to create a composition of instances that
+ * work together to implement a component.
+ * <p>
+ * Note that currently, there is no default for the factory, so please use
+ * <code>setFactory(factory, createMethod)</code> instead.
+ *
+ * @param createMethod the name of the create method
+ * @return this component
+ */
+ BundleComponent setFactory(String createMethod);
+
+ /**
+ * Sets the instance and method to invoke to get back all instances that
+ * are part of a composition and need dependencies injected. All of them
+ * will be searched for any of the dependencies. The method that is
+ * invoked must return an <code>Object[]</code>.
+ *
+ * @param instance the instance that has the method
+ * @param getMethod the method to invoke
+ * @return this component
+ */
+ BundleComponent setComposition(Object instance, String getMethod);
+
+ /**
+ * Sets the method to invoke on the service implementation to get back all
+ * instances that are part of a composition and need dependencies injected.
+ * All of them will be searched for any of the dependencies. The method that
+ * is invoked must return an <code>Object[]</code>.
+ *
+ * @param getMethod the method to invoke
+ * @return this component
+ */
+ BundleComponent setComposition(String getMethod);
+
+ /**
+ * Activate debug for this component. Informations related to dependency processing will be displayed
+ * using osgi log service, our to standard output if no log service is currently available.
+ * @param label
+ */
+ BundleComponent setDebug(String label);
+
+ /**
* Sets the bundle state mask and bundle manifest headers filter.
*
* @param bundleStateMask the bundle state mask to apply
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/Component.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/Component.java?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/Component.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/Component.java Wed Dec 19 14:40:48 2018
@@ -33,7 +33,7 @@ import org.osgi.framework.ServiceRegistr
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
@ProviderType
-public interface Component<T extends Component<T>> extends AbstractComponent {
+public interface Component {
/**
* Component service scopes
@@ -67,7 +67,7 @@ public interface Component<T extends Com
*
* @return this component
*/
- T setScope(ServiceScope scope);
+ Component setScope(ServiceScope scope);
/**
* Sets the implementation for this component. You can actually specify
@@ -100,7 +100,7 @@ public interface Component<T extends Com
* @return this component
* @see ComponentStateListener
*/
- public T setImplementation(Object implementation);
+ Component setImplementation(Object implementation);
/**
* Adds dependency(ies) to this component, atomically. If the component is already active or if you add
@@ -111,28 +111,28 @@ public interface Component<T extends Com
* @param dependencies the dependencies to add.
* @return this component
*/
- public T add(Dependency ... dependencies);
+ Component add(Dependency ... dependencies);
/**
* Removes a dependency from the component.
* @param d the dependency to remove
* @return this component
*/
- public T remove(Dependency d);
+ Component remove(Dependency d);
/**
* Adds a component state listener to this component.
*
* @param listener the state listener
*/
- public T add(ComponentStateListener listener);
+ Component add(ComponentStateListener listener);
/**
* Removes a component state listener from this component.
*
* @param listener the state listener
*/
- public T remove(ComponentStateListener listener);
+ Component remove(ComponentStateListener listener);
/**
* Sets the public interface under which this component should be registered
@@ -142,7 +142,7 @@ public interface Component<T extends Com
* @param properties the properties for this service
* @return this component
*/
- public T setInterface(String serviceName, Dictionary<?,?> properties);
+ Component setInterface(String serviceName, Dictionary<?,?> properties);
/**
* Sets the public interfaces under which this component should be registered
@@ -152,7 +152,7 @@ public interface Component<T extends Com
* @param properties the properties for these services
* @return this component
*/
- public T setInterface(String[] serviceNames, Dictionary<?, ?> properties);
+ Component setInterface(String[] serviceNames, Dictionary<?, ?> properties);
/**
* Sets the public interface under which this component should be registered
@@ -162,7 +162,7 @@ public interface Component<T extends Com
* @param properties the properties for this service
* @return this component
*/
- public T setInterface(Class<?> serviceName, Dictionary<?,?> properties);
+ Component setInterface(Class<?> serviceName, Dictionary<?,?> properties);
/**
* Sets the public interfaces under which this component should be registered
@@ -172,7 +172,7 @@ public interface Component<T extends Com
* @param properties the properties for these services
* @return this component
*/
- public T setInterface(Class<?>[] serviceNames, Dictionary<?, ?> properties);
+ Component setInterface(Class<?>[] serviceNames, Dictionary<?, ?> properties);
/**
* Configures auto configuration of injected classes in the component instance.
@@ -188,7 +188,7 @@ public interface Component<T extends Com
* @param clazz the class (from the list above)
* @param autoConfig <code>false</code> to turn off auto configuration
*/
- public T setAutoConfig(Class<?> clazz, boolean autoConfig);
+ Component setAutoConfig(Class<?> clazz, boolean autoConfig);
/**
* Configures auto configuration of injected classes in the component instance.
@@ -197,18 +197,7 @@ public interface Component<T extends Com
* @param instanceName the name of the instance to inject the class into
* @see #setAutoConfig(Class, boolean)
*/
- public T setAutoConfig(Class<?> clazz, String instanceName);
-
- /**
- * Returns the service registration for this component. The method
- * will return <code>null</code> if no service registration is
- * available, for example if this component is not registered as a
- * service at all.
- *
- * @return the service registration
- */
- @SuppressWarnings("rawtypes")
- public ServiceRegistration getServiceRegistration();
+ Component setAutoConfig(Class<?> clazz, String instanceName);
/**
* Sets the service properties associated with the component. If the service
@@ -216,7 +205,7 @@ public interface Component<T extends Com
*
* @param serviceProperties the properties
*/
- public T setServiceProperties(Dictionary<?, ?> serviceProperties);
+ Component setServiceProperties(Dictionary<?, ?> serviceProperties);
/**
* Sets the names of the methods used as callbacks. These methods, when found, are
@@ -234,7 +223,7 @@ public interface Component<T extends Com
* @param destroy the name of the destroy method
* @return the component
*/
- public T setCallbacks(String init, String start, String stop, String destroy);
+ Component setCallbacks(String init, String start, String stop, String destroy);
/**
* Sets the names of the methods used as callbacks. These methods, when found, are
@@ -249,7 +238,7 @@ public interface Component<T extends Com
*
* @return this component
*/
- public T setCallbacks(Object instance, String init, String start, String stop, String destroy);
+ Component setCallbacks(Object instance, String init, String start, String stop, String destroy);
/**
* Sets the factory to use to create the implementation. You can specify
@@ -264,7 +253,7 @@ public interface Component<T extends Com
* @param createMethod the name of the create method
* @return this component
*/
- public T setFactory(Object factory, String createMethod);
+ Component setFactory(Object factory, String createMethod);
/**
* Sets the factory to use to create the implementation. You specify the
@@ -279,7 +268,7 @@ public interface Component<T extends Com
* @param createMethod the name of the create method
* @return this component
*/
- public T setFactory(String createMethod);
+ Component setFactory(String createMethod);
/**
* Sets the instance and method to invoke to get back all instances that
@@ -291,7 +280,7 @@ public interface Component<T extends Com
* @param getMethod the method to invoke
* @return this component
*/
- public T setComposition(Object instance, String getMethod);
+ Component setComposition(Object instance, String getMethod);
/**
* Sets the method to invoke on the service implementation to get back all
@@ -302,12 +291,64 @@ public interface Component<T extends Com
* @param getMethod the method to invoke
* @return this component
*/
- public T setComposition(String getMethod);
+ Component setComposition(String getMethod);
/**
* Activate debug for this component. Informations related to dependency processing will be displayed
* using osgi log service, our to standard output if no log service is currently available.
* @param label
*/
- public T setDebug(String label);
+ Component setDebug(String label);
+
+ /**
+ * Returns the service registration for this component. The method
+ * will return <code>null</code> if no service registration is
+ * available, for example if this component is not registered as a
+ * service at all.
+ *
+ * @return the service registration
+ */
+ @SuppressWarnings("rawtypes")
+ ServiceRegistration getServiceRegistration();
+
+ /**
+ * Returns the instance that make up this component. If the component has a composition of instances,
+ * then the first instance of the composition is returned. Null is returned if the component has not
+ * even been instantiated.
+ *
+ * @return the component instances
+ */
+ public <U> U getInstance();
+
+ /**
+ * Returns the composition instances that make up this component, or just the
+ * component instance if it does not have a composition, or an empty array if
+ * the component has not even been instantiated.
+ *
+ * @return the component instances
+ */
+ public Object[] getInstances();
+
+ /**
+ * Returns the component service properties.
+ * The returned dictionary is either empty if no service properties were defined for this component,
+ * or copy of the existing service properties associated with this component.
+ *
+ * @return a copy of the service properties associated to this component or an empty dictionary
+ * if no service properties were defined for this component.
+ */
+ public <K,V> Dictionary<K,V> getServiceProperties();
+
+ /**
+ * Returns the dependency manager associated with this component.
+ * @return the dependency manager associated with this component.
+ */
+ public DependencyManager getDependencyManager();
+
+ /**
+ * Returns the component description (dependencies, service provided, etc ...).
+ * @return the component description (dependencies, service provided, etc ...).
+ */
+ public ComponentDeclaration getComponentDeclaration();
+
}
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyActivatorBase.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyActivatorBase.java?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyActivatorBase.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyActivatorBase.java Wed Dec 19 14:40:48 2018
@@ -126,7 +126,7 @@ public abstract class DependencyActivato
*
* @return the new component
*/
- public Component<?> createComponent() {
+ public Component createComponent() {
return m_manager.createComponent();
}
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyManager.java?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyManager.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyManager.java Wed Dec 19 14:40:48 2018
@@ -157,7 +157,7 @@ public class DependencyManager extends D
*
* @return the new component
*/
- public Component<?> createComponent() {
+ public Component createComponent() {
return new ComponentImpl(m_context, this, m_logger);
}
@@ -295,7 +295,7 @@ public class DependencyManager extends D
* Removes all components and their dependencies.
*/
public void clear() {
- for (Component<?> component : m_components.keySet()) {
+ for (Component component : m_components.keySet()) {
remove(component);
}
m_components.clear();
Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/FactoryComponent.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/FactoryComponent.java?rev=1849304&r1=1849303&r2=1849304&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/FactoryComponent.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/FactoryComponent.java Wed Dec 19 14:40:48 2018
@@ -18,6 +18,10 @@
*/
package org.apache.felix.dm;
+import java.util.Dictionary;
+
+import org.apache.felix.dm.Component.ServiceScope;
+
/**
* Interface used to configure the various parameters needed when defining
* a Dependency Manager factory component.
@@ -45,7 +49,7 @@ package org.apache.felix.dm;
* public class Activator extends DependencyActivatorBase {
* &Override
* public void init(BundleContext context, DependencyManager dm) throws Exception {
- * Component factoryComponent = createFactoryComponent()
+ * FactoryComponent factoryComponent = createFactoryComponent()
* .setFactoryPid("my.factory.pid")
* .setInterface(MySevice.class.getName(), null)
* .setImplementation(MyComponent.class)
@@ -70,9 +74,248 @@ package org.apache.felix.dm;
*
* @see DependencyManager#createFactoryComponent()
*/
-public interface FactoryComponent extends Component<FactoryComponent> {
+public interface FactoryComponent extends Component {
+ /**
+ * Sets the component scope.
+ * @param scope the component scope (default=SINGLETON)
+ *
+ * @return this component
+ */
+ FactoryComponent setScope(ServiceScope scope);
+
+ /**
+ * Sets the implementation for this component. You can actually specify
+ * an instance you have instantiated manually, or a <code>Class</code>
+ * that will be instantiated using its default constructor when the
+ * required dependencies are resolved, effectively giving you a lazy
+ * instantiation mechanism.
+ *
+ * There are four special methods that are called when found through
+ * reflection to give you life cycle management options:
+ * <ol>
+ * <li><code>init()</code> is invoked after the instance has been
+ * created and dependencies have been resolved, and can be used to
+ * initialize the internal state of the instance or even to add more
+ * dependencies based on runtime state</li>
+ * <li><code>start()</code> is invoked right before the service is
+ * registered</li>
+ * <li><code>stop()</code> is invoked right after the service is
+ * unregistered</li>
+ * <li><code>destroy()</code> is invoked after all dependencies are
+ * removed</li>
+ * </ol>
+ * In short, this allows you to initialize your instance before it is
+ * registered, perform some post-initialization and pre-destruction code
+ * as well as final cleanup. If a method is not defined, it simply is not
+ * called, so you can decide which one(s) you need. If you need even more
+ * fine-grained control, you can register as a service state listener too.
+ *
+ * @param implementation the implementation
+ * @return this component
+ * @see ComponentStateListener
+ */
+ FactoryComponent setImplementation(Object implementation);
+
+ /**
+ * Adds dependency(ies) to this component, atomically. If the component is already active or if you add
+ * dependencies from the init method, then you should add all the dependencies in one single add method call
+ * (using the varargs argument), because this method may trigger component activation (like
+ * the ServiceTracker.open() method does).
+ *
+ * @param dependencies the dependencies to add.
+ * @return this component
+ */
+ FactoryComponent add(Dependency ... dependencies);
+
+ /**
+ * Removes a dependency from the component.
+ * @param d the dependency to remove
+ * @return this component
+ */
+ FactoryComponent remove(Dependency d);
+
+ /**
+ * Adds a component state listener to this component.
+ *
+ * @param listener the state listener
+ */
+ FactoryComponent add(ComponentStateListener listener);
+
+ /**
+ * Removes a component state listener from this component.
+ *
+ * @param listener the state listener
+ */
+ FactoryComponent remove(ComponentStateListener listener);
+
+ /**
+ * Sets the public interface under which this component should be registered
+ * in the OSGi service registry.
+ *
+ * @param serviceName the name of the service interface
+ * @param properties the properties for this service
+ * @return this component
+ */
+ FactoryComponent setInterface(String serviceName, Dictionary<?,?> properties);
+
+ /**
+ * Sets the public interfaces under which this component should be registered
+ * in the OSGi service registry.
+ *
+ * @param serviceNames the names of the service interface
+ * @param properties the properties for these services
+ * @return this component
+ */
+ FactoryComponent setInterface(String[] serviceNames, Dictionary<?, ?> properties);
+
+ /**
+ * Sets the public interface under which this component should be registered
+ * in the OSGi service registry.
+ *
+ * @param serviceName the name of the service interface
+ * @param properties the properties for this service
+ * @return this component
+ */
+ FactoryComponent setInterface(Class<?> serviceName, Dictionary<?,?> properties);
+
+ /**
+ * Sets the public interfaces under which this component should be registered
+ * in the OSGi service registry.
+ *
+ * @param serviceNames the names of the service interface
+ * @param properties the properties for these services
+ * @return this component
+ */
+ FactoryComponent setInterface(Class<?>[] serviceNames, Dictionary<?, ?> properties);
+
+ /**
+ * Configures auto configuration of injected classes in the component instance.
+ * The following injections are currently performed, unless you explicitly
+ * turn them off:
+ * <dl>
+ * <dt>BundleContext</dt><dd>the bundle context of the bundle</dd>
+ * <dt>ServiceRegistration</dt><dd>the service registration used to register your service</dd>
+ * <dt>DependencyManager</dt><dd>the dependency manager instance</dd>
+ * <dt>Component</dt><dd>the component instance of the dependency manager</dd>
+ * </dl>
+ *
+ * @param clazz the class (from the list above)
+ * @param autoConfig <code>false</code> to turn off auto configuration
+ */
+ FactoryComponent setAutoConfig(Class<?> clazz, boolean autoConfig);
+
+ /**
+ * Configures auto configuration of injected classes in the component instance.
+ *
+ * @param clazz the class (from the list above)
+ * @param instanceName the name of the instance to inject the class into
+ * @see #setAutoConfig(Class, boolean)
+ */
+ FactoryComponent setAutoConfig(Class<?> clazz, String instanceName);
+
+ /**
+ * Sets the service properties associated with the component. If the service
+ * was already registered, it will be updated.
+ *
+ * @param serviceProperties the properties
+ */
+ FactoryComponent setServiceProperties(Dictionary<?, ?> serviceProperties);
+
+ /**
+ * Sets the names of the methods used as callbacks. These methods, when found, are
+ * invoked as part of the life cycle management of the component implementation. The
+ * dependency manager will look for a method of this name with the following signatures,
+ * in this order:
+ * <ol>
+ * <li>method(Component component)</li>
+ * <li>method()</li>
+ * </ol>
+ *
+ * @param init the name of the init method
+ * @param start the name of the start method
+ * @param stop the name of the stop method
+ * @param destroy the name of the destroy method
+ * @return the component
+ */
+ FactoryComponent setCallbacks(String init, String start, String stop, String destroy);
+
+ /**
+ * Sets the names of the methods used as callbacks. These methods, when found, are
+ * invoked on the specified instance as part of the life cycle management of the component
+ * implementation.
+ * <p>
+ * See setCallbacks(String init, String start, String stop, String destroy) for more
+ * information on the signatures. Specifying an instance means you can create a manager
+ * that will be invoked whenever the life cycle of a component changes and this manager
+ * can then decide how to expose this life cycle to the actual component, offering an
+ * important indirection when developing your own component models.
+ *
+ * @return this component
+ */
+ FactoryComponent setCallbacks(Object instance, String init, String start, String stop, String destroy);
+
+ /**
+ * Sets the factory to use to create the implementation. You can specify
+ * both the factory class and method to invoke. The method should return
+ * the implementation, and can use any method to create it. Actually, this
+ * can be used together with <code>setComposition</code> to create a
+ * composition of instances that work together to implement a component. The
+ * factory itself can also be instantiated lazily by not specifying an
+ * instance, but a <code>Class</code>.
+ *
+ * @param factory the factory instance or class
+ * @param createMethod the name of the create method
+ * @return this component
+ */
+ FactoryComponent setFactory(Object factory, String createMethod);
+
+ /**
+ * Sets the factory to use to create the implementation. You specify the
+ * method to invoke. The method should return the implementation, and can
+ * use any method to create it. Actually, this can be used together with
+ * <code>setComposition</code> to create a composition of instances that
+ * work together to implement a component.
+ * <p>
+ * Note that currently, there is no default for the factory, so please use
+ * <code>setFactory(factory, createMethod)</code> instead.
+ *
+ * @param createMethod the name of the create method
+ * @return this component
+ */
+ FactoryComponent setFactory(String createMethod);
+
/**
+ * Sets the instance and method to invoke to get back all instances that
+ * are part of a composition and need dependencies injected. All of them
+ * will be searched for any of the dependencies. The method that is
+ * invoked must return an <code>Object[]</code>.
+ *
+ * @param instance the instance that has the method
+ * @param getMethod the method to invoke
+ * @return this component
+ */
+ FactoryComponent setComposition(Object instance, String getMethod);
+
+ /**
+ * Sets the method to invoke on the service implementation to get back all
+ * instances that are part of a composition and need dependencies injected.
+ * All of them will be searched for any of the dependencies. The method that
+ * is invoked must return an <code>Object[]</code>.
+ *
+ * @param getMethod the method to invoke
+ * @return this component
+ */
+ FactoryComponent setComposition(String getMethod);
+
+ /**
+ * Activate debug for this component. Informations related to dependency processing will be displayed
+ * using osgi log service, our to standard output if no log service is currently available.
+ * @param label
+ */
+ FactoryComponent setDebug(String label);
+
+ /**
* Sets the pid matching the factory configuration
* @param factoryPid the pid matching the factory configuration
*/