Define APIs to determine how to translate an intent.
It's a part of ONOS-1654.
- IntentResolver handles translation of an intent
- IIntentRuntimeService supports to register/unregister IntentResolver
Change-Id: I9367fddf29eb55c3d7ed206e1fbf8635454f2e36
diff --git a/src/main/java/net/onrc/onos/api/intent/IntentResolver.java b/src/main/java/net/onrc/onos/api/intent/IntentResolver.java
new file mode 100644
index 0000000..1f13cdc
--- /dev/null
+++ b/src/main/java/net/onrc/onos/api/intent/IntentResolver.java
@@ -0,0 +1,24 @@
+package net.onrc.onos.api.intent;
+
+import java.util.List;
+
+/**
+ * An interface to translate an intent to lower level intents.
+ *
+ * IntentResolvers are registered to {@link IIntentRuntimeService} to handle translations of intents
+ * (we call it intent resolution).
+ *
+ * @param <T> the type of intent this resolver translates
+ */
+public interface IntentResolver<T extends Intent> {
+ /**
+ * Returns lower level intents, into which the given intent is translated.
+ *
+ * This method is invoked by the Intent Framework when the framework find an unresolved intent.
+ *
+ * @param intent the intent to be translated.
+ * @return lower level intents, into which the given intent is translated.
+ * @throws IntentResolutionException if this method can't resolve the intent.
+ */
+ public List<Intent> resolve(T intent) throws IntentResolutionException;
+}