felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1629083 - in /felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples: ./ src/org/apache/felix/dependencymanager/samples/conf/ src/org/apache/felix/dependencymanager/samples/device/ src/org/apache/felix/...
Date Thu, 02 Oct 2014 22:05:05 GMT
Author: pderop
Date: Thu Oct  2 22:05:04 2014
New Revision: 1629083

URL: http://svn.apache.org/r1629083
Log:
Purified logs. Added adevice.annot example

Added:
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/device.annot.bnd
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/Device.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAccess.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAccessConsumer.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAccessImpl.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAndParameterFactory.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceImpl.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceParameter.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceParameterImpl.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/util/
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/util/Helper.java
Removed:
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/impl/
Modified:
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/conf.bnd
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/device.bnd
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/hello.annot.bnd
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/hello.bnd
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/conf/Configurator.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/DeviceAccessConsumer.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/ServiceConsumer.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/ServiceProviderImpl.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/annot/ServiceConsumer.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/annot/ServiceProviderImpl.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/tpool/Activator.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/tpool.bnd

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/conf.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/conf.bnd?rev=1629083&r1=1629082&r2=1629083&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/conf.bnd
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/conf.bnd
Thu Oct  2 22:05:04 2014
@@ -1,3 +1,4 @@
 Private-Package:  \
-	org.apache.felix.dependencymanager.samples.conf
+	org.apache.felix.dependencymanager.samples.conf,\
+	org.apache.felix.dependencymanager.samples.util
 Bundle-Activator: org.apache.felix.dependencymanager.samples.conf.Activator
\ No newline at end of file

Added: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/device.annot.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/device.annot.bnd?rev=1629083&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/device.annot.bnd
(added)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/device.annot.bnd
Thu Oct  2 22:05:04 2014
@@ -0,0 +1,3 @@
+Private-Package:  \
+	org.apache.felix.dependencymanager.samples.device.annot,\
+	org.apache.felix.dependencymanager.samples.util
\ No newline at end of file

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/device.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/device.bnd?rev=1629083&r1=1629082&r2=1629083&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/device.bnd
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/device.bnd
Thu Oct  2 22:05:04 2014
@@ -1,3 +1,4 @@
 Bundle-Activator: org.apache.felix.dependencymanager.samples.device.Activator
 Private-Package:  \
-	org.apache.felix.dependencymanager.samples.device
\ No newline at end of file
+	org.apache.felix.dependencymanager.samples.device,\
+	org.apache.felix.dependencymanager.samples.util
\ No newline at end of file

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/hello.annot.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/hello.annot.bnd?rev=1629083&r1=1629082&r2=1629083&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/hello.annot.bnd
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/hello.annot.bnd
Thu Oct  2 22:05:04 2014
@@ -1,2 +1,3 @@
 Private-Package:  \
-	org.apache.felix.dependencymanager.samples.hello.annot
\ No newline at end of file
+	org.apache.felix.dependencymanager.samples.hello.annot,\
+	org.apache.felix.dependencymanager.samples.util
\ No newline at end of file

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/hello.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/hello.bnd?rev=1629083&r1=1629082&r2=1629083&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/hello.bnd
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/hello.bnd
Thu Oct  2 22:05:04 2014
@@ -1,3 +1,4 @@
 Private-Package:  \
-	org.apache.felix.dependencymanager.samples.hello
+	org.apache.felix.dependencymanager.samples.hello,\
+	org.apache.felix.dependencymanager.samples.util
 Bundle-Activator: org.apache.felix.dependencymanager.samples.hello.Activator
\ No newline at end of file

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/conf/Configurator.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/conf/Configurator.java?rev=1629083&r1=1629082&r2=1629083&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/conf/Configurator.java
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/conf/Configurator.java
Thu Oct  2 22:05:04 2014
@@ -4,6 +4,7 @@ import java.io.IOException;
 import java.util.Hashtable;
 import java.util.Properties;
 
+import org.apache.felix.dependencymanager.samples.util.Helper;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
 
