1 package org.opendaylight.controller.sal.compatibility.topology
3 import java.util.Collections
5 import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction
6 import org.opendaylight.controller.md.sal.common.api.data.DataModification
7 import org.opendaylight.controller.sal.binding.api.data.DataProviderService
8 import org.opendaylight.controller.sal.topology.IPluginOutTopologyService
9 import org.opendaylight.controller.sal.topology.TopoEdgeUpdate
10 import org.opendaylight.yangtools.yang.binding.DataObject
11 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
12 import org.opendaylight.yangtools.yang.common.RpcResult
13 import org.slf4j.LoggerFactory
15 class TopologyTransaction implements DataCommitTransaction<InstanceIdentifier<?extends DataObject>, DataObject> {
16 static val LOG = LoggerFactory.getLogger(TopologyTransaction);
18 val DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification;
21 IPluginOutTopologyService topologyPublisher;
24 DataProviderService dataService;
26 List<TopoEdgeUpdate> edgeUpdates;
28 new(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification,IPluginOutTopologyService topologyPublisher,
29 DataProviderService dataService,List<TopoEdgeUpdate> edgeUpdates) {
30 _modification = modification;
31 _topologyPublisher = topologyPublisher
32 _dataService = dataService
33 _edgeUpdates = edgeUpdates
35 override finish() throws IllegalStateException {
37 if(topologyPublisher != null && _edgeUpdates != null && !edgeUpdates.empty) {
38 topologyPublisher.edgeUpdate(edgeUpdates)
41 return new RpcResultTo()
44 override getModification() {
48 override rollback() throws IllegalStateException {
52 class RpcResultTo implements RpcResult<Void> {
54 override getErrors() {
55 return Collections.emptySet
58 override getResult() {
62 override isSuccessful() {