Package org.serviceconnector.api.cln
Class SCSessionService
java.lang.Object
org.serviceconnector.api.cln.SCService
org.serviceconnector.api.cln.SCSessionService
The Class SessionService. SessionService is a remote interface in client API to a session service and provides communication functions. Creating a session service instance for
API users should be done by calling SCClient newSessionService().
State Diagram
State Diagram
|| |-------execute-------|
\/ | |
|---------| |----------| |--------------| |
| initial |----attach--->| attached |----create session--->| has session |--echo--| |
| |<---detach----| |<---delete session----| with service |<-------| |
|---------| |----------| |--------------|<------------|
||
\/
After creating a session a delete session must be done in every case at the end of communication. A delete session may be called multiple times. Nothing happens if the session
turns inactive in meantime.- Author:
- JTraber
-
Field Summary
Fields inherited from class org.serviceconnector.api.cln.SCService
messageCallback, pendingRequest, requester, scClient, serviceName, sessionActive, sessionId -
Method Summary
Modifier and TypeMethodDescriptioncreateSession(int operationTimeoutSeconds, SCMessage scMessage, SCMessageCallback messageCallback) Creates the session on SC.createSession(SCMessage scMessage, SCMessageCallback callback) Creates the session on SC.voidDelete session on SC with default operation timeout.voiddeleteSession(int operationTimeoutSeconds) Delete session on SC.voiddeleteSession(int operationTimeoutSeconds, SCMessage scMessage) Delete session on SC.voiddeleteSession(SCMessage scMessage) Delete session on SC with default operation timeout.Execute.Execute with default operation timeout.intGets the echo interval in seconds.intGets the echo timeout in seconds.booleanChecks if has a session.voidSend.voidSend with default operation timeout.voidsetEchoIntervalSeconds(int echoIntervalSeconds) Sets the echo interval in seconds.voidsetEchoTimeoutSeconds(int echoTimeoutSeconds) Sets the echo timeout in seconds.Methods inherited from class org.serviceconnector.api.cln.SCService
getSCClient, getServiceName, getSessionId, isActive
-
Method Details
-
createSession
public SCMessage createSession(SCMessage scMessage, SCMessageCallback callback) throws SCServiceException, SCMPValidatorException Creates the session on SC. Uses default operation timeout to complete operation.
Once a create session has been called a delete session must be done at the end of communication.- Parameters:
scMessage- the SC messagecallback- the message callback which is used to inform the client in case of asynchronous operations- Returns:
- the SC message
- Throws:
SCServiceException- session already created
create session on SC failed
error message received from SC
create session has been rejected by the serverSCMPValidatorException- create session message is null
message callback is null
-
createSession
public SCMessage createSession(int operationTimeoutSeconds, SCMessage scMessage, SCMessageCallback messageCallback) throws SCServiceException, SCMPValidatorException Creates the session on SC.
Once a create session has been called a delete session must be done at the end of communication.- Parameters:
operationTimeoutSeconds- the allowed time in seconds to complete the operationscMessage- the SC messagemessageCallback- the message callback which is used to inform the client in case of asynchronous operations- Returns:
- the SC message
- Throws:
SCServiceException- session already created
create session on SC failed
error message received from SC
create session has been rejected by the serverSCMPValidatorException- create session message is null
message callback is null
-
execute
Execute with default operation timeout. Execute is a synchronous operation with the SC. Any reply will be received as return of the method.- Parameters:
requestMsg- the request message- Returns:
- the SC message
- Throws:
SCServiceException- session not active (not created yet or dead)
pending request, no second request allowed
execute on SC failed
error message received from SCSCMPValidatorException- execute message is null
-
execute
public SCMessage execute(int operationTimeoutSeconds, SCMessage scMessage) throws SCServiceException, SCMPValidatorException Execute. Execute is a synchronous operation with the SC. Any reply will be received as return of the method.- Parameters:
operationTimeoutSeconds- the allowed time in seconds to complete the operationscMessage- the SC message to execute- Returns:
- the reply
- Throws:
SCServiceException- session not active (not created yet or dead)
pending request, no second request allowed
execute on SC failed
error message received from SCSCMPValidatorException- execute message is null
-
send
Send with default operation timeout. Send is an asynchronous operation with the SC. Any reply will be informed over the callback.- Parameters:
requestMsg- the request message- Throws:
SCServiceException- session not active (not created yet or dead)
pending request, no second request allowed
send on SC failedSCMPValidatorException- send message is null
-
send
public void send(int operationtTimeoutSeconds, SCMessage scMessage) throws SCServiceException, SCMPValidatorException Send. Asynchronous operation. Send is an asynchronous operation with the SC. Any reply will be informed over the callback.- Parameters:
operationtTimeoutSeconds- the allowed time in seconds to complete the operationscMessage- the SC message- Throws:
SCServiceException- session not active (not created yet or dead)
pending request, no second request allowed
send on SC failedSCMPValidatorException- send message is null
-
deleteSession
Delete session on SC with default operation timeout. A delete session may be called multiple times. Nothing happens if the session turns inactive in meantime.- Throws:
SCServiceException- pending request, no second request allowed
delete session on SC failed
error message received from SC
-
deleteSession
Delete session on SC. A delete session may be called multiple times. Nothing happens if the session turns inactive in meantime.- Parameters:
operationTimeoutSeconds- allowed time to complete operation- Throws:
SCServiceException- pending request, no second request allowed
delete session on SC failed
error message received from SC
-
deleteSession
Delete session on SC with default operation timeout. A delete session may be called multiple times. Nothing happens if the session turns inactive in meantime.- Parameters:
scMessage- the SC message- Throws:
SCServiceException- pending request, no second request allowed
delete session on SC failed
error message received from SC
-
deleteSession
public void deleteSession(int operationTimeoutSeconds, SCMessage scMessage) throws SCServiceException Delete session on SC. A delete session may be called multiple times. Nothing happens if the session turns inactive in meantime.- Parameters:
operationTimeoutSeconds- the allowed time in seconds to complete the operationscMessage- the SC message- Throws:
SCServiceException- pending request, no second request allowed
delete session on SC failed
error message received from SC
-
setEchoTimeoutSeconds
Sets the echo timeout in seconds. Time in seconds the an echo request waits to be confirmed. If no confirmation is received session is marked as dead.- Parameters:
echoTimeoutSeconds- time to wait for completion of an echo request Example: 10- Throws:
SCMPValidatorException- echoTimeoutSeconds > 1 and < 3600
-
getEchoTimeoutSeconds
public int getEchoTimeoutSeconds()Gets the echo timeout in seconds. Time in seconds the an echo request waits to be confirmed.- Returns:
- the echo timeout in seconds
-
setEchoIntervalSeconds
public void setEchoIntervalSeconds(int echoIntervalSeconds) Sets the echo interval in seconds. Interval in seconds between two subsequent ECHO messages sent by the client to SC. The message is sent only when no message is pending.- Parameters:
echoIntervalSeconds- Validation: echoIntervalSeconds > 1 and < 3600
Example: 360
-
getEchoIntervalSeconds
public int getEchoIntervalSeconds()Gets the echo interval in seconds.- Returns:
- the echo interval in seconds
-
hasSession
public boolean hasSession()Checks if has a session.- Returns:
- true, if is subscribed
-