Refactor NoAction class

- Move from inner class to core.matchaction.action package
- Rename from NoAction to NullAction
- Make NullAction singleton

Change-Id: I0a41c7ef984492f2b293a6df27479a4cca68a5f9
diff --git a/src/main/java/net/onrc/onos/core/matchaction/action/Actions.java b/src/main/java/net/onrc/onos/core/matchaction/action/Actions.java
new file mode 100644
index 0000000..c69f871
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/matchaction/action/Actions.java
@@ -0,0 +1,19 @@
+package net.onrc.onos.core.matchaction.action;
+
+/**
+ * Utility for creating an instance of action.
+ */
+public final class Actions {
+    private Actions() {}
+
+    // TODO: consider if it is meaningful to return NullAction
+    // instead of just Action
+    /**
+     * Returns an action representing null action.
+     *
+     * @return action representing null action
+     */
+    public static NullAction nullAction() {
+        return NullAction.getInstance();
+    }
+}
diff --git a/src/main/java/net/onrc/onos/core/matchaction/action/NullAction.java b/src/main/java/net/onrc/onos/core/matchaction/action/NullAction.java
new file mode 100644
index 0000000..3613ada
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/matchaction/action/NullAction.java
@@ -0,0 +1,23 @@
+package net.onrc.onos.core.matchaction.action;
+
+/**
+ * An action which does not affect anything at all.
+ * In other words, NOP.
+ *
+ * This action can be used for intent only. Flow Manager and Match Action Manager
+ * may not handle correctly.
+ */
+public final class NullAction implements Action {
+    private static final NullAction INSTANCE = new NullAction();
+
+    private NullAction() {}
+
+    /**
+     * Returns singleton of this class.
+     *
+     * @return singleton of this class
+     */
+    static NullAction getInstance() {
+        return INSTANCE;
+    }
+}
diff --git a/src/test/java/net/onrc/onos/api/newintent/ConnectivityIntentTest.java b/src/test/java/net/onrc/onos/api/newintent/ConnectivityIntentTest.java
index be84f25..6704f32 100644
--- a/src/test/java/net/onrc/onos/api/newintent/ConnectivityIntentTest.java
+++ b/src/test/java/net/onrc/onos/api/newintent/ConnectivityIntentTest.java
@@ -1,6 +1,7 @@
 package net.onrc.onos.api.newintent;
 
 import net.onrc.onos.core.matchaction.action.Action;
+import net.onrc.onos.core.matchaction.action.Actions;
 import net.onrc.onos.core.matchaction.match.Match;
 import net.onrc.onos.core.matchaction.match.PacketMatchBuilder;
 import net.onrc.onos.core.util.SwitchPort;
@@ -14,7 +15,7 @@
 
     public static final IntentId IID = new IntentId(123);
     public static final Match MATCH = (new PacketMatchBuilder()).build();
-    public static final Action NOP = new NoAction();
+    public static final Action NOP = Actions.nullAction();
 
     public static final SwitchPort P1 = new SwitchPort(111, (short) 0x1);
     public static final SwitchPort P2 = new SwitchPort(222, (short) 0x2);