*/
package org.opendaylight.openflowplugin.applications.topology.manager;
-import com.google.common.base.Optional;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
+import java.util.Optional;
import java.util.concurrent.ExecutionException;
import javax.annotation.Nonnull;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+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.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationService;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class FlowCapableTopologyProvider implements ClusterSingletonService, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(FlowCapableTopologyProvider.class);
private static final String TOPOLOGY_PROVIDER = "ofp-topology-manager";
static final String TOPOLOGY_ID = "flow:1";
private final DataBroker dataBroker;
- private final NotificationProviderService notificationService;
+ private final NotificationService notificationService;
private final OperationProcessor processor;
private final ClusterSingletonServiceProvider clusterSingletonServiceProvider;
private InstanceIdentifier<Topology> topologyPathIID;
private ListenerRegistration<NotificationListener> listenerRegistration;
private ClusterSingletonServiceRegistration singletonServiceRegistration;
- public FlowCapableTopologyProvider(final DataBroker dataBroker,
- final NotificationProviderService notificationService,
+ @Inject
+ public FlowCapableTopologyProvider(@Reference final DataBroker dataBroker,
+ @Reference final NotificationService notificationService,
final OperationProcessor processor,
- final ClusterSingletonServiceProvider clusterSingletonServiceProvider) {
+ @Reference final ClusterSingletonServiceProvider
+ clusterSingletonServiceProvider) {
this.dataBroker = dataBroker;
this.notificationService = notificationService;
this.processor = processor;
/**
* Gets called on start of a bundle.
*/
+ @PostConstruct
public void start() {
final TopologyKey key = new TopologyKey(new TopologyId(TOPOLOGY_ID));
this.topologyPathIID = InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, key);
}
@Override
+ @PreDestroy
public void close() {
this.transactionChainManager.close();
if (this.listenerRegistration != null) {