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 2015/03/08 00:21:00 UTC
svn commit: r1664931 -
/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-configuration.mdtext
Author: pderop
Date: Sat Mar 7 23:21:00 2015
New Revision: 1664931
URL: http://svn.apache.org/r1664931
Log:
Fixed formatting (attempt 2).
Modified:
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-configuration.mdtext
Modified: felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-configuration.mdtext
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-configuration.mdtext?rev=1664931&r1=1664930&r2=1664931&view=diff
==============================================================================
--- felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-configuration.mdtext (original)
+++ felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-configuration.mdtext Sat Mar 7 23:21:00 2015
@@ -75,16 +75,17 @@ Finally, the last example shows how to d
The following component first depends on a "sample.MyComponent" configuration pid. Then the init method gets from that configuration
another pid for a second "global" configuration:
+
:::java
package sample;
-
+
/**
* A Service that dynamically defines an extra dynamic configuration dependency from its init method.
*/
@Component
class MyComponent {
private Dictionary m_config;
-
+
// Inject initial Configuration (injected before any other required dependencies)
@ConfigurationDependency
void componentConfiguration(Dictionary config) {
@@ -92,27 +93,28 @@ another pid for a second "global" config
m_config = config;
}
- /**
- * All unnamed dependencies are injected: we can now configure our dynamic configuration whose dependency name is "global".
- */
- @Init
- Map init() {
- return new HashMap() {{
- put("global.pid", m_config.get("globalConfig.pid"));
- put("global.propagate", m_config.get("globalConfig.propagate"));
- }};
- }
-
- // Injected after init, and dynamically configured by the init method.
- @ConfigurationDependency(name="global")
- void globalConfiguration(Dictionary globalConfig) {
- // you must throw an exception if the configuration is not valid
- }
-
- /**
- * All dependencies are injected and our service is now ready to be published.
- */
- @Start
- void start() {
- }
+ /**
+ * All unnamed dependencies are injected: we can now configure our dynamic configuration whose dependency name is "global".
+ */
+ @Init
+ Map init() {
+ return new HashMap() {{
+ put("global.pid", m_config.get("globalConfig.pid"));
+ put("global.propagate", m_config.get("globalConfig.propagate"));
+ }};
+ }
+
+ // Injected after init, and dynamically configured by the init method.
+ @ConfigurationDependency(name="global")
+ void globalConfiguration(Dictionary globalConfig) {
+ // you must throw an exception if the configuration is not valid
+ }
+
+ /**
+ * All dependencies are injected and our service is now ready to be published.
+ */
+ @Start
+ void start() {
+ }
}
+