Extract common ID generation logic using IdBlockAllocator

- Define IdGenerator<T> interface
- Implement AbstractIdBlockAllocatorBasedIdGenerator<T>, which
  has the common logic for the existing IntentId, FlowId, MatchActionId,
  and MatchActionOperationsId generator implementations.

Change-Id: I7aeea249df1710719760ed477bffe62853577e0f
diff --git a/src/test/java/net/onrc/onos/api/flowmanager/FakeFlowManagerService.java b/src/test/java/net/onrc/onos/api/flowmanager/FakeFlowManagerService.java
index c231bca..50e68ce 100644
--- a/src/test/java/net/onrc/onos/api/flowmanager/FakeFlowManagerService.java
+++ b/src/test/java/net/onrc/onos/api/flowmanager/FakeFlowManagerService.java
@@ -2,6 +2,7 @@
 
 import com.google.common.collect.ImmutableList;
 import net.onrc.onos.core.flowmanager.FlowBatchHandleImpl;
+import net.onrc.onos.core.util.IdGenerator;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -87,7 +88,7 @@
     }
 
     @Override
-    public FlowIdGenerator getFlowIdGenerator() {
+    public IdGenerator<FlowId> getFlowIdGenerator() {
         throw new UnsupportedOperationException();
     }
 
diff --git a/src/test/java/net/onrc/onos/api/flowmanager/FlowIdGenerator.java b/src/test/java/net/onrc/onos/api/flowmanager/FlowIdGenerator.java
new file mode 100644
index 0000000..95087af
--- /dev/null
+++ b/src/test/java/net/onrc/onos/api/flowmanager/FlowIdGenerator.java
@@ -0,0 +1,10 @@
+package net.onrc.onos.api.flowmanager;
+
+import net.onrc.onos.core.util.IdGenerator;
+
+/**
+ * An generator of {@link FlowId}. It is defined only for
+ * testing purpose to keep type safety on mock creation.
+ */
+public interface FlowIdGenerator extends IdGenerator<FlowId> {
+}
diff --git a/src/test/java/net/onrc/onos/api/newintent/IntentIdGenerator.java b/src/test/java/net/onrc/onos/api/newintent/IntentIdGenerator.java
new file mode 100644
index 0000000..2f5e013
--- /dev/null
+++ b/src/test/java/net/onrc/onos/api/newintent/IntentIdGenerator.java
@@ -0,0 +1,16 @@
+package net.onrc.onos.api.newintent;
+
+import net.onrc.onos.core.util.IdGenerator;
+
+/**
+ * This interface is for generator of IntentId. It is defined only for
+ * testing purpose to keep type safety on mock creation.
+ *
+ * <p>
+ * {@link #getNewId()} generates a globally unique {@link IntentId} instance
+ * on each invocation. Application developers should not generate IntentId
+ * by themselves. Instead use an implementation of this interface.
+ * </p>
+ */
+public interface IntentIdGenerator extends IdGenerator<IntentId> {
+}