Openfire 3.9.3 Javadoc

org.jivesoftware.openfire.component
Class InternalComponentManager

java.lang.Object
  extended by org.jivesoftware.openfire.container.BasicModule
      extended by org.jivesoftware.openfire.component.InternalComponentManager
All Implemented Interfaces:
ChannelHandler, Module, RoutableChannelHandler, org.xmpp.component.ComponentManager

public class InternalComponentManager
extends BasicModule
implements org.xmpp.component.ComponentManager, RoutableChannelHandler

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).

Author:
Derek DeMoro

Constructor Summary
InternalComponentManager()
           
 
Method Summary
 void addComponent(String subdomain, org.xmpp.component.Component component)
           
 void addListener(ComponentEventListener listener)
          Adds a new listener that will be notified of component events.
 void addPresenceRequest(org.xmpp.packet.JID prober, org.xmpp.packet.JID probee)
          Registers Probeers who have not yet been serviced.
 org.xmpp.packet.JID getAddress()
          Returns the XMPP address.
 String getHomeDirectory()
           
static InternalComponentManager getInstance()
           
 String getProperty(String name)
           
 String getServerName()
           
 boolean hasComponent(org.xmpp.packet.JID componentJID)
          Returns true if a component is associated to the specified address.
 void initialize(XMPPServer server)
          Initializes the basic module.
 boolean isExternalMode()
           
 void process(org.xmpp.packet.Packet packet)
          Processes packets that were sent to this service.
 void query(org.xmpp.component.Component component, org.xmpp.packet.IQ packet, org.xmpp.component.IQResultListener listener)
           
 org.xmpp.packet.IQ query(org.xmpp.component.Component component, org.xmpp.packet.IQ packet, long timeout)
           
 void removeComponent(String subdomain)
          Removes a component.
 void removeComponent(String subdomain, org.xmpp.component.Component component)
          Removes a given component.
 void removeListener(ComponentEventListener listener)
          Removes the specified listener from the listeners being notified of component events.
 void sendPacket(org.xmpp.component.Component component, org.xmpp.packet.Packet packet)
           
 void setProperty(String name, String value)
           
 void start()
          Starts the basic module.
 void stop()
          Stops the basic module.
 
Methods inherited from class org.jivesoftware.openfire.container.BasicModule
destroy, getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InternalComponentManager

public InternalComponentManager()
Method Detail

getInstance

public static InternalComponentManager getInstance()

initialize

public void initialize(XMPPServer server)
Description copied from class: BasicModule

Initializes the basic module.

Inheriting classes that choose to override this method MUST call this initialize() method before accessing BasicModule resources.

Specified by:
initialize in interface Module
Overrides:
initialize in class BasicModule
Parameters:
server - the server hosting this module.

start

public void start()
Description copied from class: BasicModule

Starts the basic module.

Inheriting classes that choose to override this method MUST call this start() method before accessing BasicModule resources.

Specified by:
start in interface Module
Overrides:
start in class BasicModule

stop

public void stop()
Description copied from class: BasicModule

Stops the basic module.

Inheriting classes that choose to override this method MUST call this stop() method before accessing BasicModule resources.

Specified by:
stop in interface Module
Overrides:
stop in class BasicModule

addComponent

public void addComponent(String subdomain,
                         org.xmpp.component.Component component)
                  throws org.xmpp.component.ComponentException
Specified by:
addComponent in interface org.xmpp.component.ComponentManager
Throws:
org.xmpp.component.ComponentException

removeComponent

public void removeComponent(String subdomain)
Removes a component. The Component.shutdown() method will be called on the component. Note that if the component was an external component that was connected several times then all its connections will be terminated.

Specified by:
removeComponent in interface org.xmpp.component.ComponentManager
Parameters:
subdomain - the subdomain of the component's address.

removeComponent

public void removeComponent(String subdomain,
                            org.xmpp.component.Component component)
Removes a given component. Unlike removeComponent(String) this method will just remove a single component instead of all components associated to the subdomain. External components may connect several times and register for the same subdomain. This method just removes a singled connection not all of them.

Parameters:
subdomain - the subdomain of the component's address.
component - specific component to remove.

sendPacket

public void sendPacket(org.xmpp.component.Component component,
                       org.xmpp.packet.Packet packet)
Specified by:
sendPacket in interface org.xmpp.component.ComponentManager

query

public org.xmpp.packet.IQ query(org.xmpp.component.Component component,
                                org.xmpp.packet.IQ packet,
                                long timeout)
                         throws org.xmpp.component.ComponentException
Specified by:
query in interface org.xmpp.component.ComponentManager
Throws:
org.xmpp.component.ComponentException

query

public void query(org.xmpp.component.Component component,
                  org.xmpp.packet.IQ packet,
                  org.xmpp.component.IQResultListener listener)
           throws org.xmpp.component.ComponentException
Specified by:
query in interface org.xmpp.component.ComponentManager
Throws:
org.xmpp.component.ComponentException

addListener

public void addListener(ComponentEventListener listener)
Adds a new listener that will be notified of component events. Events being notified are: 1) when a component is added to the component manager, 2) when a component is deleted and 3) when disco#info is received from a component.

Parameters:
listener - the new listener to notify of component events.

removeListener

public void removeListener(ComponentEventListener listener)
Removes the specified listener from the listeners being notified of component events.

Parameters:
listener - the listener to remove.

getProperty

public String getProperty(String name)
Specified by:
getProperty in interface org.xmpp.component.ComponentManager

setProperty

public void setProperty(String name,
                        String value)
Specified by:
setProperty in interface org.xmpp.component.ComponentManager

getServerName

public String getServerName()
Specified by:
getServerName in interface org.xmpp.component.ComponentManager

getHomeDirectory

public String getHomeDirectory()

isExternalMode

public boolean isExternalMode()
Specified by:
isExternalMode in interface org.xmpp.component.ComponentManager

hasComponent

public boolean hasComponent(org.xmpp.packet.JID componentJID)
Returns true if a component is associated to the specified address. Components registered with this JVM or other cluster nodes are going to be considered.

Parameters:
componentJID - the address of the component. This is the complete domain.
Returns:
true if a component is associated to the specified address.

addPresenceRequest

public void addPresenceRequest(org.xmpp.packet.JID prober,
                               org.xmpp.packet.JID probee)
Registers Probeers who have not yet been serviced.

Parameters:
prober - the jid probing.
probee - the presence being probed.

getAddress

public org.xmpp.packet.JID getAddress()
Description copied from interface: RoutableChannelHandler
Returns the XMPP address. The address is used by services like the core server packet router to determine if a packet should be sent to the handler. Handlers that are working on behalf of the server should use the generic server hostname address (e.g. server.com).

Specified by:
getAddress in interface RoutableChannelHandler
Returns:
the XMPP address.

process

public void process(org.xmpp.packet.Packet packet)
             throws PacketException
Processes packets that were sent to this service. Currently only packets that were sent from registered components are being processed. In the future, we may also process packet of trusted clients. Trusted clients may be able to execute ad-hoc commands such as adding or removing components.

Specified by:
process in interface ChannelHandler
Parameters:
packet - the packet to process.
Throws:
PacketException - thrown if the packet is malformed (results in the sender's session being shutdown).

Openfire 3.9.3 Javadoc

Copyright © 2003-2008 Jive Software.