tom

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

......@@ -41,11 +41,13 @@ public class SimpleDeviceManager implements DeviceProviderBroker {
@Override
public DeviceProviderService register(DeviceProvider provider) {
log.info("Registering provider {}", provider.id());
return broker.register(provider);
}
@Override
public void unregister(DeviceProvider provider) {
log.info("Unregistering provider {}", provider.id());
broker.unregister(provider);
}
......
......@@ -5,7 +5,13 @@ import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onlab.onos.net.Device;
import org.onlab.onos.net.MastershipRole;
import org.onlab.onos.net.device.DeviceProvider;
import org.onlab.onos.net.device.DeviceProviderBroker;
import org.onlab.onos.net.device.DeviceProviderService;
import org.onlab.onos.net.provider.AbstractProvider;
import org.onlab.onos.net.provider.ProviderId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -13,24 +19,47 @@ import org.slf4j.LoggerFactory;
* Device provider which uses an OpenFlow controller to detect devices.
*/
@Component
public class OpenFlowDeviceProvider {
public class OpenFlowDeviceProvider extends AbstractProvider implements DeviceProvider {
private final Logger log = LoggerFactory.getLogger(OpenFlowDeviceProvider.class);
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected DeviceProviderBroker broker;
protected DeviceProviderBroker providerBroker;
private DeviceProviderService providerService;
// @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
// protected OpenFlowController controller;
/**
* Creates an OpenFlow device provider.
*/
public OpenFlowDeviceProvider() {
super(new ProviderId("org.onlab.onos.provider.of.device"));
}
@Activate
public void activate() {
providerService = providerBroker.register(this);
log.info("Started");
}
@Deactivate
public void deactivate() {
providerBroker.unregister(this);
providerService = null;
log.info("Stopped");
}
@Override
public void triggerProbe(Device device) {
log.info("Triggerring probe on device {}", device.id());
}
@Override
public void roleChanged(Device device, MastershipRole newRole) {
log.info("Accepting mastership role change fordevice {}", device.id());
}
}
......
......@@ -37,6 +37,10 @@
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
</plugins>
......