Class ExternalComponent
- java.lang.Object
-
- rocks.xmpp.core.session.XmppSession
-
- rocks.xmpp.extensions.component.accept.ExternalComponent
-
- All Implemented Interfaces:
AutoCloseable
,Session
,StreamHandler
public final class ExternalComponent extends XmppSession
An external component session which connects to an XMPP server using the "Jabber Component Protocol".- See Also:
- XEP-0114: Jabber Component Protocol
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class rocks.xmpp.core.session.XmppSession
XmppSession.Status
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connect(Jid from)
static ExternalComponent
create(String componentName, String sharedSecret, String hostname, int port)
Creates a new external component using a default configuration.static ExternalComponent
create(String componentName, String sharedSecret, XmppSessionConfiguration configuration, String hostname, int port)
Creates a new external component.static ExternalComponent
create(String componentName, String sharedSecret, XmppSessionConfiguration xmppSessionConfiguration, ClientConnectionConfiguration connectionConfiguration)
Creates a new external component using a default configuration.boolean
handleElement(Object element)
Handles an XMPP element.void
notifyException(Throwable e)
Called if any unhandled exception is thrown during reading or writing.-
Methods inherited from class rocks.xmpp.core.session.XmppSession
addConnectionListener, addCreationListener, addInboundIQListener, addInboundMessageListener, addInboundPresenceListener, addIQHandler, addIQHandler, addMessageAcknowledgedListener, addOutboundIQListener, addOutboundMessageListener, addOutboundPresenceListener, addSendFailedListener, addSendSucceededListener, addSessionStatusListener, close, closeAsync, closeAsync, connect, createMarshaller, createUnmarshaller, createUnmarshaller, disableFeature, disableFeature, enableFeature, enableFeature, getActiveConnection, getConfiguration, getConnectedResource, getConnections, getDebugger, getDomain, getEnabledFeatures, getLocalXmppAddress, getManager, getReaderInterceptors, getRemoteXmppAddress, getStatus, getUnacknowledgedStanzas, getWriterInterceptors, isAuthenticated, isConnected, isSupported, markAcknowledged, query, query, query, removeConnectionListener, removeCreationListener, removeInboundIQListener, removeInboundMessageListener, removeInboundPresenceListener, removeIQHandler, removeMessageAcknowledgedListener, removeOutboundIQListener, removeOutboundMessageListener, removeOutboundPresenceListener, removeSendFailedListener, removeSendSucceededListener, removeSessionStatusListener, send, sendAndAwaitMessage, sendAndAwaitPresence, sendIQ, sendMessage, sendPresence
-
-
-
-
Method Detail
-
create
public static ExternalComponent create(String componentName, String sharedSecret, String hostname, int port)
Creates a new external component using a default configuration. Any registeredcreation listeners
are triggered.- Parameters:
componentName
- The component name.sharedSecret
- The shared secret (password).hostname
- The hostname to connect to.port
- The port to connect to.- Returns:
- The external component.
-
create
public static ExternalComponent create(String componentName, String sharedSecret, XmppSessionConfiguration configuration, String hostname, int port)
Creates a new external component. Any registeredcreation listeners
are triggered.- Parameters:
componentName
- The component name.sharedSecret
- The shared secret (password).configuration
- The configuration.hostname
- The hostname to connect to.port
- The port to connect to.- Returns:
- The external component.
-
create
public static ExternalComponent create(String componentName, String sharedSecret, XmppSessionConfiguration xmppSessionConfiguration, ClientConnectionConfiguration connectionConfiguration)
Creates a new external component using a default configuration. Any registeredcreation listeners
are triggered.- Parameters:
componentName
- The component name.sharedSecret
- The shared secret (password).xmppSessionConfiguration
- The XMPP configuration.connectionConfiguration
- The connection configuration.- Returns:
- The external component.
-
connect
public final void connect(Jid from) throws XmppException
- Specified by:
connect
in classXmppSession
- Throws:
XmppException
-
handleElement
public final boolean handleElement(Object element) throws XmppException
Description copied from class:XmppSession
Handles an XMPP element.This method should be called on the reader thread.
- Specified by:
handleElement
in interfaceStreamHandler
- Overrides:
handleElement
in classXmppSession
- Parameters:
element
- The XMPP element.- Returns:
- True, if the stream needs to be restarted; otherwise false.
- Throws:
StreamErrorException
- If the element is a stream error.StreamNegotiationException
- If any exception occurred during stream feature negotiation.XmppException
- If any other XMPP exception occurs.
-
notifyException
public final void notifyException(Throwable e)
Description copied from class:XmppSession
Called if any unhandled exception is thrown during reading or writing.This method will close the stream.
- Overrides:
notifyException
in classXmppSession
- Parameters:
e
- The exception. If an unrecoverable XMPP stream error occurred, the exception is aStreamError
.
-
-