blob: 1e1374a660ce49c9e58a4d380f030252c9cc7b3c [file] [log] [blame]
Simon Hunted804d52016-03-30 09:51:40 -07001/*
2 * Copyright 2016 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.ui.impl.topo.model;
18
19import org.slf4j.Logger;
20import org.slf4j.LoggerFactory;
21
22/**
23 * A lazily-initialized Singleton that creates and maintains the UI-model
24 * of the network topology.
25 */
26public final class UiSharedTopologyModel {
27
28 private static final Logger log =
29 LoggerFactory.getLogger(UiSharedTopologyModel.class);
30
31 private static UiSharedTopologyModel singleton = null;
32
33 private UiSharedTopologyModel() {
34 // TODO: set up core model listeners and build the state of the model
35 }
36
37 public void register(UiTopoLayout layout) {
38 log.info("Registering topology layout {}", layout);
39 // TODO: register the view
40 }
41
42 public void unregister(UiTopoLayout layout) {
43 log.info("Unregistering topology layout {}", layout);
44 // TODO: unregister the view
45 }
46
47 /**
48 * Returns a reference to the Singleton UI network topology model.
49 *
50 * @return the singleton topology model
51 */
52 public static synchronized UiSharedTopologyModel instance() {
53 if (singleton == null) {
54 log.info("Instantiating Singleton.");
55 singleton = new UiSharedTopologyModel();
56 }
57 return singleton;
58 }
59}