KickJava   Java API By Example, From Geeks To Geeks.

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


1 /**
2  * $RCSfile: Component.java,v $
3  * $Revision: 1.4 $
4  * $Date: 2005/04/13 17:28:51 $
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 import org.xmpp.packet.JID;
25
26 /**
27  * Component enhance the functionality of an XMPP server.
28  *
29  * Components are JavaBeans and will have their properties exposed as ad-hoc commands.
30  *
31  * @author Matt Tucker
32  */

33 public interface Component {
34
35     /**
36      * Returns the name of this component.
37      *
38      * @return the name of this component.
39      */

40     public String JavaDoc getName();
41
42     /**
43      * Returns the description of this component.
44      *
45      * @return the description of this component.
46      */

47     public String JavaDoc getDescription();
48
49     /**
50      * Processes a packet sent to this Component.
51      *
52      * @param packet the packet.
53      * @see ComponentManager#sendPacket(Component, Packet)
54      */

55     public void processPacket(Packet packet);
56
57     /**
58      * Initializes this component with a ComponentManager and the JID
59      * that this component is available at (e.g. <tt>service.example.com</tt>). If a
60      * ComponentException is thrown then the component will not be loaded.<p>
61      *
62      * The initialization code must not rely on receiving packets from the server since
63      * the component has not been fully initialized yet. This means that at this point the
64      * component must not rely on information that is obtained from the server such us
65      * discovered items.
66      *
67      * @param jid the XMPP address that this component is available at.
68      * @param componentManager the component manager.
69      * @throws ComponentException if an error occured while initializing the component.
70      */

71     public void initialize(JID jid, ComponentManager componentManager) throws ComponentException;
72
73     /**
74      * Notification message indicating that the component will start receiving incoming
75      * packets. At this time the component may finish pending initialization issues that
76      * require information obtained from the server.<p>
77      *
78      * It is likely that most of the component will leave this method empty.
79      */

80     public void start();
81
82     /**
83      * Shuts down this component. All component resources must be released as
84      * part of shutdown.
85      */

86     public void shutdown();
87 }
Popular Tags