Move nested class to top-level class

Because BatchWrite is public and no need to place it as an inner class in
IntentStore interface

Change-Id: I17e87e06baa4f0af55fa30b09a891bc23932a6fd
diff --git a/core/api/src/main/java/org/onosproject/net/intent/BatchWrite.java b/core/api/src/main/java/org/onosproject/net/intent/BatchWrite.java
new file mode 100644
index 0000000..e030036
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/intent/BatchWrite.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2014 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.intent;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.collect.ImmutableList;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+public class BatchWrite {
+
+    public enum OpType {
+        CREATE_INTENT,
+        REMOVE_INTENT,
+        SET_STATE,
+        SET_INSTALLABLE,
+        REMOVE_INSTALLED
+    }
+
+    List<Operation> operations = new ArrayList<>();
+
+    public List<Operation> operations() {
+        return Collections.unmodifiableList(operations);
+    }
+
+    public boolean isEmpty() {
+        return operations.isEmpty();
+    }
+
+    public BatchWrite createIntent(Intent intent) {
+        operations.add(Operation.of(OpType.CREATE_INTENT,
+                ImmutableList.of(intent)));
+        return this;
+    }
+
+    public BatchWrite removeIntent(IntentId intentId) {
+        operations.add(Operation.of(OpType.REMOVE_INTENT,
+                ImmutableList.of(intentId)));
+        return this;
+    }
+
+    public BatchWrite setState(Intent intent, IntentState newState) {
+        operations.add(Operation.of(OpType.SET_STATE,
+                ImmutableList.of(intent, newState)));
+        return this;
+    }
+
+    public BatchWrite setInstallableIntents(IntentId intentId, List<Intent> installableIntents) {
+        operations.add(Operation.of(OpType.SET_INSTALLABLE,
+                ImmutableList.of(intentId, installableIntents)));
+        return this;
+    }
+
+    public BatchWrite removeInstalledIntents(IntentId intentId) {
+        operations.add(Operation.of(OpType.REMOVE_INSTALLED,
+                ImmutableList.of(intentId)));
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("operations", operations)
+                .toString();
+    }
+
+    public static class Operation {
+        final OpType type;
+        final ImmutableList<Object> args;
+
+        public static Operation of(OpType type, List<Object> args) {
+            return new Operation(type, args);
+        }
+
+        // TODO: consider make it private
+        public Operation(OpType type, List<Object> args) {
+            this.type = checkNotNull(type);
+            this.args = ImmutableList.copyOf(args);
+        }
+
+        public OpType type() {
+            return type;
+        }
+
+        public ImmutableList<Object> args() {
+            return args;
+        }
+
+        @SuppressWarnings("unchecked")
+        public <T> T arg(int i) {
+            return (T) args.get(i);
+        }
+
+        @Override
+        public String toString() {
+            return MoreObjects.toStringHelper(getClass())
+                    .add("type", type)
+                    .add("args", args)
+                    .toString();
+        }
+    }
+}
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 518ad26..129a15b 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
@@ -15,16 +15,9 @@
  */
 package org.onosproject.net.intent;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.onosproject.net.intent.IntentStore.BatchWrite.Operation;
+import org.onosproject.net.intent.BatchWrite.Operation;
 import org.onosproject.store.Store;
 
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.ImmutableList;
-
-import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 
 /**
@@ -135,96 +128,4 @@
      */
     List<Operation> batchWrite(BatchWrite batch);
 
