Interface SessionInfo

  • All Superinterfaces:
    org.tentackle.misc.Immutable, java.io.Serializable
    All Known Implementing Classes:
    DefaultSessionInfo

    public interface SessionInfo
    extends org.tentackle.misc.Immutable, java.io.Serializable
    Session information.
    Author:
    harald
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void applyProperties()
      Applies the properties to this session info.
      Sets user and password from properties, if given.
      void checkServerVersionInfo​(java.io.Serializable serverVersionInfo)
      Checks the version information (of the server).
      void clearCloned()
      Cleares the cloned flag.
      void clearPassword()
      Clears the password.
      Will remove it from memory by overwriting each element in the character array.
      SessionInfo clone()
      Clones a sessioninfo.
      The password will be copied if not null.
      long getApplicationId()
      Returns the application id.
      java.lang.String getApplicationName()
      Gets the name of the application.
      java.io.Serializable getClientVersionInfo()
      Gets the client version info.
      java.lang.String getHostInfo()
      Gets the host info.
      java.util.Locale getLocale()
      Gets the session's locale.
      Returns the JVM's default locale if not set explicitly via setLocale(java.util.Locale).
      java.lang.String getOsInfo()
      Gets the operating system info.
      char[] getPassword()
      Gets the password.
      java.util.Properties getProperties()
      Gets the connection properties.
      The 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 failes a PersistenceException is thrown.
      java.lang.String getPropertiesName()
      Gets the name of the property file.
      long getSince()
      Gets the epochal time since when logged in.
      java.util.TimeZone getTimeZone()
      Gets the timezone.
      int getUserClassId()
      Gets the class id of the current user.
      long getUserId()
      Gets the user id.
      java.lang.String getUserName()
      Gets the username.
      java.lang.String getVmInfo()
      Gets the info string describing the JVM.
      boolean isCloned()
      Checks whether this session info is cloned.
      boolean isLockLingerEnabled()
      Determines whether tokenlocks are removed when session is closed.
      By default, locks are not removed for cloned sessions.
      void setApplicationId​(long applicationId)
      Sets the application id.
      Should be unique among the same application name.
      void setApplicationName​(java.lang.String name)
      Sets the name of the application.
      void setClientVersionInfo​(java.io.Serializable clientVersionInfo)
      Sets the client's version info.
      void setHostInfo​(java.lang.String hostInfo)
      Sets the host info.
      void setLocale​(java.util.Locale locale)
      Sets the session's locale.
      void setLockLingerEnabled​(boolean enabled)
      Sets whether tokenlocks are removed when session is closed.
      void setOsInfo​(java.lang.String osInfo)
      Sets the operating system info.
      void setPassword​(char[] password)
      Sets the password.
      void setProperties​(java.util.Properties properties)
      Sets the connection properties.
      void setPropertiesName​(java.lang.String propertiesName)
      Sets the name of the property file.
      (without the extension .properties)
      void setSince​(long since)
      Sets the epochal time since when logged in.
      void setTimeZone​(java.util.TimeZone timeZone)
      Sets the timezone.
      void setUserClassId​(int userClassId)
      Sets the class id of the current user.
      void setUserId​(long userId)
      Sets the user id.
      void setUserName​(java.lang.String userName)
      Sets the username.
      void setVmInfo​(java.lang.String vmInfo)
      Sets the info string describing the JVM.
      • Methods inherited from interface org.tentackle.misc.Immutable

        getImmutableLoggingLevel, isFinallyImmutable, isImmutable, setFinallyImmutable, setImmutable, setImmutableLoggingLevel
    • Method Detail

      • 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

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

        void setUserName​(java.lang.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, null if not logged in
      • setSince

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

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

        void setApplicationName​(java.lang.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
      • clone

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

        void clearCloned()
        Cleares the cloned flag. Useful if the sessioninfo should no longer be treated as cloned.
      • isCloned

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

        void setClientVersionInfo​(java.io.Serializable clientVersionInfo)
        Sets the client's version info.
        Parameters:
        clientVersionInfo - the version info
      • getClientVersionInfo

        java.io.Serializable getClientVersionInfo()
        Gets the client version info.
        Returns:
        the version info
      • setProperties

        void setProperties​(java.util.Properties properties)
        Sets the connection properties.
        Parameters:
        properties - the connection properties.
      • getProperties

        java.util.Properties getProperties()
        Gets the connection properties.
        The 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 failes a PersistenceException is thrown.
        Returns:
        the connection properties, never null
      • getPropertiesName

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

        void setPropertiesName​(java.lang.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 and password from properties, if given.
      • getLocale

        java.util.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​(java.util.Locale locale)
        Sets the session's locale.
        Parameters:
        locale - the locale, null to use JVM's locale
      • getVmInfo

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

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

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

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

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

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

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

        void setTimeZone​(java.util.TimeZone timeZone)
        Sets the timezone.
        Parameters:
        timeZone - the timezone
      • checkServerVersionInfo

        void checkServerVersionInfo​(java.io.Serializable serverVersionInfo)
        Checks the version information (of the server).

        The default implementation does nothing.

        Parameters:
        serverVersionInfo - the server's version info
        Throws:
        VersionInfoIncompatibleException - if versions are not compatible
      • isLockLingerEnabled

        boolean isLockLingerEnabled()
        Determines whether tokenlocks 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 tokenlocks are removed when session is closed.
        Parameters:
        enabled - true if leave locks untouched, false to remove locks