Fixing topology related interface/class tree

- (Mutable)Topology no longer implements ImmutableTopology

    --- BaseTopology (was ImmutableTopology)
     |
     +-- ImmutableTopology (new)
     |
     +-- MutableTopology (was Topology)
       |
       +-- RefreshableTopology
       |
       +-- TopologyInternal
            This interface is placed in wrong place. To be fixed later.

Change-Id: Ifa9defcc7c0fc22bba19977fe4ea57eaf792275e
diff --git a/src/main/java/net/onrc/onos/core/topology/BaseTopology.java b/src/main/java/net/onrc/onos/core/topology/BaseTopology.java
new file mode 100644
index 0000000..6b2bef8
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/topology/BaseTopology.java
@@ -0,0 +1,217 @@
+package net.onrc.onos.core.topology;
+
+import java.util.Collection;
+
+import net.floodlightcontroller.util.MACAddress;
+import net.onrc.onos.core.util.Dpid;
+import net.onrc.onos.core.util.PortNumber;
+import net.onrc.onos.core.util.SwitchPort;
+
+// TODO move to appropriate package. under api??
+/**
+ * BaseTopology interface common to both {@link ImmutableTopology} and {@link MutableTopology}.
+ */
+public interface BaseTopology {
+
+    /**
+     * Gets the switch for a given switch DPID.
+     *
+     * @param dpid the switch dpid.
+     * @return the switch if found, otherwise null.
+     */
+    public Switch getSwitch(Dpid dpid);
+
+    /**
+     * Gets all switches in the network.
+     *
+     * @return all switches in the network.
+     */
+    public Iterable<Switch> getSwitches();
+
+    /**
+     * Gets the port on a switch.
+     *
+     * @param dpid   the switch DPID.
+     * @param portNumber the switch port number.
+     * @return the switch port if found, otherwise null.
+     */
+    public Port getPort(Dpid dpid, PortNumber portNumber);
+
+    /**
+     * Gets the port on a switch.
+     *
+     * @param port port identifier
+     * @return the switch port if found, otherwise null.
+     */
+    public Port getPort(SwitchPort port);
+
+    /**
+     * Gets all ports on a switch specified.
+     *
+     * @param dpid Switch dpid
+     * @return ports.
+     */
+    public Collection<Port> getPorts(Dpid dpid);
+
+    /**
+     * Gets the outgoing link from a switch port.
+     * <p/>
+     * FIXME As a temporary workaround, it will look for type "packet" and
+     * returns it if found, else return whichever link is found first.
+     *
+     * @param dpid   the switch DPID.
+     * @param portNumber the switch port number.
+     * @return the outgoing link if found, otherwise null.
+     */
+    public Link getOutgoingLink(Dpid dpid, PortNumber portNumber);
+
+    /**
+     * Gets the outgoing link from a switch port.
+     *
+     * @param dpid   the switch DPID.
+     * @param portNumber the switch port number.
+     * @param type   type of the link
+     * @return the outgoing link if found, otherwise null.
+     */
+    public Link getOutgoingLink(Dpid dpid, PortNumber portNumber, String type);
+
+    /**
+     * Gets the outgoing link from a switch port.
+     * <p/>
+     * FIXME As a temporary workaround, it will look for type "packet" and
+     * returns it if found, else return whichever link is found first.
+     *
+     * @param port port identifier
+     * @return the outgoing link if found, otherwise null.
+     */
+    public Link getOutgoingLink(SwitchPort port);
+
+    /**
+     * Gets the outgoing link from a switch port.
+     *
+     * @param port port identifier
+     * @param type type of the link
+     * @return the outgoing link if found, otherwise null.
+     */
+    public Link getOutgoingLink(SwitchPort port, String type);
+
+    /**
+     * Gets all the outgoing link from a switch port.
+     *
+     * @param port port identifier
+     * @return outgoing links
+     */
+    public Collection<Link> getOutgoingLinks(SwitchPort port);
+
+    /**
+     * Gets the incoming link to a switch port.
+     * <p/>
+     * FIXME As a temporary workaround, it will look for type "packet" and
+     * returns it if found, else return whichever link is found first.
+     *
+     * @param dpid   the switch DPID.
+     * @param portNumber the switch port number.
+     * @return the incoming link if found, otherwise null.
+     */
+    public Link getIncomingLink(Dpid dpid, PortNumber portNumber);
+
+    /**
+     * Gets the incoming link to a switch port.
+     * <p/>
+     * FIXME As a temporary workaround, it will look for type "packet" and
+     * returns it if found, else return whichever link is found first.
+     *
+     * @param dpid   the switch DPID.
+     * @param portNumber the switch port number.
+     * @param type type of the link
+     * @return the incoming link if found, otherwise null.
+     */
+    public Link getIncomingLink(Dpid dpid, PortNumber portNumber, String type);
+
+    /**
+     * Gets the incoming link to a switch port.
+     * <p/>
+     * FIXME As a temporary workaround, it will look for type "packet" and
+     * returns it if found, else return whichever link is found first.
+     *
+     * @param port port identifier
+     * @return the incoming link if found, otherwise null.
+     */
+    public Link getIncomingLink(SwitchPort port);
+
+    /**
+     * Gets the incoming link to a switch port.
+     *
+     * @param port port identifier
+     * @param type type of the link
+     * @return the incoming link if found, otherwise null.
+     */
+    public Link getIncomingLink(SwitchPort port, String type);
+
+    /**
+     * Gets all the incoming link from a switch port.
+     *
+     * @param port port identifier
+     * @return incoming links
+     */
+    public Collection<Link> getIncomingLinks(SwitchPort port);
+
+    /**
+     * Gets the outgoing link from a switch and a port to another switch and
+     * a port.
+     *
+     * @param srcDpid   the source switch DPID.
+     * @param srcPortNumber the source switch port number.
+     * @param dstDpid   the destination switch DPID.
+     * @param dstPortNumber the destination switch port number.
+     * @return the outgoing link if found, otherwise null.
+     */
+    public Link getLink(Dpid srcDpid, PortNumber srcPortNumber,
+                        Dpid dstDpid, PortNumber dstPortNumber);
+
+    /**
+     * Gets the outgoing link from a switch and a port to another switch and
+     * a port.
+     *
+     * @param srcDpid   the source switch DPID.
+     * @param srcPortNumber the source switch port number.
+     * @param dstDpid   the destination switch DPID.
+     * @param dstPortNumber the destination switch port number.
+     * @param type      type of the link
+     * @return the outgoing link if found, otherwise null.
+     */
+    public Link getLink(Dpid srcDpid, PortNumber srcPortNumber,
+                        Dpid dstDpid, PortNumber dstPortNumber,
+                        String type);
+
+    /**
+     * Gets all links in the network.
+     * <p/>
+     *
+     * @return all links in the network.
+     */
+    public Iterable<Link> getLinks();
+
+    /**
+     * Gets the network device for a given MAC address.
+     *
+     * @param address the MAC address to use.
+     * @return the network device for the MAC address if found, otherwise null.
+     */
+    public Host getHostByMac(MACAddress address);
+
+    /**
+     * Gets all devices in the network.
+     *
+     * @return all devices in the network
+     */
+    public Iterable<Host> getHosts();
+
+    /**
+     * Gets all devices on specified port.
+     *
+     * @param port port which the device is attached
+     * @return all devices attached to the port.
+     */
+    public Collection<Host> getHosts(SwitchPort port);
+}
diff --git a/src/main/java/net/onrc/onos/core/topology/ITopologyService.java b/src/main/java/net/onrc/onos/core/topology/ITopologyService.java
index ecb1212..26b6212 100644
--- a/src/main/java/net/onrc/onos/core/topology/ITopologyService.java
+++ b/src/main/java/net/onrc/onos/core/topology/ITopologyService.java
@@ -11,7 +11,7 @@
      *
      * @return the global Topology object
      */
