tom

Adding maven-scr-plugin to provide tree pom.xml; components are now igniting.

...@@ -41,11 +41,13 @@ public class SimpleDeviceManager implements DeviceProviderBroker { ...@@ -41,11 +41,13 @@ public class SimpleDeviceManager implements DeviceProviderBroker {
41 41
42 @Override 42 @Override
43 public DeviceProviderService register(DeviceProvider provider) { 43 public DeviceProviderService register(DeviceProvider provider) {
44 + log.info("Registering provider {}", provider.id());
44 return broker.register(provider); 45 return broker.register(provider);
45 } 46 }
46 47
47 @Override 48 @Override
48 public void unregister(DeviceProvider provider) { 49 public void unregister(DeviceProvider provider) {
50 + log.info("Unregistering provider {}", provider.id());
49 broker.unregister(provider); 51 broker.unregister(provider);
50 } 52 }
51 53
......
...@@ -5,7 +5,13 @@ import org.apache.felix.scr.annotations.Component; ...@@ -5,7 +5,13 @@ import org.apache.felix.scr.annotations.Component;
5 import org.apache.felix.scr.annotations.Deactivate; 5 import org.apache.felix.scr.annotations.Deactivate;
6 import org.apache.felix.scr.annotations.Reference; 6 import org.apache.felix.scr.annotations.Reference;
7 import org.apache.felix.scr.annotations.ReferenceCardinality; 7 import org.apache.felix.scr.annotations.ReferenceCardinality;
8 +import org.onlab.onos.net.Device;
9 +import org.onlab.onos.net.MastershipRole;
10 +import org.onlab.onos.net.device.DeviceProvider;
8 import org.onlab.onos.net.device.DeviceProviderBroker; 11 import org.onlab.onos.net.device.DeviceProviderBroker;
12 +import org.onlab.onos.net.device.DeviceProviderService;
13 +import org.onlab.onos.net.provider.AbstractProvider;
14 +import org.onlab.onos.net.provider.ProviderId;
9 import org.slf4j.Logger; 15 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory; 16 import org.slf4j.LoggerFactory;
11 17
...@@ -13,24 +19,47 @@ import org.slf4j.LoggerFactory; ...@@ -13,24 +19,47 @@ import org.slf4j.LoggerFactory;
13 * Device provider which uses an OpenFlow controller to detect devices. 19 * Device provider which uses an OpenFlow controller to detect devices.
14 */ 20 */
15 @Component 21 @Component
16 -public class OpenFlowDeviceProvider { 22 +public class OpenFlowDeviceProvider extends AbstractProvider implements DeviceProvider {
17 23
18 private final Logger log = LoggerFactory.getLogger(OpenFlowDeviceProvider.class); 24 private final Logger log = LoggerFactory.getLogger(OpenFlowDeviceProvider.class);
19 25
20 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 26 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
21 - protected DeviceProviderBroker broker; 27 + protected DeviceProviderBroker providerBroker;
28 +
29 + private DeviceProviderService providerService;
22 30
23 // @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 31 // @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
24 // protected OpenFlowController controller; 32 // protected OpenFlowController controller;
25 33
34 +
35 + /**
36 + * Creates an OpenFlow device provider.
37 + */
38 + public OpenFlowDeviceProvider() {
39 + super(new ProviderId("org.onlab.onos.provider.of.device"));
40 + }
41 +
26 @Activate 42 @Activate
27 public void activate() { 43 public void activate() {
44 + providerService = providerBroker.register(this);
28 log.info("Started"); 45 log.info("Started");
29 } 46 }
30 47
31 @Deactivate 48 @Deactivate
32 public void deactivate() { 49 public void deactivate() {
50 + providerBroker.unregister(this);
51 + providerService = null;
33 log.info("Stopped"); 52 log.info("Stopped");
34 } 53 }
35 54
55 + @Override
56 + public void triggerProbe(Device device) {
57 + log.info("Triggerring probe on device {}", device.id());
58 + }
59 +
60 + @Override
61 + public void roleChanged(Device device, MastershipRole newRole) {
62 + log.info("Accepting mastership role change fordevice {}", device.id());
63 + }
64 +
36 } 65 }
......
...@@ -37,6 +37,10 @@ ...@@ -37,6 +37,10 @@
37 <plugins> 37 <plugins>
38 <plugin> 38 <plugin>
39 <groupId>org.apache.felix</groupId> 39 <groupId>org.apache.felix</groupId>
40 + <artifactId>maven-scr-plugin</artifactId>
41 + </plugin>
42 + <plugin>
43 + <groupId>org.apache.felix</groupId>
40 <artifactId>maven-bundle-plugin</artifactId> 44 <artifactId>maven-bundle-plugin</artifactId>
41 </plugin> 45 </plugin>
42 </plugins> 46 </plugins>
......