@@ -19,7 +20,7 @@ public class Configurator {
 
     public void start() {
         try {
-            System.out.println(Thread.currentThread().getName() + ": Starting " + this.getClass().getName());
+            Helper.log("conf", "Configurator starting");
             // Provide configuration to the hello.ServiceConsumer component
             m_serviceConsumerConf = m_ca.getConfiguration("org.apache.felix.dependencymanager.samples.hello.ServiceConsumer",
null);
             Hashtable props = new Properties();
@@ -31,7 +32,6 @@ public class Configurator {
             props = new Properties();
             props.put("key", "value");
             m_serviceConsumerAnnotConf.update(props);
-
         }
         catch (IOException e) {
             e.printStackTrace();

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/DeviceAccessConsumer.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/DeviceAccessConsumer.java?rev=1629083&r1=1629082&r2=1629083&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/DeviceAccessConsumer.java
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/DeviceAccessConsumer.java
Thu Oct  2 22:05:04 2014
@@ -2,9 +2,11 @@ package org.apache.felix.dependencymanag
 
 import java.util.Map;
 
+import org.apache.felix.dependencymanager.samples.util.Helper;
+
 public class DeviceAccessConsumer {
     void add(Map<String, Object> props, DeviceAccess deviceAccess) {
-        System.out.println("Handling device access: id=" + props.get("device.id") 
+        Helper.log("device", "DeviceAccessConsumer: Handling device access: id=" + props.get("device.id")

             + "\n\t device=" + deviceAccess.getDevice() 
             + "\n\t device parameter=" + deviceAccess.getDeviceParameter()
             + "\n\t device access properties=" + props);

Added: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/Device.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/Device.java?rev=1629083&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/Device.java
(added)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/Device.java
Thu Oct  2 22:05:04 2014
@@ -0,0 +1,5 @@
+package org.apache.felix.dependencymanager.samples.device.annot;
+
+public interface Device {
+    int getDeviceId();
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAccess.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAccess.java?rev=1629083&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAccess.java
(added)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAccess.java
Thu Oct  2 22:05:04 2014
@@ -0,0 +1,6 @@
+package org.apache.felix.dependencymanager.samples.device.annot;
+
+public interface DeviceAccess {
+    Device getDevice();
+    DeviceParameter getDeviceParameter();
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAccessConsumer.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAccessConsumer.java?rev=1629083&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAccessConsumer.java
(added)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAccessConsumer.java
Thu Oct  2 22:05:04 2014
@@ -0,0 +1,18 @@
+package org.apache.felix.dependencymanager.samples.device.annot;
+
+import java.util.Map;
+
+import org.apache.felix.dependencymanager.samples.util.Helper;
+import org.apache.felix.dm.annotation.api.Component;
+import org.apache.felix.dm.annotation.api.ServiceDependency;
+
+@Component
+public class DeviceAccessConsumer {
+    @ServiceDependency
+    void add(Map<String, Object> props, DeviceAccess deviceAccess) {
+        Helper.log("device.annot", "Handling device access: id=" + props.get("device.id")

+            + "\n\t device=" + deviceAccess.getDevice() 
+            + "\n\t device parameter=" + deviceAccess.getDeviceParameter()
+            + "\n\t device access properties=" + props);
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAccessImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAccessImpl.java?rev=1629083&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAccessImpl.java
(added)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAccessImpl.java
Thu Oct  2 22:05:04 2014
@@ -0,0 +1,48 @@
+package org.apache.felix.dependencymanager.samples.device.annot;
+
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.felix.dependencymanager.samples.util.Helper;
+import org.apache.felix.dm.annotation.api.AdapterService;
+import org.apache.felix.dm.annotation.api.Init;
+import org.apache.felix.dm.annotation.api.ServiceDependency;
+import org.apache.felix.dm.annotation.api.Start;
+
+@AdapterService(adapteeService=Device.class)
+public class DeviceAccessImpl implements DeviceAccess {
+    volatile Device device;
+    
+    @ServiceDependency(name="deviceparam")
+    volatile DeviceParameter deviceParameter;
+
+    @Init
+    Map<String, String> init() {
+        Helper.log("device.annot", "DeviceAccessImpl.init: device id=" + device.getDeviceId());
+        // Dynamically configure our "deviceparam" dependency, using the already injected
device service.
+        Map<String, String> filters = new HashMap<>();
+        filters.put("deviceparam.filter", "(device.id=" + device.getDeviceId() + ")");
+        filters.put("deviceparam.required", "true");
+        return filters;
+    }
+    
+    @Start
+    Map start() {
+        Helper.log("device.annot", "DeviceAccessImpl.start");
+        // Dynamically add a service property, using the device.id
+        Map<String, Object> props = new Hashtable<>();
+        props.put("device.access.id", device.getDeviceId());
+        return props;
+    }
+
+    @Override
+    public Device getDevice() {
+        return device;
+    }
+
+    @Override
+    public DeviceParameter getDeviceParameter() {
+        return deviceParameter;    
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAndParameterFactory.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAndParameterFactory.java?rev=1629083&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAndParameterFactory.java
(added)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceAndParameterFactory.java
Thu Oct  2 22:05:04 2014
@@ -0,0 +1,43 @@
+package org.apache.felix.dependencymanager.samples.device.annot;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Set;
+
+import org.apache.felix.dependencymanager.samples.util.Helper;
+import org.apache.felix.dm.annotation.api.Component;
+import org.apache.felix.dm.annotation.api.ServiceDependency;
+import org.apache.felix.dm.annotation.api.Start;
+
+/**
+ * Component used to instantiate Device and DeviceParameter services, using DM annotation
"factory set".
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Component
+public class DeviceAndParameterFactory {
+    @ServiceDependency(filter = "(" + Component.FACTORY_NAME + "=Device)")
+    volatile Set<Dictionary> m_deviceFactory;
+    
+    @ServiceDependency(filter = "(" + Component.FACTORY_NAME + "=DeviceParameter)")
+    volatile Set<Dictionary> m_deviceParameterFactory;
+
+    @Start
+    public void start() {
+        Helper.log("device.annot", "DeviceAndParameterFactory.start");
+        for (int i = 0; i < 2; i ++) {
+            createDeviceAndParameter(i);
+        }
+    }
+    
+    private void createDeviceAndParameter(int id) {
+        Helper.log("device.annot", "DeviceAndParameterFactory: creating Device/DeviceParameter
with id=" + id);
+
+        Dictionary device = new Hashtable<>();
+        device.put("device.id", new Integer(id));
+        m_deviceFactory.add(device);
+        
+        Dictionary param = new Hashtable<>();
+        param.put("device.id", new Integer(id));
+        m_deviceParameterFactory.add(param);
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceImpl.java?rev=1629083&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceImpl.java
(added)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceImpl.java
Thu Oct  2 22:05:04 2014
@@ -0,0 +1,21 @@
+package org.apache.felix.dependencymanager.samples.device.annot;
+
+import java.util.Dictionary;
+
+import org.apache.felix.dependencymanager.samples.util.Helper;
+import org.apache.felix.dm.annotation.api.Component;
+
+@Component(factorySet = "Device", factoryConfigure = "configure")
+public class DeviceImpl implements Device {
+    int id;
+
+    void configure(Dictionary<String, Object> configuration) {
+        Helper.log("device.annot", "DeviceImpl.configure: conf=" + configuration);
+        this.id = (Integer) configuration.get("device.id");
+    }
+
+    @Override
+    public int getDeviceId() {
+        return id;
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceParameter.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceParameter.java?rev=1629083&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceParameter.java
(added)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceParameter.java
Thu Oct  2 22:05:04 2014
@@ -0,0 +1,5 @@
+package org.apache.felix.dependencymanager.samples.device.annot;
+
+public interface DeviceParameter {
+    int getDeviceId();
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceParameterImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceParameterImpl.java?rev=1629083&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceParameterImpl.java
(added)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/device/annot/DeviceParameterImpl.java
Thu Oct  2 22:05:04 2014
@@ -0,0 +1,21 @@
+package org.apache.felix.dependencymanager.samples.device.annot;
+
+import java.util.Dictionary;
+
+import org.apache.felix.dependencymanager.samples.util.Helper;
+import org.apache.felix.dm.annotation.api.Component;
+
+@Component(factorySet="DeviceParameter", factoryConfigure="configure")
+public class DeviceParameterImpl implements DeviceParameter {
+    int id;
+        
+    void configure(Dictionary<String, Object> configuration) {
+        Helper.log("device.annot", "DeviceParameterImpl.configure: conf=" + configuration);
+        this.id = (Integer) configuration.get("device.id");
+    }
+
+    @Override
+    public int getDeviceId() {
+        return id;
+    }
+}

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/ServiceConsumer.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/ServiceConsumer.java?rev=1629083&r1=1629082&r2=1629083&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/ServiceConsumer.java
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/ServiceConsumer.java
Thu Oct  2 22:05:04 2014
@@ -2,6 +2,8 @@ package org.apache.felix.dependencymanag
 
 import java.util.Dictionary;
 
+import org.apache.felix.dependencymanager.samples.util.Helper;
+
 /**
  * Our service consumer. We depend on a ServiceProvider, and on a configuration.
  * 
@@ -11,11 +13,11 @@ public class ServiceConsumer {
 	volatile ServiceProvider service;
 	
     protected void update(Dictionary<?, ?> conf) {
-        System.out.println("ServiceConsumer updated with conf " + conf);
+        Helper.log("hello", "ServiceConsumer.update: conf=" + conf);
     }
     
 	public void start() {
-        System.out.println(Thread.currentThread().getName() + ": Starting " + this.getClass().getName());
+        Helper.log("hello", "ServiceConsumer.start: calling service.hello()");
 		this.service.hello();
 	}
 }

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/ServiceProviderImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/ServiceProviderImpl.java?rev=1629083&r1=1629082&r2=1629083&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/ServiceProviderImpl.java
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/ServiceProviderImpl.java
Thu Oct  2 22:05:04 2014
@@ -1,5 +1,7 @@
 package org.apache.felix.dependencymanager.samples.hello;
 
+import org.apache.felix.dependencymanager.samples.util.Helper;
+
 
 /**
  * The implementation for our service provider.
@@ -9,6 +11,6 @@ package org.apache.felix.dependencymanag
 public class ServiceProviderImpl implements ServiceProvider {
 	@Override
 	public void hello() {
-        System.out.println(Thread.currentThread().getName() + ": Hello");
+        Helper.log("hello", "ServiceProviderImpl.hello");
 	}
 }

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/annot/ServiceConsumer.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/annot/ServiceConsumer.java?rev=1629083&r1=1629082&r2=1629083&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/annot/ServiceConsumer.java
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/annot/ServiceConsumer.java
Thu Oct  2 22:05:04 2014
@@ -2,6 +2,7 @@ package org.apache.felix.dependencymanag
 
 import java.util.Dictionary;
 
+import org.apache.felix.dependencymanager.samples.util.Helper;
 import org.apache.felix.dm.annotation.api.Component;
 import org.apache.felix.dm.annotation.api.ConfigurationDependency;
 import org.apache.felix.dm.annotation.api.ServiceDependency;
@@ -19,12 +20,12 @@ public class ServiceConsumer {
 	
     @ConfigurationDependency
     protected void update(Dictionary<?, ?> conf) {
-        System.out.println("ServiceConsumer updated with conf " + conf);
+        Helper.log("hello.annot", "ServiceConsumer.update: " + conf);
     }
     
     @Start
 	public void start() {
-        System.out.println(Thread.currentThread().getName() + ": Starting " + this.getClass().getName());
+        Helper.log("hello.annot", "ServiceConsumer.start: calling service.hello() ...");
 		this.service.hello();
 	}
 }

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/annot/ServiceProviderImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/annot/ServiceProviderImpl.java?rev=1629083&r1=1629082&r2=1629083&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/annot/ServiceProviderImpl.java
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/hello/annot/ServiceProviderImpl.java
Thu Oct  2 22:05:04 2014
@@ -1,5 +1,6 @@
 package org.apache.felix.dependencymanager.samples.hello.annot;
 
+import org.apache.felix.dependencymanager.samples.util.Helper;
 import org.apache.felix.dm.annotation.api.Component;
 
 
@@ -12,6 +13,6 @@ import org.apache.felix.dm.annotation.ap
 public class ServiceProviderImpl implements ServiceProvider {
 	@Override
 	public void hello() {
-        System.out.println(Thread.currentThread().getName() + ": Hello");
+        Helper.log("hello.annot", "ServiceProviderImpl.hello");
 	}
 }

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/tpool/Activator.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/tpool/Activator.java?rev=1629083&r1=1629082&r2=1629083&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/tpool/Activator.java
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/tpool/Activator.java
Thu Oct  2 22:05:04 2014
@@ -3,6 +3,7 @@ package org.apache.felix.dependencymanag
 import java.util.Hashtable;
 import java.util.concurrent.Executor;
 
+import org.apache.felix.dependencymanager.samples.util.Helper;
 import org.apache.felix.dm.DependencyActivatorBase;
 import org.apache.felix.dm.DependencyManager;
 import org.osgi.framework.BundleContext;
@@ -23,6 +24,7 @@ import org.osgi.framework.BundleContext;
 public class Activator extends DependencyActivatorBase {  
     @Override
     public void init(BundleContext context, DependencyManager mgr) throws Exception {
+        Helper.log("tpool", "Activator.init: registering threadpool");
         Hashtable props = new Hashtable();
         props.put("target", DependencyManager.THREADPOOL);
         mgr.add(createComponent()

Added: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/util/Helper.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/util/Helper.java?rev=1629083&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/util/Helper.java
(added)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/util/Helper.java
Thu Oct  2 22:05:04 2014
@@ -0,0 +1,7 @@
+package org.apache.felix.dependencymanager.samples.util;
+
+public class Helper {
+    public static void log(String who, String msg) {
+        System.out.println("[" + Thread.currentThread().getName() + " - " + who + "] " +
msg);
+    }
+}

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/tpool.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/tpool.bnd?rev=1629083&r1=1629082&r2=1629083&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/tpool.bnd
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.samples/tpool.bnd
Thu Oct  2 22:05:04 2014
@@ -1,3 +1,4 @@
 Private-Package:  \
-	org.apache.felix.dependencymanager.samples.tpool
+	org.apache.felix.dependencymanager.samples.tpool,\
+	org.apache.felix.dependencymanager.samples.util
 Bundle-Activator: org.apache.felix.dependencymanager.samples.tpool.Activator
\ No newline at end of file



Mime
View raw message