Converted UiSharedTopologyModel to be a @Service.
Change-Id: Idc8df1b9c0a52db01ac545567dacc0e1c770f84a
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/ModelCache.java b/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/ModelCache.java
new file mode 100644
index 0000000..d72ff3d
--- /dev/null
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/ModelCache.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.ui.impl.topo.model;
+
+import org.onosproject.event.EventDispatcher;
+import org.onosproject.net.Device;
+import org.onosproject.ui.model.topo.UiDevice;
+
+/**
+ * UI Topology Model cache.
+ */
+class ModelCache {
+
+ private final EventDispatcher dispatcher;
+
+ ModelCache(EventDispatcher eventDispatcher) {
+ this.dispatcher = eventDispatcher;
+ }
+
+ /**
+ * Clear our model.
+ */
+ void clear() {
+ // TODO: clear our internal state
+ }
+
+ /**
+ * Create our internal model of the global topology.
+ */
+ void load() {
+// loadClusterMembers();
+// loadRegions();
+// loadDevices();
+// loadHosts();
+// loadLinks();
+ }
+
+
+ // add or update device
+ void addOrUpdateDevice(Device device) {
+ // fetch UiDevice
+ UiDevice uiDevice = new UiDevice();
+
+ dispatcher.post(
+ new UiModelEvent(UiModelEvent.Type.DEVICE_ADDED, uiDevice)
+ );
+
+ }
+
+ void removeDevice(Device device) {
+ UiDevice uiDevice = new UiDevice();
+
+ dispatcher.post(
+ new UiModelEvent(UiModelEvent.Type.DEVICE_REMOVED, uiDevice)
+ );
+
+ }
+
+ // TODO remaining model objects
+
+}