fixed activator in order to display the "config.pid\# configuration from webconsole, using meta types
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1095973 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/samples/src/main/java/samples/dependonconfiguration/Activator.java b/dependencymanager/samples/src/main/java/samples/dependonconfiguration/Activator.java
index deeea17..fda9b3a 100644
--- a/dependencymanager/samples/src/main/java/samples/dependonconfiguration/Activator.java
+++ b/dependencymanager/samples/src/main/java/samples/dependonconfiguration/Activator.java
@@ -10,16 +10,16 @@
.setImplementation(Task.class)
.add(createConfigurationDependency()
.setPid("config.pid")
- .setHeading("English Dictionary")
- .setDescription("Configuration for the EnglishDictionary Service")
+ // The following is optional and allows to display our configuration from webconsole
+ .setHeading("Task Configuration")
+ .setDescription("Configuration for the Task Service")
.add(createPropertyMetaData()
- .setCardinality(Integer.MAX_VALUE)
- .setType(String.class)
- .setHeading("English Words")
- .setDescription("Declare here some valid english words")
- .setDefaults(new String[] {"hello", "world"})
- .setId("words")))
- );
+ .setCardinality(0)
+ .setType(String.class)
+ .setHeading("Task Interval")
+ .setDescription("Declare here the interval used to trigger the Task")
+ .setDefaults(new String[] {"10"})
+ .setId("interval"))));
}
public void destroy(BundleContext context, DependencyManager manager) throws Exception {}
diff --git a/dependencymanager/samples/src/main/java/samples/dependonconfiguration/Task.java b/dependencymanager/samples/src/main/java/samples/dependonconfiguration/Task.java
index 4c439b4..d4fdb82 100644
--- a/dependencymanager/samples/src/main/java/samples/dependonconfiguration/Task.java
+++ b/dependencymanager/samples/src/main/java/samples/dependonconfiguration/Task.java
@@ -8,16 +8,21 @@
public class Task implements ManagedService {
private String m_interval;
- public void execute() {
- System.out.println("Scheduling task with interval " + m_interval);
- }
-
public void updated(Dictionary properties) throws ConfigurationException {
if (properties != null) {
m_interval = (String) properties.get("interval");
if (m_interval == null) {
throw new ConfigurationException("interval", "must be specified");
}
+ System.out.println("Task.updated: properties=" + properties);
}
}
+
+ public void start() {
+ System.out.println("Task.start");
+ }
+
+ public void execute() {
+ System.out.println("Scheduling task with interval " + m_interval);
+ }
}