Package com.isode.som
Class SomSession
java.lang.Object
com.isode.som.SomSession
- Direct Known Subclasses:
SomPumiceSession,SomQmgrSession
Class which implements a SOM connection between a client application
and a SOM server - i.e. the Queue Manager or a Isode M-Store X.400 server.
Functionality for opening and closing connections (including use of SASL
is included.
- Author:
- tc
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected longstatic final Stringcom.isode.som.SomThreadstatic final Stringstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intError codes which can be returned.static final intstatic final intstatic final StringUseful string values -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new SomSession objectSomSession(SomHandler handler) Create a new SomSession object. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck whether the connection is authenticated or notvoidclose()Close an open connectionstatic StringgetErrorText(int status) Obtain a string representation of a given error code.Get the hostname for this sessionintGet operation status valueList<com.isode.crypto.x509.SSLCertificate>Get a list of the SSL Certificates which the server has returned when a TLS-encrypted connection is in use.String[]Get the list of SASL mechanisms which this Queue Manager supports.booleanbooleanisAsync()Test whether session is an asynchonous onebooleanTest whether the session is connectedbooleanTest whether we are in the process of establishing a connection.booleanTest whether the session is disconnectedvoidOpen a connection, using SIMPLE authenticationvoidOpen a connection using a specific SASL mechanismvoidOpen a connection using a specific SASL mechanism over TLSvoidopen(String host, int port, String authid, String authzid, String password, String mechanism, boolean useTls) Open a connection using a specific SASL mechanism over TLSvoidpauseResults(boolean cache) voidregisterACP127AnonStatusCommand(SomCommand commandObj) voidregisterACP127CircuitCreateCommand(SomCommand commandObj) voidregisterACP127CircuitDeleteCommand(SomCommand commandObj) voidregisterACP127CircuitUpdate(SomCommand commandObj) voidregisterACP127MonitorDataSameCommand(SomCommand commandObj) voidregisterACP127MonitorMsgStatusCommand(SomCommand commandObj) voidregisterACP127MonitorRateCommand(SomCommand commandObj) voidregisterACP127MonitorReadCommand(SomCommand commandObj) voidregisterACP127MonitorReadMissCommand(SomCommand commandObj) voidregisterACP127MonitorWriteCommand(SomCommand commandObj) voidregisterACP127MonitorWriteMissCommand(SomCommand commandObj) voidregisterACP127MonStatusCommand(SomCommand commandObj) voidregisterACP127NewMsgOutCommand(SomCommand commandObj) voidregisterACP127OTAMStatusCommand(SomCommand commandObj) voidregisterLogMonitorCommand(SomCommand commandObj) Register a persistent handler for LOGMON responsesvoidregisterRecapListCommand(SomCommand commandObj) voidregisterStoreMonitorCommand(SomCommand commandObj) voidsendCommand(SomCommand commandObj) Send a command out over the wirevoidsendCommand(SomCommand commandObj, boolean withCrlfs) Send a command out over the wirevoidsendResponse(SomCommand commandObj, String resp) Send a response back to the server.voidsetAsync(boolean async) Set session to be asynchronousvoidsetConnectionTimeout(int t) Set connection timeout.voidsetOpStatus(int val) Set operation statusvoidsetProtocol(String prot) voidsomSessionDebugPrefix(String prefix) The prefix given is used to name the SomSession thread, making it easy to indetify in a debugger.voidwaitForCommand(long timeout) Wait for some sort of response to come back to a command
-
Field Details
-
SOM_ERROR_NETWORK
public static final int SOM_ERROR_NETWORKError codes which can be returned.- See Also:
-
SOM_ERROR_ABORT
public static final int SOM_ERROR_ABORT- See Also:
-
SOM_ERROR_INTERNAL
public static final int SOM_ERROR_INTERNAL- See Also:
-
SOM_ERROR_PROTOCOL
public static final int SOM_ERROR_PROTOCOL- See Also:
-
SOM_ERROR_LIMITREACHED
public static final int SOM_ERROR_LIMITREACHED- See Also:
-
SOM_ERROR_AUTHFAILED
public static final int SOM_ERROR_AUTHFAILED- See Also:
-
SOM_ERROR_MORE
public static final int SOM_ERROR_MORE- See Also:
-
SOM_ERROR_FAILED
public static final int SOM_ERROR_FAILED- See Also:
-
SOM_ERROR_OK
public static final int SOM_ERROR_OK- See Also:
-
SOM_PROTOCOL
Useful string values- See Also:
-
ACP127_PROTOCOL
- See Also:
-
OTAM_PROTOCOL
- See Also:
-
GSSAPI
- See Also:
-
connectionTimeout
protected long connectionTimeout -
listenerThread
public com.isode.som.SomThread listenerThread
-
-
Constructor Details
-
SomSession
public SomSession()Create a new SomSession object -
SomSession
Create a new SomSession object.- Parameters:
handler- object which will handle command responses
-
-
Method Details
-
setProtocol
-
setConnectionTimeout
public void setConnectionTimeout(int t) Set connection timeout.- Parameters:
t- timeout in seconds
-
getErrorText
Obtain a string representation of a given error code.- Parameters:
status- error code- Returns:
- string representation of error code
-
hasRight
-
getRights
-
isConnected
public boolean isConnected()Test whether the session is connected- Returns:
- true if connected
-
isConnecting
public boolean isConnecting()Test whether we are in the process of establishing a connection.- Returns:
- true if we are in the middle of connection establishment
-
isDisconnected
public boolean isDisconnected()Test whether the session is disconnected- Returns:
- true if not connected
-
isAsync
public boolean isAsync()Test whether session is an asynchonous one- Returns:
- true if asynchronous
-
setAsync
public void setAsync(boolean async) Set session to be asynchronous- Parameters:
async- whether session should be asynchronous or not
-
getOpStatus
public int getOpStatus()Get operation status value- Returns:
- operation status
-
setOpStatus
public void setOpStatus(int val) Set operation status- Parameters:
val- value to set
-
open
Open a connection, using SIMPLE authentication- Parameters:
host- hostname or IP address to connect toport- port to useusername- username to usepassword- password to use- Throws:
SomException- on error
-
open
public void open(String host, int port, String username, String password, String mechanism) throws SomException Open a connection using a specific SASL mechanism- Parameters:
host- hostname or IP address to connect toport- port to useusername- username to usepassword- password to usemechanism- SASL mechanism to use- Throws:
SomException- on error
-
open
public void open(String host, int port, String username, String password, String mechanism, boolean useTls) throws SomException Open a connection using a specific SASL mechanism over TLS- Parameters:
host- hostname or IP address to connect toport- port to useusername- username to usepassword- password to usemechanism- SASL mechanism to useuseTls- whether to use TLS or not- Throws:
SomException- on error
-
open
public void open(String host, int port, String authid, String authzid, String password, String mechanism, boolean useTls) throws SomException Open a connection using a specific SASL mechanism over TLS- Parameters:
host- hostname or IP address to connect toport- port to useauthid- authid to useauthzid- authzid to usepassword- password to usemechanism- SASL mechanism to useuseTls- whether to use TLS or not- Throws:
SomException- on error
-
somSessionDebugPrefix
The prefix given is used to name the SomSession thread, making it easy to indetify in a debugger.- Parameters:
prefix-
-
getPeerCertificates
Get a list of the SSL Certificates which the server has returned when a TLS-encrypted connection is in use.- Returns:
- list of SSLCertificates, or null if TLS not in use.
-
close
public void close()Close an open connection -
authenticated
public boolean authenticated()Check whether the connection is authenticated or not- Returns:
- true if authenticated connection
-
getSupportedMechanisms
Get the list of SASL mechanisms which this Queue Manager supports.- Returns:
- list of mechanisms, which may be null
- Since:
- 16.1
-
waitForCommand
Wait for some sort of response to come back to a command- Parameters:
timeout- length of time to wait- Throws:
SomException- on error
-
pauseResults
public void pauseResults(boolean cache) -
sendCommand
Send a command out over the wire- Parameters:
commandObj- Command object to send- Throws:
SomException- on error
-
sendCommand
Send a command out over the wire- Parameters:
commandObj- Command object to sendwithCrlfs- true if the command should be followed by CRLFs before sending, false otherwise- Throws:
SomException- on error
-
sendResponse
Send a response back to the server.- Parameters:
commandObj- Command object with which response is associatedresp- Response string- Throws:
SomException- on error
-
registerLogMonitorCommand
Register a persistent handler for LOGMON responses- Parameters:
commandObj- Command object which handler is associated with- Throws:
SomException- on error
-
registerStoreMonitorCommand
- Throws:
SomException
-
registerRecapListCommand
- Throws:
SomException
-
registerACP127MonitorWriteCommand
- Throws:
SomException
-
registerACP127CircuitDeleteCommand
- Throws:
SomException
-
registerACP127CircuitCreateCommand
- Throws:
SomException
-
registerACP127CircuitUpdate
- Throws:
SomException
-
registerACP127MonitorReadCommand
- Throws:
SomException
-
registerACP127MonitorRateCommand
- Throws:
SomException
-
registerACP127MonitorReadMissCommand
- Throws:
SomException
-
registerACP127MonitorWriteMissCommand
- Throws:
SomException
-
registerACP127MonitorMsgStatusCommand
- Throws:
SomException
-
registerACP127MonitorDataSameCommand
- Throws:
SomException
-
registerACP127OTAMStatusCommand
- Throws:
SomException
-
registerACP127MonStatusCommand
- Throws:
SomException
-
registerACP127AnonStatusCommand
- Throws:
SomException
-
registerACP127NewMsgOutCommand
- Throws:
SomException
-
getHostName
Get the hostname for this session- Returns:
- host name
-