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/main/java/net/onrc/onos/core/newintent/AbstractIntentCompiler.java b/src/main/java/net/onrc/onos/core/newintent/AbstractIntentCompiler.java
index 0b16f10..46f4cf9 100644
--- a/src/main/java/net/onrc/onos/core/newintent/AbstractIntentCompiler.java
+++ b/src/main/java/net/onrc/onos/core/newintent/AbstractIntentCompiler.java
@@ -4,10 +4,10 @@
import net.onrc.onos.api.newintent.Intent;
import net.onrc.onos.api.newintent.IntentCompiler;
import net.onrc.onos.api.newintent.IntentId;
-import net.onrc.onos.api.newintent.IntentIdGenerator;
import net.onrc.onos.core.matchaction.action.Action;
import net.onrc.onos.core.matchaction.action.Actions;
import net.onrc.onos.core.matchaction.action.OutputAction;
+import net.onrc.onos.core.util.IdGenerator;
import net.onrc.onos.core.util.SwitchPort;
import java.util.ArrayList;
@@ -20,7 +20,7 @@
* @param <T> the type of intent
*/
public abstract class AbstractIntentCompiler<T extends Intent> implements IntentCompiler<T> {
- private final IntentIdGenerator idGenerator;
+ private final IdGenerator<IntentId> idGenerator;
/**
* Constructs an instance with the specified Intent ID generator.
@@ -32,7 +32,7 @@
* </p>
* @param idGenerator intent ID generator
*/
- protected AbstractIntentCompiler(IntentIdGenerator idGenerator) {
+ protected AbstractIntentCompiler(IdGenerator<IntentId> idGenerator) {
this.idGenerator = checkNotNull(idGenerator);
}