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/10/09 13:35:30 UTC
svn commit: r1843269 -
/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/components.mdtext
Author: pderop
Date: Tue Oct 9 13:35:30 2018
New Revision: 1843269
URL: http://svn.apache.org/viewvc?rev=1843269&view=rev
Log:
dm r12 updates
Modified:
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/components.mdtext
Modified: felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/components.mdtext
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/components.mdtext?rev=1843269&r1=1843268&r2=1843269&view=diff
==============================================================================
--- felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/components.mdtext (original)
+++ felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/components.mdtext Tue Oct 9 13:35:30 2018
@@ -100,7 +100,7 @@ This has to be a fixed set of instances
We now describe how to declare a service composition using the Api, and the Annotations:
-### Composition / API
+Example:
When using the DependencyManager API, you can use the *Component.setComposition* method to declare a special callback in your component that
returns the list of object that are part of the component, and all dependencies and lifecycle callbacks will be invoked
@@ -152,45 +152,6 @@ And here is the Activator, which uses th
}
}
-### Composition / Annotations
-
-Here is the same example as above, but using Annotations:
-
- :::java
- @Component
- public class ProviderImpl implements Provider {
- private final ProviderParticipant1 m_participant1 = new ProviderParticipant1();
- private final ProviderParticipant2 m_participant2 = new ProviderParticipant2();
- private volatile LogService m_log; // injected
-
- @Composition
- Object[] getComposition() {
- return new Object[] { this, m_participant1, m_participant2 };
- }
-
- @Start
- void start() {
- m_log.log(LogService.LOG_INFO, "ProviderImpl.start(): participants=" + m_participant1 + "," + m_participant2
- + ", conf=" + m_conf);
- }
- }
-
- public class ProviderParticipant1 {
- private volatile LogService m_log; // also injected, since we are part of the composition
-
- void start() {
- m_log.log(LogService.LOG_INFO, "ProviderParticipant1.start()");
- }
- }
-
- public class ProviderParticipant2 {
- private volatile LogService m_log; // also injected, since we are part of the composition
-
- void start() {
- m_log.log(LogService.LOG_INFO, "ProviderParticipant2.start()");
- }
- }
-
## Factories