Refactoring intent API.
diff --git a/core/net/src/main/java/org/onlab/onos/impl/CoreManager.java b/core/net/src/main/java/org/onlab/onos/impl/CoreManager.java
index edfc080..da1f8c9 100644
--- a/core/net/src/main/java/org/onlab/onos/impl/CoreManager.java
+++ b/core/net/src/main/java/org/onlab/onos/impl/CoreManager.java
@@ -27,6 +27,7 @@
     private static Version version = Version.version("1.0.0-SNAPSHOT");
 
     private final Map<Short, DefaultApplicationId> appIds = new ConcurrentHashMap<>();
+    private final Map<String, DefaultApplicationId> appIdsByName = new ConcurrentHashMap<>();
 
     // TODO: work in progress
 
@@ -50,9 +51,13 @@
 
     @Override
     public ApplicationId registerApplication(String name) {
-        short id = (short) ID_DISPENSER.getAndIncrement();
-        DefaultApplicationId appId = new DefaultApplicationId(id, name);
-        appIds.put(id, appId);
+        DefaultApplicationId appId = appIdsByName.get(name);
+        if (appId == null) {
+            short id = (short) ID_DISPENSER.getAndIncrement();
+            appId = new DefaultApplicationId(id, name);
+            appIds.put(id, appId);
+            appIdsByName.put(name, appId);
+        }
         return appId;
     }
 
diff --git a/core/net/src/main/java/org/onlab/onos/net/intent/impl/HostToHostIntentCompiler.java b/core/net/src/main/java/org/onlab/onos/net/intent/impl/HostToHostIntentCompiler.java
index 50faf38..e769982 100644
--- a/core/net/src/main/java/org/onlab/onos/net/intent/impl/HostToHostIntentCompiler.java
+++ b/core/net/src/main/java/org/onlab/onos/net/intent/impl/HostToHostIntentCompiler.java
@@ -11,11 +11,9 @@
 import org.onlab.onos.net.flow.TrafficSelector;
 import org.onlab.onos.net.host.HostService;
 import org.onlab.onos.net.intent.HostToHostIntent;
-import org.onlab.onos.net.intent.IdGenerator;
 import org.onlab.onos.net.intent.Intent;
 import org.onlab.onos.net.intent.IntentCompiler;
 import org.onlab.onos.net.intent.IntentExtensionService;
-import org.onlab.onos.net.intent.IntentId;
 import org.onlab.onos.net.intent.PathIntent;
 import org.onlab.onos.net.topology.PathService;
 
@@ -41,12 +39,8 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected HostService hostService;
 
-    protected IdGenerator<IntentId> intentIdGenerator;
-
     @Activate
     public void activate() {
-        IdBlockAllocator idBlockAllocator = new DummyIdBlockAllocator();
-        intentIdGenerator = new IdBlockAllocatorBasedIntentIdGenerator(idBlockAllocator);
         intentManager.registerCompiler(HostToHostIntent.class, this);
     }
 
