Chaning IntentStore.isMaster to take a key

Change-Id: I2d04a6aa7418e06137b0688bcb4e3af060a02b63
diff --git a/core/api/src/main/java/org/onosproject/net/intent/IntentService.java b/core/api/src/main/java/org/onosproject/net/intent/IntentService.java
index 2db280f..ff7083d 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/IntentService.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentService.java
@@ -82,6 +82,10 @@
      */
     List<Intent> getInstallableIntents(Key intentKey);
 
+    default boolean isLocal(Key intentKey) {
+        return true;
+    }
+
     /**
      * Adds the specified listener for intent events.
      *
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 b6f7aed..a7c7515 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
@@ -106,11 +106,11 @@
      * Checks to see whether the calling instance is the master for processing
      * this intent, or more specifically, the key contained in this intent.
      *
-     * @param intent intent to check
+     * @param intentKey intentKey to check
      * @return true if master; false, otherwise
      */
     //TODO better name
-    default boolean isMaster(Intent intent) { //FIXME remove default when impl.
+    default boolean isMaster(Key intentKey) { //FIXME remove default when impl.
         return true;
     }
 }
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 2f1326fa..8b6f583 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
@@ -201,6 +201,11 @@
     }
 
     @Override
+    public boolean isLocal(Key intentKey) {
+        return store.isMaster(intentKey);
+    }
+
+    @Override
     public void addListener(IntentListener listener) {
         listenerRegistry.addListener(listener);
     }
diff --git a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java
index cb4e947..9b38f44 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java
@@ -276,8 +276,8 @@
     }
 
     @Override
-    public boolean isMaster(Intent intent) {
-        return partitionService.isMine(intent.key());
+    public boolean isMaster(Key intentKey) {
+        return partitionService.isMine(intentKey);
     }
 
     private void notifyDelegateIfNotNull(IntentEvent event) {
@@ -308,7 +308,7 @@
                 // The pending intents map has been updated. If we are master for
                 // this intent's partition, notify the Manager that it should do
                 // some work.
-                if (isMaster(event.value().intent())) {
+                if (isMaster(event.value().intent().key())) {
                     if (delegate != null) {
                         delegate.process(copyData(event.value()));
                     }
diff --git a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/SimpleIntentStore.java b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/SimpleIntentStore.java
index 8778e93..5f1cbd4 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/SimpleIntentStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/SimpleIntentStore.java
@@ -252,7 +252,7 @@
     }
 
     @Override
-    public boolean isMaster(Intent intent) {
+    public boolean isMaster(Key intentKey) {
         return true;
     }
 }
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 7e5eb12..0eef07a 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
@@ -124,9 +124,4 @@
         notifyDelegate(IntentEvent.getEvent(data));
     }
 
-
-    @Override
-    public boolean isMaster(Intent intent) {
-        return true;
-    }
 }