Add InstallableIntent implementations

- PathFlowIntent
- SingleDstTreeFlowIntent
- SingleSrcTreeFlowIntent

These intents are intented to be generated by IntentCompilers and used
internally in IntentService implementation. IntentInstaller for above Intent
types handles installations.

This resolves ONOS-1881, ONOS-1882, and ONOS-1883.

Change-Id: Iacdcbc46d8b61e3ef13091d4a88fe6fb8ea990e6
diff --git a/src/main/java/net/onrc/onos/core/newintent/PathFlowIntent.java b/src/main/java/net/onrc/onos/core/newintent/PathFlowIntent.java
new file mode 100644
index 0000000..988a8b3
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/newintent/PathFlowIntent.java
@@ -0,0 +1,63 @@
+package net.onrc.onos.core.newintent;
+
+import com.google.common.base.Objects;
+import net.onrc.onos.api.flowmanager.PathFlow;
+import net.onrc.onos.api.newintent.AbstractIntent;
+import net.onrc.onos.api.newintent.InstallableIntent;
+import net.onrc.onos.api.newintent.IntentId;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Intent containing {@link PathFlow} object, which defines an explicit path.
+ *
+ * It is intended to establish a path by using Flow Manager's API.
+ */
+public class PathFlowIntent extends AbstractIntent implements InstallableIntent {
+
+    private final PathFlow flow;
+
+    public PathFlowIntent(IntentId id, PathFlow flow) {
+        super(id);
+        this.flow = checkNotNull(flow);
+    }
+
+    /**
+     * Returns {@link PathFlow} object, which defines an explicit path.
+     *
+     * @return {@link PathFlow path}
+     */
+    public PathFlow getFlow() {
+        return flow;
+
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        if (!super.equals(o)) {
+            return false;
+        }
+
+        PathFlowIntent that = (PathFlowIntent) o;
+        return Objects.equal(this.flow, that.flow);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(super.hashCode(), flow);
+    }
+
+    @Override
+    public String toString() {
+        return Objects.toStringHelper(getClass())
+                .add("id", getId())
+                .add("flow", flow)
+                .toString();
+    }
+}
diff --git a/src/main/java/net/onrc/onos/core/newintent/SingleDstTreeFlowIntent.java b/src/main/java/net/onrc/onos/core/newintent/SingleDstTreeFlowIntent.java
new file mode 100644
index 0000000..498eb0a
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/newintent/SingleDstTreeFlowIntent.java
@@ -0,0 +1,68 @@
+package net.onrc.onos.core.newintent;
+
+import com.google.common.base.Objects;
+import net.onrc.onos.api.flowmanager.SingleDstTreeFlow;
+import net.onrc.onos.api.newintent.AbstractIntent;
+import net.onrc.onos.api.newintent.InstallableIntent;
+import net.onrc.onos.api.newintent.IntentId;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Intent containing {@link SingleDstTreeFlow} object, which defines an explicit tree.
+ *
+ * It is intended to establish a path by using Flow Manager's API.
+ */
+public class SingleDstTreeFlowIntent extends AbstractIntent implements InstallableIntent {
+
+    private final SingleDstTreeFlow tree;
+
+    /**
+     * Constructs an intent containing the specified {@link SingleDstTreeFlow tree}.
+     *
+     * @param id intent identifier
+     * @param tree tree
+     */
+    public SingleDstTreeFlowIntent(IntentId id, SingleDstTreeFlow tree) {
+        super(id);
+        this.tree = checkNotNull(tree);
+    }
+
+    /**
+     * Returns the tree.
+     *
+     * @return tree
+     */
+    public SingleDstTreeFlow getTree() {
+        return tree;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        if (!super.equals(o)) {
+            return false;
+        }
+
+        SingleDstTreeFlowIntent that = (SingleDstTreeFlowIntent) o;
+        return Objects.equal(this.tree, that.tree);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(super.hashCode(), tree);
+    }
+
+    @Override
+    public String toString() {
+        return Objects.toStringHelper(getClass())
+                .add("id", getId())
+                .add("tree", tree)
+                .toString();
+    }
+}
diff --git a/src/main/java/net/onrc/onos/core/newintent/SingleSrcTreeFlowIntent.java b/src/main/java/net/onrc/onos/core/newintent/SingleSrcTreeFlowIntent.java
new file mode 100644
index 0000000..a203605
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/newintent/SingleSrcTreeFlowIntent.java
@@ -0,0 +1,68 @@
+package net.onrc.onos.core.newintent;
+
+import com.google.common.base.Objects;
+import net.onrc.onos.api.flowmanager.SingleSrcTreeFlow;
+import net.onrc.onos.api.newintent.AbstractIntent;
+import net.onrc.onos.api.newintent.InstallableIntent;
+import net.onrc.onos.api.newintent.IntentId;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Intent containing {@link  SingleSrcTreeFlow} object, which defines an explicit tree.
+ *
+ * It is intended to establish a path by using Flow Manager's API.
+ */
+public class SingleSrcTreeFlowIntent extends AbstractIntent implements InstallableIntent {
+
+    private final SingleSrcTreeFlow tree;
+
+    /**
+     * Constructs an intent containing the specified {@link SingleSrcTreeFlow tree}.
+     *
+     * @param id intent identifier
+     * @param tree tree
+     */
+    public SingleSrcTreeFlowIntent(IntentId id, SingleSrcTreeFlow tree) {
+        super(id);
+        this.tree = checkNotNull(tree);
+    }
+
+    /**
+     * Returns the tree.
+     *
+     * @return tree
+     */
+    public SingleSrcTreeFlow getTree() {
+        return tree;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        if (!super.equals(o)) {
+            return false;
+        }
+
+        SingleSrcTreeFlowIntent that = (SingleSrcTreeFlowIntent) o;
+        return Objects.equal(this.tree, that.tree);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(super.hashCode(), tree);
+    }
+
+    @Override
+    public String toString() {
+        return Objects.toStringHelper(getClass())
+                .add("id", getId())
+                .add("tree", tree)
+                .toString();
+    }
+}