Enforce overrinding execute() method in IntentUpdate subclasses
Change-Id: I02cf03abd60f771357b98bbd79c83eb3e0dce958
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/CompilingFailed.java
index 34469ff..df3422a 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/CompilingFailed.java
@@ -18,8 +18,6 @@
import org.onosproject.net.intent.BatchWrite;
import org.onosproject.net.intent.Intent;
-import java.util.Optional;
-
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onosproject.net.intent.IntentState.FAILED;
@@ -40,11 +38,6 @@
}
@Override
- public Optional<IntentUpdate> execute() {
- return Optional.empty();
- }
-
- @Override
public void writeAfterExecution(BatchWrite batchWrite) {
batchWrite.setState(intent, FAILED);
batchWrite.removeInstalledIntents(intent.id());
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/CompletedIntentUpdate.java
index a2ed4d9..df0b267 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/CompletedIntentUpdate.java
@@ -21,6 +21,7 @@
import java.util.Collections;
import java.util.List;
+import java.util.Optional;
/**
* Represents a completed phase of processing an intent.
@@ -63,4 +64,9 @@
default List<Intent> allInstallables() {
return Collections.emptyList();
}
+
+ @Override
+ default Optional<IntentUpdate> execute() {
+ return Optional.empty();
+ }
}
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/IntentUpdate.java
index 155c0fe..127c4c8 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/IntentUpdate.java
@@ -30,9 +30,7 @@
*
* @return next update
*/
- default Optional<IntentUpdate> execute() {
- return Optional.empty();
- }
+ Optional<IntentUpdate> execute();
/**
* Write data to the specified BatchWrite before execution() is called.