Class LocalComponentSession
- java.lang.Object
-
- org.jivesoftware.openfire.session.LocalSession
-
- org.jivesoftware.openfire.session.LocalComponentSession
-
- All Implemented Interfaces:
ChannelHandler<org.xmpp.packet.Packet>
,RoutableChannelHandler
,ComponentSession
,Session
public class LocalComponentSession extends LocalSession implements ComponentSession
Represents a session between the server and a component.- Author:
- Gaston Dombiak
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LocalComponentSession.LocalExternalComponent
The ExternalComponent acts as a proxy of the remote connected component.-
Nested classes/interfaces inherited from interface org.jivesoftware.openfire.session.ComponentSession
ComponentSession.ExternalComponent
-
Nested classes/interfaces inherited from interface org.jivesoftware.openfire.session.Session
Session.Status
-
-
Field Summary
-
Fields inherited from class org.jivesoftware.openfire.session.LocalSession
address, conn, serverName, sessionManager, startDate, status, streamID, streamManager
-
Fields inherited from interface org.jivesoftware.openfire.session.Session
MAJOR_VERSION, MINOR_VERSION
-
-
Constructor Summary
Constructors Constructor Description LocalComponentSession(String serverName, Connection conn, StreamID id)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
authenticate(String digest)
Authenticate the external component using a digest method.static LocalComponentSession
createSession(String serverName, org.xmlpull.v1.XmlPullParser xpp, Connection connection)
Returns a newly created session between the server and a component.List<org.dom4j.Element>
getAvailableStreamFeatures()
Returns a text with the available stream features.Connection
getConnection()
Returns the connection associated with this Session.ComponentSession.ExternalComponent
getExternalComponent()
void
reattach(LocalSession connectionProvider, long h)
Reattach the (existing) session to the connection provided by a new session (a session that will be replaced by the older, pre-existing session).void
setDetached()
Set the session to detached mode, indicating that the underlying connection has been closed.String
toString()
-
Methods inherited from class org.jivesoftware.openfire.session.LocalSession
close, deliverRawText, getAddress, getCipherSuiteName, getCreationDate, getHostAddress, getHostName, getLanguage, getLastActiveDate, getNumClientPackets, getNumServerPackets, getPeerCertificates, getServerName, getSessionData, getSoftwareVersion, getStatus, getStreamID, getStreamManager, getTLSProtocolName, incrementClientPacketCount, incrementServerPacketCount, isClosed, isDetached, isEncrypted, isUsingSelfSignedCertificate, process, removeSessionData, setAddress, setSessionData, setSoftwareVersionData, setStatus, validate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jivesoftware.openfire.session.Session
close, deliverRawText, getAddress, getCipherSuiteName, getCreationDate, getHostAddress, getHostName, getLanguage, getLastActiveDate, getNumClientPackets, getNumServerPackets, getPeerCertificates, getServerName, getSoftwareVersion, getStatus, getStreamID, getTLSProtocolName, isAuthenticated, isClosed, isEncrypted, process, validate
-
-
-
-
Constructor Detail
-
LocalComponentSession
public LocalComponentSession(String serverName, Connection conn, StreamID id)
-
-
Method Detail
-
createSession
public static LocalComponentSession createSession(String serverName, org.xmlpull.v1.XmlPullParser xpp, Connection connection) throws org.xmlpull.v1.XmlPullParserException
Returns a newly created session between the server and a component. The session will be created and returned only if all the checkings were correct.A domain will be binded for the new connecting component. This method is following the JEP-114 where the domain to bind is sent in the TO attribute of the stream header.
- Parameters:
serverName
- the name of the server where the session is connecting to.xpp
- the parser that is reading the provided XML through the connection.connection
- the connection with the component.- Returns:
- a newly created session between the server and a component.
- Throws:
org.xmlpull.v1.XmlPullParserException
- if there was an XML error while creating the session.
-
getAvailableStreamFeatures
public List<org.dom4j.Element> getAvailableStreamFeatures()
Description copied from class:LocalSession
Returns a text with the available stream features. Each subclass may return different values depending whether the session has been authenticated or not.- Specified by:
getAvailableStreamFeatures
in classLocalSession
- Returns:
- a text with the available stream features or
null
to add nothing.
-
setDetached
public void setDetached()
Description copied from class:LocalSession
Set the session to detached mode, indicating that the underlying connection has been closed.- Overrides:
setDetached
in classLocalSession
-
reattach
public void reattach(LocalSession connectionProvider, long h)
Description copied from class:LocalSession
Reattach the (existing) session to the connection provided by a new session (a session that will be replaced by the older, pre-existing session). The connection must already be initialized as a running XML Stream, normally by having run through XEP-0198 resumption.- Overrides:
reattach
in classLocalSession
- Parameters:
connectionProvider
- Session from which to obtain the connection from.h
- the sequence number of the last handled stanza sent over the former stream
-
getConnection
@Nonnull public Connection getConnection()
Returns the connection associated with this Session.- Overrides:
getConnection
in classLocalSession
- Returns:
- The connection for this session
-
getExternalComponent
public ComponentSession.ExternalComponent getExternalComponent()
- Specified by:
getExternalComponent
in interfaceComponentSession
-
authenticate
public boolean authenticate(String digest)
Authenticate the external component using a digest method. The digest includes the stream ID and the secret key of the main domain of the external component. A component needs to authenticate just once but it may bind several domains.- Parameters:
digest
- the digest sent in the handshake.- Returns:
- true if the authentication was successful.
-
toString
public String toString()
- Overrides:
toString
in classLocalSession
-
-