@@ -70,13 +64,10 @@
     // Creates a path intent from the specified path and original connectivity intent.
     private Intent createPathIntent(Path path, Host src, Host dst,
                                     HostToHostIntent intent) {
-
         TrafficSelector selector = builder(intent.selector())
                 .matchEthSrc(src.mac()).matchEthDst(dst.mac()).build();
-
-        return new PathIntent(intentIdGenerator.getNewId(),
-                              selector, intent.treatment(),
-                              path.src(), path.dst(), path);
+        return new PathIntent(intent.appId(), selector, intent.treatment(),
+                              path);
     }
 
     private Path getPath(HostId one, HostId two) {
diff --git a/core/net/src/main/java/org/onlab/onos/net/intent/impl/IdBlockAllocatorBasedIntentIdGenerator.java b/core/net/src/main/java/org/onlab/onos/net/intent/impl/IdBlockAllocatorBasedIntentIdGenerator.java
deleted file mode 100644
index 9620e59..0000000
--- a/core/net/src/main/java/org/onlab/onos/net/intent/impl/IdBlockAllocatorBasedIntentIdGenerator.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.onlab.onos.net.intent.impl;
-
-import org.onlab.onos.net.intent.IntentId;
-
-/**
- * An implementation of {@link org.onlab.onos.net.intent.IdGenerator} of intent ID,
- * which uses {@link IdBlockAllocator}.
- */
-public class IdBlockAllocatorBasedIntentIdGenerator extends AbstractBlockAllocatorBasedIdGenerator<IntentId> {
-
-    /**
-     * Constructs an intent ID generator, which uses the specified ID block allocator
-     * to generate a global unique intent ID.
-     *
-     * @param allocator the ID block allocator to use for generating intent IDs
-     */
-    public IdBlockAllocatorBasedIntentIdGenerator(IdBlockAllocator allocator) {
-        super(allocator);
-    }
-
-    @Override
-    protected IntentId convertFrom(long value) {
-        return new IntentId(value);
-    }
-}
diff --git a/core/net/src/main/java/org/onlab/onos/net/intent/impl/IntentManager.java b/core/net/src/main/java/org/onlab/onos/net/intent/impl/IntentManager.java
index ff1e948..1838814 100644
--- a/core/net/src/main/java/org/onlab/onos/net/intent/impl/IntentManager.java
+++ b/core/net/src/main/java/org/onlab/onos/net/intent/impl/IntentManager.java
@@ -1,30 +1,8 @@
 package org.onlab.onos.net.intent.impl;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-import static java.util.concurrent.Executors.newSingleThreadExecutor;
-import static org.onlab.onos.net.intent.IntentState.COMPILING;
-import static org.onlab.onos.net.intent.IntentState.FAILED;
-import static org.onlab.onos.net.intent.IntentState.INSTALLED;
-import static org.onlab.onos.net.intent.IntentState.INSTALLING;
-import static org.onlab.onos.net.intent.IntentState.RECOMPILING;
-import static org.onlab.onos.net.intent.IntentState.WITHDRAWING;
-import static org.onlab.onos.net.intent.IntentState.WITHDRAWN;
-import static org.onlab.util.Tools.namedThreads;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
@@ -36,7 +14,6 @@
 import org.onlab.onos.net.flow.CompletedBatchOperation;
 import org.onlab.onos.net.flow.FlowRuleBatchOperation;
 import org.onlab.onos.net.flow.FlowRuleService;
-import org.onlab.onos.net.intent.InstallableIntent;
 import org.onlab.onos.net.intent.Intent;
 import org.onlab.onos.net.intent.IntentCompiler;
 import org.onlab.onos.net.intent.IntentEvent;
@@ -52,9 +29,24 @@
 import org.onlab.onos.net.intent.IntentStoreDelegate;
 import org.slf4j.Logger;
 
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static java.util.concurrent.Executors.newSingleThreadExecutor;
+import static org.onlab.onos.net.intent.IntentState.*;
+import static org.onlab.util.Tools.namedThreads;
+import static org.slf4j.LoggerFactory.getLogger;
 
 /**
  * An implementation of Intent Manager.
@@ -71,8 +63,8 @@
     // Collections for compiler, installer, and listener are ONOS instance local
     private final ConcurrentMap<Class<? extends Intent>,
             IntentCompiler<? extends Intent>> compilers = new ConcurrentHashMap<>();
-    private final ConcurrentMap<Class<? extends InstallableIntent>,
-            IntentInstaller<? extends InstallableIntent>> installers = new ConcurrentHashMap<>();
+    private final ConcurrentMap<Class<? extends Intent>,
+            IntentInstaller<? extends Intent>> installers = new ConcurrentHashMap<>();
 
     private final AbstractListenerRegistry<IntentEvent, IntentListener>
             listenerRegistry = new AbstractListenerRegistry<>();
@@ -186,17 +178,17 @@
     }
 
     @Override
-    public <T extends InstallableIntent> void registerInstaller(Class<T> cls, IntentInstaller<T> installer) {
+    public <T extends Intent> void registerInstaller(Class<T> cls, IntentInstaller<T> installer) {
         installers.put(cls, installer);
     }
 
     @Override
-    public <T extends InstallableIntent> void unregisterInstaller(Class<T> cls) {
+    public <T extends Intent> void unregisterInstaller(Class<T> cls) {
         installers.remove(cls);
     }
 
     @Override
-    public Map<Class<? extends InstallableIntent>, IntentInstaller<? extends InstallableIntent>> getInstallers() {
+    public Map<Class<? extends Intent>, IntentInstaller<? extends Intent>> getInstallers() {
         return ImmutableMap.copyOf(installers);
     }
 
@@ -223,7 +215,7 @@
      * @param <T>    the type of installable intent
      * @return intent installer corresponding to the specified installable intent
      */
-    private <T extends InstallableIntent> IntentInstaller<T> getInstaller(T intent) {
+    private <T extends Intent> IntentInstaller<T> getInstaller(T intent) {
         @SuppressWarnings("unchecked")
         IntentInstaller<T> installer = (IntentInstaller<T>) installers.get(intent.getClass());
         if (installer == null) {
@@ -243,7 +235,7 @@
 
         try {
             // Compile the intent into installable derivatives.
-            List<InstallableIntent> installable = compileIntent(intent);
+            List<Intent> installable = compileIntent(intent);
 
             // If all went well, associate the resulting list of installable
             // intents with the top-level intent and proceed to install.
@@ -264,12 +256,12 @@
      * @param intent intent
      * @return result of compilation
      */
-    private List<InstallableIntent> compileIntent(Intent intent) {
-        if (intent instanceof InstallableIntent) {
-            return ImmutableList.of((InstallableIntent) intent);
+    private List<Intent> compileIntent(Intent intent) {
+        if (intent instanceof Intent) {
+            return ImmutableList.of((Intent) intent);
         }
 
-        List<InstallableIntent> installable = new ArrayList<>();
+        List<Intent> installable = new ArrayList<>();
         // TODO do we need to registerSubclassCompiler?
         for (Intent compiled : getCompiler(intent).compile(intent)) {
             installable.addAll(compileIntent(compiled));
@@ -290,12 +282,12 @@
 
         List<FlowRuleBatchOperation> installWork = Lists.newArrayList();
         try {
-            List<InstallableIntent> installables = store.getInstallableIntents(intent.id());
+            List<Intent> installables = store.getInstallableIntents(intent.id());
             if (installables != null) {
-                for (InstallableIntent installable : installables) {
+                for (Intent installable : installables) {
                     registerSubclassInstallerIfNeeded(installable);
                     trackerService.addTrackedResources(intent.id(),
-                                                       installable.requiredLinks());
+                                                       installable.resources());
                     List<FlowRuleBatchOperation> batch = getInstaller(installable).install(installable);
                     installWork.addAll(batch);
                 }
@@ -324,14 +316,13 @@
 
         try {
             // Compile the intent into installable derivatives.
-            List<InstallableIntent> installable = compileIntent(intent);
+            List<Intent> installable = compileIntent(intent);
 
             // If all went well, compare the existing list of installable
             // intents with the newly compiled list. If they are the same,
             // bail, out since the previous approach was determined not to
             // be viable.
-            List<InstallableIntent> originalInstallable =
-                    store.getInstallableIntents(intent.id());
+            List<Intent> originalInstallable = store.getInstallableIntents(intent.id());
 
             if (Objects.equals(originalInstallable, installable)) {
                 eventDispatcher.post(store.setState(intent, FAILED));
@@ -376,9 +367,9 @@
     private void uninstallIntent(Intent intent, IntentState nextState) {
         List<FlowRuleBatchOperation> uninstallWork = Lists.newArrayList();
         try {
-            List<InstallableIntent> installables = store.getInstallableIntents(intent.id());
+            List<Intent> installables = store.getInstallableIntents(intent.id());
             if (installables != null) {
-                for (InstallableIntent installable : installables) {
+                for (Intent installable : installables) {
                     List<FlowRuleBatchOperation> batches = getInstaller(installable).uninstall(installable);
                     uninstallWork.addAll(batches);
                 }
@@ -422,12 +413,12 @@
      *
      * @param intent intent
      */
-    private void registerSubclassInstallerIfNeeded(InstallableIntent intent) {
+    private void registerSubclassInstallerIfNeeded(Intent intent) {
         if (!installers.containsKey(intent.getClass())) {
             Class<?> cls = intent.getClass();
             while (cls != Object.class) {
-                // As long as we're within the InstallableIntent class descendants
-                if (InstallableIntent.class.isAssignableFrom(cls)) {
+                // As long as we're within the Intent class descendants
+                if (Intent.class.isAssignableFrom(cls)) {
                     IntentInstaller<?> installer = installers.get(cls);
                     if (installer != null) {
                         installers.put(intent.getClass(), installer);
@@ -505,8 +496,8 @@
         private final IntentState nextState;
 
         public IntentInstallMonitor(Intent intent,
-                List<FlowRuleBatchOperation> work,
-                IntentState nextState) {
+                                    List<FlowRuleBatchOperation> work,
+                                    IntentState nextState) {
             this.intent = intent;
             this.work = work;
             // TODO how many Futures can be outstanding? one?
@@ -531,9 +522,7 @@
         }
 
         /**
-         * Apply a list of FlowRules.
-         *
-         * @param rules rules to apply
+         * Applies the next batch.
          */
         private Future<CompletedBatchOperation> applyNextBatch() {
             if (work.isEmpty()) {
diff --git a/core/net/src/main/java/org/onlab/onos/net/intent/impl/MultiPointToSinglePointIntentCompiler.java b/core/net/src/main/java/org/onlab/onos/net/intent/impl/MultiPointToSinglePointIntentCompiler.java
index 6ce12d6..cfc8d73 100644
--- a/core/net/src/main/java/org/onlab/onos/net/intent/impl/MultiPointToSinglePointIntentCompiler.java
+++ b/core/net/src/main/java/org/onlab/onos/net/intent/impl/MultiPointToSinglePointIntentCompiler.java
@@ -1,10 +1,5 @@
 package org.onlab.onos.net.intent.impl;
 
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
@@ -13,16 +8,19 @@
 import org.onlab.onos.net.ConnectPoint;
 import org.onlab.onos.net.Link;
 import org.onlab.onos.net.Path;
-import org.onlab.onos.net.intent.IdGenerator;
 import org.onlab.onos.net.intent.Intent;
 import org.onlab.onos.net.intent.IntentCompiler;
 import org.onlab.onos.net.intent.IntentExtensionService;
-import org.onlab.onos.net.intent.IntentId;
 import org.onlab.onos.net.intent.LinkCollectionIntent;
 import org.onlab.onos.net.intent.MultiPointToSinglePointIntent;
 import org.onlab.onos.net.intent.PointToPointIntent;
 import org.onlab.onos.net.topology.PathService;
 
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
 /**
  * An intent compiler for
  * {@link org.onlab.onos.net.intent.MultiPointToSinglePointIntent}.
@@ -37,12 +35,8 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected PathService pathService;
 
-    protected IdGenerator<IntentId> intentIdGenerator;
-
     @Activate
     public void activate() {
-        IdBlockAllocator idBlockAllocator = new DummyIdBlockAllocator();
-        intentIdGenerator = new IdBlockAllocatorBasedIntentIdGenerator(idBlockAllocator);
         intentManager.registerCompiler(MultiPointToSinglePointIntent.class, this);
     }
 
@@ -60,9 +54,9 @@
             links.addAll(path.links());
         }
 
-        Intent result = new LinkCollectionIntent(intentIdGenerator.getNewId(),
-                intent.selector(), intent.treatment(),
-                links, intent.egressPoint());
+        Intent result = new LinkCollectionIntent(intent.appId(),
+                                                 intent.selector(), intent.treatment(),
+                                                 links, intent.egressPoint());
         return Arrays.asList(result);
     }
 
diff --git a/core/net/src/main/java/org/onlab/onos/net/intent/impl/ObjectiveTracker.java b/core/net/src/main/java/org/onlab/onos/net/intent/impl/ObjectiveTracker.java
index 7ba4e26..90e878e 100644
--- a/core/net/src/main/java/org/onlab/onos/net/intent/impl/ObjectiveTracker.java
+++ b/core/net/src/main/java/org/onlab/onos/net/intent/impl/ObjectiveTracker.java
@@ -11,6 +11,7 @@
 import org.onlab.onos.event.Event;
 import org.onlab.onos.net.Link;
 import org.onlab.onos.net.LinkKey;
+import org.onlab.onos.net.NetworkResource;
 import org.onlab.onos.net.intent.IntentId;
 import org.onlab.onos.net.link.LinkEvent;
 import org.onlab.onos.net.topology.TopologyEvent;
@@ -27,8 +28,8 @@
 import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.collect.Multimaps.synchronizedSetMultimap;
 import static java.util.concurrent.Executors.newSingleThreadExecutor;
-import static org.onlab.onos.net.link.LinkEvent.Type.LINK_REMOVED;
 import static org.onlab.onos.net.LinkKey.linkKey;
+import static org.onlab.onos.net.link.LinkEvent.Type.LINK_REMOVED;
 import static org.onlab.util.Tools.namedThreads;
 import static org.slf4j.LoggerFactory.getLogger;
 
@@ -81,16 +82,22 @@
     }
 
     @Override
-    public void addTrackedResources(IntentId intentId, Collection<Link> resources) {
-        for (Link link : resources) {
-            intentsByLink.put(linkKey(link), intentId);
+    public void addTrackedResources(IntentId intentId,
+                                    Collection<NetworkResource> resources) {
+        for (NetworkResource resource : resources) {
+            if (resource instanceof Link) {
+                intentsByLink.put(linkKey((Link) resource), intentId);
+            }
         }
     }
 
     @Override
-    public void removeTrackedResources(IntentId intentId, Collection<Link> resources) {
-        for (Link link : resources) {
-            intentsByLink.remove(linkKey(link), intentId);
+    public void removeTrackedResources(IntentId intentId,
+                                       Collection<NetworkResource> resources) {
+        for (NetworkResource resource : resources) {
+            if (resource instanceof Link) {
+                intentsByLink.remove(linkKey((Link) resource), intentId);
+            }
         }
     }
 
diff --git a/core/net/src/main/java/org/onlab/onos/net/intent/impl/ObjectiveTrackerService.java b/core/net/src/main/java/org/onlab/onos/net/intent/impl/ObjectiveTrackerService.java
index 15496ff..9acd215 100644
--- a/core/net/src/main/java/org/onlab/onos/net/intent/impl/ObjectiveTrackerService.java
+++ b/core/net/src/main/java/org/onlab/onos/net/intent/impl/ObjectiveTrackerService.java
@@ -1,6 +1,6 @@
 package org.onlab.onos.net.intent.impl;
 
-import org.onlab.onos.net.Link;
+import org.onlab.onos.net.NetworkResource;
 import org.onlab.onos.net.intent.IntentId;
 
 import java.util.Collection;
@@ -28,17 +28,19 @@
     /**
      * Adds a path flow to be tracked.
      *
-     * @param intentId intent identity on whose behalf the path is being tracked
+     * @param intentId  intent identity on whose behalf the path is being tracked
      * @param resources resources to track
      */
-    public void addTrackedResources(IntentId intentId, Collection<Link> resources);
+    public void addTrackedResources(IntentId intentId,
+                                    Collection<NetworkResource> resources);
 
     /**
      * Removes a path flow to be tracked.
      *
-     * @param intentId intent identity on whose behalf the path is being tracked
+     * @param intentId  intent identity on whose behalf the path is being tracked
      * @param resources resources to stop tracking
      */
-    public void removeTrackedResources(IntentId intentId, Collection<Link> resources);
+    public void removeTrackedResources(IntentId intentId,
+                                       Collection<NetworkResource> resources);
 
 }
diff --git a/core/net/src/main/java/org/onlab/onos/net/intent/impl/PointToPointIntentCompiler.java b/core/net/src/main/java/org/onlab/onos/net/intent/impl/PointToPointIntentCompiler.java
index 0556df0..25d50cc 100644
--- a/core/net/src/main/java/org/onlab/onos/net/intent/impl/PointToPointIntentCompiler.java
+++ b/core/net/src/main/java/org/onlab/onos/net/intent/impl/PointToPointIntentCompiler.java
@@ -1,10 +1,5 @@
 package org.onlab.onos.net.intent.impl;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
@@ -16,16 +11,19 @@
 import org.onlab.onos.net.Link;
 import org.onlab.onos.net.Path;
 import org.onlab.onos.net.host.HostService;
-import org.onlab.onos.net.intent.IdGenerator;
 import org.onlab.onos.net.intent.Intent;
 import org.onlab.onos.net.intent.IntentCompiler;
 import org.onlab.onos.net.intent.IntentExtensionService;
-import org.onlab.onos.net.intent.IntentId;
 import org.onlab.onos.net.intent.PathIntent;
 import org.onlab.onos.net.intent.PointToPointIntent;
 import org.onlab.onos.net.provider.ProviderId;
 import org.onlab.onos.net.topology.PathService;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+
 /**
  * A intent compiler for {@link org.onlab.onos.net.intent.HostToHostIntent}.
  */
@@ -43,12 +41,8 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected HostService hostService;
 
-    protected IdGenerator<IntentId> intentIdGenerator;
-
     @Activate
     public void activate() {
-        IdBlockAllocator idBlockAllocator = new DummyIdBlockAllocator();
-        intentIdGenerator = new IdBlockAllocatorBasedIntentIdGenerator(idBlockAllocator);
         intentManager.registerCompiler(PointToPointIntent.class, this);
     }
 
@@ -67,23 +61,21 @@
         links.add(DefaultEdgeLink.createEdgeLink(intent.egressPoint(), false));
 
         return Arrays.asList(createPathIntent(new DefaultPath(PID, links, path.cost() + 2,
-                                              path.annotations()),
-                             intent));
+                                                              path.annotations()),
+                                              intent));
     }
 
     /**
      * Creates a path intent from the specified path and original
      * connectivity intent.
      *
-     * @param path path to create an intent for
+     * @param path   path to create an intent for
      * @param intent original intent
      */
     private Intent createPathIntent(Path path,
                                     PointToPointIntent intent) {
-
-        return new PathIntent(intentIdGenerator.getNewId(),
-                              intent.selector(), intent.treatment(),
-                              path.src(), path.dst(), path);
+        return new PathIntent(intent.appId(),
+                              intent.selector(), intent.treatment(), path);
     }
 
     /**