|
Wildfire 3.2.4 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jivesoftware.wildfire.container.BasicModule org.jivesoftware.wildfire.component.InternalComponentManager
public class InternalComponentManager
Manages the registration and delegation of Components. The ComponentManager
is responsible for managing registration and delegation of Components
,
as well as offering a facade around basic server functionallity such as sending and
receiving of packets.
This component manager will be an internal service whose JID will be component.[domain]. So the component manager will be able to send packets to other internal or external components and also receive packets from other components or even from trusted clients (e.g. ad-hoc commands).
Nested Class Summary | |
---|---|
static class |
InternalComponentManager.RoutableComponent
Exposes a Component as a RoutableChannelHandler. |
Constructor Summary | |
---|---|
InternalComponentManager()
|
Method Summary | |
---|---|
void |
addComponent(String subdomain,
Component component)
Adds a component. |
void |
addListener(ComponentEventListener listener)
Adds a new listener that will be notified of component events. |
void |
addPresenceRequest(JID prober,
JID probee)
Registers Probeers who have not yet been serviced. |
JID |
getAddress()
Returns the XMPP address. |
Component |
getComponent(JID componentJID)
Retrieves the Component which is mapped
to the specified JID. |
Component |
getComponent(String jid)
Retrieves the Component which is mapped
to the specified JID. |
Collection<Component> |
getComponents()
Returns the list of components that are currently installed in the server. |
String |
getHomeDirectory()
|
static InternalComponentManager |
getInstance()
|
Log |
getLog()
Returns a Log instance, which can be used by components for logging error, warning, info, and debug messages. |
String |
getProperty(String name)
Returns a property value specified by name. |
String |
getServerName()
Returns the domain of the XMPP server. |
boolean |
isExternalMode()
Returns true if components managed by this component manager are external components connected to the server over a network connection. |
void |
process(Packet packet)
Processes packets that were sent to this service. |
IQ |
query(Component component,
IQ packet,
int timeout)
Sends an IQ packet to the XMPP server and waits to get an IQ of type result or error. |
void |
query(Component component,
IQ packet,
IQResultListener listener)
Sends an IQ packet to the server and returns immediately. |
void |
removeComponent(String subdomain)
Removes a component. |
void |
removeListener(ComponentEventListener listener)
Removes the specified listener from the listeners being notified of component events. |
void |
sendPacket(Component component,
Packet packet)
Sends a packet to the XMPP server. |
void |
setProperty(String name,
String value)
Sets a property value. |
void |
start()
Starts the basic module. |
void |
stop()
Stops the basic module. |
Methods inherited from class org.jivesoftware.wildfire.container.BasicModule |
---|
destroy, getName, initialize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InternalComponentManager()
Method Detail |
---|
public static InternalComponentManager getInstance()
public void start()
BasicModule
Starts the basic module.
Inheriting classes that choose to override this method MUST call this start() method before accessing BasicModule resources.
start
in interface Module
start
in class BasicModule
public void stop()
BasicModule
Stops the basic module.
Inheriting classes that choose to override this method MUST call this stop() method before accessing BasicModule resources.
stop
in interface Module
stop
in class BasicModule
public void addComponent(String subdomain, Component component) throws ComponentException
ComponentManager
Component.initialize(org.xmpp.packet.JID, ComponentManager)
method will be called on the component. The subdomain specifies the address of
the component on a server. For example, if the subdomain is "test" and the XMPP
server is at "example.com", then the component's address would be "test.example.com".
addComponent
in interface ComponentManager
subdomain
- the subdomain of the component's address.component
- the component.
ComponentException
public void removeComponent(String subdomain)
ComponentManager
Component.shutdown()
method will be called on the
component.
removeComponent
in interface ComponentManager
subdomain
- the subdomain of the component's address.public void sendPacket(Component component, Packet packet)
ComponentManager
Components are trusted by the server and may use any value in from address. Usually the from address uses the component's address as the domain but this is not required.
sendPacket
in interface ComponentManager
component
- the component sending the packet.packet
- the packet to send.public IQ query(Component component, IQ packet, int timeout) throws ComponentException
ComponentManager
If no answer is received from the server before the specified timeout then an IQ of type error will be returned. Components are trusted by the server and may use any value in from address. Usually the from address uses the component's address as the domain but this is not required.
query
in interface ComponentManager
component
- the component sending the packet.packet
- the IQ packet to send.timeout
- the number of milliseconds to wait before returning an IQ error.
ComponentException
public void query(Component component, IQ packet, IQResultListener listener) throws ComponentException
ComponentManager
query
in interface ComponentManager
component
- the component sending the packet.packet
- the IQ packet to send.listener
- the listener that will be invoked when an answer is received.
ComponentException
public void addListener(ComponentEventListener listener)
listener
- the new listener to notify of component events.public void removeListener(ComponentEventListener listener)
listener
- the listener to remove.public String getProperty(String name)
ComponentManager
getProperty
in interface ComponentManager
name
- the property name.
public void setProperty(String name, String value)
ComponentManager
setProperty
in interface ComponentManager
name
- the property name.value
- the property value.public String getServerName()
ComponentManager
getServerName
in interface ComponentManager
public String getHomeDirectory()
public boolean isExternalMode()
ComponentManager
isExternalMode
in interface ComponentManager
public Log getLog()
ComponentManager
getLog
in interface ComponentManager
public Collection<Component> getComponents()
public Component getComponent(JID componentJID)
Component
which is mapped
to the specified JID.
componentJID
- the jid mapped to the component.
public Component getComponent(String jid)
Component
which is mapped
to the specified JID.
jid
- the jid mapped to the component.
public void addPresenceRequest(JID prober, JID probee)
prober
- the jid probing.probee
- the presence being probed.public JID getAddress()
RoutableChannelHandler
getAddress
in interface RoutableChannelHandler
public void process(Packet packet) throws PacketException
process
in interface ChannelHandler
packet
- the packet to process.
PacketException
- thrown if the packet is malformed (results in the sender's
session being shutdown).
|
Wildfire 3.2.4 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |