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.JIDprotected byte[]protected StreamIDFields inherited from interface org.jivesoftware.openfire.session.Session
Log, MAJOR_VERSION, MINOR_VERSION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close this session, including associated (socket) connection(s) where appropriate.voiddeliverRawText(String text) Delivers raw text to the remote XMPP entity.protected voiddoClusterTask(ClusterTask task) Invokes a task on the remote cluster member in an asynchronous fashion.protected ObjectInvokes a task on the remote cluster member synchronously and returns the result of the remote operation.org.xmpp.packet.JIDObtain 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 LocaleReturns the locale that is used for this session (e.g.Obtain the time the session last had activity.longObtain the number of packets sent from the client to the server.longObtain 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.booleanisClosed()Returns true if the link to the remote XMPP entity (the session) is closed.booleanReturns true if the session is detached (that is, if the underlying connection has been closed while the session instance itself has not been closed).booleanReturns true if this session uses encrypted communication paths when exchanging data with the remote XMPP entity.voidMark this session in the associated stream manager as non-resumable.voidprocess(org.xmpp.packet.Packet packet) Process an XMPP packet.booleanvalidate()Verifies that the session is still live.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jivesoftware.openfire.session.Session
close, 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:SessionObtain 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:
getAddressin interfaceRoutableChannelHandler- Specified by:
getAddressin 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:SessionObtain the stream ID associated with this session. Stream ID's are generated by the server and should be unique and random.- Specified by:
getStreamIDin interfaceSession- Returns:
- This session's assigned stream ID
-
getServerName
Description copied from interface:SessionObtain the name of the server this session belongs to.- Specified by:
getServerNamein interfaceSession- Returns:
- the server name.
-
getCreationDate
Description copied from interface:SessionObtain the date the session was created.- Specified by:
getCreationDatein interfaceSession- Returns:
- the session's creation date.
-
getLastActiveDate
Description copied from interface:SessionObtain the time the session last had activity.- Specified by:
getLastActiveDatein interfaceSession- Returns:
- The last time the session received activity.
-
getNumClientPackets
public long getNumClientPackets()Description copied from interface:SessionObtain the number of packets sent from the client to the server.- Specified by:
getNumClientPacketsin interfaceSession- Returns:
- The number of packets sent from the client to the server.
-
getNumServerPackets
public long getNumServerPackets()Description copied from interface:SessionObtain the number of packets sent from the server to the client.- Specified by:
getNumServerPacketsin interfaceSession- Returns:
- The number of packets sent from the server to the client.
-
getTLSProtocolName
Description copied from interface:SessionReturns 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:
getTLSProtocolNamein interfaceSession- Returns:
- a TLS protocol (version) name.
-
getCipherSuiteName
Description copied from interface:SessionReturns 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:
getCipherSuiteNamein interfaceSession- Returns:
- cipher suite name.
-
getPeerCertificates
Description copied from interface:SessionReturns the peer certificates associated with this session, if any.- Specified by:
getPeerCertificatesin interfaceSession- Returns:
- certificates, possibly empty or null.
-
getSoftwareVersion
Description copied from interface:SessionReturns all Software Version data as reported by the remote XMPP entity, as obtained through XEP-0092.- Specified by:
getSoftwareVersionin interfaceSession- Returns:
- The Software Version information (never null, possibly empty)
-
process
public void process(org.xmpp.packet.Packet packet) Description copied from interface:ChannelHandlerProcess an XMPP packet.- Specified by:
processin interfaceChannelHandler<org.xmpp.packet.Packet>- Specified by:
processin interfaceSession- Parameters:
packet- a packet to process.
-
close
public void close()Description copied from interface:SessionClose 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:SessionReturns true if the link to the remote XMPP entity (the session) is closed. -
isDetached
public boolean isDetached()Description copied from interface:SessionReturns 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:
isDetachedin interfaceSession- Returns:
- true if session detached
-
isEncrypted
public boolean isEncrypted()Description copied from interface:SessionReturns true if this session uses encrypted communication paths when exchanging data with the remote XMPP entity.- Specified by:
isEncryptedin interfaceSession- Returns:
- true if the session is encrypted (e.g. TLS)
-
getHostAddress
Description copied from interface:SessionReturns the IP address string in textual presentation.- Specified by:
getHostAddressin 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:SessionGets 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
checkConnectmethod is first called with the hostname and-1as 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:
getHostNamein 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:SessionDelivers 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:
deliverRawTextin interfaceSession- Parameters:
text- the XML stanzas represented kept in a String.
-
markNonResumable
public void markNonResumable()Description copied from interface:SessionMark this session in the associated stream manager as non-resumable. If a session was not resumable before invoking this method, or if stream management wasn't in effect at all, an invocation of this method has no effect.- Specified by:
markNonResumablein interfaceSession
-
validate
public boolean validate()Description copied from interface:SessionVerifies 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:SessionReturns the locale that is used for this session (e.g.Locale.ENGLISH).- Specified by:
getLanguagein interfaceSession- Returns:
- The language for the session.
-