Added Intent Subscriber and Module

Module is used to drive plan computation and installation
Also, added support for ADD/REMOVE in plan computation

Change-Id: Ib88eae8b13a1f5ed1503c5ff7762980f8ed032ac
diff --git a/src/main/java/net/onrc/onos/intent/FlowEntry.java b/src/main/java/net/onrc/onos/intent/FlowEntry.java
index 14d1038..13bfa21 100644
--- a/src/main/java/net/onrc/onos/intent/FlowEntry.java
+++ b/src/main/java/net/onrc/onos/intent/FlowEntry.java
@@ -4,11 +4,13 @@
 import java.util.Set;
 
 import net.floodlightcontroller.util.MACAddress;
+import net.onrc.onos.intent.IntentOperation.Operator;
 import net.onrc.onos.ofcontroller.networkgraph.Port;
 import net.onrc.onos.ofcontroller.networkgraph.Switch;
 import net.onrc.onos.ofcontroller.util.Dpid;
 import net.onrc.onos.ofcontroller.util.FlowEntryActions;
 import net.onrc.onos.ofcontroller.util.FlowEntryId;
+import net.onrc.onos.ofcontroller.util.FlowEntryUserState;
 
 /**
  * 
@@ -20,13 +22,16 @@
 	protected Switch sw;
 	protected Match match;
 	protected Set<Action> actions;
+	protected Operator operator;
 	
 	public FlowEntry(Switch sw, Port srcPort, Port dstPort, 
-					 MACAddress srcMac, MACAddress dstMac) {
+			 MACAddress srcMac, MACAddress dstMac,
+			 Operator operator) {
 		this.sw = sw;
 		this.match = new Match(sw, srcPort, srcMac, dstMac);
 		this.actions = new HashSet<Action>();
 		this.actions.add(new ForwardAction(dstPort));
+		this.operator = operator;
 	}
 	
 	public String toString() {
@@ -37,6 +42,14 @@
 	    return sw;
 	}
 	
+	public Operator getOperator() {
+	    return operator;
+	}
+	
+	public void setOperator(Operator op) {
+	    operator = op;
+	}
+	
 	public net.onrc.onos.ofcontroller.util.FlowEntry getFlowEntry() {
 		net.onrc.onos.ofcontroller.util.FlowEntry entry = new net.onrc.onos.ofcontroller.util.FlowEntry();
 		entry.setDpid(new Dpid(sw.getDpid()));
@@ -47,6 +60,17 @@
 		    flowEntryActions.addAction(action.getFlowEntryAction());
 		}
 		entry.setFlowEntryActions(flowEntryActions);
+		switch(operator) {
+		case ADD:
+		    entry.setFlowEntryUserState(FlowEntryUserState.FE_USER_MODIFY);
+		    break;
+		case REMOVE:
+		    entry.setFlowEntryUserState(FlowEntryUserState.FE_USER_DELETE);
+		    break;
+		}
 		return entry;
 	}
+	
+	//TODO: implement hash for cookie
+	//TODO: implement equals (don't include operator!)
 }
\ No newline at end of file