KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > xmpp > component > ComponentManager


1 /**
2  * $RCSfile: ComponentManager.java,v $
3  * $Revision: 1.6 $
4  * $Date: 2005/04/11 21:22:59 $
5  *
6  * Copyright 2004 Jive Software.
7  *
8  * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */

20
21 package org.xmpp.component;
22
23 import org.xmpp.packet.Packet;
24
25 /**
26  * Manages components.
27  *
28  * @see Component
29  * @author Matt Tucker
30  */

31 public interface ComponentManager {
32
33     /**
34      * Adds a component. The {@link Component#initialize(org.xmpp.packet.JID, ComponentManager)}
35      * method will be called on the component. The subdomain specifies the address of
36      * the component on a server. For example, if the subdomain is "test" and the XMPP
37      * server is at "example.com", then the component's address would be "test.example.com".
38      *
39      * @param subdomain the subdomain of the component's address.
40      * @param component the component.
41      */

42     public void addComponent(String JavaDoc subdomain, Component component) throws ComponentException;
43
44     /**
45      * Removes a component. The {@link Component#shutdown} method will be called on the
46      * component.
47      *
48      * @param subdomain the subdomain of the component's address.
49      */

50     public void removeComponent(String JavaDoc subdomain) throws ComponentException;
51
52     /**
53      * Sends a packet to the XMPP server. The "from" value of the packet must be in
54      * the domain name of the component. For example, if the component has a domain
55      * of "test.example.com", then "user@test.example.com" would be a valid "from"
56      * value.
57      *
58      * @param component the component sending the packet.
59      * @param packet the packet to send.
60      */

61     public void sendPacket(Component component, Packet packet) throws ComponentException;
62
63     /**
64      * Returns a property value specified by name. Properties can be used by
65      * components to store configuration data. It is recommended that each
66      * component qualify property names to prevent overlap. For example a
67      * component that broadcasts messages to groups of users, might prepend
68      * all property names it uses with "broadcast.".
69      *
70      * @param name the property name.
71      * @return the property value.
72      */

73     public String JavaDoc getProperty(String JavaDoc name);
74
75     /**
76      * Sets a property value. Properties can be used by components to
77      * store configuration data. It is recommended that each component
78      * qualify property names to prevent overlap. For example a component
79      * that broadcasts messages to groups of users, might prepend all
80      * property names it uses with "broadcast.".
81      *
82      * @param name the property name.
83      * @param value the property value.
84      */

85     public void setProperty(String JavaDoc name, String JavaDoc value);
86
87     /**
88      * Returns the domain of the XMPP server. The domain name may be the IP address or the host
89      * name.
90      *
91      * @return the domain of the XMPP server.
92      */

93     public String JavaDoc getServerName();
94     
95     /**
96      * Returns true if components managed by this component manager are external
97      * components connected to the server over a network connection. Otherwise,
98      * the components are internal to the server.
99      *
100      * @return true if the managed components are external components.
101      */

102     public boolean isExternalMode();
103
104     /**
105      * Returns a Log instance, which can be used by components for logging error,
106      * warning, info, and debug messages.
107      *
108      * @return a Log instance.
109      */

110     public Log getLog();
111 }
Popular Tags