Interface SessionInfo

All Superinterfaces:
Immutable, Serializable
All Known Implementing Classes:
DefaultSessionInfo

public interface SessionInfo extends Immutable, Serializable
Session information.
Author:
harald
  • Method Details

    • getUserId

      long getUserId()
      Gets the user id.
      Returns:
      the object ID of the current user
    • setUserId

      void setUserId(long userId)
      Sets the user id.
      Parameters:
      userId - the object ID of the user
    • getUserClassId

      int getUserClassId()
      Gets the class id of the current user.
      Returns:
      the class id
    • setUserClassId

      void setUserClassId(int userClassId)
      Sets the class id of the current user.
      Parameters:
      userClassId - the class id
    • getUserName

      String getUserName()
      Gets the username.
      Returns:
      the username
    • setUserName

      void setUserName(String userName)
      Sets the username.
      Parameters:
      userName - the name of the user
    • getPassword

      char[] getPassword()
      Gets the password.
      Returns:
      the password
    • setPassword

      void setPassword(char[] password)
      Sets the password.
      Parameters:
      password - the password
    • clearPassword

      void clearPassword()
      Clears the password.
      Will remove it from memory by overwriting each element in the character array.
    • getSince

      long getSince()
      Gets the epochal time since when logged in.
      Returns:
      logged in since, 0 if not logged in
    • setSince

      void setSince(long since)
      Sets the epochal time since when logged in.
      Parameters:
      since - logged in since, 0 if not logged in
    • getApplicationName

      String getApplicationName()
      Gets the name of the application.
      Returns:
      the name, null if none
    • setApplicationName

      void setApplicationName(String name)
      Sets the name of the application.
      Parameters:
      name - the name
    • setApplicationId

      void setApplicationId(long applicationId)
      Sets the application id.
      Should be unique among the same application name.
      Parameters:
      applicationId - the optional application id
    • getApplicationId

      long getApplicationId()
      Returns the application id.
      Returns:
      the id, 0 if none
    • setSessionName

      void setSessionName(String sessionName)
      Sets an optional session name.
      May be used to describe the purpose of the session.
      Parameters:
      sessionName - the session name, null if none
    • getSessionName

      String getSessionName()
      Gets the optional session name.
      Returns:
      the name, null if none
    • clone

      SessionInfo clone()
      Clones a session-info.
      The password will be copied if not null.
      Returns:
      the cloned session info
    • clearCloned

      void clearCloned()
      Clears the cloned flag.
      Useful if the session-info should no longer be treated as cloned.
    • isCloned

      boolean isCloned()
      Checks whether this session info is cloned.
      Returns:
      true if cloned
    • setClientVersion

      void setClientVersion(String clientVersion)
      Sets the client's version.
      Parameters:
      clientVersion - the client version
    • getClientVersion

      String getClientVersion()
      Gets the client version.
      Returns:
      the client version
    • setProperties

      void setProperties(org.tentackle.common.EncryptedProperties properties)
      Sets the connection properties.
      Parameters:
      properties - the connection properties.
    • getProperties

      org.tentackle.common.EncryptedProperties getProperties()
      Gets the connection properties.
      The properties are not set so far, the method will load the properties file by adding the extension ".properties" to getPropertiesName() (if it does not contain an extension already).
      If there is no such file, the properties will be read as a resource according to the classpath.
      If all fails a PersistenceException is thrown.
      Returns:
      the connection properties, never null
    • getPropertiesName

      String getPropertiesName()
      Gets the name of the property file.
      Returns:
      the filename
    • setPropertiesName

      void setPropertiesName(String propertiesName)
      Sets the name of the property file.
      (without the extension .properties)
      Parameters:
      propertiesName - the filename
    • applyProperties

      void applyProperties()
      Applies the properties to this session info.
      Sets user, password and application-name from properties, if given.
    • getLocale

      Locale getLocale()
      Gets the session's locale.
      Returns the JVM's default locale if not set explicitly via setLocale(java.util.Locale).
      Returns:
      the locale, never null
    • setLocale

      void setLocale(Locale locale)
      Sets the session's locale.
      Parameters:
      locale - the locale, null to use JVM's locale
    • getVmInfo

      String getVmInfo()
      Gets the info string describing the JVM.
      Returns:
      the jvm info
    • setVmInfo

      void setVmInfo(String vmInfo)
      Sets the info string describing the JVM.
      Parameters:
      vmInfo - the jvm info
    • getOsInfo

      String getOsInfo()
      Gets the operating system info.
      Returns:
      the OS info
    • setOsInfo

      void setOsInfo(String osInfo)
      Sets the operating system info.
      Parameters:
      osInfo - the OS info
    • getHostInfo

      String getHostInfo()
      Gets the host info.
      Returns:
      the hostname or similar info
    • setHostInfo

      void setHostInfo(String hostInfo)
      Sets the host info.
      Parameters:
      hostInfo - the info
    • getTimeZone

      TimeZone getTimeZone()
      Gets the timezone.
      Returns:
      the timezone
    • setTimeZone

      void setTimeZone(TimeZone timeZone)
      Sets the timezone.
      Parameters:
      timeZone - the timezone
    • checkServerVersion

      void checkServerVersion(String serverVersion)
      Checks the version of the server.

      The default implementation does nothing.

      Parameters:
      serverVersion - the server's version
      Throws:
      VersionIncompatibleException - if versions are not compatible
    • isLockLingerEnabled

      boolean isLockLingerEnabled()
      Determines whether token-locks are removed when session is closed.
      By default, locks are not removed for cloned sessions.
      Returns:
      true if leave locks untouched, false to remove locks
    • setLockLingerEnabled

      void setLockLingerEnabled(boolean enabled)
      Sets whether token-locks are removed when session is closed.
      Parameters:
      enabled - true if leave locks untouched, false to remove locks