public class EspritClientConnector<C extends ClientContext,U extends User> extends AbstractClientObject<C> implements ClientConnector, Initializable
RequestChannel
and the MessageChannel of the network connection.
Furthermore it maintains the SessionId in case of a successful connection as well as the
current User object in case of a valid login.| Constructor and Description |
|---|
EspritClientConnector(C clientCtx,
ServerHost serverHost) |
| Modifier and Type | Method and Description |
|---|---|
void |
addABOChangeListener(ABOChangeEvent.Listener l) |
void |
addAgentMessageListener(AgentMessageListener l) |
void |
addBatchTaskListener(BatchTaskEvent.Listener l) |
void |
addNetEventListener(GenericEvent.Listener l) |
void |
addNetMessageListener(NetMessageEvent.Listener l) |
void |
addNetworkConnectionListener(NetworkConnectionEvent.Listener l) |
void |
addRemoteRecordChangeListener(RemoteRecordChangeEvent.Listener l) |
void |
addRemoteTaskListener(RemoteTaskEvent.Listener l) |
void |
addRequestListener(NetRequestEvent.Listener l) |
void |
addResponseListener(NetResponseEvent.Listener l) |
void |
addServerLogMessageListener(LogMessageEvent.Listener l) |
void |
addServerStatusListener(GenericEvent.Listener l) |
void |
addSystemEventListener(GenericEvent.Listener l) |
void |
checkConnected()
Checks whether the client is connected and throws an Exception if not
|
void |
checkInitialized()
Checks whether initialization has yet been done and throws
an
NotInitializedException if not. |
void |
close() |
void |
connect()
Performs the initial connection for request and message channel
|
protected LoginAgent |
createLoginAgent(ClientConnector conn,
LoginData data)
Create the LoginAgent which performs the login.
|
boolean |
disconnect()
Disconnects both the request and message connections
|
protected void |
doOnLogin(U user) |
protected void |
doOnLogout(User user) |
java.lang.String |
getClientConnectionInfo()
Returns an info string about the current client side connection.
|
java.sql.Timestamp |
getConnectedSinceTs()
Returns the timestamp since the connection was established.
|
LoginData |
getLastLoginData() |
MessageChannel |
getMessageChannel() |
RequestChannel |
getRequestChannel() |
java.lang.String |
getServerConnectionInfo()
Returns an info string about the current server side connection.
|
ServerHost |
getServerHost()
Returns the
ServerHost defined for this connection. |
ServerId |
getServerId()
Returns the
ServerId object which is available since the first
successful server connection. |
SessionId |
getSessionId()
Returns the
SessionId if a connection is established. |
U |
getUser()
Returns the User object that represents the current login user or null if client is not logged in
|
UserId |
getUserId()
Returns the
UserId object of the current login. |
void |
init()
Performs the initialization of this class.
|
boolean |
isClosed() |
boolean |
isConnected()
Tells whether the network connection is established
|
boolean |
isInitialized()
Tells whether initialization has yet been done.
|
boolean |
isLoggedIn()
Tells whether the user is currently logged in.
|
U |
login(LoginData loginData)
Performs a user login with the given login parameters
|
U |
login(java.lang.String userName,
java.lang.String password)
Performs a user login with the given login parameters.
|
boolean |
logout(boolean isFinalLogout)
Logs the current user out.
|
void |
reconnect()
Reconnects the client with the login parameters of the last login
|
void |
removeABOChangeListener(ABOChangeEvent.Listener l) |
void |
removeAgentMessageListener(AgentMessageListener l) |
void |
removeBatchTaskListener(BatchTaskEvent.Listener l) |
void |
removeNetEventListener(GenericEvent.Listener l) |
void |
removeNetMessageListener(NetMessageEvent.Listener l) |
void |
removeNetworkConnectionListener(NetworkConnectionEvent.Listener l) |
void |
removeRemoteRecordChangeListener(RemoteRecordChangeEvent.Listener l) |
void |
removeRemoteTaskListener(RemoteTaskEvent.Listener l) |
void |
removeRequestListener(NetRequestEvent.Listener l) |
void |
removeResponseListener(NetResponseEvent.Listener l) |
void |
removeServerLogMessageListener(LogMessageEvent.Listener l) |
void |
removeServerStatusListener(GenericEvent.Listener l) |
void |
removeSystemEventListener(GenericEvent.Listener l) |
boolean |
sendLogout(boolean isFinalLogout) |
void |
setConnectionTimeout(int timeoutSeconds) |
void |
setLastMessageTypesRegistered(NetMessageType[] msgTypes) |
void |
setServerShutDownHandler(ServerShutdownEvent.Listener handler) |
getClientConfig, getClientContextgetApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannelconfigureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString, toStringpublic EspritClientConnector(C clientCtx, ServerHost serverHost)
public void init()
throws java.lang.Exception
Initializableinit in interface Initializablejava.lang.Exceptionpublic boolean isInitialized()
InitializableisInitialized in interface Initializablepublic void checkInitialized()
throws NotInitializedException
InitializableNotInitializedException if not.checkInitialized in interface InitializableNotInitializedExceptionpublic boolean isClosed()
public final void close()
close in interface java.lang.AutoCloseablepublic final RequestChannel getRequestChannel()
public final MessageChannel getMessageChannel()
public void setConnectionTimeout(int timeoutSeconds)
public final void connect()
throws java.lang.Exception
connect in interface ClientConnectorjava.lang.Exceptionpublic final boolean disconnect()
disconnect in interface ClientConnectorpublic final boolean isConnected()
ClientConnectorisConnected in interface ClientConnectorClientConnector.checkConnected()public void checkConnected()
throws ClientNotConnectedException
ClientConnectorcheckConnected in interface ClientConnectorClientNotConnectedExceptionClientConnector.isConnected()protected LoginAgent createLoginAgent(ClientConnector conn, LoginData data)
public final U login(java.lang.String userName, java.lang.String password) throws java.lang.Exception
ClientConnectorClientConnector.login(LoginData).login in interface ClientConnectorjava.lang.Exceptionpublic final U login(LoginData loginData) throws java.lang.Exception
ClientConnectorlogin in interface ClientConnectorjava.lang.Exceptionprotected void doOnLogin(U user)
public final boolean logout(boolean isFinalLogout)
reconnect().logout in interface ClientConnectorprotected void doOnLogout(User user)
public final boolean isLoggedIn()
ClientConnectorisLoggedIn in interface ClientConnectorpublic final void reconnect()
throws java.lang.Exception
reconnect in interface ClientConnectorjava.lang.Exceptionpublic final LoginData getLastLoginData()
getLastLoginData in interface ClientConnectorpublic final U getUser()
getUser in interface ClientConnectorpublic final void setLastMessageTypesRegistered(NetMessageType[] msgTypes)
public final boolean sendLogout(boolean isFinalLogout)
public final UserId getUserId()
ClientConnectorUserId object of the current login.getUserId in interface ClientConnectorpublic final ServerHost getServerHost()
ClientConnectorServerHost defined for this connection.getServerHost in interface ClientConnectorpublic final ServerId getServerId()
ClientConnectorServerId object which is available since the first
successful server connection. It provides further detail information
about the server.getServerId in interface ClientConnectorpublic final SessionId getSessionId()
ClientConnectorSessionId if a connection is established. Null otherwise.getSessionId in interface ClientConnectorpublic final java.lang.String getClientConnectionInfo()
ClientConnectorgetClientConnectionInfo in interface ClientConnectorpublic final java.lang.String getServerConnectionInfo()
ClientConnectorgetServerConnectionInfo in interface ClientConnectorpublic final java.sql.Timestamp getConnectedSinceTs()
ClientConnectorgetConnectedSinceTs in interface ClientConnectorpublic final void setServerShutDownHandler(ServerShutdownEvent.Listener handler)
setServerShutDownHandler in interface ClientConnectorpublic final void addNetworkConnectionListener(NetworkConnectionEvent.Listener l)
addNetworkConnectionListener in interface NetworkConnectionEvent.Sourcepublic final void removeNetworkConnectionListener(NetworkConnectionEvent.Listener l)
removeNetworkConnectionListener in interface NetworkConnectionEvent.Sourcepublic final void addRequestListener(NetRequestEvent.Listener l)
addRequestListener in interface NetRequestEvent.Sourcepublic final void removeRequestListener(NetRequestEvent.Listener l)
removeRequestListener in interface NetRequestEvent.Sourcepublic final void addResponseListener(NetResponseEvent.Listener l)
addResponseListener in interface NetResponseEvent.Sourcepublic final void removeResponseListener(NetResponseEvent.Listener l)
removeResponseListener in interface NetResponseEvent.Sourcepublic final void addBatchTaskListener(BatchTaskEvent.Listener l)
addBatchTaskListener in interface BatchTaskEvent.Sourcepublic final void removeBatchTaskListener(BatchTaskEvent.Listener l)
removeBatchTaskListener in interface BatchTaskEvent.Sourcepublic final void addServerLogMessageListener(LogMessageEvent.Listener l)
addServerLogMessageListener in interface ClientConnectorpublic final void removeServerLogMessageListener(LogMessageEvent.Listener l)
removeServerLogMessageListener in interface ClientConnectorpublic final void addAgentMessageListener(AgentMessageListener l)
addAgentMessageListener in interface ClientConnectorpublic final void removeAgentMessageListener(AgentMessageListener l)
removeAgentMessageListener in interface ClientConnectorpublic final void addNetMessageListener(NetMessageEvent.Listener l)
addNetMessageListener in interface NetMessageEvent.Sourcepublic final void removeNetMessageListener(NetMessageEvent.Listener l)
removeNetMessageListener in interface NetMessageEvent.Sourcepublic final void addRemoteTaskListener(RemoteTaskEvent.Listener l)
addRemoteTaskListener in interface RemoteTaskEvent.Sourcepublic final void removeRemoteTaskListener(RemoteTaskEvent.Listener l)
removeRemoteTaskListener in interface RemoteTaskEvent.Sourcepublic final void addRemoteRecordChangeListener(RemoteRecordChangeEvent.Listener l)
addRemoteRecordChangeListener in interface RemoteRecordChangeEvent.Sourcepublic final void removeRemoteRecordChangeListener(RemoteRecordChangeEvent.Listener l)
removeRemoteRecordChangeListener in interface RemoteRecordChangeEvent.Sourcepublic final void addServerStatusListener(GenericEvent.Listener l)
addServerStatusListener in interface ServerStatusEvent.Sourcepublic final void removeServerStatusListener(GenericEvent.Listener l)
removeServerStatusListener in interface ServerStatusEvent.Sourcepublic final void addSystemEventListener(GenericEvent.Listener l)
addSystemEventListener in interface SystemEvent.Sourcepublic final void removeSystemEventListener(GenericEvent.Listener l)
removeSystemEventListener in interface SystemEvent.Sourcepublic final void addNetEventListener(GenericEvent.Listener l)
addNetEventListener in interface ClientConnectorpublic final void removeNetEventListener(GenericEvent.Listener l)
removeNetEventListener in interface ClientConnectorpublic final void addABOChangeListener(ABOChangeEvent.Listener l)
addABOChangeListener in interface ABOChangeEvent.Sourcepublic final void removeABOChangeListener(ABOChangeEvent.Listener l)
removeABOChangeListener in interface ABOChangeEvent.SourceCopyright © 2014 EsprIT-Systems. All Rights Reserved.