-    public Topology getTopology();
+    public MutableTopology getTopology();
 
     /**
      * Adds a listener for topology events.
diff --git a/src/main/java/net/onrc/onos/core/topology/ImmutableTopology.java b/src/main/java/net/onrc/onos/core/topology/ImmutableTopology.java
index 0f7ab96..ed5678e 100644
--- a/src/main/java/net/onrc/onos/core/topology/ImmutableTopology.java
+++ b/src/main/java/net/onrc/onos/core/topology/ImmutableTopology.java
@@ -1,216 +1,10 @@
 package net.onrc.onos.core.topology;
 
-import java.util.Collection;
-
-import net.floodlightcontroller.util.MACAddress;
-import net.onrc.onos.core.util.Dpid;
-import net.onrc.onos.core.util.PortNumber;
-import net.onrc.onos.core.util.SwitchPort;
-
+//TODO move to appropriate package under api
 /**
- * ImmutableTopology.
+ * ImmutableTopology, which could be accessed without locking, etc.
  */
-public interface ImmutableTopology {
+public interface ImmutableTopology extends BaseTopology {
 
-    /**
-     * Gets the switch for a given switch DPID.
-     *
-     * @param dpid the switch dpid.
-     * @return the switch if found, otherwise null.
-     */
-    public Switch getSwitch(Dpid dpid);
-
-    /**
-     * Gets all switches in the network.
-     *
-     * @return all switches in the network.
-     */
-    public Iterable<Switch> getSwitches();
-
-    /**
-     * Gets the port on a switch.
-     *
-     * @param dpid   the switch DPID.
-     * @param portNumber the switch port number.
-     * @return the switch port if found, otherwise null.
-     */
-    public Port getPort(Dpid dpid, PortNumber portNumber);
-
-    /**
-     * Gets the port on a switch.
-     *
-     * @param port port identifier
-     * @return the switch port if found, otherwise null.
-     */
-    public Port getPort(SwitchPort port);
-
-    /**
-     * Gets all ports on a switch specified.
-     *
-     * @param dpid Switch dpid
-     * @return ports.
-     */
-    public Collection<Port> getPorts(Dpid dpid);
-
-    /**
-     * Gets the outgoing link from a switch port.
-     * <p/>
-     * FIXME As a temporary workaround, it will look for type "packet" and
-     * returns it if found, else return whichever link is found first.
-     *
-     * @param dpid   the switch DPID.
-     * @param portNumber the switch port number.
-     * @return the outgoing link if found, otherwise null.
-     */
-    public Link getOutgoingLink(Dpid dpid, PortNumber portNumber);
-
-    /**
-     * Gets the outgoing link from a switch port.
-     *
-     * @param dpid   the switch DPID.
-     * @param portNumber the switch port number.
-     * @param type   type of the link
-     * @return the outgoing link if found, otherwise null.
-     */
-    public Link getOutgoingLink(Dpid dpid, PortNumber portNumber, String type);
-
-    /**
-     * Gets the outgoing link from a switch port.
-     * <p/>
-     * FIXME As a temporary workaround, it will look for type "packet" and
-     * returns it if found, else return whichever link is found first.
-     *
-     * @param port port identifier
-     * @return the outgoing link if found, otherwise null.
-     */
-    public Link getOutgoingLink(SwitchPort port);
-
-    /**
-     * Gets the outgoing link from a switch port.
-     *
-     * @param port port identifier
-     * @param type type of the link
-     * @return the outgoing link if found, otherwise null.
-     */
-    public Link getOutgoingLink(SwitchPort port, String type);
-
-    /**
-     * Gets all the outgoing link from a switch port.
-     *
-     * @param port port identifier
-     * @return outgoing links
-     */
-    public Collection<Link> getOutgoingLinks(SwitchPort port);
-
-    /**
-     * Gets the incoming link to a switch port.
-     * <p/>
-     * FIXME As a temporary workaround, it will look for type "packet" and
-     * returns it if found, else return whichever link is found first.
-     *
-     * @param dpid   the switch DPID.
-     * @param portNumber the switch port number.
-     * @return the incoming link if found, otherwise null.
-     */
-    public Link getIncomingLink(Dpid dpid, PortNumber portNumber);
-
-    /**
-     * Gets the incoming link to a switch port.
-     * <p/>
-     * FIXME As a temporary workaround, it will look for type "packet" and
-     * returns it if found, else return whichever link is found first.
-     *
-     * @param dpid   the switch DPID.
-     * @param portNumber the switch port number.
-     * @param type type of the link
-     * @return the incoming link if found, otherwise null.
-     */
-    public Link getIncomingLink(Dpid dpid, PortNumber portNumber, String type);
-
-    /**
-     * Gets the incoming link to a switch port.
-     * <p/>
-     * FIXME As a temporary workaround, it will look for type "packet" and
-     * returns it if found, else return whichever link is found first.
-     *
-     * @param port port identifier
-     * @return the incoming link if found, otherwise null.
-     */
-    public Link getIncomingLink(SwitchPort port);
-
-    /**
-     * Gets the incoming link to a switch port.
-     *
-     * @param port port identifier
-     * @param type type of the link
-     * @return the incoming link if found, otherwise null.
-     */
-    public Link getIncomingLink(SwitchPort port, String type);
-
-    /**
-     * Gets all the incoming link from a switch port.
-     *
-     * @param port port identifier
-     * @return incoming links
-     */
-    public Collection<Link> getIncomingLinks(SwitchPort port);
-
-    /**
-     * Gets the outgoing link from a switch and a port to another switch and
-     * a port.
-     *
-     * @param srcDpid   the source switch DPID.
-     * @param srcPortNumber the source switch port number.
-     * @param dstDpid   the destination switch DPID.
-     * @param dstPortNumber the destination switch port number.
-     * @return the outgoing link if found, otherwise null.
-     */
-    public Link getLink(Dpid srcDpid, PortNumber srcPortNumber,
-                        Dpid dstDpid, PortNumber dstPortNumber);
-
-    /**
-     * Gets the outgoing link from a switch and a port to another switch and
-     * a port.
-     *
-     * @param srcDpid   the source switch DPID.
-     * @param srcPortNumber the source switch port number.
-     * @param dstDpid   the destination switch DPID.
-     * @param dstPortNumber the destination switch port number.
-     * @param type      type of the link
-     * @return the outgoing link if found, otherwise null.
-     */
-    public Link getLink(Dpid srcDpid, PortNumber srcPortNumber,
-                        Dpid dstDpid, PortNumber dstPortNumber,
-                        String type);
-
-    /**
-     * Gets all links in the network.
-     * <p/>
-     *
-     * @return all links in the network.
-     */
-    public Iterable<Link> getLinks();
-
-    /**
-     * Gets the network device for a given MAC address.
-     *
-     * @param address the MAC address to use.
-     * @return the network device for the MAC address if found, otherwise null.
-     */
-    public Host getHostByMac(MACAddress address);
-
-    /**
-     * Gets all devices in the network.
-     *
-     * @return all devices in the network
-     */
-    public Iterable<Host> getHosts();
-
-    /**
-     * Gets all devices on specified port.
-     *
-     * @param port port which the device is attached
-     * @return all devices attached to the port.
-     */
-    public Collection<Host> getHosts(SwitchPort port);
+    // no additional interface needed.
 }
diff --git a/src/main/java/net/onrc/onos/core/topology/Topology.java b/src/main/java/net/onrc/onos/core/topology/MutableTopology.java
similarity index 72%
rename from src/main/java/net/onrc/onos/core/topology/Topology.java
rename to src/main/java/net/onrc/onos/core/topology/MutableTopology.java
index 464f463..7372bcb 100644
--- a/src/main/java/net/onrc/onos/core/topology/Topology.java
+++ b/src/main/java/net/onrc/onos/core/topology/MutableTopology.java
@@ -4,13 +4,20 @@
 
 import org.codehaus.jackson.map.annotate.JsonSerialize;
 
+//TODO move to appropriate package under api
 /**
+ * MutableTopology, which this instance can be updated to new view.
+ * <p>
+ * Requires read-lock to access any information on this topology view.
+ * <p>
+ * Note: This is still read-only view of the topology.
+ * <p>
  * The northbound interface to the topology. This interface
  * is presented to the rest of ONOS. It is currently read-only, as we want
  * only the discovery modules to be allowed to modify the topology.
  */
 @JsonSerialize(using = TopologySerializer.class)
-public interface Topology extends ImmutableTopology {
+public interface MutableTopology extends BaseTopology {
 
     /**
      * Acquire a read lock on the entire topology. The topology will not
diff --git a/src/main/java/net/onrc/onos/core/topology/TopologyImpl.java b/src/main/java/net/onrc/onos/core/topology/TopologyImpl.java
index 5411a1b..b50bf48 100644
--- a/src/main/java/net/onrc/onos/core/topology/TopologyImpl.java
+++ b/src/main/java/net/onrc/onos/core/topology/TopologyImpl.java
@@ -33,7 +33,7 @@
 /**
  * Class to represent an instance of Topology Snapshot.
  */
-public class TopologyImpl implements Topology, TopologyInternal {
+public class TopologyImpl implements MutableTopology, TopologyInternal {
 
     private static final Logger log = LoggerFactory.getLogger(TopologyImpl.class);
 
diff --git a/src/main/java/net/onrc/onos/core/topology/TopologyInternal.java b/src/main/java/net/onrc/onos/core/topology/TopologyInternal.java
index e712795..292e260 100644
--- a/src/main/java/net/onrc/onos/core/topology/TopologyInternal.java
+++ b/src/main/java/net/onrc/onos/core/topology/TopologyInternal.java
@@ -8,10 +8,13 @@
 import net.onrc.onos.core.util.PortNumber;
 import net.onrc.onos.core.util.SwitchPort;
 
+// FIXME This Class hierarchy is wrong.
+// - We need BaseTopology + access to self-contained *Event objects.
+//   abstract class implementing BaseTopology?
 /**
  * Interface to reference internal self-contained elements.
  */
-public interface TopologyInternal extends Topology {
+public interface TopologyInternal extends MutableTopology {
     /**
      * Gets a SwitchEvent.
      *
diff --git a/src/main/java/net/onrc/onos/core/topology/TopologyManager.java b/src/main/java/net/onrc/onos/core/topology/TopologyManager.java
index 31933e4..62228f0 100644
--- a/src/main/java/net/onrc/onos/core/topology/TopologyManager.java
+++ b/src/main/java/net/onrc/onos/core/topology/TopologyManager.java
@@ -130,11 +130,11 @@
     }
 
     /**
-     * Get the Topology.
+     * Get the MutableTopology.
      *
-     * @return the Topology.
+     * @return the MutableTopology.
      */
-    Topology getTopology() {
+    MutableTopology getTopology() {
         return topology;
     }
 
diff --git a/src/main/java/net/onrc/onos/core/topology/TopologyModule.java b/src/main/java/net/onrc/onos/core/topology/TopologyModule.java
index 07ba2cf..7913fc5 100644
--- a/src/main/java/net/onrc/onos/core/topology/TopologyModule.java
+++ b/src/main/java/net/onrc/onos/core/topology/TopologyModule.java
@@ -67,7 +67,7 @@
     }
 
     @Override
-    public Topology getTopology() {
+    public MutableTopology getTopology() {
         return topologyManager.getTopology();
     }
 
diff --git a/src/main/java/net/onrc/onos/core/topology/TopologyPublisher.java b/src/main/java/net/onrc/onos/core/topology/TopologyPublisher.java
index 7675aae..d27d68e 100644
--- a/src/main/java/net/onrc/onos/core/topology/TopologyPublisher.java
+++ b/src/main/java/net/onrc/onos/core/topology/TopologyPublisher.java
@@ -69,7 +69,7 @@
 
     private IHostService hostService;
 
-    private Topology topology;
+    private MutableTopology mutableTopology;
 
     private static final String ENABLE_CLEANUP_PROPERTY = "EnableCleanup";
     private boolean cleanupEnabled = true;
@@ -142,7 +142,7 @@
          * registry.
          */
         private void switchCleanup() {
-            Iterable<Switch> switches = topology.getSwitches();
+            Iterable<Switch> switches = mutableTopology.getSwitches();
 
             if (log.isTraceEnabled()) {
                 log.trace("Checking for inactive switches");
@@ -440,7 +440,7 @@
                                 byte[].class,
                                 TopologyEvent.class);
 
-        topology = topologyService.getTopology();
+        mutableTopology = topologyService.getTopology();
 
         // Run the cleanup thread
         String enableCleanup =
diff --git a/src/main/java/net/onrc/onos/core/topology/web/HostsResource.java b/src/main/java/net/onrc/onos/core/topology/web/HostsResource.java
index 301fb9e..70db064 100644
--- a/src/main/java/net/onrc/onos/core/topology/web/HostsResource.java
+++ b/src/main/java/net/onrc/onos/core/topology/web/HostsResource.java
@@ -2,7 +2,7 @@
 
 import static net.onrc.onos.core.topology.web.TopologyResource.eval;
 import net.onrc.onos.core.topology.ITopologyService;
-import net.onrc.onos.core.topology.Topology;
+import net.onrc.onos.core.topology.MutableTopology;
 
 import org.restlet.representation.Representation;
 import org.restlet.resource.Get;
@@ -24,12 +24,12 @@
             (ITopologyService) getContext().getAttributes()
                 .get(ITopologyService.class.getCanonicalName());
 
-        Topology topology = topologyService.getTopology();
-        topology.acquireReadLock();
+        MutableTopology mutableTopology = topologyService.getTopology();
+        mutableTopology.acquireReadLock();
         try {
-            return eval(toRepresentation(topology.getHosts(), null));
+            return eval(toRepresentation(mutableTopology.getHosts(), null));
         } finally {
-            topology.releaseReadLock();
+            mutableTopology.releaseReadLock();
         }
     }
 }
diff --git a/src/main/java/net/onrc/onos/core/topology/web/LinksResource.java b/src/main/java/net/onrc/onos/core/topology/web/LinksResource.java
index 6d910a8..d5fc52c 100644
--- a/src/main/java/net/onrc/onos/core/topology/web/LinksResource.java
+++ b/src/main/java/net/onrc/onos/core/topology/web/LinksResource.java
@@ -2,7 +2,7 @@
 
 import static net.onrc.onos.core.topology.web.TopologyResource.eval;
 import net.onrc.onos.core.topology.ITopologyService;
-import net.onrc.onos.core.topology.Topology;
+import net.onrc.onos.core.topology.MutableTopology;
 
 import org.restlet.representation.Representation;
 import org.restlet.resource.Get;
@@ -24,12 +24,12 @@
             (ITopologyService) getContext().getAttributes()
                 .get(ITopologyService.class.getCanonicalName());
 
-        Topology topology = topologyService.getTopology();
-        topology.acquireReadLock();
+        MutableTopology mutableTopology = topologyService.getTopology();
+        mutableTopology.acquireReadLock();
         try {
-            return eval(toRepresentation(topology.getLinks(), null));
+            return eval(toRepresentation(mutableTopology.getLinks(), null));
         } finally {
-            topology.releaseReadLock();
+            mutableTopology.releaseReadLock();
         }
     }
 }
diff --git a/src/main/java/net/onrc/onos/core/topology/web/SwitchesResource.java b/src/main/java/net/onrc/onos/core/topology/web/SwitchesResource.java
index dfb381e..3eeadbb 100644
--- a/src/main/java/net/onrc/onos/core/topology/web/SwitchesResource.java
+++ b/src/main/java/net/onrc/onos/core/topology/web/SwitchesResource.java
@@ -2,7 +2,7 @@
 
 import static net.onrc.onos.core.topology.web.TopologyResource.eval;
 import net.onrc.onos.core.topology.ITopologyService;
-import net.onrc.onos.core.topology.Topology;
+import net.onrc.onos.core.topology.MutableTopology;
 
 import org.restlet.representation.Representation;
 import org.restlet.resource.Get;
@@ -24,12 +24,12 @@
             (ITopologyService) getContext().getAttributes()
                 .get(ITopologyService.class.getCanonicalName());
 
-        Topology topology = topologyService.getTopology();
-        topology.acquireReadLock();
+        MutableTopology mutableTopology = topologyService.getTopology();
+        mutableTopology.acquireReadLock();
         try {
-            return eval(toRepresentation(topology.getSwitches(), null));
+            return eval(toRepresentation(mutableTopology.getSwitches(), null));
         } finally {
-            topology.releaseReadLock();
+            mutableTopology.releaseReadLock();
         }
     }
 }
diff --git a/src/main/java/net/onrc/onos/core/topology/web/TopologyResource.java b/src/main/java/net/onrc/onos/core/topology/web/TopologyResource.java
index 8068552..7406075 100644
--- a/src/main/java/net/onrc/onos/core/topology/web/TopologyResource.java
+++ b/src/main/java/net/onrc/onos/core/topology/web/TopologyResource.java
@@ -1,7 +1,7 @@
 package net.onrc.onos.core.topology.web;
 
 import net.onrc.onos.core.topology.ITopologyService;
-import net.onrc.onos.core.topology.Topology;
+import net.onrc.onos.core.topology.MutableTopology;
 
 import org.restlet.engine.io.BufferingRepresentation;
 import org.restlet.representation.Representation;
@@ -23,12 +23,12 @@
             (ITopologyService) getContext().getAttributes()
                 .get(ITopologyService.class.getCanonicalName());
 
-        Topology topology = topologyService.getTopology();
-        topology.acquireReadLock();
+        MutableTopology mutableTopology = topologyService.getTopology();
+        mutableTopology.acquireReadLock();
         try {
-            return eval(toRepresentation(topology, null));
+            return eval(toRepresentation(mutableTopology, null));
         } finally {
-            topology.releaseReadLock();
+            mutableTopology.releaseReadLock();
         }
     }
 
diff --git a/src/main/java/net/onrc/onos/core/topology/web/serializers/TopologySerializer.java b/src/main/java/net/onrc/onos/core/topology/web/serializers/TopologySerializer.java
index b241ee4..2e21ab6 100644
--- a/src/main/java/net/onrc/onos/core/topology/web/serializers/TopologySerializer.java
+++ b/src/main/java/net/onrc/onos/core/topology/web/serializers/TopologySerializer.java
@@ -5,7 +5,7 @@
 import net.onrc.onos.core.topology.Host;
 import net.onrc.onos.core.topology.Link;
 import net.onrc.onos.core.topology.Switch;
-import net.onrc.onos.core.topology.Topology;
+import net.onrc.onos.core.topology.MutableTopology;
 
 import org.codehaus.jackson.JsonGenerator;
 import org.codehaus.jackson.map.SerializerProvider;
@@ -14,25 +14,25 @@
 /**
  * JSON serializer for Topology objects.
  */
-public class TopologySerializer extends SerializerBase<Topology> {
+public class TopologySerializer extends SerializerBase<MutableTopology> {
     /**
      * Default constructor.
      */
     public TopologySerializer() {
-        super(Topology.class);
+        super(MutableTopology.class);
     }
 
     /**
      * Serializes a Topology object in JSON.  The resulting JSON contains the
      * switches, links and ports provided by the Topology object.
      *
-     * @param topology the Topology that is being converted to JSON
+     * @param mutableTopology the Topology that is being converted to JSON
      * @param jsonGenerator generator to place the serialized JSON into
      * @param serializerProvider unused but required for method override
      * @throws IOException if the JSON serialization process fails
      */
     @Override
-    public void serialize(Topology topology,
+    public void serialize(MutableTopology mutableTopology,
                           JsonGenerator jsonGenerator,
                           SerializerProvider serializerProvider)
         throws IOException {
@@ -42,21 +42,21 @@
 
         // Output the switches array
         jsonGenerator.writeArrayFieldStart("switches");
-        for (final Switch swtch : topology.getSwitches()) {
+        for (final Switch swtch : mutableTopology.getSwitches()) {
             jsonGenerator.writeObject(swtch);
         }
         jsonGenerator.writeEndArray();
 
         // Output the links array
         jsonGenerator.writeArrayFieldStart("links");
-        for (final Link link : topology.getLinks()) {
+        for (final Link link : mutableTopology.getLinks()) {
             jsonGenerator.writeObject(link);
         }
         jsonGenerator.writeEndArray();
 
         // Output the hosts array
         jsonGenerator.writeArrayFieldStart("hosts");
-        for (final Host host : topology.getHosts()) {
+        for (final Host host : mutableTopology.getHosts()) {
             jsonGenerator.writeObject(host);
         }
         jsonGenerator.writeEndArray();