Sho SHIMIZU
Committed by Brian O'Connor

Enforce overrinding execute() method in IntentUpdate subclasses

Change-Id: I02cf03abd60f771357b98bbd79c83eb3e0dce958
......@@ -18,8 +18,6 @@ package org.onosproject.net.intent.impl;
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 @@ class CompilingFailed implements CompletedIntentUpdate {
}
@Override
public Optional<IntentUpdate> execute() {
return Optional.empty();
}
@Override
public void writeAfterExecution(BatchWrite batchWrite) {
batchWrite.setState(intent, FAILED);
batchWrite.removeInstalledIntents(intent.id());
......
......@@ -21,6 +21,7 @@ import org.onosproject.net.intent.Intent;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
/**
* Represents a completed phase of processing an intent.
......@@ -63,4 +64,9 @@ interface CompletedIntentUpdate extends IntentUpdate {
default List<Intent> allInstallables() {
return Collections.emptyList();
}
@Override
default Optional<IntentUpdate> execute() {
return Optional.empty();
}
}
......
......@@ -30,9 +30,7 @@ interface IntentUpdate {
*
* @return next update
*/
default Optional<IntentUpdate> execute() {
return Optional.empty();
}
Optional<IntentUpdate> execute();
/**
* Write data to the specified BatchWrite before execution() is called.
......