Bug 5596 Created lifecycle service
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / statistics / StatisticsContext.java
index eeb55c65be50cab5e1bf5096ed169991681ad75d..d681cfde8fe36601b14b516127793cc83ef667c4 100644 (file)
@@ -8,15 +8,60 @@
 
 package org.opendaylight.openflowplugin.api.openflow.statistics;
 
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
-import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
+import com.google.common.util.concurrent.ListenableFuture;
+import io.netty.util.Timeout;
+import java.util.Optional;
+import org.opendaylight.openflowplugin.api.openflow.OFPContext;
+import org.opendaylight.openflowplugin.api.openflow.OFPManager;
+import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
+import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
+import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
 
 /**
- * Created by Martin Bobak <mbobak@cisco.com> on 27.2.2015.
+ * Context for statistics
  */
-public interface StatisticsContext {
+public interface StatisticsContext extends RequestContextStack, AutoCloseable, OFPContext {
 
-    void setDeviceContext(DeviceContext deviceContext);
+    /**
+     * Gather data from device
+     * @return true if gathering was successful
+     */
+    ListenableFuture<Boolean> gatherDynamicData();
 
-    void setRequestContext(RequestContext requestContext);
+    /**
+     * Initial data gathering
+     * @return true if gathering was successful
+     */
+    ListenableFuture<Boolean> initialGatherDynamicData();
+
+    /**
+     * Method has to be called from DeviceInitialization Method, otherwise
+     * we are not able to poll anything. Statistics Context normally initialize
+     * this part by initialization process but we don't have this information
+     * in initialization phase and we have to populate whole list after every
+     * device future collecting. Because device future collecting set DeviceState
+     * and we creating marks for the correct kind of stats from DeviceState.
+     */
+    void statListForCollectingInitialization();
+
+    /**
+     * @param pollTimeout handle to nearest scheduled statistics poll
+     */
+    void setPollTimeout(Timeout pollTimeout);
+
+    /**
+     * @return handle to currently scheduled statistics polling
+     */
+    Optional<Timeout> getPollTimeout();
+
+    /**
+     * @return dedicated item life cycle change listener (per device)
+     */
+    ItemLifecycleListener getItemLifeCycleListener();
+
+    @Override
+    void close();
+
+    void setSchedulingEnabled(boolean schedulingEnabled);
+    boolean isSchedulingEnabled();
 }