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 06f7b4a12263712af86e64f2f643c0110ca4e2e8..3749756ff04ff7d4b5ce5720a427f2a53f22d960 100644 (file)
@@ -18,14 +18,13 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicLong;
 
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-
-import java.util.concurrent.TimeUnit;
-
-import org.opendaylight.openflowplugin.openflow.md.ModelDrivenSwitch;
-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;
@@ -37,16 +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;
-    public static Cache<TransactionKey, Object> bulkTransactionCache = CacheBuilder.newBuilder().expireAfterWrite(10000, TimeUnit.MILLISECONDS).concurrencyLevel(1).build();
     private CompositeObjectRegistration<ModelDrivenSwitch> providerRegistration;
-
+    private int seed;
+    
 
     /**
      * default ctor
@@ -82,11 +82,6 @@ public class SessionContextOFImpl implements SessionContext {
         return Collections.unmodifiableSet(auxiliaryConductors.entrySet());
     }
     
-    @Override
-    public Cache<TransactionKey, Object> getbulkTransactionCache() {
-        return bulkTransactionCache;
-    }
-
     @Override
     public GetFeaturesOutput getFeatures() {
         return features;
@@ -127,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;
     }
 
@@ -216,4 +218,22 @@ public class SessionContextOFImpl implements SessionContext {
     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;
+    }
 }