PCEPSessionNegotiatorFactory is not generic
[bgpcep.git] / pcep / impl / src / main / java / org / opendaylight / protocol / pcep / impl / AbstractPCEPSessionNegotiatorFactory.java
index c31f458182bb75533f785585418d9b0f83c13001..1a07ee291cba2ba0e29367f51e657c37f8b5ff8c 100644 (file)
@@ -9,11 +9,11 @@ package org.opendaylight.protocol.pcep.impl;
 
 import io.netty.channel.Channel;
 import io.netty.util.concurrent.Promise;
-import org.opendaylight.protocol.framework.SessionListenerFactory;
-import org.opendaylight.protocol.framework.SessionNegotiator;
-import org.opendaylight.protocol.framework.SessionNegotiatorFactory;
-import org.opendaylight.protocol.pcep.PCEPSessionListener;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
+import org.opendaylight.protocol.pcep.PCEPSession;
+import org.opendaylight.protocol.pcep.PCEPSessionNegotiatorFactory;
+import org.opendaylight.protocol.pcep.PCEPSessionNegotiatorFactoryDependencies;
+import org.opendaylight.protocol.pcep.SessionNegotiator;
+import org.opendaylight.yangtools.yang.common.Uint8;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -21,33 +21,34 @@ import org.slf4j.LoggerFactory;
  * SessionNegotiator which takes care of making sure sessions between PCEP peers are kept unique. This needs to be
  * further subclassed to provide either a client or server factory.
  */
-public abstract class AbstractPCEPSessionNegotiatorFactory implements
-        SessionNegotiatorFactory<Message, PCEPSessionImpl, PCEPSessionListener> {
-
+public abstract class AbstractPCEPSessionNegotiatorFactory implements PCEPSessionNegotiatorFactory {
     private static final Logger LOG = LoggerFactory.getLogger(AbstractPCEPSessionNegotiatorFactory.class);
 
-    private PCEPPeerRegistry sessionRegistry = new PCEPPeerRegistry();
+    private final PCEPPeerRegistry sessionRegistry = new PCEPPeerRegistry();
 
     /**
      * Create a new negotiator. This method needs to be implemented by subclasses to actually provide a negotiator.
      *
-     * @param promise Session promise to be completed by the negotiator
-     * @param channel Associated channel
+     * @param snd       PCEP Session Negotiator dependencies
+     * @param promise   Session promise to be completed by the negotiator
+     * @param channel   Associated channel
      * @param sessionId Session ID assigned to the resulting session
      * @return a PCEP session negotiator
      */
-    protected abstract AbstractPCEPSessionNegotiator createNegotiator(Promise<PCEPSessionImpl> promise, PCEPSessionListener listener,
-            Channel channel, short sessionId);
+    protected abstract AbstractPCEPSessionNegotiator createNegotiator(
+            PCEPSessionNegotiatorFactoryDependencies snd,
+            Promise<PCEPSession> promise,
+            Channel channel, Uint8 sessionId);
 
     @Override
-    public final SessionNegotiator<PCEPSessionImpl> getSessionNegotiator(final SessionListenerFactory<PCEPSessionListener> factory,
-            final Channel channel, final Promise<PCEPSessionImpl> promise) {
+    public final SessionNegotiator getSessionNegotiator(final PCEPSessionNegotiatorFactoryDependencies dependencies,
+            final Channel channel, final Promise<PCEPSession> promise) {
 
         LOG.debug("Instantiating bootstrap negotiator for channel {}", channel);
-        return new PCEPSessionNegotiator(channel, promise, factory, this);
+        return new PCEPSessionNegotiator(channel, promise, dependencies, this);
     }
 
     public PCEPPeerRegistry getSessionRegistry() {
-        return this.sessionRegistry;
+        return sessionRegistry;
     }
 }