Move IntentUpdate subclasses to the dedicated package

Resolve ONOS-1051
- Create package "phase" under intent.impl
- Rename IntentUpdate and CompletedIntentUpdate
  - IntentUpdate -> IntentProcessPhase
  - CompletedIntentUpdate -> FinalIntentProcessPhase
- Loosen method/field visibility as short term hack

Change-Id: Idc0fd9a74aadd227d62006d00fee473c63b1fc05
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
index b39d280..0a2316d 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
@@ -47,6 +47,12 @@
 import org.onosproject.net.intent.IntentStore;
 import org.onosproject.net.intent.IntentStoreDelegate;
 import org.onosproject.net.intent.Key;
+import org.onosproject.net.intent.impl.phase.CompilingFailed;
+import org.onosproject.net.intent.impl.phase.FinalIntentProcessPhase;
+import org.onosproject.net.intent.impl.phase.InstallRequest;
+import org.onosproject.net.intent.impl.phase.IntentProcessPhase;
+import org.onosproject.net.intent.impl.phase.WithdrawRequest;
+import org.onosproject.net.intent.impl.phase.Withdrawn;
 import org.slf4j.Logger;
 
 import java.util.ArrayList;
@@ -112,8 +118,9 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected EventDeliveryService eventDispatcher;
 
+    // TODO: make this protected due to short term hack for ONOS-1051
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected FlowRuleService flowRuleService;
+    public FlowRuleService flowRuleService;
 
 
     private ExecutorService batchExecutor;
@@ -268,7 +275,8 @@
      * @param previousInstallables previous intent installables
      * @return result of compilation
      */
