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; ...@@ -18,8 +18,6 @@ package org.onosproject.net.intent.impl;
18 import org.onosproject.net.intent.BatchWrite; 18 import org.onosproject.net.intent.BatchWrite;
19 import org.onosproject.net.intent.Intent; 19 import org.onosproject.net.intent.Intent;
20 20
21 -import java.util.Optional;
22 -
23 import static com.google.common.base.Preconditions.checkNotNull; 21 import static com.google.common.base.Preconditions.checkNotNull;
24 import static org.onosproject.net.intent.IntentState.FAILED; 22 import static org.onosproject.net.intent.IntentState.FAILED;
25 23
...@@ -40,11 +38,6 @@ class CompilingFailed implements CompletedIntentUpdate { ...@@ -40,11 +38,6 @@ class CompilingFailed implements CompletedIntentUpdate {
40 } 38 }
41 39
42 @Override 40 @Override
43 - public Optional<IntentUpdate> execute() {
44 - return Optional.empty();
45 - }
46 -
47 - @Override
48 public void writeAfterExecution(BatchWrite batchWrite) { 41 public void writeAfterExecution(BatchWrite batchWrite) {
49 batchWrite.setState(intent, FAILED); 42 batchWrite.setState(intent, FAILED);
50 batchWrite.removeInstalledIntents(intent.id()); 43 batchWrite.removeInstalledIntents(intent.id());
......
...@@ -21,6 +21,7 @@ import org.onosproject.net.intent.Intent; ...@@ -21,6 +21,7 @@ import org.onosproject.net.intent.Intent;
21 21
22 import java.util.Collections; 22 import java.util.Collections;
23 import java.util.List; 23 import java.util.List;
24 +import java.util.Optional;
24 25
25 /** 26 /**
26 * Represents a completed phase of processing an intent. 27 * Represents a completed phase of processing an intent.
...@@ -63,4 +64,9 @@ interface CompletedIntentUpdate extends IntentUpdate { ...@@ -63,4 +64,9 @@ interface CompletedIntentUpdate extends IntentUpdate {
63 default List<Intent> allInstallables() { 64 default List<Intent> allInstallables() {
64 return Collections.emptyList(); 65 return Collections.emptyList();
65 } 66 }
67 +
68 + @Override
69 + default Optional<IntentUpdate> execute() {
70 + return Optional.empty();
71 + }
66 } 72 }
......
...@@ -30,9 +30,7 @@ interface IntentUpdate { ...@@ -30,9 +30,7 @@ interface IntentUpdate {
30 * 30 *
31 * @return next update 31 * @return next update
32 */ 32 */
33 - default Optional<IntentUpdate> execute() { 33 + Optional<IntentUpdate> execute();
34 - return Optional.empty();
35 - }
36 34
37 /** 35 /**
38 * Write data to the specified BatchWrite before execution() is called. 36 * Write data to the specified BatchWrite before execution() is called.
......