X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fcompatibility%2Fsal-compatibility%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcompatibility%2Ftopology%2FTopologyProvider.xtend;h=21f2b35f40a82c846df07e7ce05fab2ae540029c;hb=040d3eee776e73591337781c122f11b81aa02d40;hp=bf1a23d4bc2d90ae8307c3ab6f2998eb0fab716a;hpb=26da1d7b5baaef16e403cf6b926e36b604c4394a;p=controller.git diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyProvider.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyProvider.xtend index bf1a23d4bc..21f2b35f40 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyProvider.xtend +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyProvider.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility.topology import org.opendaylight.controller.sal.binding.api.data.DataProviderService @@ -8,10 +15,10 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey import org.opendaylight.yangtools.yang.binding.DataObject import org.opendaylight.yangtools.yang.binding.InstanceIdentifier -import org.opendaylight.yangtools.concepts.Registration -import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link import org.slf4j.LoggerFactory +import org.opendaylight.yangtools.concepts.ListenerRegistration +import org.opendaylight.controller.sal.binding.api.data.DataChangeListener class TopologyProvider implements AutoCloseable{ static val LOG = LoggerFactory.getLogger(TopologyProvider); @@ -23,26 +30,35 @@ class TopologyProvider implements AutoCloseable{ @Property DataProviderService dataService; - Registration,DataObject>> commitHandlerRegistration; + ListenerRegistration listenerRegistration + def void start() { - commitHandler = new TopologyCommitHandler(dataService) - commitHandler.setTopologyPublisher(topologyPublisher) + + } + def void startAdapter() { + if(dataService == null){ + LOG.error("dataService not set"); + return; + } + commitHandler = new TopologyCommitHandler(dataService,topologyPublisher); val InstanceIdentifier path = InstanceIdentifier.builder(NetworkTopology) .child(Topology,new TopologyKey(new TopologyId("flow:1"))) .child(Link) .toInstance(); - commitHandlerRegistration = dataService.registerCommitHandler(path,commitHandler); + listenerRegistration = dataService.registerDataChangeListener(path,commitHandler); LOG.info("TopologyProvider started") } override close() throws Exception { - commitHandlerRegistration.close + listenerRegistration.close } def setTopologyPublisher(IPluginOutTopologyService topologyPublisher) { _topologyPublisher = topologyPublisher; - commitHandler.setTopologyPublisher(topologyPublisher); + if(commitHandler != null){ + commitHandler.setTopologyPublisher(topologyPublisher); + } } -} \ No newline at end of file +}