Class RemoteSession
- All Implemented Interfaces:
ChannelHandler<org.xmpp.packet.Packet>
,RoutableChannelHandler
,Session
- Direct Known Subclasses:
RemoteClientSession
,RemoteComponentSession
,RemoteConnectionMultiplexerSession
,RemoteIncomingServerSession
,RemoteOutgoingServerSession
- Author:
- Gaston Dombiak
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jivesoftware.openfire.session.Session
Session.Status
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.xmpp.packet.JID
protected byte[]
protected StreamID
Fields inherited from interface org.jivesoftware.openfire.session.Session
Log, MAJOR_VERSION, MINOR_VERSION
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close this session, including associated (socket) connection(s) where appropriate.void
deliverRawText
(String text) Delivers raw text to the remote XMPP entity.protected void
doClusterTask
(ClusterTask task) Invokes a task on the remote cluster member in an asynchronous fashion.protected Object
Invokes a task on the remote cluster member synchronously and returns the result of the remote operation.org.xmpp.packet.JID
Obtain the address of the user.Returns the TLS cipher suite name used by the underlying connection(s) of the session, if any.Obtain the date the session was created.Returns the IP address string in textual presentation.Gets the host name for this IP address.final Locale
Returns the locale that is used for this session (e.g.Obtain the time the session last had activity.long
Obtain the number of packets sent from the client to the server.long
Obtain the number of packets sent from the server to the client.Returns the peer certificates associated with this session, if any.Obtain the name of the server this session belongs to.Returns all Software Version data as reported by the remote XMPP entity, as obtained through XEP-0092.Remote sessions are always authenticated.Obtain the stream ID associated with this session.Returns the TLS protocol name used by the underlying connection(s) of the session, if any.boolean
isClosed()
Returns true if the link to the remote XMPP entity (the session) is closed.boolean
Returns true if the session is detached (that is, if the underlying connection has been closed while the session instance itself has not been closed).boolean
Returns true if this session uses encrypted communication paths when exchanging data with the remote XMPP entity.void
process
(org.xmpp.packet.Packet packet) Process an XMPP packet.boolean
validate()
Verifies that the session is still live.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jivesoftware.openfire.session.Session
isAuthenticated
-
Field Details
-
nodeID
protected byte[] nodeID -
address
protected org.xmpp.packet.JID address -
streamID
-
-
Constructor Details
-
RemoteSession
public RemoteSession(byte[] nodeID, org.xmpp.packet.JID address)
-
-
Method Details
-
getAddress
@Nonnull public org.xmpp.packet.JID getAddress()Description copied from interface:Session
Obtain the address of the user. 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 interfaceRoutableChannelHandler
- Specified by:
getAddress
in interfaceSession
- Returns:
- the address of the packet handler.
-
getStatus
Remote sessions are always authenticated. Otherwise, they won't be visibile to other cluster nodes. When the session is closed it will no longer be visible to other nodes so CLOSED is never returned. -
getStreamID
Description copied from interface:Session
Obtain the stream ID associated with this session. Stream ID's are generated by the server and should be unique and random.- Specified by:
getStreamID
in interfaceSession
- Returns:
- This session's assigned stream ID
-
getServerName
Description copied from interface:Session
Obtain the name of the server this session belongs to.- Specified by:
getServerName
in interfaceSession
- Returns:
- the server name.
-
getCreationDate
Description copied from interface:Session
Obtain the date the session was created.- Specified by:
getCreationDate
in interfaceSession
- Returns:
- the session's creation date.
-
getLastActiveDate
Description copied from interface:Session
Obtain the time the session last had activity.- Specified by:
getLastActiveDate
in interfaceSession
- Returns:
- The last time the session received activity.
-
getNumClientPackets
public long getNumClientPackets()Description copied from interface:Session
Obtain the number of packets sent from the client to the server.- Specified by:
getNumClientPackets
in interfaceSession
- Returns:
- The number of packets sent from the client to the server.
-
getNumServerPackets
public long getNumServerPackets()Description copied from interface:Session
Obtain the number of packets sent from the server to the client.- Specified by:
getNumServerPackets
in interfaceSession
- Returns:
- The number of packets sent from the server to the client.
-
getTLSProtocolName
Description copied from interface:Session
Returns the TLS protocol name used by the underlying connection(s) of the session, if any. Always returns a valid string, though the string may be "NONE"- Specified by:
getTLSProtocolName
in interfaceSession
- Returns:
- a TLS protocol (version) name.
-
getCipherSuiteName
Description copied from interface:Session
Returns the TLS cipher suite name used by the underlying connection(s) of the session, if any. Always returns a valid string, though the string may be "NONE"- Specified by:
getCipherSuiteName
in interfaceSession
- Returns:
- cipher suite name.
-
getPeerCertificates
Description copied from interface:Session
Returns the peer certificates associated with this session, if any.- Specified by:
getPeerCertificates
in interfaceSession
- Returns:
- certificates, possibly empty or null.
-
getSoftwareVersion
Description copied from interface:Session
Returns all Software Version data as reported by the remote XMPP entity, as obtained through XEP-0092.- Specified by:
getSoftwareVersion
in interfaceSession
- Returns:
- The Software Version information (never null, possibly empty)
-
process
public void process(org.xmpp.packet.Packet packet) Description copied from interface:ChannelHandler
Process an XMPP packet.- Specified by:
process
in interfaceChannelHandler<org.xmpp.packet.Packet>
- Specified by:
process
in interfaceSession
- Parameters:
packet
- a packet to process.
-
close
public void close()Description copied from interface:Session
Close this session, including associated (socket) connection(s) where appropriate. The order of events for closing the session is:- Set closing flag to prevent redundant shutdowns.
- Call notifyEvent all listeners that the channel is shutting down.
- Close the underlying connection(s) (eg: socket).
Session.getStatus()
will be CLOSED. -
isClosed
public boolean isClosed()Description copied from interface:Session
Returns true if the link to the remote XMPP entity (the session) is closed. -
isDetached
public boolean isDetached()Description copied from interface:Session
Returns true if the session is detached (that is, if the underlying connection has been closed while the session instance itself has not been closed).- Specified by:
isDetached
in interfaceSession
- Returns:
- true if session detached
-
isEncrypted
public boolean isEncrypted()Description copied from interface:Session
Returns true if this session uses encrypted communication paths when exchanging data with the remote XMPP entity.- Specified by:
isEncrypted
in interfaceSession
- Returns:
- true if the session is encrypted (e.g. TLS)
-
getHostAddress
Description copied from interface:Session
Returns the IP address string in textual presentation.- Specified by:
getHostAddress
in interfaceSession
- Returns:
- the raw IP address in a string format.
- Throws:
UnknownHostException
- if IP address of host could not be determined.
-
getHostName
Description copied from interface:Session
Gets the host name for this IP address.If this InetAddress was created with a host name, this host name will be remembered and returned; otherwise, a reverse name lookup will be performed and the result will be returned based on the system configured name lookup service. If a lookup of the name service is required, call
getCanonicalHostName
.If there is a security manager, its
checkConnect
method is first called with the hostname and-1
as its arguments to see if the operation is allowed. If the operation is not allowed, it will return the textual representation of the IP address.- Specified by:
getHostName
in interfaceSession
- Returns:
- the host name for this IP address, or if the operation is not allowed by the security check, the textual representation of the IP address.
- Throws:
UnknownHostException
- if IP address of host could not be determined.- See Also:
-
deliverRawText
Description copied from interface:Session
Delivers raw text to the remote XMPP entity. This is a very low level way for sending XML stanzas to the client. This method should not be used unless you have very good reasons for not usingSession.process(Packet)
.This method avoids having to get the writer of this connection and mess directly with the writer. Therefore, this method ensures a correct delivery of the stanza even if other threads were sending data concurrently.
- Specified by:
deliverRawText
in interfaceSession
- Parameters:
text
- the XML stanzas represented kept in a String.
-
validate
public boolean validate()Description copied from interface:Session
Verifies that the session is still live. Typically this is done by sending a whitespace character between packets. // TODO No one is sending this message now. Delete it? -
doSynchronousClusterTask
Invokes a task on the remote cluster member synchronously and returns the result of the remote operation.- Parameters:
task
- the ClusterTask object to be invoked on a given cluster member.- Returns:
- result of remote operation.
-
doClusterTask
Invokes a task on the remote cluster member in an asynchronous fashion.- Parameters:
task
- the task to be invoked on the specified cluster member.
-
getLanguage
Description copied from interface:Session
Returns the locale that is used for this session (e.g.Locale.ENGLISH
).- Specified by:
getLanguage
in interfaceSession
- Returns:
- The language for the session.
-