Specialize RemoteDeviceHandler to NetconfSessionPreferences
[netconf.git] / netconf / sal-netconf-connector / src / main / java / org / opendaylight / netconf / sal / connect / netconf / NetconfDevice.java
index 4ffafe55b29528219898f0c3ba2df8847f40d803..2a68e0948e12b073757b40d7dd02b91ba4bbab7d 100644 (file)
@@ -20,7 +20,6 @@ import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.util.concurrent.EventExecutor;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -86,12 +85,8 @@ import org.slf4j.LoggerFactory;
 /**
  *  This is a mediator between NetconfDeviceCommunicator and NetconfDeviceSalFacade.
  */
-public class NetconfDevice
-        implements RemoteDevice<NetconfSessionPreferences, NetconfMessage, NetconfDeviceCommunicator> {
-
-    @SuppressFBWarnings(value = "SLF4J_LOGGER_SHOULD_BE_PRIVATE",
-            justification = "Needed for common logging of related classes")
-    static final Logger LOG = LoggerFactory.getLogger(NetconfDevice.class);
+public class NetconfDevice implements RemoteDevice<NetconfDeviceCommunicator> {
+    private static final Logger LOG = LoggerFactory.getLogger(NetconfDevice.class);
 
     private static final QName RFC8528_SCHEMA_MOUNTS_QNAME = QName.create(
         SchemaMountConstants.RFC8528_MODULE, "schema-mounts").intern();
@@ -105,7 +100,7 @@ public class NetconfDevice
 
     protected final List<SchemaSourceRegistration<?>> sourceRegistrations = new ArrayList<>();
 
-    private final RemoteDeviceHandler<NetconfSessionPreferences> salFacade;
+    private final RemoteDeviceHandler salFacade;
     private final ListeningExecutorService processingExecutor;
     private final DeviceActionFactory deviceActionFactory;
     private final NetconfDeviceSchemasResolver stateSchemasResolver;
@@ -120,17 +115,17 @@ public class NetconfDevice
     private boolean connected = false;
 
     // Message transformer is constructed once the schemas are available
-    private MessageTransformer<NetconfMessage> messageTransformer;
+    private MessageTransformer messageTransformer;
 
     public NetconfDevice(final SchemaResourcesDTO schemaResourcesDTO, final BaseNetconfSchemas baseSchemas,
-            final RemoteDeviceId id, final RemoteDeviceHandler<NetconfSessionPreferences> salFacade,
+            final RemoteDeviceId id, final RemoteDeviceHandler salFacade,
             final ListeningExecutorService globalProcessingExecutor, final boolean reconnectOnSchemasChange) {
         this(schemaResourcesDTO, baseSchemas, id, salFacade, globalProcessingExecutor, reconnectOnSchemasChange, null,
             null, null, null);
     }
 
     public NetconfDevice(final SchemaResourcesDTO schemaResourcesDTO, final BaseNetconfSchemas baseSchemas,
-            final RemoteDeviceId id, final RemoteDeviceHandler<NetconfSessionPreferences> salFacade,
+            final RemoteDeviceId id, final RemoteDeviceHandler salFacade,
             final ListeningExecutorService globalProcessingExecutor, final boolean reconnectOnSchemasChange,
             final DeviceActionFactory deviceActionFactory, final NetconfNode node, final EventExecutor eventExecutor,
             final NetconfNodeAugmentedOptional nodeOptional) {
@@ -248,9 +243,8 @@ public class NetconfDevice
     }
 
     private synchronized void handleSalInitializationSuccess(final MountPointContext result,
-                                        final NetconfSessionPreferences remoteSessionCapabilities,
-                                        final DOMRpcService deviceRpc,
-                                        final RemoteDeviceCommunicator<NetconfMessage> listener) {
+            final NetconfSessionPreferences remoteSessionCapabilities, final DOMRpcService deviceRpc,
+            final RemoteDeviceCommunicator listener) {
         //NetconfDevice.SchemaSetup can complete after NetconfDeviceCommunicator was closed. In that case do nothing,
         //since salFacade.onDeviceDisconnected was already called.
         if (connected) {
@@ -269,8 +263,7 @@ public class NetconfDevice
         }
     }
 
-    private void handleSalInitializationFailure(final Throwable throwable,
-                                                final RemoteDeviceCommunicator<NetconfMessage> listener) {
+    private void handleSalInitializationFailure(final Throwable throwable, final RemoteDeviceCommunicator listener) {
         LOG.error("{}: Initialization in sal failed, disconnecting from device", id, throwable);
         listener.close();
         onRemoteSessionDown();
@@ -284,7 +277,7 @@ public class NetconfDevice
         updateTransformer(null);
     }
 
-    private synchronized void updateTransformer(final MessageTransformer<NetconfMessage> transformer) {
+    private synchronized void updateTransformer(final MessageTransformer transformer) {
         messageTransformer = transformer;
     }
 
@@ -368,7 +361,7 @@ public class NetconfDevice
     }
 
     protected NetconfDeviceRpc getDeviceSpecificRpc(final MountPointContext result,
-            final RemoteDeviceCommunicator<NetconfMessage> listener, final BaseSchema schema) {
+            final RemoteDeviceCommunicator listener, final BaseSchema schema) {
         return new NetconfDeviceRpc(result.getEffectiveModelContext(), listener,
             new NetconfMessageTransformer(result, true, schema));
     }