-    List<Intent> compileIntent(Intent intent, List<Intent> previousInstallables) {
+    // TODO: make this non-public due to short term hack for ONOS-1051
+    public List<Intent> compileIntent(Intent intent, List<Intent> previousInstallables) {
         if (intent.isInstallable()) {
             return ImmutableList.of(intent);
         }
@@ -284,7 +292,8 @@
 
     //TODO javadoc
     //FIXME
-    FlowRuleOperations coordinate(IntentData current, IntentData pending) {
+    // TODO: make this non-public due to short term hack for ONOS-1051
+    public FlowRuleOperations coordinate(IntentData current, IntentData pending) {
         List<Intent> oldInstallables = (current != null) ? current.installables() : null;
         List<Intent> newInstallables = pending.installables();
 
@@ -347,7 +356,8 @@
      * @param current intent data stored in the store
      * @return flow rule operations
      */
-    FlowRuleOperations uninstallCoordinate(IntentData current, IntentData pending) {
+    // TODO: make this non-public due to short term hack for ONOS-1051
+    public FlowRuleOperations uninstallCoordinate(IntentData current, IntentData pending) {
         List<Intent> installables = current.installables();
         List<List<FlowRuleBatchOperation>> plans = new ArrayList<>();
         for (Intent installable : installables) {
@@ -520,7 +530,7 @@
         }
     }
 
-    private IntentUpdate createIntentUpdate(IntentData intentData) {
+    private IntentProcessPhase createIntentUpdate(IntentData intentData) {
         IntentData current = store.getIntentData(intentData.key());
         switch (intentData.state()) {
             case INSTALL_REQ:
@@ -537,7 +547,7 @@
         }
     }
 
-    private Future<CompletedIntentUpdate> submitIntentData(IntentData data) {
+    private Future<FinalIntentProcessPhase> submitIntentData(IntentData data) {
         return workerExecutor.submit(new IntentWorker(data));
     }
 
@@ -590,15 +600,15 @@
             }
         }
 
-        private List<Future<CompletedIntentUpdate>> createIntentUpdates() {
+        private List<Future<FinalIntentProcessPhase>> createIntentUpdates() {
             return data.stream()
                     .map(IntentManager.this::submitIntentData)
                     .collect(Collectors.toList());
         }
 
-        private List<CompletedIntentUpdate> waitForFutures(List<Future<CompletedIntentUpdate>> futures) {
-            ImmutableList.Builder<CompletedIntentUpdate> updateBuilder = ImmutableList.builder();
-            for (Future<CompletedIntentUpdate> future : futures) {
+        private List<FinalIntentProcessPhase> waitForFutures(List<Future<FinalIntentProcessPhase>> futures) {
+            ImmutableList.Builder<FinalIntentProcessPhase> updateBuilder = ImmutableList.builder();
+            for (Future<FinalIntentProcessPhase> future : futures) {
                 try {
                     updateBuilder.add(future.get());
                 } catch (InterruptedException | ExecutionException e) {
@@ -609,14 +619,14 @@
             return updateBuilder.build();
         }
 
-        private void submitUpdates(List<CompletedIntentUpdate> updates) {
+        private void submitUpdates(List<FinalIntentProcessPhase> updates) {
             store.batchWrite(updates.stream()
-                                    .map(CompletedIntentUpdate::data)
+                                    .map(FinalIntentProcessPhase::data)
                                     .collect(Collectors.toList()));
         }
     }
 
-    private final class IntentWorker implements Callable<CompletedIntentUpdate> {
+    private final class IntentWorker implements Callable<FinalIntentProcessPhase> {
 
         private final IntentData data;
 
@@ -625,16 +635,16 @@
         }
 
         @Override
-        public CompletedIntentUpdate call() throws Exception {
-            IntentUpdate update = createIntentUpdate(data);
-            Optional<IntentUpdate> currentPhase = Optional.of(update);
-            IntentUpdate previousPhase = update;
+        public FinalIntentProcessPhase call() throws Exception {
+            IntentProcessPhase update = createIntentUpdate(data);
+            Optional<IntentProcessPhase> currentPhase = Optional.of(update);
+            IntentProcessPhase previousPhase = update;
 
             while (currentPhase.isPresent()) {
                 previousPhase = currentPhase.get();
                 currentPhase = previousPhase.execute();
             }
-            return (CompletedIntentUpdate) previousPhase;
+            return (FinalIntentProcessPhase) previousPhase;
         }
     }
 
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/AbstractFailed.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/AbstractFailed.java
similarity index 91%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/AbstractFailed.java
rename to core/net/src/main/java/org/onosproject/net/intent/impl/phase/AbstractFailed.java
index d68ef69..8c2734b 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/AbstractFailed.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/AbstractFailed.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl;
+package org.onosproject.net.intent.impl.phase;
 
 import org.onosproject.net.intent.IntentData;
 
@@ -24,7 +24,7 @@
  * A common parent class of a class representing failure
  * as IntentUpdate subclass.
  */
-abstract class AbstractFailed extends CompletedIntentUpdate {
+abstract class AbstractFailed extends FinalIntentProcessPhase {
 
     private final IntentData intentData;
 
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/Compiling.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Compiling.java
similarity index 90%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/Compiling.java
rename to core/net/src/main/java/org/onosproject/net/intent/impl/phase/Compiling.java
index bf4079f..b68230a 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/Compiling.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Compiling.java
@@ -13,11 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl;
+package org.onosproject.net.intent.impl.phase;
 
 import org.onosproject.net.intent.Intent;
 import org.onosproject.net.intent.IntentData;
 import org.onosproject.net.intent.IntentException;
+import org.onosproject.net.intent.impl.IntentManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -29,7 +30,7 @@
 /**
  * Represents a phase where an intent is being compiled.
  */
-class Compiling implements IntentUpdate {
+final class Compiling implements IntentProcessPhase {
 
     private static final Logger log = LoggerFactory.getLogger(Compiling.class);
 
@@ -45,7 +46,7 @@
     }
 
     @Override
-    public Optional<IntentUpdate> execute() {
+    public Optional<IntentProcessPhase> execute() {
         try {
             List<Intent> installables = (current != null) ? current.installables() : null;
             pending.setInstallables(intentManager.compileIntent(pending.intent(), installables));
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/CompilingFailed.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/CompilingFailed.java
similarity index 84%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/CompilingFailed.java
rename to core/net/src/main/java/org/onosproject/net/intent/impl/phase/CompilingFailed.java
index 186b4be..e537308 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/CompilingFailed.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/CompilingFailed.java
@@ -13,21 +13,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl;
+package org.onosproject.net.intent.impl.phase;
 
 import org.onosproject.net.intent.IntentData;
 
 /**
  * Represents a phase where the compile has failed.
  */
-class CompilingFailed extends AbstractFailed {
+public class CompilingFailed extends AbstractFailed {
 
     /**
      * Create an instance with the specified data.
      *
      * @param intentData intentData
      */
-    CompilingFailed(IntentData intentData) {
+    public CompilingFailed(IntentData intentData) {
         super(intentData);
     }
 }
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/CompletedIntentUpdate.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/FinalIntentProcessPhase.java
similarity index 76%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/CompletedIntentUpdate.java
rename to core/net/src/main/java/org/onosproject/net/intent/impl/phase/FinalIntentProcessPhase.java
index 612ae1e..72451a5 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/CompletedIntentUpdate.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/FinalIntentProcessPhase.java
@@ -13,19 +13,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl;
+package org.onosproject.net.intent.impl.phase;
 
 import org.onosproject.net.intent.IntentData;
 
 import java.util.Optional;
 
 /**
- * Represents a completed phase of processing an intent.
+ * Represents a final phase of processing an intent.
  */
-abstract class CompletedIntentUpdate implements IntentUpdate {
+public abstract class FinalIntentProcessPhase implements IntentProcessPhase {
 
     @Override
-    public final Optional<IntentUpdate> execute() {
+    public final Optional<IntentProcessPhase> execute() {
         return Optional.empty();
     }
 
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/InstallCoordinating.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/InstallCoordinating.java
similarity index 90%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/InstallCoordinating.java
rename to core/net/src/main/java/org/onosproject/net/intent/impl/phase/InstallCoordinating.java
index 6145ad2..5fd82ec 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/InstallCoordinating.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/InstallCoordinating.java
@@ -13,11 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl;
+package org.onosproject.net.intent.impl.phase;
 
 import org.onosproject.net.flow.FlowRuleOperations;
 import org.onosproject.net.intent.IntentData;
 import org.onosproject.net.intent.IntentException;
+import org.onosproject.net.intent.impl.IntentManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -29,7 +30,7 @@
  * Represents a phase to create a {@link FlowRuleOperations} instance
  * with using registered intent installers.
  */
-class InstallCoordinating implements IntentUpdate {
+final class InstallCoordinating implements IntentProcessPhase {
 
     private static final Logger log = LoggerFactory.getLogger(InstallCoordinating.class);
 
@@ -45,7 +46,7 @@
     }
 
     @Override
-    public Optional<IntentUpdate> execute() {
+    public Optional<IntentProcessPhase> execute() {
         try {
             //FIXME we orphan flow rules that are currently on the data plane
             // ... should either reuse them or remove them
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/InstallRequest.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/InstallRequest.java
similarity index 79%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/InstallRequest.java
rename to core/net/src/main/java/org/onosproject/net/intent/impl/phase/InstallRequest.java
index ebc49fc..e54b10a 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/InstallRequest.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/InstallRequest.java
@@ -13,9 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl;
+package org.onosproject.net.intent.impl.phase;
 
 import org.onosproject.net.intent.IntentData;
+import org.onosproject.net.intent.impl.IntentManager;
 
 import java.util.Optional;
 
@@ -24,21 +25,21 @@
 /**
  * Represents a phase where intent installation has been requested.
  */
-class InstallRequest implements IntentUpdate {
+public final class InstallRequest implements IntentProcessPhase {
 
     // TODO: define an interface and use it, instead of IntentManager
     private final IntentManager intentManager;
     private final IntentData pending;
     private final Optional<IntentData> current;
 
-    InstallRequest(IntentManager intentManager, IntentData intentData, Optional<IntentData> current) {
+    public InstallRequest(IntentManager intentManager, IntentData intentData, Optional<IntentData> current) {
         this.intentManager = checkNotNull(intentManager);
         this.pending = checkNotNull(intentData);
         this.current = checkNotNull(current);
     }
 
     @Override
-    public Optional<IntentUpdate> execute() {
+    public Optional<IntentProcessPhase> execute() {
         return Optional.of(new Compiling(intentManager, pending, current.orElse(null)));
     }
 }
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/Installed.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Installed.java
similarity index 91%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/Installed.java
rename to core/net/src/main/java/org/onosproject/net/intent/impl/phase/Installed.java
index 1a2dea9..cd4d14e 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/Installed.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Installed.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl;
+package org.onosproject.net.intent.impl.phase;
 
 import org.onosproject.net.intent.IntentData;
 
@@ -23,7 +23,7 @@
 /**
  * Represent a phase where an intent has been installed.
  */
-class Installed extends CompletedIntentUpdate {
+class Installed extends FinalIntentProcessPhase {
 
     private final IntentData intentData;
 
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/Installing.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Installing.java
similarity index 90%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/Installing.java
rename to core/net/src/main/java/org/onosproject/net/intent/impl/phase/Installing.java
index 122f224..05c499f 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/Installing.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Installing.java
@@ -13,11 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl;
+package org.onosproject.net.intent.impl.phase;
 
 import org.onosproject.net.flow.FlowRuleOperations;
 import org.onosproject.net.intent.IntentData;
 import org.onosproject.net.intent.IntentException;
+import org.onosproject.net.intent.impl.IntentManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -29,7 +30,7 @@
  * Represents a phase of installing an intent with calling
  * {@link org.onosproject.net.flow.FlowRuleService}.
  */
-class Installing implements IntentUpdate {
+final class Installing implements IntentProcessPhase {
 
     private static final Logger log = LoggerFactory.getLogger(Installing.class);
 
@@ -45,7 +46,7 @@
     }
 
     @Override
-    public Optional<IntentUpdate> execute() {
+    public Optional<IntentProcessPhase> execute() {
         try {
             intentManager.flowRuleService.apply(flowRules); // FIXME we need to provide a context
             return Optional.of(new Installed(pending));
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/InstallingFailed.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/InstallingFailed.java
similarity index 95%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/InstallingFailed.java
rename to core/net/src/main/java/org/onosproject/net/intent/impl/phase/InstallingFailed.java
index 6b15dcb..b3bf3a3 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/InstallingFailed.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/InstallingFailed.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl;
+package org.onosproject.net.intent.impl.phase;
 
 import org.onosproject.net.intent.IntentData;
 
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentUpdate.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/IntentProcessPhase.java
similarity index 86%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/IntentUpdate.java
rename to core/net/src/main/java/org/onosproject/net/intent/impl/phase/IntentProcessPhase.java
index ed3e9e2..56bf122 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentUpdate.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/IntentProcessPhase.java
@@ -13,14 +13,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl;
+package org.onosproject.net.intent.impl.phase;
 
 import java.util.Optional;
 
 /**
  * Represents a phase of processing an intent.
  */
-interface IntentUpdate {
+public interface IntentProcessPhase {
 
     /**
      * Execute the procedure represented by the instance
@@ -28,5 +28,5 @@
      *
      * @return next update
      */
-    Optional<IntentUpdate> execute();
+    Optional<IntentProcessPhase> execute();
 }
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/WithdrawCoordinating.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/WithdrawCoordinating.java
similarity index 90%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/WithdrawCoordinating.java
rename to core/net/src/main/java/org/onosproject/net/intent/impl/phase/WithdrawCoordinating.java
index aa5e993..24d6dd5 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/WithdrawCoordinating.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/WithdrawCoordinating.java
@@ -13,11 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl;
+package org.onosproject.net.intent.impl.phase;
 
 import org.onosproject.net.flow.FlowRuleOperations;
 import org.onosproject.net.intent.IntentData;
 import org.onosproject.net.intent.IntentException;
+import org.onosproject.net.intent.impl.IntentManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -29,7 +30,7 @@
  * Represents a phase to create a {@link FlowRuleOperations} instance
  * with using registered intent installers.
  */
-class WithdrawCoordinating implements IntentUpdate {
+final class WithdrawCoordinating implements IntentProcessPhase {
 
     private static final Logger log = LoggerFactory.getLogger(WithdrawCoordinating.class);
 
@@ -45,7 +46,7 @@
     }
 
     @Override
-    public Optional<IntentUpdate> execute() {
+    public Optional<IntentProcessPhase> execute() {
         try {
             // Note: current.installables() are not null or empty due to createIntentUpdate check
             FlowRuleOperations flowRules = intentManager.uninstallCoordinate(current, pending);
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/WithdrawRequest.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/WithdrawRequest.java
similarity index 82%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/WithdrawRequest.java
rename to core/net/src/main/java/org/onosproject/net/intent/impl/phase/WithdrawRequest.java
index 7444d35..bbc7f34 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/WithdrawRequest.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/WithdrawRequest.java
@@ -13,9 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl;
+package org.onosproject.net.intent.impl.phase;
 
 import org.onosproject.net.intent.IntentData;
+import org.onosproject.net.intent.impl.IntentManager;
 
 import java.util.Optional;
 
@@ -24,21 +25,21 @@
 /**
  * Represents a phase of requesting a withdraw of an intent.
  */
-class WithdrawRequest implements IntentUpdate {
+public final class WithdrawRequest implements IntentProcessPhase {
 
     // TODO: define an interface and use it, instead of IntentManager
     private final IntentManager intentManager;
     private final IntentData pending;
     private final IntentData current;
 
-    WithdrawRequest(IntentManager intentManager, IntentData intentData, IntentData current) {
+    public WithdrawRequest(IntentManager intentManager, IntentData intentData, IntentData current) {
         this.intentManager = checkNotNull(intentManager);
         this.pending = checkNotNull(intentData);
         this.current = checkNotNull(current);
     }
 
     @Override
-    public Optional<IntentUpdate> execute() {
+    public Optional<IntentProcessPhase> execute() {
         //TODO perhaps we want to validate that the pending and current are the
         // same version i.e. they are the same
         // Note: this call is not just the symmetric version of submit
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/Withdrawing.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Withdrawing.java
similarity index 88%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/Withdrawing.java
rename to core/net/src/main/java/org/onosproject/net/intent/impl/phase/Withdrawing.java
index 06a0ad3..676c3c7 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/Withdrawing.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Withdrawing.java
@@ -13,10 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl;
+package org.onosproject.net.intent.impl.phase;
 
 import org.onosproject.net.flow.FlowRuleOperations;
 import org.onosproject.net.intent.IntentData;
+import org.onosproject.net.intent.impl.IntentManager;
 
 import java.util.Optional;
 
@@ -26,7 +27,7 @@
  * Represents a phase of withdrawing an intent with calling
  * {@link org.onosproject.net.flow.FlowRuleService}.
  */
-class Withdrawing implements IntentUpdate {
+class Withdrawing implements IntentProcessPhase {
 
     // TODO: define an interface and use it, instead of IntentManager
     private final IntentManager intentManager;
@@ -40,7 +41,7 @@
     }
 
     @Override
-    public Optional<IntentUpdate> execute() {
+    public Optional<IntentProcessPhase> execute() {
         intentManager.flowRuleService.apply(flowRules);
         return Optional.of(new Withdrawn(pending));
     }
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/WithdrawingFailed.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/WithdrawingFailed.java
similarity index 89%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/WithdrawingFailed.java
rename to core/net/src/main/java/org/onosproject/net/intent/impl/phase/WithdrawingFailed.java
index 13a5da6..4e6874e 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/WithdrawingFailed.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/WithdrawingFailed.java
@@ -13,14 +13,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl;
+package org.onosproject.net.intent.impl.phase;
 
 import org.onosproject.net.intent.IntentData;
 
 /**
  * Represents a phase where the withdraw has failed.
  */
-class WithdrawingFailed extends AbstractFailed {
+final class WithdrawingFailed extends AbstractFailed {
 
     /**
      * Create an instance with the specified data.
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/Withdrawn.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Withdrawn.java
similarity index 83%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/Withdrawn.java
rename to core/net/src/main/java/org/onosproject/net/intent/impl/phase/Withdrawn.java
index e5e4acd..069a989 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/Withdrawn.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Withdrawn.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl;
+package org.onosproject.net.intent.impl.phase;
 
 import org.onosproject.net.intent.IntentData;
 import org.onosproject.net.intent.IntentState;
@@ -24,15 +24,15 @@
 /**
  * Represents a phase where an intent has been withdrawn.
  */
-class Withdrawn extends CompletedIntentUpdate {
+public final class Withdrawn extends FinalIntentProcessPhase {
 
     private final IntentData intentData;
 
-    Withdrawn(IntentData intentData) {
+    public Withdrawn(IntentData intentData) {
         this(intentData, WITHDRAWING);
     }
 
-    Withdrawn(IntentData intentData, IntentState newState) {
+    public Withdrawn(IntentData intentData, IntentState newState) {
         this.intentData = checkNotNull(intentData);
         this.intentData.setState(newState);
     }