|
Whack | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jivesoftware.whack.ExternalComponentManager
public class ExternalComponentManager
Implementation of the ComponentManager interface for external components. This implementation follows JEP-0014.
Constructor Summary | |
---|---|
ExternalComponentManager(String host)
Constructs a new ExternalComponentManager that will make connections to the specified XMPP server on the default port (5222). |
|
ExternalComponentManager(String host,
int port)
Constructs a new ExternalComponentManager that will make connections to the specified XMPP server on the given port. |
Method Summary | |
---|---|
void |
addComponent(String subdomain,
org.xmpp.component.Component component)
Adds a component. |
void |
addComponent(String subdomain,
org.xmpp.component.Component component,
Integer port)
|
int |
getConnectTimeout()
Returns the timeout (in milliseconds) to use when trying to connect to the server. |
org.xmpp.component.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 |
getSecretKey(String subdomain)
Returns the secret key for a sub-domain. |
String |
getServerName()
Returns the domain of the XMPP server where we are connected to or null if this value was never configured. |
boolean |
isExternalMode()
Returns true if components managed by this component manager are external components connected to the server over a network connection. |
boolean |
isMultipleAllowed(String subdomain)
Returns if we want components to be able to connect multiple times to the same JID. |
void |
query(org.xmpp.component.Component component,
org.xmpp.packet.IQ packet,
IQResultListener listener)
Sends an IQ packet to the server and returns immediately. |
org.xmpp.packet.IQ |
query(org.xmpp.component.Component component,
org.xmpp.packet.IQ packet,
long timeout)
Sends an IQ packet to the XMPP server and waits to get an IQ of type result or error. |
void |
removeComponent(String subdomain)
Removes a component. |
void |
sendPacket(org.xmpp.component.Component component,
org.xmpp.packet.Packet packet)
Sends a packet to the XMPP server. |
void |
setConnectTimeout(int connectTimeout)
Sets the timeout (in milliseconds) to use when trying to connect to the server. |
void |
setDefaultSecretKey(String secretKey)
Sets the default secret key, which will be used when connecting if a specific secret key for the component hasn't been sent. |
void |
setMultipleAllowed(String subdomain,
boolean allowMultiple)
Sets whether we will tell the XMPP server that we want multiple components to be able to connect to the same JID. |
void |
setProperty(String name,
String value)
Sets a property value. |
void |
setSecretKey(String subdomain,
String secretKey)
Sets a secret key for a sub-domain, for future use by a component connecting to the server. |
void |
setServerName(String domain)
Sets the domain of the XMPP server. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExternalComponentManager(String host)
host
- the IP address or name of the XMPP server to connect to (e.g. "example.com").public ExternalComponentManager(String host, int port)
host
- the IP address or name of the XMPP server to connect to (e.g. "example.com").port
- the port to connect on.Method Detail |
---|
public void setSecretKey(String subdomain, String secretKey)
subdomain
- the sub-domain.secretKey
- the secret keypublic String getSecretKey(String subdomain)
subdomain
- the subdomain to return its secret key.
public void setDefaultSecretKey(String secretKey)
secretKey
- the default secret key.public boolean isMultipleAllowed(String subdomain)
subdomain
- the sub-domain.
public void setMultipleAllowed(String subdomain, boolean allowMultiple)
subdomain
- the sub-domain.allowMultiple
- Set to true if we want to allow multiple connections to same JID.public void addComponent(String subdomain, org.xmpp.component.Component component) throws org.xmpp.component.ComponentException
org.xmpp.component.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 org.xmpp.component.ComponentManager
subdomain
- the subdomain of the component's address.component
- the component.
org.xmpp.component.ComponentException
- if the component connection is lost and the component cannot be added.public void addComponent(String subdomain, org.xmpp.component.Component component, Integer port) throws org.xmpp.component.ComponentException
org.xmpp.component.ComponentException
public void removeComponent(String subdomain) throws org.xmpp.component.ComponentException
org.xmpp.component.ComponentManager
Component.shutdown()
method will be called on the
component.
removeComponent
in interface org.xmpp.component.ComponentManager
subdomain
- the subdomain of the component's address.
org.xmpp.component.ComponentException
- if the component connection is lost and the component cannot be removed.public void sendPacket(org.xmpp.component.Component component, org.xmpp.packet.Packet packet)
org.xmpp.component.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 org.xmpp.component.ComponentManager
component
- the component sending the packet.packet
- the packet to send.public org.xmpp.packet.IQ query(org.xmpp.component.Component component, org.xmpp.packet.IQ packet, long timeout) throws org.xmpp.component.ComponentException
org.xmpp.component.ComponentManager
If no answer is received from the server before the specified timeout then null 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 org.xmpp.component.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.
org.xmpp.component.ComponentException
- if the component connection is lost or unavialble during the time of sending and
recieving packets.public void query(org.xmpp.component.Component component, org.xmpp.packet.IQ packet, IQResultListener listener) throws org.xmpp.component.ComponentException
org.xmpp.component.ComponentManager
query
in interface org.xmpp.component.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.
org.xmpp.component.ComponentException
- if the component connection is lost or unavialble during the time of sending and
recieving packets.public String getProperty(String name)
org.xmpp.component.ComponentManager
getProperty
in interface org.xmpp.component.ComponentManager
name
- the property name.
public void setProperty(String name, String value)
org.xmpp.component.ComponentManager
setProperty
in interface org.xmpp.component.ComponentManager
name
- the property name.value
- the property value.public void setServerName(String domain)
domain
- the domain of the XMPP server.public String getServerName()
getServerName
in interface org.xmpp.component.ComponentManager
public int getConnectTimeout()
public void setConnectTimeout(int connectTimeout)
connectTimeout
- the timeout, in milliseconds, to use when trying to connect to the server.public boolean isExternalMode()
org.xmpp.component.ComponentManager
isExternalMode
in interface org.xmpp.component.ComponentManager
public org.xmpp.component.Log getLog()
org.xmpp.component.ComponentManager
getLog
in interface org.xmpp.component.ComponentManager
|
Whack | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |