blob: 4ffc74a49317c675b882bd18552c7d80adca1f28 [file] [log] [blame]
Thomas Vachuska3553b302015-03-07 14:49:43 -08001/*
2 * Copyright 2015 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 */
16package org.onosproject.ui;
17
18import com.fasterxml.jackson.databind.node.ObjectNode;
19
20/**
21 * Abstraction of a user interface session connection.
22 */
23public interface UiConnection {
24
25 /**
Thomas Vachuska0af26912016-03-21 21:37:30 -070026 * Returns the name of the logged-in user for which this connection exists.
27 *
28 * @return logged in user name
29 */
30 String userName();
31
32 /**
Thomas Vachuska3553b302015-03-07 14:49:43 -080033 * Sends the specified JSON message to the user interface client.
34 *
35 * @param message message to send
36 */
37 void sendMessage(ObjectNode message);
38
Thomas Vachuskab6acc7b2015-03-11 09:11:21 -070039 /**
40 * Composes a message into JSON and sends it to the user interface client.
41 *
42 * @param type message type
43 * @param sid message sequence number
44 * @param payload message payload
45 */
Simon Huntda580882015-05-12 20:58:18 -070046 // TODO: remove sid parameter
Thomas Vachuskab6acc7b2015-03-11 09:11:21 -070047 void sendMessage(String type, long sid, ObjectNode payload);
48
Thomas Vachuska3553b302015-03-07 14:49:43 -080049}