de.esprit.netsuite.server.netch

## Class Session

- java.lang.Object
- - de.esprit.common.util.DumpableObject
  - - de.esprit.appsuite.launch.AbstractApplicationObject<S>
    - - de.esprit.netsuite.server.AbstractServerObject<ServerContext>
      - - de.esprit.netsuite.server.netch.Session

- All Implemented Interfaces:
    ApplicationObject<ServerContext>, SimpleLogSupport, Dumpable, ServerObject<ServerContext>

      public class Session
      extends AbstractServerObject<ServerContext>

  This class encapsulates a connection to a client by maintaining it's `SessionId` and the according `ServerNetworkAdapter`.
  Author:
    Rainer Buesch

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Session(ServerContext serverCtx, ServerNetworkAdapter adapter, SessionId sessionId)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearMessageTypeRegistry()`
    `void` | `closeSession()`
    `void` | `deregisterMessageType(NetMessageType... msgTypes)`
    `boolean` | `equals(java.lang.Object obj)`
    `long` | `getDuration()`
    `ServerNetworkAdapter` | `getNetworkAdapter()`
    `NetMessageType[]` | `getRegisteredMessageTypes()`
    `SessionId` | `getSessionId()`
    `long` | `getStartTime()`
    `UserId` | `getUserId()`
    `java.lang.String` | `getUserName()`
    `int` | `hashCode()`
    `boolean` | `isCoClient()`
    `boolean` | `isLoggedIn()`
    `boolean` | `isRegisteredForMessageType(NetMessageType msgType)`
    `void` | `logoutUser()`
    `void` | `registerMessageType(NetMessageType... msgTypes)`
    `ClientInfo` | `requestClientInfo(SessionId fromSessionId, long millis)` Requests a new `ClientInfo` object from the client by sending a `ClientInfoCommand`.
    `void` | `sendNetMessage(NetMessage msg)`
    `void` | `setClientInfo(ClientInfo clientInfo)` Sets a new `ClientInfo` object and releases any thread waiting for it.
    `void` | `setUserId(UserId userId)`
    `ToString` | `toString(ToString s)` This method allows subclasses to add values to the existing ToString of the superclass.

    - ### Methods inherited from class de.esprit.netsuite.server.AbstractServerObject

      `checkPermission, getServerConfig, getServerContext, getStatisticManager`

    - ### 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`

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

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

- - ### Constructor Detail

    - #### Session

          public Session(ServerContext serverCtx,
                 ServerNetworkAdapter adapter,
                 SessionId sessionId)

  - ### Method Detail

    - #### getNetworkAdapter

          public ServerNetworkAdapter getNetworkAdapter()

    - #### setClientInfo

          public void setClientInfo(ClientInfo clientInfo)

      Sets a new `ClientInfo` object and releases any thread waiting for it.

    - #### requestClientInfo

          public ClientInfo requestClientInfo(SessionId fromSessionId,
                                     long millis)

      Requests a new `ClientInfo` object from the client by sending a `ClientInfoCommand`. The client will react by sending a `ClientInfoUpdateAgent` in order to update the `ClientInfo` object. If this does not happen in time then the returned `ClientInfo` object will contain an error.

    - #### getStartTime

          public long getStartTime()

    - #### getDuration

          public long getDuration()

    - #### logoutUser

          public void logoutUser()
                          throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### sendNetMessage

          public void sendNetMessage(NetMessage msg)

    - #### getSessionId

          public SessionId getSessionId()

    - #### setUserId

          public void setUserId(UserId userId)

    - #### getUserId

          public UserId getUserId()

    - #### isLoggedIn

          public boolean isLoggedIn()

    - #### getUserName

          public java.lang.String getUserName()

    - #### isCoClient

          public boolean isCoClient()

    - #### closeSession

          public void closeSession()

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### clearMessageTypeRegistry

          public void clearMessageTypeRegistry()

    - #### registerMessageType

          public void registerMessageType(NetMessageType... msgTypes)

    - #### deregisterMessageType

          public void deregisterMessageType(NetMessageType... msgTypes)

    - #### isRegisteredForMessageType

          public boolean isRegisteredForMessageType(NetMessageType msgType)

    - #### getRegisteredMessageTypes

          public NetMessageType[] getRegisteredMessageTypes()

    - #### toString

          public ToString toString(ToString s)

      Description copied from interface: `Dumpable`
      This method allows subclasses to add values to the existing ToString of the superclass. Usually subclasses only need to override this method.
      Specified by:
        `toString` in interface `Dumpable`
      Overrides:
        `toString` in class `AbstractServerObject<ServerContext>`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.