blob: 580872df830b80fef94f203b3192b2b0483b1b42 [file] [log] [blame]
Simon Huntf679c4e2016-04-01 17:02:24 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Simon Huntf679c4e2016-04-01 17:02:24 -07003 *
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 */
16package org.onosproject.ui;
17
Simon Hunt4f4ffc32016-08-03 18:30:47 -070018import org.onosproject.net.region.RegionId;
Simon Huntf679c4e2016-04-01 17:02:24 -070019import org.onosproject.ui.model.topo.UiTopoLayout;
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070020import org.onosproject.ui.model.topo.UiTopoLayoutId;
Simon Huntf679c4e2016-04-01 17:02:24 -070021
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070022import java.util.Set;
Simon Huntf679c4e2016-04-01 17:02:24 -070023
24/**
25 * Service for managing {@link UiTopoLayout} instances.
Simon Hunt8add9ee2016-09-20 17:05:07 -070026 * Those instances are used in conjunction with modeling the region-based
27 * topology views.
Simon Huntf679c4e2016-04-01 17:02:24 -070028 */
29public interface UiTopoLayoutService {
30
31 /**
Thomas Vachuska92b016b2016-05-20 11:37:57 -070032 * Returns the top-level root layout, which always exists and cannot
33 * be removed or associated directly with a region.
34 *
35 * @return root topology layout
36 */
37 UiTopoLayout getRootLayout();
38
39 /**
Simon Huntd0fa2842016-10-24 18:04:05 -070040 * Returns the set of available layouts (not including the root layout).
Simon Huntf679c4e2016-04-01 17:02:24 -070041 *
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070042 * @return set of available layouts
Simon Huntf679c4e2016-04-01 17:02:24 -070043 */
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070044 Set<UiTopoLayout> getLayouts();
Simon Huntf679c4e2016-04-01 17:02:24 -070045
46 /**
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070047 * Adds a layout to the system or updates an existing one.
Simon Huntf679c4e2016-04-01 17:02:24 -070048 *
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070049 * @param layout the layout to add or update
Simon Hunt8add9ee2016-09-20 17:05:07 -070050 * @return true if added; false if updated
Simon Huntf679c4e2016-04-01 17:02:24 -070051 */
52 boolean addLayout(UiTopoLayout layout);
53
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070054 /**
55 * Returns the layout with the specified identifier.
Thomas Vachuska92b016b2016-05-20 11:37:57 -070056 *
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070057 * @param layoutId layout identifier
58 * @return layout or null if no such layout is found
59 */
60 UiTopoLayout getLayout(UiTopoLayoutId layoutId);
61
Simon Huntf679c4e2016-04-01 17:02:24 -070062 /**
Simon Hunt4f4ffc32016-08-03 18:30:47 -070063 * Returns the layout which has the backing region identified by
64 * the given region identifier.
65 *
66 * @param regionId region identifier
67 * @return corresponding layout
68 */
Thomas Vachuska528ea952017-10-09 18:25:35 +020069 // FIXME: We will need to add support for multiple layouts (logical & physical)
70 // for the same region and this method won't have sufficient inputs to resolve
71 // the desired layout.
Simon Hunt4f4ffc32016-08-03 18:30:47 -070072 UiTopoLayout getLayout(RegionId regionId);
73
74 /**
Simon Huntb1ce2602016-07-23 14:04:31 -070075 * Returns the set of peer layouts of the specified layout. That is,
76 * those layouts that share the same parent.
77 *
78 * @param layoutId layout identifier
79 * @return set of peer layouts; empty set if layout has no peers
80 */
Simon Hunt98189192016-07-29 19:02:27 -070081 Set<UiTopoLayout> getPeerLayouts(UiTopoLayoutId layoutId);
Simon Huntb1ce2602016-07-23 14:04:31 -070082
83 /**
Thomas Vachuska92b016b2016-05-20 11:37:57 -070084 * Returns the set of the child layouts of the specified layout.
85 *
86 * @param layoutId layout identifier
87 * @return set of child layouts; empty set if layout has no children
88 */
89 Set<UiTopoLayout> getChildren(UiTopoLayoutId layoutId);
90
91 /**
Simon Huntf679c4e2016-04-01 17:02:24 -070092 * Removes a layout from the system.
93 *
94 * @param layout the layout to remove
Simon Hunt8add9ee2016-09-20 17:05:07 -070095 * @return true if removed; false if no longer registered
Simon Huntf679c4e2016-04-01 17:02:24 -070096 */
97 boolean removeLayout(UiTopoLayout layout);
98
99}