01: /**
02: * Copyright (C) 2004-2007 Jive Software. All rights reserved.
03: *
04: * This software is published under the terms of the GNU Public License (GPL),
05: * a copy of which is included in this distribution.
06: */package org.xmpp.component;
07:
08: import org.xmpp.packet.JID;
09: import org.xmpp.packet.Packet;
10:
11: /**
12: * Component enhance the functionality of an XMPP server.
13: *
14: * Components are JavaBeans and will have their properties exposed as ad-hoc commands.
15: *
16: * @author Matt Tucker
17: */
18: public interface Component {
19:
20: /**
21: * Returns the name of this component.
22: *
23: * @return the name of this component.
24: */
25: public String getName();
26:
27: /**
28: * Returns the description of this component.
29: *
30: * @return the description of this component.
31: */
32: public String getDescription();
33:
34: /**
35: * Processes a packet sent to this Component.
36: *
37: * @param packet the packet.
38: * @see ComponentManager#sendPacket(Component, Packet)
39: */
40: public void processPacket(Packet packet);
41:
42: /**
43: * Initializes this component with a ComponentManager and the JID
44: * that this component is available at (e.g. <tt>service.example.com</tt>). If a
45: * ComponentException is thrown then the component will not be loaded.<p>
46: *
47: * The initialization code must not rely on receiving packets from the server since
48: * the component has not been fully initialized yet. This means that at this point the
49: * component must not rely on information that is obtained from the server such us
50: * discovered items.
51: *
52: * @param jid the XMPP address that this component is available at.
53: * @param componentManager the component manager.
54: * @throws ComponentException if an error occured while initializing the component.
55: */
56: public void initialize(JID jid, ComponentManager componentManager)
57: throws ComponentException;
58:
59: /**
60: * Notification message indicating that the component will start receiving incoming
61: * packets. At this time the component may finish pending initialization issues that
62: * require information obtained from the server.<p>
63: *
64: * It is likely that most of the component will leave this method empty.
65: */
66: public void start();
67:
68: /**
69: * Shuts down this component. All component resources must be released as
70: * part of shutdown.
71: */
72: public void shutdown();
73: }
|