KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jivesoftware > messenger > disco > DiscoInfoProvider


1 /**
2  * $RCSfile: DiscoInfoProvider.java,v $
3  * $Revision: 1.5 $
4  * $Date: 2005/07/26 05:08:21 $
5  *
6  * Copyright (C) 2004 Jive Software. All rights reserved.
7  *
8  * This software is published under the terms of the GNU Public License (GPL),
9  * a copy of which is included in this distribution.
10  */

11
12 package org.jivesoftware.messenger.disco;
13
14 import org.dom4j.Element;
15 import org.jivesoftware.messenger.forms.spi.XDataFormImpl;
16 import org.xmpp.packet.JID;
17
18 import java.util.Iterator JavaDoc;
19
20 /**
21  * A DiscoInfoProvider is responsible for providing information about a JID's name and its node. For
22  * example, the room service could implement this interface in order to provide disco#info about
23  * its rooms. In this case, the JID's name will be the room's name and node will be null.<p>
24  * <p/>
25  * The information to provide has to include the entity's identity and the features offered and
26  * protocols supported by the target entity. The identity will be provided as an Element that will
27  * include the categoty, type and name attributes. Whilst the features will be just plain Strings.
28  *
29  * @author Gaston Dombiak
30  */

31 public interface DiscoInfoProvider {
32
33     /**
34      * Returns an Iterator (of Element) with the target entity's identities. Each Element must
35      * include the categoty, type and name attributes of the entity.
36      *
37      * @param name the recipient JID's name.
38      * @param node the requested disco node.
39      * @param senderJID the XMPPAddress of user that sent the disco info request.
40      * @return an Iterator (of Element) with the target entity's identities.
41      */

42     public abstract Iterator JavaDoc<Element> getIdentities(String JavaDoc name, String JavaDoc node, JID senderJID);
43
44     /**
45      * Returns an Iterator (of String) with the supported features. The features to include are the
46      * features offered and supported protocols by the target entity identified by the requested
47      * name and node.
48      *
49      * @param name the recipient JID's name.
50      * @param node the requested disco node.
51      * @param senderJID the XMPPAddress of user that sent the disco info request.
52      * @return an Iterator (of String) with the supported features.
53      */

54     public abstract Iterator JavaDoc<String JavaDoc> getFeatures(String JavaDoc name, String JavaDoc node, JID senderJID);
55
56     /**
57      * Returns an XDataForm with the extended information about the entity or null if none. Each bit
58      * of information about the entity must be included as a value of a field of the form.
59      *
60      * @param name the recipient JID's name.
61      * @param node the requested disco node.
62      * @param senderJID the XMPPAddress of user that sent the disco info request.
63      * @return an XDataForm with the extended information about the entity or null if none.
64      */

65     public abstract XDataFormImpl getExtendedInfo(String JavaDoc name, String JavaDoc node, JID senderJID);
66
67     /**
68      * Returns true if we can provide information related to the requested name and node. For
69      * example, if the requested name refers to a non-existant MUC room then the answer will be
70      * false. In case that the sender of the disco request is not authorized to discover this
71      * information an UnauthorizedException will be thrown.
72      *
73      * @param name the recipient JID's name.
74      * @param node the requested disco node.
75      * @param senderJID the XMPPAddress of user that sent the disco info request.
76      * @return true if we can provide information related to the requested name and node.
77      */

78     public abstract boolean hasInfo(String JavaDoc name, String JavaDoc node, JID senderJID);
79 }
80
Popular Tags