-
- All Superinterfaces:
org.tentackle.misc.Immutable,java.io.Serializable
- All Known Implementing Classes:
DefaultSessionInfo
public interface SessionInfo extends org.tentackle.misc.Immutable, java.io.SerializableSession information.- Author:
- harald
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidapplyProperties()Applies the properties to this session info.
Sets user and password from properties, if given.voidcheckServerVersionInfo(java.io.Serializable serverVersionInfo)Checks the version information (of the server).voidclearCloned()Cleares the cloned flag.voidclearPassword()Clears the password.
Will remove it from memory by overwriting each element in the character array.SessionInfoclone()Clones a sessioninfo.
The password will be copied if not null.longgetApplicationId()Returns the application id.java.lang.StringgetApplicationName()Gets the name of the application.java.io.SerializablegetClientVersionInfo()Gets the client version info.java.lang.StringgetHostInfo()Gets the host info.java.util.LocalegetLocale()Gets the session's locale.
Returns the JVM's default locale if not set explicitly viasetLocale(java.util.Locale).java.lang.StringgetOsInfo()Gets the operating system info.char[]getPassword()Gets the password.java.util.PropertiesgetProperties()Gets the connection properties.
The the properties are not set so far, the method will load the properties file by adding the extension".properties"togetPropertiesName()(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 aPersistenceExceptionis thrown.java.lang.StringgetPropertiesName()Gets the name of the property file.longgetSince()Gets the epochal time since when logged in.java.util.TimeZonegetTimeZone()Gets the timezone.intgetUserClassId()Gets the class id of the current user.longgetUserId()Gets the user id.java.lang.StringgetUserName()Gets the username.java.lang.StringgetVmInfo()Gets the info string describing the JVM.booleanisCloned()Checks whether this session info is cloned.booleanisLockLingerEnabled()Determines whether tokenlocks are removed when session is closed.
By default, locks are not removed for cloned sessions.voidsetApplicationId(long applicationId)Sets the application id.
Should be unique among the same application name.voidsetApplicationName(java.lang.String name)Sets the name of the application.voidsetClientVersionInfo(java.io.Serializable clientVersionInfo)Sets the client's version info.voidsetHostInfo(java.lang.String hostInfo)Sets the host info.voidsetLocale(java.util.Locale locale)Sets the session's locale.voidsetLockLingerEnabled(boolean enabled)Sets whether tokenlocks are removed when session is closed.voidsetOsInfo(java.lang.String osInfo)Sets the operating system info.voidsetPassword(char[] password)Sets the password.voidsetProperties(java.util.Properties properties)Sets the connection properties.voidsetPropertiesName(java.lang.String propertiesName)Sets the name of the property file.
(without the extension.properties)voidsetSince(long since)Sets the epochal time since when logged in.voidsetTimeZone(java.util.TimeZone timeZone)Sets the timezone.voidsetUserClassId(int userClassId)Sets the class id of the current user.voidsetUserId(long userId)Sets the user id.voidsetUserName(java.lang.String userName)Sets the username.voidsetVmInfo(java.lang.String vmInfo)Sets the info string describing the JVM.
-
-
-
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"togetPropertiesName()(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 aPersistenceExceptionis 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 viasetLocale(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
-
-