Package org.jivesoftware.whack
Class ExternalComponentManager
java.lang.Object
org.jivesoftware.whack.ExternalComponentManager
- All Implemented Interfaces:
org.xmpp.component.ComponentManager
Implementation of the ComponentManager interface for external components.
This implementation follows JEP-0014.
- Author:
- Matt Tucker
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new ExternalComponentManager that will make connections to the specified XMPP server on the default external component port (5275).ExternalComponentManager(String host, int port) Deprecated.ExternalComponentManager(String host, int port, boolean startEncrypted) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComponent(String subdomain, org.xmpp.component.Component component) voidaddComponent(String subdomain, org.xmpp.component.Component component, Integer port) intReturns the timeout (in milliseconds) to use when trying to connect to the server.getProperty(String name) getSecretKey(String subdomain) Returns the secret key for a sub-domain.Returns the domain of the XMPP server where we are connected to or null if this value was never configured.booleanbooleanisMultipleAllowed(String subdomain) Returns if we want components to be able to connect multiple times to the same JID.org.xmpp.packet.IQquery(org.xmpp.component.Component component, org.xmpp.packet.IQ packet, long timeout) voidquery(org.xmpp.component.Component component, org.xmpp.packet.IQ packet, org.xmpp.component.IQResultListener listener) voidremoveComponent(String subdomain) voidsendPacket(org.xmpp.component.Component component, org.xmpp.packet.Packet packet) voidsetConnectTimeout(int connectTimeout) Sets the timeout (in milliseconds) to use when trying to connect to the server.voidsetDefaultSecretKey(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.voidsetMultipleAllowed(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.voidsetProperty(String name, String value) voidsetSecretKey(String subdomain, String secretKey) Sets a secret key for a sub-domain, for future use by a component connecting to the server.voidsetServerName(String domain) Sets the domain of the XMPP server.
-
Constructor Details
-
ExternalComponentManager
Constructs a new ExternalComponentManager that will make connections to the specified XMPP server on the default external component port (5275).- Parameters:
host- the IP address or name of the XMPP server to connect to (e.g. "example.com").
-
ExternalComponentManager
Deprecated.Constructs a new ExternalComponentManager that will make connections to the specified XMPP server on the given port.- Parameters:
host- the IP address or name of the XMPP server to connect to (e.g. "example.com").port- the port to connect on.
-
ExternalComponentManager
-
-
Method Details
-
setSecretKey
Sets a secret key for a sub-domain, for future use by a component connecting to the server. Keys are used as an authentication mechanism when connecting to the server. Some servers may require a different key for each component, while others may use a global secret key.- Parameters:
subdomain- the sub-domain.secretKey- the secret key
-
getSecretKey
Returns the secret key for a sub-domain. If no key was found then the default secret key will be returned.- Parameters:
subdomain- the subdomain to return its secret key.- Returns:
- the secret key for a sub-domain.
-
setDefaultSecretKey
Sets the default secret key, which will be used when connecting if a specific secret key for the component hasn't been sent. Keys are used as an authentication mechanism when connecting to the server. Some servers may require a different key for each component, while others may use a global secret key.- Parameters:
secretKey- the default secret key.
-
isMultipleAllowed
Returns if we want components to be able to connect multiple times to the same JID. This is a custom Openfire extension and will not work with any other XMPP server. Other XMPP servers should ignore this extra setting.- Parameters:
subdomain- the sub-domain.- Returns:
- True or false if we are allowing multiple connections.
-
setMultipleAllowed
Sets whether we will tell the XMPP server that we want multiple components to be able to connect to the same JID. This is a custom Openfire extension and will not work with any other XMPP server. Other XMPP servers should ignore this extra setting.- Parameters:
subdomain- the sub-domain.allowMultiple- Set to true if we want to allow multiple connections to same JID.
-
addComponent
public void addComponent(String subdomain, org.xmpp.component.Component component) throws org.xmpp.component.ComponentException - Specified by:
addComponentin interfaceorg.xmpp.component.ComponentManager- Throws:
org.xmpp.component.ComponentException
-
addComponent
public void addComponent(String subdomain, org.xmpp.component.Component component, Integer port) throws org.xmpp.component.ComponentException - Throws:
org.xmpp.component.ComponentException
-
removeComponent
- Specified by:
removeComponentin interfaceorg.xmpp.component.ComponentManager- Throws:
org.xmpp.component.ComponentException
-
sendPacket
public void sendPacket(org.xmpp.component.Component component, org.xmpp.packet.Packet packet) - Specified by:
sendPacketin interfaceorg.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:
queryin interfaceorg.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:
queryin interfaceorg.xmpp.component.ComponentManager- Throws:
org.xmpp.component.ComponentException
-
getProperty
- Specified by:
getPropertyin interfaceorg.xmpp.component.ComponentManager
-
setProperty
- Specified by:
setPropertyin interfaceorg.xmpp.component.ComponentManager
-
setServerName
Sets the domain of the XMPP server. The domain may or may not match the host. The domain will be used mainly for the XMPP packets while the host is used mainly for creating connections to the server.- Parameters:
domain- the domain of the XMPP server.
-
getServerName
Returns the domain of the XMPP server where we are connected to or null if this value was never configured. When the value is null then the component will register with just its subdomain and we expect the server to accept the component and append its domain to form the JID of the component.- Specified by:
getServerNamein interfaceorg.xmpp.component.ComponentManager- Returns:
- the domain of the XMPP server or null if never configured.
-
getConnectTimeout
public int getConnectTimeout()Returns the timeout (in milliseconds) to use when trying to connect to the server. The default value is 2 seconds.- Returns:
- the timeout to use when trying to connect to the server.
-
setConnectTimeout
public void setConnectTimeout(int connectTimeout) Sets the timeout (in milliseconds) to use when trying to connect to the server. The default value is 2 seconds.- Parameters:
connectTimeout- the timeout, in milliseconds, to use when trying to connect to the server.
-
isExternalMode
public boolean isExternalMode()- Specified by:
isExternalModein interfaceorg.xmpp.component.ComponentManager
-