-    public static class BatchWrite {
-
-        public enum OpType {
-            CREATE_INTENT,
-            REMOVE_INTENT,
-            SET_STATE,
-            SET_INSTALLABLE,
-            REMOVE_INSTALLED
-        }
-
-        List<Operation> operations = new ArrayList<>();
-
-        public List<Operation> operations() {
-            return Collections.unmodifiableList(operations);
-        }
-
-        public boolean isEmpty() {
-            return operations.isEmpty();
-        }
-
-        public BatchWrite createIntent(Intent intent) {
-            operations.add(Operation.of(OpType.CREATE_INTENT,
-                                        ImmutableList.of(intent)));
-            return this;
-        }
-
-        public BatchWrite removeIntent(IntentId intentId) {
-            operations.add(Operation.of(OpType.REMOVE_INTENT,
-                                        ImmutableList.of(intentId)));
-            return this;
-        }
-
-        public BatchWrite setState(Intent intent, IntentState newState) {
-            operations.add(Operation.of(OpType.SET_STATE,
-                                        ImmutableList.of(intent, newState)));
-            return this;
-        }
-
-        public BatchWrite setInstallableIntents(IntentId intentId, List<Intent> installableIntents) {
-            operations.add(Operation.of(OpType.SET_INSTALLABLE,
-                                        ImmutableList.of(intentId, installableIntents)));
-            return this;
-        }
-
-        public BatchWrite removeInstalledIntents(IntentId intentId) {
-            operations.add(Operation.of(OpType.REMOVE_INSTALLED,
-                                        ImmutableList.of(intentId)));
-            return this;
-        }
-
-        @Override
-        public String toString() {
-            return MoreObjects.toStringHelper(getClass())
-                    .add("operations", operations)
-                    .toString();
-        }
-
-        public static class Operation {
-            final OpType type;
-            final ImmutableList<Object> args;
-
-            public static Operation of(OpType type, List<Object> args) {
-                return new Operation(type, args);
-            }
-
-            public Operation(OpType type, List<Object> args) {
-                this.type = checkNotNull(type);
-                this.args = ImmutableList.copyOf(args);
-            }
-
-            public OpType type() {
-                return type;
-            }
-
-            public ImmutableList<Object> args() {
-                return args;
-            }
-
-            @SuppressWarnings("unchecked")
-            public <T> T arg(int i) {
-                return (T) args.get(i);
-            }
-
-            @Override
-            public String toString() {
-                return MoreObjects.toStringHelper(getClass())
-                        .add("type", type)
-                        .add("args", args)
-                        .toString();
-            }
-        }
-    }
 }
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 e771584..b65f5d8 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
@@ -48,7 +48,7 @@
 import org.onosproject.net.intent.IntentService;
 import org.onosproject.net.intent.IntentState;
 import org.onosproject.net.intent.IntentStore;
-import org.onosproject.net.intent.IntentStore.BatchWrite;
+import org.onosproject.net.intent.BatchWrite;
 import org.onosproject.net.intent.IntentStoreDelegate;
 import org.slf4j.Logger;
 
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 12688fb..5290131 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
@@ -32,13 +32,14 @@
 import org.apache.felix.scr.annotations.Service;
 import org.onlab.metrics.MetricsService;
 import org.onosproject.core.MetricsHelper;
+import org.onosproject.net.intent.BatchWrite;
 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.IntentStore.BatchWrite.Operation;
+import org.onosproject.net.intent.BatchWrite.Operation;
 import org.onosproject.store.AbstractStore;
 import org.onosproject.store.serializers.KryoNamespaces;
 import org.onosproject.store.serializers.KryoSerializer;
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 343a33e..7938194 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
@@ -38,12 +38,13 @@
 import org.apache.felix.scr.annotations.Service;
 import org.onlab.metrics.MetricsService;
 import org.onosproject.core.MetricsHelper;
+import org.onosproject.net.intent.BatchWrite;
 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.IntentStore.BatchWrite.Operation;
+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;
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 e8e7bf5..5f0ad2b 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
@@ -22,13 +22,14 @@
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Service;
+import org.onosproject.net.intent.BatchWrite;
 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.IntentStore.BatchWrite.Operation;
+import org.onosproject.net.intent.BatchWrite.Operation;
 import org.onosproject.store.AbstractStore;
 import org.slf4j.Logger;