BUG-731: hide serverSessionManager 48/6748/1
authorRobert Varga <rovarga@cisco.com>
Tue, 6 May 2014 15:49:29 +0000 (17:49 +0200)
committerRobert Varga <rovarga@cisco.com>
Tue, 6 May 2014 15:49:29 +0000 (17:49 +0200)
It should not be visible, so expose the only functionality required by
subclasses.

Change-Id: Ic90c71080ed14cfcb1afbc67f18f85ab9888ffa5
Signed-off-by: Robert Varga <rovarga@cisco.com>
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/AbstractTopologySessionListener.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/Stateful02TopologySessionListener.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/Stateful07TopologySessionListener.java

index acc7e2d508f8c9717134ed2cd6b839bf9e86c113..c3cdc667a2fe9abc5dd2697eac8d8b67cf7ac277 100644 (file)
@@ -42,6 +42,7 @@ 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.topology.NodeBuilder;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
+import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -71,13 +72,11 @@ public abstract class AbstractTopologySessionListener<SRPID, PLSPID> implements
        };
        private static final Logger LOG = LoggerFactory.getLogger(AbstractTopologySessionListener.class);
 
-       // FIXME: make this private
-       protected final ServerSessionManager serverSessionManager;
-
        private final Map<SRPID, PCEPRequest> waitingRequests = new HashMap<>();
        private final Map<SRPID, PCEPRequest> sendingRequests = new HashMap<>();
        private final Map<String, ReportedLsp> lspData = new HashMap<>();
        private final Map<PLSPID, String> lsps = new HashMap<>();
+       private final ServerSessionManager serverSessionManager;
        private InstanceIdentifier<Node> topologyNode;
        private InstanceIdentifier<Node1> topologyAugment;
        private PathComputationClientBuilder pccBuilder;
@@ -376,4 +375,8 @@ public abstract class AbstractTopologySessionListener<SRPID, PLSPID> implements
                Preconditions.checkNotNull(id, "ID parameter null.");
                return this.lsps.get(id);
        }
+
+       protected final <T extends DataObject> T readOperationalData(final InstanceIdentifier<T> id) {
+               return serverSessionManager.readOperationalData(id);
+       }
 }
index 4caf11d67d404f33c62298755b9331fc6ff21fcb..018b63b659a4951ad1c7b9deb23f2ee61305f66f 100644 (file)
@@ -160,7 +160,7 @@ public class Stateful02TopologySessionListener extends AbstractTopologySessionLi
        public synchronized ListenableFuture<OperationResult> addLsp(final AddLspArgs input) {
                // Make sure there is no such LSP
                final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName()).build();
-               if (this.serverSessionManager.readOperationalData(lsp) != null) {
+               if (readOperationalData(lsp) != null) {
                        LOG.debug("Node {} already contains lsp {} at {}", input.getNode(), input.getName(), lsp);
                        return OperationResults.UNSENT.future();
                }
@@ -188,7 +188,7 @@ public class Stateful02TopologySessionListener extends AbstractTopologySessionLi
        public synchronized ListenableFuture<OperationResult> removeLsp(final RemoveLspArgs input) {
                // Make sure the LSP exists, we need it for PLSP-ID
                final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName()).build();
-               final ReportedLsp rep = this.serverSessionManager.readOperationalData(lsp);
+               final ReportedLsp rep = readOperationalData(lsp);
                if (rep == null) {
                        LOG.debug("Node {} does not contain LSP {}", input.getNode(), input.getName());
                        return OperationResults.UNSENT.future();
@@ -210,7 +210,7 @@ public class Stateful02TopologySessionListener extends AbstractTopologySessionLi
        public synchronized ListenableFuture<OperationResult> updateLsp(final UpdateLspArgs input) {
                // Make sure the LSP exists
                final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName()).build();
-               final ReportedLsp rep = this.serverSessionManager.readOperationalData(lsp);
+               final ReportedLsp rep = readOperationalData(lsp);
                if (rep == null) {
                        LOG.warn("Node {} does not contain LSP {}", input.getNode(), input.getName());
                        return OperationResults.UNSENT.future();
@@ -244,7 +244,7 @@ public class Stateful02TopologySessionListener extends AbstractTopologySessionLi
                // Make sure the LSP exists
                final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName()).build();
                LOG.debug("Checking if LSP {} has operational state {}", lsp, op);
-               final ReportedLsp rep = this.serverSessionManager.readOperationalData(lsp);
+               final ReportedLsp rep = readOperationalData(lsp);
                if (rep == null) {
                        LOG.debug("Node {} does not contain LSP {}", input.getNode(), input.getName());
                        return OperationResults.UNSENT.future();
index eea99a8e9007fd37ba3bd3031880b5a46714cc4d..03dcea609aaea595f3f4a027c0b20776dd350df8 100644 (file)
@@ -201,7 +201,7 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
        public synchronized ListenableFuture<OperationResult> addLsp(final AddLspArgs input) {
                // Make sure there is no such LSP
                final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName()).build();
-               if (this.serverSessionManager.readOperationalData(lsp) != null) {
+               if (readOperationalData(lsp) != null) {
                        LOG.debug("Node {} already contains lsp {} at {}", input.getNode(), input.getName(), lsp);
                        return OperationResults.UNSENT.future();
                }
@@ -227,7 +227,7 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
        public synchronized ListenableFuture<OperationResult> removeLsp(final RemoveLspArgs input) {
                // Make sure the LSP exists, we need it for PLSP-ID
                final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName()).build();
-               final ReportedLsp rep = this.serverSessionManager.readOperationalData(lsp);
+               final ReportedLsp rep = readOperationalData(lsp);
                if (rep == null) {
                        LOG.debug("Node {} does not contain LSP {}", input.getNode(), input.getName());
                        return OperationResults.UNSENT.future();
@@ -250,7 +250,7 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
        public synchronized ListenableFuture<OperationResult> updateLsp(final UpdateLspArgs input) {
                // Make sure the LSP exists
                final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName()).build();
-               final ReportedLsp rep = this.serverSessionManager.readOperationalData(lsp);
+               final ReportedLsp rep = readOperationalData(lsp);
                if (rep == null) {
                        LOG.debug("Node {} does not contain LSP {}", input.getNode(), input.getName());
                        return OperationResults.UNSENT.future();
@@ -284,7 +284,7 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
                // Make sure the LSP exists
                final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName()).build();
                LOG.debug("Checking if LSP {} has operational state {}", lsp, op);
-               final ReportedLsp rep = this.serverSessionManager.readOperationalData(lsp);
+               final ReportedLsp rep = readOperationalData(lsp);
                if (rep == null) {
                        LOG.debug("Node {} does not contain LSP {}", input.getNode(), input.getName());
                        return OperationResults.UNSENT.future();