From 4d19ab9398a18e2cc13f7278d61ba628aeac7f7a Mon Sep 17 00:00:00 2001 From: Yuta HIGUCHI Date: Thu, 27 Oct 2016 16:27:15 -0700 Subject: [PATCH] Adding javadoc to IntentInstaller.OperationContext Change-Id: I9b37b4181d9130fccbed19bb13b3c1df0c0d0e0d --- .../net/intent/impl/IntentInstaller.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentInstaller.java b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentInstaller.java index 1e569c4f71..8ea910b3e3 100644 --- a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentInstaller.java +++ b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentInstaller.java @@ -187,13 +187,41 @@ class IntentInstaller { private abstract class OperationContext { protected Optional toUninstall; protected Optional toInstall; + /** + * Implementation of {@link OperationContext} should call this on success. + */ protected Consumer successConsumer; + /** + * Implementation of {@link OperationContext} should call this on error. + */ protected Consumer errorConsumer; + /** + * Applies the Intents specified by + * {@link #prepareIntents(List, Direction)} call(s) prior to this call. + */ abstract void apply(); + /** + * Returns error state of the context. + *

+ * Used for error logging purpose. + * Returned Object should have reasonable toString() implementation. + * @return context state, describing current error state + */ abstract Object error(); + /** + * Prepares Intent(s) to {@link #apply() apply} in this operation. + *

+ * Intents specified by {@code intentsToApply} in a single call + * can be applied to the Devices in arbitrary order. + * But group of Intents specified in consecutive {@link #prepareIntents(List, Direction)} + * calls must be applied in order. (e.g., guarded by barrier) + * + * @param intentsToApply {@link Intent}s to apply + * @param direction of operation + */ abstract void prepareIntents(List intentsToApply, Direction direction); void prepare(Optional toUninstall, Optional toInstall, @@ -311,6 +339,7 @@ class IntentInstaller { FlowRuleOperations.Builder builder = FlowRuleOperations.builder(); FlowRuleOperationsContext flowRuleOperationsContext; + @Override void apply() { flowRuleOperationsContext = new FlowRuleOperationsContext() { @Override