de.esprit.netsuite.client.netch

## Class EspritClientConnector<C extends ClientContext,U extends User>

- java.lang.Object
- - de.esprit.common.util.DumpableObject
  - - de.esprit.appsuite.launch.AbstractApplicationObject<C>
    - - de.esprit.netsuite.client.AbstractClientObject<C>
      - - de.esprit.netsuite.client.netch.EspritClientConnector<C,U>

- All Implemented Interfaces:
    ApplicationObject<C>, CloseableComponent, Initializable, SimpleLogSupport, Dumpable, ClientObject<C>, NetRequestEvent.Source, NetResponseEvent.Source, NetworkConnectionEvent.Source, ClientConnector, ABOChangeEvent.Source, BatchTaskEvent.Source, NetMessageEvent.Source, RemoteRecordChangeEvent.Source, ServerStatusEvent.Source, SystemEvent.Source, RemoteTaskEvent.Source, java.lang.AutoCloseable

      public class EspritClientConnector<C extends ClientContext,U extends User>
      extends AbstractClientObject<C>
      implements ClientConnector, Initializable

  This class provides the user facade to the network. It maintains both the `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.
  Author:
    Rainer Buesch

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EspritClientConnector(C clientCtx, ServerHost serverHost)`

  - ### Method Summary

    Methods
    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)`

    - ### Methods inherited from class de.esprit.netsuite.client.AbstractClientObject

      `getClientConfig, getClientContext`

    - ### Methods inherited from class de.esprit.appsuite.launch.AbstractApplicationObject

      `getApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel`

    - ### Methods inherited from class de.esprit.common.util.DumpableObject

      `configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### EspritClientConnector

          public EspritClientConnector(C clientCtx,
                               ServerHost serverHost)

  - ### Method Detail

    - #### init

          public void init()
                    throws java.lang.Exception

      Description copied from interface: `Initializable`
      Performs the initialization of this class. Note that the implementation should maintain an isInitialized flag which must be set when initialization has completed.
      Specified by:
        `init` in interface `Initializable`
      Throws:
        `java.lang.Exception`

    - #### isInitialized

          public boolean isInitialized()

      Description copied from interface: `Initializable`
      Tells whether initialization has yet been done.
      Specified by:
        `isInitialized` in interface `Initializable`

    - #### checkInitialized

          public void checkInitialized()
                                throws NotInitializedException

      Description copied from interface: `Initializable`
      Checks whether initialization has yet been done and throws an `NotInitializedException` if not.
      Specified by:
        `checkInitialized` in interface `Initializable`
      Throws:
        `NotInitializedException`

    - #### isClosed

          public boolean isClosed()

    - #### close

          public final void close()

      Specified by:
        `close` in interface `java.lang.AutoCloseable`

    - #### getRequestChannel

          public final RequestChannel getRequestChannel()

    - #### getMessageChannel

          public final MessageChannel getMessageChannel()

    - #### setConnectionTimeout

          public void setConnectionTimeout(int timeoutSeconds)

    - #### connect

          public final void connect()
                             throws java.lang.Exception

      Performs the initial connection for request and message channel
      Specified by:
        `connect` in interface `ClientConnector`
      Throws:
        `java.lang.Exception`

    - #### disconnect

          public final boolean disconnect()

      Disconnects both the request and message connections
      Specified by:
        `disconnect` in interface `ClientConnector`

    - #### isConnected

          public final boolean isConnected()

      Description copied from interface: `ClientConnector`
      Tells whether the network connection is established
      Specified by:
        `isConnected` in interface `ClientConnector`
      See Also:
        `ClientConnector.checkConnected()`

    - #### checkConnected

          public void checkConnected()
                              throws ClientNotConnectedException

      Description copied from interface: `ClientConnector`
      Checks whether the client is connected and throws an Exception if not
      Specified by:
        `checkConnected` in interface `ClientConnector`
      Throws:
        `ClientNotConnectedException`
      See Also:
        `ClientConnector.isConnected()`

    - #### createLoginAgent

          protected LoginAgent createLoginAgent(ClientConnector conn,
                                    LoginData data)

      Create the LoginAgent which performs the login.

    - #### login

          public final U login(java.lang.String userName,
                java.lang.String password)
                                     throws java.lang.Exception

      Description copied from interface: `ClientConnector`
      Performs a user login with the given login parameters. This is a shortcut method for `ClientConnector.login(LoginData)`.
      Specified by:
        `login` in interface `ClientConnector`
      Throws:
        `java.lang.Exception`

    - #### login

          public final U login(LoginData loginData)
                                     throws java.lang.Exception

      Description copied from interface: `ClientConnector`
      Performs a user login with the given login parameters
      Specified by:
        `login` in interface `ClientConnector`
      Throws:
        `java.lang.Exception`

    - #### doOnLogin

          protected void doOnLogin(U user)

    - #### logout

          public final boolean logout(boolean isFinalLogout)

      Logs the current user out. If isFinalLogout is set, then no automatic re-login will be performed on `reconnect()`.
      Specified by:
        `logout` in interface `ClientConnector`

    - #### doOnLogout

          protected void doOnLogout(User user)

    - #### isLoggedIn

          public final boolean isLoggedIn()

      Description copied from interface: `ClientConnector`
      Tells whether the user is currently logged in.
      Specified by:
        `isLoggedIn` in interface `ClientConnector`

    - #### reconnect

          public final void reconnect()
                               throws java.lang.Exception

      Reconnects the client with the login parameters of the last login
      Specified by:
        `reconnect` in interface `ClientConnector`
      Throws:
        `java.lang.Exception`

    - #### getLastLoginData

          public final LoginData getLastLoginData()

      Specified by:
        `getLastLoginData` in interface `ClientConnector`

    - #### getUser

          public final U getUser()

      Returns the User object that represents the current login user or null if client is not logged in
      Specified by:
        `getUser` in interface `ClientConnector`

    - #### setLastMessageTypesRegistered

          public final void setLastMessageTypesRegistered(NetMessageType[] msgTypes)

    - #### sendLogout

          public final boolean sendLogout(boolean isFinalLogout)

    - #### getUserId

          public final UserId getUserId()

      Description copied from interface: `ClientConnector`
      Returns the `UserId` object of the current login.
      Specified by:
        `getUserId` in interface `ClientConnector`

    - #### getServerHost

          public final ServerHost getServerHost()

      Description copied from interface: `ClientConnector`
      Returns the `ServerHost` defined for this connection.
      Specified by:
        `getServerHost` in interface `ClientConnector`

    - #### getServerId

          public final ServerId getServerId()

      Description copied from interface: `ClientConnector`
      Returns the `ServerId` object which is available since the first successful server connection. It provides further detail information about the server.
      Specified by:
        `getServerId` in interface `ClientConnector`

    - #### getSessionId

          public final SessionId getSessionId()

      Description copied from interface: `ClientConnector`
      Returns the `SessionId` if a connection is established. Null otherwise.
      Specified by:
        `getSessionId` in interface `ClientConnector`

    - #### getClientConnectionInfo

          public final java.lang.String getClientConnectionInfo()

      Description copied from interface: `ClientConnector`
      Returns an info string about the current client side connection.
      Specified by:
        `getClientConnectionInfo` in interface `ClientConnector`

    - #### getServerConnectionInfo

          public final java.lang.String getServerConnectionInfo()

      Description copied from interface: `ClientConnector`
      Returns an info string about the current server side connection.
      Specified by:
        `getServerConnectionInfo` in interface `ClientConnector`

    - #### getConnectedSinceTs

          public final java.sql.Timestamp getConnectedSinceTs()

      Description copied from interface: `ClientConnector`
      Returns the timestamp since the connection was established.
      Specified by:
        `getConnectedSinceTs` in interface `ClientConnector`

    - #### setServerShutDownHandler

          public final void setServerShutDownHandler(ServerShutdownEvent.Listener handler)

      Specified by:
        `setServerShutDownHandler` in interface `ClientConnector`

    - #### addNetworkConnectionListener

          public final void addNetworkConnectionListener(NetworkConnectionEvent.Listener l)

      Specified by:
        `addNetworkConnectionListener` in interface `NetworkConnectionEvent.Source`

    - #### removeNetworkConnectionListener

          public final void removeNetworkConnectionListener(NetworkConnectionEvent.Listener l)

      Specified by:
        `removeNetworkConnectionListener` in interface `NetworkConnectionEvent.Source`

    - #### addRequestListener

          public final void addRequestListener(NetRequestEvent.Listener l)

      Specified by:
        `addRequestListener` in interface `NetRequestEvent.Source`

    - #### removeRequestListener

          public final void removeRequestListener(NetRequestEvent.Listener l)

      Specified by:
        `removeRequestListener` in interface `NetRequestEvent.Source`

    - #### addResponseListener

          public final void addResponseListener(NetResponseEvent.Listener l)

      Specified by:
        `addResponseListener` in interface `NetResponseEvent.Source`

    - #### removeResponseListener

          public final void removeResponseListener(NetResponseEvent.Listener l)

      Specified by:
        `removeResponseListener` in interface `NetResponseEvent.Source`

    - #### addBatchTaskListener

          public final void addBatchTaskListener(BatchTaskEvent.Listener l)

      Specified by:
        `addBatchTaskListener` in interface `BatchTaskEvent.Source`

    - #### removeBatchTaskListener

          public final void removeBatchTaskListener(BatchTaskEvent.Listener l)

      Specified by:
        `removeBatchTaskListener` in interface `BatchTaskEvent.Source`

    - #### addServerLogMessageListener

          public final void addServerLogMessageListener(LogMessageEvent.Listener l)

      Specified by:
        `addServerLogMessageListener` in interface `ClientConnector`

    - #### removeServerLogMessageListener

          public final void removeServerLogMessageListener(LogMessageEvent.Listener l)

      Specified by:
        `removeServerLogMessageListener` in interface `ClientConnector`

    - #### addAgentMessageListener

          public final void addAgentMessageListener(AgentMessageListener l)

      Specified by:
        `addAgentMessageListener` in interface `ClientConnector`

    - #### removeAgentMessageListener

          public final void removeAgentMessageListener(AgentMessageListener l)

      Specified by:
        `removeAgentMessageListener` in interface `ClientConnector`

    - #### addNetMessageListener

          public final void addNetMessageListener(NetMessageEvent.Listener l)

      Specified by:
        `addNetMessageListener` in interface `NetMessageEvent.Source`

    - #### removeNetMessageListener

          public final void removeNetMessageListener(NetMessageEvent.Listener l)

      Specified by:
        `removeNetMessageListener` in interface `NetMessageEvent.Source`

    - #### addRemoteTaskListener

          public final void addRemoteTaskListener(RemoteTaskEvent.Listener l)

      Specified by:
        `addRemoteTaskListener` in interface `RemoteTaskEvent.Source`

    - #### removeRemoteTaskListener

          public final void removeRemoteTaskListener(RemoteTaskEvent.Listener l)

      Specified by:
        `removeRemoteTaskListener` in interface `RemoteTaskEvent.Source`

    - #### addRemoteRecordChangeListener

          public final void addRemoteRecordChangeListener(RemoteRecordChangeEvent.Listener l)

      Specified by:
        `addRemoteRecordChangeListener` in interface `RemoteRecordChangeEvent.Source`

    - #### removeRemoteRecordChangeListener

          public final void removeRemoteRecordChangeListener(RemoteRecordChangeEvent.Listener l)

      Specified by:
        `removeRemoteRecordChangeListener` in interface `RemoteRecordChangeEvent.Source`

    - #### addServerStatusListener

          public final void addServerStatusListener(GenericEvent.Listener l)

      Specified by:
        `addServerStatusListener` in interface `ServerStatusEvent.Source`

    - #### removeServerStatusListener

          public final void removeServerStatusListener(GenericEvent.Listener l)

      Specified by:
        `removeServerStatusListener` in interface `ServerStatusEvent.Source`

    - #### addSystemEventListener

          public final void addSystemEventListener(GenericEvent.Listener l)

      Specified by:
        `addSystemEventListener` in interface `SystemEvent.Source`

    - #### removeSystemEventListener

          public final void removeSystemEventListener(GenericEvent.Listener l)

      Specified by:
        `removeSystemEventListener` in interface `SystemEvent.Source`

    - #### addNetEventListener

          public final void addNetEventListener(GenericEvent.Listener l)

      Specified by:
        `addNetEventListener` in interface `ClientConnector`

    - #### removeNetEventListener

          public final void removeNetEventListener(GenericEvent.Listener l)

      Specified by:
        `removeNetEventListener` in interface `ClientConnector`

    - #### addABOChangeListener

          public final void addABOChangeListener(ABOChangeEvent.Listener l)

      Specified by:
        `addABOChangeListener` in interface `ABOChangeEvent.Source`

    - #### removeABOChangeListener

          public final void removeABOChangeListener(ABOChangeEvent.Listener l)

      Specified by:
        `removeABOChangeListener` in interface `ABOChangeEvent.Source`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.