blob: 4fb388dc1f969bd2a2d05696c88de8e18f7ba741 [file] [log] [blame]
Thomas Vachuska3553b302015-03-07 14:49:43 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Thomas Vachuska3553b302015-03-07 14:49:43 -08003 *
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
18import com.fasterxml.jackson.databind.node.ObjectNode;
Thomas Vachuska92b016b2016-05-20 11:37:57 -070019import org.onosproject.ui.model.topo.UiTopoLayout;
Thomas Vachuska3553b302015-03-07 14:49:43 -080020
21/**
22 * Abstraction of a user interface session connection.
23 */
24public interface UiConnection {
25
26 /**
Thomas Vachuska0af26912016-03-21 21:37:30 -070027 * Returns the name of the logged-in user for which this connection exists.
28 *
29 * @return logged in user name
30 */
31 String userName();
32
33 /**
Thomas Vachuska92b016b2016-05-20 11:37:57 -070034 * Returns the current layout context.
35 *
36 * @return current topology layout
37 */
38 UiTopoLayout currentLayout();
39
40 /**
41 * Changes the current layout context to the specified layout.
42 *
43 * @param topoLayout new topology layout context
44 */
45 void setCurrentLayout(UiTopoLayout topoLayout);
46
47 /**
48 * Returns the current view identifier.
49 *
50 * @return current view
51 */
52 String currentView();
53
54 /**
55 * Sets the currently selected view.
56 *
57 * @param viewId view identifier
58 */
59 void setCurrentView(String viewId);
60
61 /**
Thomas Vachuska3553b302015-03-07 14:49:43 -080062 * Sends the specified JSON message to the user interface client.
63 *
64 * @param message message to send
65 */
66 void sendMessage(ObjectNode message);
67
Thomas Vachuskab6acc7b2015-03-11 09:11:21 -070068 /**
69 * Composes a message into JSON and sends it to the user interface client.
70 *
71 * @param type message type
72 * @param sid message sequence number
73 * @param payload message payload
74 */
Simon Huntda580882015-05-12 20:58:18 -070075 // TODO: remove sid parameter
Thomas Vachuskab6acc7b2015-03-11 09:11:21 -070076 void sendMessage(String type, long sid, ObjectNode payload);
77
Thomas Vachuska3553b302015-03-07 14:49:43 -080078}