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, getClientContext
getApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel
configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString, toString
public EspritClientConnector(C clientCtx, ServerHost serverHost)
public void init() throws java.lang.Exception
Initializable
init
in interface Initializable
java.lang.Exception
public boolean isInitialized()
Initializable
isInitialized
in interface Initializable
public void checkInitialized() throws NotInitializedException
Initializable
NotInitializedException
if not.checkInitialized
in interface Initializable
NotInitializedException
public boolean isClosed()
public final void close()
close
in interface java.lang.AutoCloseable
public final RequestChannel getRequestChannel()
public final MessageChannel getMessageChannel()
public void setConnectionTimeout(int timeoutSeconds)
public final void connect() throws java.lang.Exception
connect
in interface ClientConnector
java.lang.Exception
public final boolean disconnect()
disconnect
in interface ClientConnector
public final boolean isConnected()
ClientConnector
isConnected
in interface ClientConnector
ClientConnector.checkConnected()
public void checkConnected() throws ClientNotConnectedException
ClientConnector
checkConnected
in interface ClientConnector
ClientNotConnectedException
ClientConnector.isConnected()
protected LoginAgent createLoginAgent(ClientConnector conn, LoginData data)
public final U login(java.lang.String userName, java.lang.String password) throws java.lang.Exception
ClientConnector
ClientConnector.login(LoginData)
.login
in interface ClientConnector
java.lang.Exception
public final U login(LoginData loginData) throws java.lang.Exception
ClientConnector
login
in interface ClientConnector
java.lang.Exception
protected void doOnLogin(U user)
public final boolean logout(boolean isFinalLogout)
reconnect()
.logout
in interface ClientConnector
protected void doOnLogout(User user)
public final boolean isLoggedIn()
ClientConnector
isLoggedIn
in interface ClientConnector
public final void reconnect() throws java.lang.Exception
reconnect
in interface ClientConnector
java.lang.Exception
public final LoginData getLastLoginData()
getLastLoginData
in interface ClientConnector
public final U getUser()
getUser
in interface ClientConnector
public final void setLastMessageTypesRegistered(NetMessageType[] msgTypes)
public final boolean sendLogout(boolean isFinalLogout)
public final UserId getUserId()
ClientConnector
UserId
object of the current login.getUserId
in interface ClientConnector
public final ServerHost getServerHost()
ClientConnector
ServerHost
defined for this connection.getServerHost
in interface ClientConnector
public final ServerId getServerId()
ClientConnector
ServerId
object which is available since the first
successful server connection. It provides further detail information
about the server.getServerId
in interface ClientConnector
public final SessionId getSessionId()
ClientConnector
SessionId
if a connection is established. Null otherwise.getSessionId
in interface ClientConnector
public final java.lang.String getClientConnectionInfo()
ClientConnector
getClientConnectionInfo
in interface ClientConnector
public final java.lang.String getServerConnectionInfo()
ClientConnector
getServerConnectionInfo
in interface ClientConnector
public final java.sql.Timestamp getConnectedSinceTs()
ClientConnector
getConnectedSinceTs
in interface ClientConnector
public final void setServerShutDownHandler(ServerShutdownEvent.Listener handler)
setServerShutDownHandler
in interface ClientConnector
public final void addNetworkConnectionListener(NetworkConnectionEvent.Listener l)
addNetworkConnectionListener
in interface NetworkConnectionEvent.Source
public final void removeNetworkConnectionListener(NetworkConnectionEvent.Listener l)
removeNetworkConnectionListener
in interface NetworkConnectionEvent.Source
public final void addRequestListener(NetRequestEvent.Listener l)
addRequestListener
in interface NetRequestEvent.Source
public final void removeRequestListener(NetRequestEvent.Listener l)
removeRequestListener
in interface NetRequestEvent.Source
public final void addResponseListener(NetResponseEvent.Listener l)
addResponseListener
in interface NetResponseEvent.Source
public final void removeResponseListener(NetResponseEvent.Listener l)
removeResponseListener
in interface NetResponseEvent.Source
public final void addBatchTaskListener(BatchTaskEvent.Listener l)
addBatchTaskListener
in interface BatchTaskEvent.Source
public final void removeBatchTaskListener(BatchTaskEvent.Listener l)
removeBatchTaskListener
in interface BatchTaskEvent.Source
public final void addServerLogMessageListener(LogMessageEvent.Listener l)
addServerLogMessageListener
in interface ClientConnector
public final void removeServerLogMessageListener(LogMessageEvent.Listener l)
removeServerLogMessageListener
in interface ClientConnector
public final void addAgentMessageListener(AgentMessageListener l)
addAgentMessageListener
in interface ClientConnector
public final void removeAgentMessageListener(AgentMessageListener l)
removeAgentMessageListener
in interface ClientConnector
public final void addNetMessageListener(NetMessageEvent.Listener l)
addNetMessageListener
in interface NetMessageEvent.Source
public final void removeNetMessageListener(NetMessageEvent.Listener l)
removeNetMessageListener
in interface NetMessageEvent.Source
public final void addRemoteTaskListener(RemoteTaskEvent.Listener l)
addRemoteTaskListener
in interface RemoteTaskEvent.Source
public final void removeRemoteTaskListener(RemoteTaskEvent.Listener l)
removeRemoteTaskListener
in interface RemoteTaskEvent.Source
public final void addRemoteRecordChangeListener(RemoteRecordChangeEvent.Listener l)
addRemoteRecordChangeListener
in interface RemoteRecordChangeEvent.Source
public final void removeRemoteRecordChangeListener(RemoteRecordChangeEvent.Listener l)
removeRemoteRecordChangeListener
in interface RemoteRecordChangeEvent.Source
public final void addServerStatusListener(GenericEvent.Listener l)
addServerStatusListener
in interface ServerStatusEvent.Source
public final void removeServerStatusListener(GenericEvent.Listener l)
removeServerStatusListener
in interface ServerStatusEvent.Source
public final void addSystemEventListener(GenericEvent.Listener l)
addSystemEventListener
in interface SystemEvent.Source
public final void removeSystemEventListener(GenericEvent.Listener l)
removeSystemEventListener
in interface SystemEvent.Source
public final void addNetEventListener(GenericEvent.Listener l)
addNetEventListener
in interface ClientConnector
public final void removeNetEventListener(GenericEvent.Listener l)
removeNetEventListener
in interface ClientConnector
public final void addABOChangeListener(ABOChangeEvent.Listener l)
addABOChangeListener
in interface ABOChangeEvent.Source
public final void removeABOChangeListener(ABOChangeEvent.Listener l)
removeABOChangeListener
in interface ABOChangeEvent.Source
Copyright © 2014 EsprIT-Systems. All Rights Reserved.