<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>blueprint-maven-plugin-annotation</artifactId>
+ <optional>true</optional>
+ </dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>blueprint-maven-plugin</artifactId>
+ <configuration>
+ <scanPaths>
+ <scanPath>org.opendaylight.openflowplugin.openflow.ofswitch.config</scanPath>
+ </scanPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
import java.util.Collection;
import java.util.concurrent.Future;
import javax.annotation.Nonnull;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import org.apache.aries.blueprint.annotation.service.Reference;
import org.opendaylight.controller.md.sal.binding.api.ClusteredDataTreeChangeListener;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class DefaultConfigPusher implements AutoCloseable, ClusteredDataTreeChangeListener<FlowCapableNode> {
private static final Logger LOG = LoggerFactory.getLogger(DefaultConfigPusher.class);
private static final long STARTUP_LOOP_TICK = 500L;
private final DeviceOwnershipService deviceOwnershipService;
private ListenerRegistration<?> listenerRegistration;
- public DefaultConfigPusher(NodeConfigService nodeConfigService, DataBroker dataBroker,
- DeviceOwnershipService deviceOwnershipService) {
+ @Inject
+ public DefaultConfigPusher(NodeConfigService nodeConfigService, @Reference DataBroker dataBroker,
+ @Reference DeviceOwnershipService deviceOwnershipService) {
this.nodeConfigService = nodeConfigService;
this.dataBroker = dataBroker;
this.deviceOwnershipService = Preconditions.checkNotNull(deviceOwnershipService,
}
@SuppressWarnings("checkstyle:IllegalCatch")
+ @PostConstruct
public void start() {
try {
final InstanceIdentifier<FlowCapableNode> path = InstanceIdentifier.create(Nodes.class).child(Node.class)
}
@Override
+ @PreDestroy
public void close() {
if (listenerRegistration != null) {
listenerRegistration.close();
xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
odl:use-default-for-reference-types="true">
- <reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"/>
- <reference id="deviceOwnershipService" interface="org.opendaylight.openflowplugin.applications.deviceownershipservice.DeviceOwnershipService"/>
-
<odl:rpc-service id="nodeConfigService" interface="org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.NodeConfigService"/>
- <bean id="LLDPPacketPuntEnforcer" class="org.opendaylight.openflowplugin.openflow.ofswitch.config.DefaultConfigPusher"
- init-method="start" destroy-method="close">
- <argument ref="nodeConfigService"/>
- <argument ref="dataBroker"/>
- <argument ref="deviceOwnershipService"/>
- </bean>
</blueprint>
\ No newline at end of file