Implement event listeners of the FlowManager.
- This commit adds two types of event objects: FlowBatchStateChangedEvent and FlowStatesChangedEvent.
- Listeners for these objects are defined by FlowManagerListener interface.
- FlowBatchStateChangedEvent notifies state changes of the flow batch operation.
-- The state is defined by FlowBatchState.
- FlowStatesChangedEvent notifies state changes of the set of Flow objects.
-- The state is defined by FlowState.
- This task is a part of ONOS-1739.
Change-Id: Ie8b3bb1c58dbe6bc608936e4a269e1de12dee96c
diff --git a/src/main/java/net/onrc/onos/api/flowmanager/FlowStateChange.java b/src/main/java/net/onrc/onos/api/flowmanager/FlowStateChange.java
new file mode 100644
index 0000000..9d7f0d6
--- /dev/null
+++ b/src/main/java/net/onrc/onos/api/flowmanager/FlowStateChange.java
@@ -0,0 +1,50 @@
+package net.onrc.onos.api.flowmanager;
+
+/**
+ * The class which expresses the state changes of Flow object.
+ */
+public class FlowStateChange {
+ private final FlowId flowId;
+ private final FlowState current;
+ private final FlowState previous;
+
+ /**
+ * Creates {@link FlowStateChange} instance.
+ *
+ * @param flowId the ID of the target flow
+ * @param current the current state of the flow
+ * @param previous the previous state of the flow
+ */
+ FlowStateChange(FlowId flowId, FlowState current, FlowState previous) {
+ this.flowId = flowId;
+ this.current = current;
+ this.previous = previous;
+ }
+
+ /**
+ * Gets the ID of the flow.
+ *
+ * @return the flow ID
+ */
+ public FlowId getFlowId() {
+ return flowId;
+ }
+
+ /**
+ * Gets the current state of the flow.
+ *
+ * @return the current state of the flow
+ */
+ public FlowState getCurrentState() {
+ return current;
+ }
+
+ /**
+ * Gets the previous state of the flow.
+ *
+ * @return the previous state of the flow
+ */
+ public FlowState getPreviousState() {
+ return previous;
+ }
+}