Define the new Intent Framework APIs (Intent Service)
- Define the base Intent class and sub-classes required in SDN-IP
- IntentService provides the APIs for application developers
- IntentExtensionService enables to define application specific intent types
- Provide event handling mechanism via IntentEventListener
This is for ONOS-1654.
Change-Id: Id1705f1fbc1acd4862b33fd9ab97aafe2e84a685
diff --git a/src/main/java/net/onrc/onos/api/newintent/AbstractIntent.java b/src/main/java/net/onrc/onos/api/newintent/AbstractIntent.java
new file mode 100644
index 0000000..f2e3d8a
--- /dev/null
+++ b/src/main/java/net/onrc/onos/api/newintent/AbstractIntent.java
@@ -0,0 +1,42 @@
+package net.onrc.onos.api.newintent;
+
+/**
+ * Base intent implementation.
+ */
+public abstract class AbstractIntent implements Intent {
+
+ private final IntentId id;
+
+ /**
+ * Creates a base intent with the specified identifier.
+ *
+ * @param id intent identifier
+ */
+ protected AbstractIntent(IntentId id) {
+ this.id = id;
+ }
+
+ @Override
+ public IntentId getId() {
+ return id;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ AbstractIntent that = (AbstractIntent) o;
+ return id.equals(that.id);
+ }
+
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+
+}