blob: a16216de63898b4e74fe1c6ff5268a959f622c8c [file] [log] [blame]
Tomek Osińskie9ccf412018-01-13 19:44:11 +01001/*
2 * Copyright 2018-present Open Networking Foundation
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.xmpp.core;
18
19/**
20 * Abstraction of a XMPP controller. Serves as a one stop
21 * shop for obtaining XMPP devices and (un)register listeners
22 * on XMPP events
23 */
24public interface XmppController {
25
26 /**
27 * Method allows to retrieve XMPP device for given XmppDeviceId, if one exists.
28 *
29 * @param xmppDeviceId the device to retrieve
30 * @return the interface to XMPP Device
31 */
32 XmppDevice getDevice(XmppDeviceId xmppDeviceId);
33
34 /**
35 * Register a listener for device events.
36 *
37 * @param deviceListener the listener to notify
38 */
39 void addXmppDeviceListener(XmppDeviceListener deviceListener);
40
41 /**
42 * Unregister a listener for device events.
43 *
44 * @param deviceListener the listener to unregister
45 */
46 void removeXmppDeviceListener(XmppDeviceListener deviceListener);
47
48 /**
Tomek Osiński7a1db182018-02-03 17:15:06 +010049 * Register a listener for IQ stanzas containing specific XML namespace.
Tomek Osińskie9ccf412018-01-13 19:44:11 +010050 *
51 * @param iqListener the listener to notify
Tomek Osiński7a1db182018-02-03 17:15:06 +010052 * @param namespace the XML namespace to observe
Tomek Osińskie9ccf412018-01-13 19:44:11 +010053 */
Tomek Osiński7a1db182018-02-03 17:15:06 +010054 void addXmppIqListener(XmppIqListener iqListener, String namespace);
Tomek Osińskie9ccf412018-01-13 19:44:11 +010055
56 /**
Tomek Osiński7a1db182018-02-03 17:15:06 +010057 * Unregister a listener for IQ stanzas containing specific XML namespace.
Tomek Osińskie9ccf412018-01-13 19:44:11 +010058 *
59 * @param iqListener the listener to unregister
Tomek Osiński7a1db182018-02-03 17:15:06 +010060 * @param namespace the XML namespace to observe
Tomek Osińskie9ccf412018-01-13 19:44:11 +010061 */
Tomek Osiński7a1db182018-02-03 17:15:06 +010062 void removeXmppIqListener(XmppIqListener iqListener, String namespace);
Tomek Osińskie9ccf412018-01-13 19:44:11 +010063
64 /**
65 * Register a listener for Message stanza of XMPP protocol.
66 *
67 * @param messageListener the listener to notify
68 */
69 void addXmppMessageListener(XmppMessageListener messageListener);
70
71 /**
72 * Unregister a listener for Message stanza of XMPP protocol.
73 *
74 * @param messageListener the listener to unregister
75 */
76 void removeXmppMessageListener(XmppMessageListener messageListener);
77
78 /**
79 * Register a listener for Presence stanza of XMPP protocol.
80 *
81 * @param presenceListener the listener to notify
82 */
83 void addXmppPresenceListener(XmppPresenceListener presenceListener);
84
85 /**
86 * Unregister a listener for Presence stanza of XMPP protocol.
87 *
88 * @param presenceListener the listener to unregister
89 */
90 void removeXmppPresenceListener(XmppPresenceListener presenceListener);
91
92}