Remove deprecated and unused APIs from IntentStore.
IntentStore#createIntent(Intent) and IntentStore#removeIntent(Intent) have
been superseded by IntentStore#batchWrite(BatchWrite)
Change-Id: I0f1c1b8fdc645435a9925bae9370d75965618c7c
diff --git a/core/api/src/main/java/org/onosproject/net/intent/IntentStore.java b/core/api/src/main/java/org/onosproject/net/intent/IntentStore.java
index cb71266..4898a45 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/IntentStore.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentStore.java
@@ -26,27 +26,6 @@
public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> {
/**
- * Submits a new intent into the store. If the returned event is not
- * null, the manager is expected to dispatch the event and then to kick
- * off intent compilation process. Otherwise, another node has been elected
- * to perform the compilation process and the node will learn about
- * the submittal and results of the intent compilation via the delegate
- * mechanism.
- *
- * @param intent intent to be submitted
- */
- @Deprecated
- void createIntent(Intent intent);
-
- /**
- * Removes the specified intent from the inventory.
- *
- * @param intentId intent identification
- */
- @Deprecated
- void removeIntent(IntentId intentId);
-
- /**
* Returns the number of intents in the store.
*
* @return the number of intents in the store
diff --git a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/DistributedIntentStore.java b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/DistributedIntentStore.java
index ef6d086..0848819 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/DistributedIntentStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/DistributedIntentStore.java
@@ -22,7 +22,6 @@
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableSet;
-
import com.google.common.collect.Lists;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
@@ -31,15 +30,16 @@
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import org.onlab.metrics.MetricsService;
+import org.onlab.util.KryoNamespace;
import org.onosproject.core.MetricsHelper;
import org.onosproject.net.intent.BatchWrite;
+import org.onosproject.net.intent.BatchWrite.Operation;
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.IntentEvent;
import org.onosproject.net.intent.IntentId;
import org.onosproject.net.intent.IntentState;
import org.onosproject.net.intent.IntentStore;
import org.onosproject.net.intent.IntentStoreDelegate;
-import org.onosproject.net.intent.BatchWrite.Operation;
import org.onosproject.store.AbstractStore;
import org.onosproject.store.serializers.KryoNamespaces;
import org.onosproject.store.serializers.KryoSerializer;
@@ -50,7 +50,6 @@
import org.onosproject.store.service.DatabaseAdminService;
import org.onosproject.store.service.DatabaseService;
import org.onosproject.store.service.impl.CMap;
-import org.onlab.util.KryoNamespace;
import org.slf4j.Logger;
import java.util.ArrayList;
@@ -63,10 +62,13 @@
import java.util.concurrent.ConcurrentHashMap;
import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkState;
-import static org.onosproject.net.intent.IntentState.*;
+import static org.onlab.metrics.MetricsUtil.startTimer;
+import static org.onlab.metrics.MetricsUtil.stopTimer;
+import static org.onosproject.net.intent.IntentState.FAILED;
+import static org.onosproject.net.intent.IntentState.INSTALLED;
+import static org.onosproject.net.intent.IntentState.INSTALL_REQ;
+import static org.onosproject.net.intent.IntentState.WITHDRAWN;
import static org.slf4j.LoggerFactory.getLogger;
-import static org.onlab.metrics.MetricsUtil.*;
@Component(immediate = true, enabled = false)
@Service
@@ -114,8 +116,6 @@
// TODO make this configurable
private boolean onlyLogTransitionError = true;
- private Timer createIntentTimer;
- private Timer removeIntentTimer;
private Timer setInstallableIntentsTimer;
private Timer getInstallableIntentsTimer;
private Timer removeInstalledIntentsTimer;
@@ -132,8 +132,6 @@
@Activate
public void activate() {
- createIntentTimer = createResponseTimer("createIntent");
- removeIntentTimer = createResponseTimer("removeIntent");
setInstallableIntentsTimer = createResponseTimer("setInstallableIntents");
getInstallableIntentsTimer = createResponseTimer("getInstallableIntents");
removeInstalledIntentsTimer = createResponseTimer("removeInstalledIntents");
@@ -190,38 +188,6 @@
}
@Override
- public void createIntent(Intent intent) {
- Context timer = startTimer(createIntentTimer);
- try {
- boolean absent = intents.putIfAbsent(intent.id(), intent);
- if (!absent) {
- // duplicate, ignore
- return;
- } else {
- this.setState(intent, IntentState.INSTALL_REQ);
- return;
- }
- } finally {
- stopTimer(timer);
- }
- }
-
- @Override
- public void removeIntent(IntentId intentId) {
- Context timer = startTimer(removeIntentTimer);
- checkState(getIntentState(intentId) == WITHDRAWN,
- "Intent state for {} is not WITHDRAWN.", intentId);
- try {
- intents.remove(intentId);
- states.remove(intentId);
- transientStates.remove(intentId);
- installable.remove(intentId);
- } finally {
- stopTimer(timer);
- }
- }
-
- @Override
public long getIntentCount() {
Context timer = startTimer(getIntentCountTimer);
try {
diff --git a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/HazelcastIntentStore.java b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/HazelcastIntentStore.java
index 667d2a8..5121aca 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/HazelcastIntentStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/HazelcastIntentStore.java
@@ -28,7 +28,6 @@
import com.hazelcast.core.EntryListener;
import com.hazelcast.core.IMap;
import com.hazelcast.core.Member;
-
import org.apache.commons.lang3.tuple.Pair;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
@@ -37,20 +36,20 @@
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import org.onlab.metrics.MetricsService;
+import org.onlab.util.KryoNamespace;
import org.onosproject.core.MetricsHelper;
import org.onosproject.net.intent.BatchWrite;
+import org.onosproject.net.intent.BatchWrite.Operation;
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.IntentEvent;
import org.onosproject.net.intent.IntentId;
import org.onosproject.net.intent.IntentState;
import org.onosproject.net.intent.IntentStore;
-import org.onosproject.net.intent.BatchWrite.Operation;
import org.onosproject.net.intent.IntentStoreDelegate;
import org.onosproject.store.hz.AbstractHazelcastStore;
import org.onosproject.store.hz.SMap;
import org.onosproject.store.serializers.KryoNamespaces;
import org.onosproject.store.serializers.KryoSerializer;
-import org.onlab.util.KryoNamespace;
import org.slf4j.Logger;
import java.util.ArrayList;
@@ -64,10 +63,10 @@
import java.util.concurrent.Future;
import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkState;
+import static org.onlab.metrics.MetricsUtil.startTimer;
+import static org.onlab.metrics.MetricsUtil.stopTimer;
import static org.onosproject.net.intent.IntentState.*;
import static org.slf4j.LoggerFactory.getLogger;
-import static org.onlab.metrics.MetricsUtil.*;
@Component(immediate = true, enabled = true)
@Service
@@ -102,8 +101,6 @@
private boolean onlyLogTransitionError = true;
- private Timer createIntentTimer;
- private Timer removeIntentTimer;
private Timer setInstallableIntentsTimer;
private Timer getInstallableIntentsTimer;
private Timer removeInstalledIntentsTimer;
@@ -131,8 +128,6 @@
public void activate() {
localIntents = new ConcurrentHashMap<>();
- createIntentTimer = createResponseTimer("createIntent");
- removeIntentTimer = createResponseTimer("removeIntent");
setInstallableIntentsTimer = createResponseTimer("setInstallableIntents");
getInstallableIntentsTimer = createResponseTimer("getInstallableIntents");
removeInstalledIntentsTimer = createResponseTimer("removeInstalledIntents");
@@ -200,38 +195,6 @@
}
@Override
- public void createIntent(Intent intent) {
- Context timer = startTimer(createIntentTimer);
- try {
- Intent existing = intents.putIfAbsent(intent.id(), intent);
- if (existing != null) {
- // duplicate, ignore
- return;
- } else {
- this.setState(intent, IntentState.INSTALL_REQ);
- return;
- }
- } finally {
- stopTimer(timer);
- }
- }
-
- @Override
- public void removeIntent(IntentId intentId) {
- Context timer = startTimer(removeIntentTimer);
- checkState(getIntentState(intentId) == WITHDRAWN,
- "Intent state for {} is not WITHDRAWN.", intentId);
- try {
- intents.remove(intentId);
- installable.remove(intentId);
- states.remove(intentId);
- transientStates.remove(intentId);
- } finally {
- stopTimer(timer);
- }
- }
-
- @Override
public long getIntentCount() {
Context timer = startTimer(getIntentCountTimer);
try {
diff --git a/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleIntentStore.java b/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleIntentStore.java
index ce687b5..efdff0a 100644
--- a/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleIntentStore.java
+++ b/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleIntentStore.java
@@ -65,8 +65,7 @@
log.info("Stopped");
}
- @Override
- public void createIntent(Intent intent) {
+ private void createIntent(Intent intent) {
if (intents.containsKey(intent.id())) {
return;
}
@@ -74,8 +73,7 @@
this.setState(intent, IntentState.INSTALL_REQ);
}
- @Override
- public void removeIntent(IntentId intentId) {
+ private void removeIntent(IntentId intentId) {
checkState(getIntentState(intentId) == WITHDRAWN,
"Intent state for {} is not WITHDRAWN.", intentId);
intents.remove(intentId);