Bug 1764 - moved Session related interfaces to openflowplugin-api
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / session / SessionContextOFImpl.java
index bef5201d4663b6cbe87300a744ce7fba1cd9cf53..3749756ff04ff7d4b5ce5720a427f2a53f22d960 100644 (file)
@@ -18,10 +18,16 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicLong;
 
-import org.opendaylight.openflowplugin.openflow.md.core.ConnectionConductor;
-import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDistinguisher;
+import org.opendaylight.openflowplugin.api.openflow.md.core.session.IMessageDispatchService;
+import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
+import org.opendaylight.openflowplugin.api.openflow.md.core.session.SwitchSessionKeyOF;
+import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitch;
+import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;
+import org.opendaylight.openflowplugin.api.openflow.md.core.NotificationEnqueuer;
+import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping;
+import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
 
 /**
  * @author mirehak
@@ -30,13 +36,17 @@ public class SessionContextOFImpl implements SessionContext {
 
     private GetFeaturesOutput features;
     private ConnectionConductor primaryConductor;
+    private NotificationEnqueuer notificationEnqueuer;
     private ConcurrentHashMap<SwitchConnectionDistinguisher, ConnectionConductor> auxiliaryConductors;
     private boolean valid;
-    private SwitchConnectionDistinguisher sessionKey;
+    private SwitchSessionKeyOF sessionKey;
     private IMessageDispatchService mdService;
     private final AtomicLong xid;
     private final Map<Long, PortGrouping> physicalPorts;
     private final Map<Long, Boolean> portBandwidth;
+    private CompositeObjectRegistration<ModelDrivenSwitch> providerRegistration;
+    private int seed;
+    
 
     /**
      * default ctor
@@ -71,7 +81,7 @@ public class SessionContextOFImpl implements SessionContext {
     public Set<Entry<SwitchConnectionDistinguisher, ConnectionConductor>> getAuxiliaryConductors() {
         return Collections.unmodifiableSet(auxiliaryConductors.entrySet());
     }
-
+    
     @Override
     public GetFeaturesOutput getFeatures() {
         return features;
@@ -112,12 +122,19 @@ public class SessionContextOFImpl implements SessionContext {
     /**
      * @param sessionKey the sessionKey to set
      */
-    public void setSessionKey(SwitchConnectionDistinguisher sessionKey) {
+    public void setSessionKey(SwitchSessionKeyOF sessionKey) {
         this.sessionKey = sessionKey;
     }
+    
+    /**
+     * @param seed the seed to set
+     */
+    public void setSeed(int seed) {
+        this.seed = seed;
+    }
 
     @Override
-    public SwitchConnectionDistinguisher getSessionKey() {
+    public SwitchSessionKeyOF getSessionKey() {
         return sessionKey;
     }
 
@@ -190,4 +207,33 @@ public class SessionContextOFImpl implements SessionContext {
         }
         return result;
     }
+    
+    @Override
+    public void setProviderRegistration(
+            CompositeObjectRegistration<ModelDrivenSwitch> providerRegistration) {
+                this.providerRegistration = providerRegistration;
+    }
+    
+    @Override
+    public CompositeObjectRegistration<ModelDrivenSwitch> getProviderRegistration() {
+        return providerRegistration;
+    }
+    
+    @Override
+    public int getSeed() {
+        return seed;
+    }
+    
+    /**
+     * @param notificationEnqueuer the notificationEnqueuer to set
+     */
+    public void setNotificationEnqueuer(
+            NotificationEnqueuer notificationEnqueuer) {
+        this.notificationEnqueuer = notificationEnqueuer;
+    }
+    
+    @Override
+    public NotificationEnqueuer getNotificationEnqueuer() {
+        return notificationEnqueuer;
+    }
 }