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/IntentService.java b/src/main/java/net/onrc/onos/api/newintent/IntentService.java
new file mode 100644
index 0000000..14fa1dc
--- /dev/null
+++ b/src/main/java/net/onrc/onos/api/newintent/IntentService.java
@@ -0,0 +1,76 @@
+package net.onrc.onos.api.newintent;
+
+import java.util.Set;
+
+/**
+ * Service for application submitting or withdrawing their intents.
+ */
+public interface IntentService {
+    /**
+     * Submits an intent into the system.
+     *
+     * This is an asynchronous request meaning that any compiling
+     * or installation activities may be done at later time.
+     *
+     * @param intent intent to be submitted
+     */
+    void submit(Intent intent);
+
+    /**
+     * Withdraws an intent from the system.
+     *
+     * This is an asynchronous request meaning that the environment
+     * may be affected at later time.
+     *
+     * @param intent intent to be withdrawn
+     */
+    void withdraw(Intent intent);
+
+    /**
+     * Submits a batch of submit & withdraw operations. Such a batch is
+     * assumed to be processed together.
+     *
+     * This is an asynchronous request meaning that the environment
+     * may be affected at later time.
+     *
+     * @param operations batch of intent operations
+     */
+    void execute(IntentOperations operations);
+
+    /**
+     * Returns immutable set of intents currently in the system.
+     *
+     * @return set of intents
+     */
+    Set<Intent> getIntents();
+
+    /**
+     * Retrieves the intent specified by its identifier.
+     *
+     * @param id intent identifier
+     * @return the intent or null if one with the given identifier is not found
+     */
+    Intent getIntent(IntentId id);
+
+    /**
+     * Retrieves the state of an intent by its identifier.
+     *
+     * @param id intent identifier
+     * @return the intent state or null if one with the given identifier is not found
+     */
+    IntentState getIntentState(IntentId id);
+
+    /**
+     * Adds the specified listener for intent events.
+     *
+     * @param listener listener to be added
+     */
+    void addListener(IntentEventListener listener);
+
+    /**
+     * Removes the specified listener for intent events.
+     *
+     * @param listener listener to be removed
+     */
+    void removeListener(IntentEventListener listener);
+}