- All Superinterfaces:
Immutable,Serializable
- All Known Implementing Classes:
DefaultSessionInfo
Session information.
- Author:
- harald
-
Method Summary
Modifier and TypeMethodDescriptionvoidApplies the properties to this session info.
Sets user, password and application-name from properties, if given.voidcheckServerVersion(String serverVersion) Checks the version of the server.voidClears the cloned flag.
Useful if the session-info should no longer be treated as cloned.voidClears the password.
Will remove it from memory by overwriting each element in the character array.clone()Clones a session-info.
The password will be copied if not null.longReturns the application id.Gets the name of the application.Gets the client version.Gets the host info.Gets the session's locale.
Returns the JVM's default locale if not set explicitly viasetLocale(java.util.Locale).Gets the operating system info.char[]Gets the password.org.tentackle.common.EncryptedPropertiesGets the connection properties.
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 fails aPersistenceExceptionis thrown.Gets the name of the property file.Gets the optional session name.longgetSince()Gets the epochal time since when logged in.Gets the timezone.intGets the class id of the current user.longGets the user id.Gets the username.Gets the info string describing the JVM.booleanisCloned()Checks whether this session info is cloned.booleanDetermines whether token-locks 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(String name) Sets the name of the application.voidsetClientVersion(String clientVersion) Sets the client's version.voidsetHostInfo(String hostInfo) Sets the host info.voidSets the session's locale.voidsetLockLingerEnabled(boolean enabled) Sets whether token-locks are removed when session is closed.voidSets the operating system info.voidsetPassword(char[] password) Sets the password.voidsetProperties(org.tentackle.common.EncryptedProperties properties) Sets the connection properties.voidsetPropertiesName(String propertiesName) Sets the name of the property file.
(without the extension.properties)voidsetSessionName(String sessionName) Sets an optional session name.
May be used to describe the purpose of the session.voidsetSince(long since) Sets the epochal time since when logged in.voidsetTimeZone(TimeZone timeZone) Sets the timezone.voidsetUserClassId(int userClassId) Sets the class id of the current user.voidsetUserId(long userId) Sets the user id.voidsetUserName(String userName) Sets the username.voidSets the info string describing the JVM.Methods inherited from interface org.tentackle.misc.Immutable
getImmutableLoggingLevel, isFinallyImmutable, isImmutable, setFinallyImmutable, setImmutable, setImmutableLoggingLevel
-
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
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
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
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
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"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 fails aPersistenceExceptionis thrown.- Returns:
- the connection properties, never null
-
getPropertiesName
String getPropertiesName()Gets the name of the property file.- Returns:
- the filename
-
setPropertiesName
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 viasetLocale(java.util.Locale).- Returns:
- the locale, never null
-
setLocale
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
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
Sets the operating system info.- Parameters:
osInfo- the OS info
-
getHostInfo
String getHostInfo()Gets the host info.- Returns:
- the hostname or similar info
-
setHostInfo
Sets the host info.- Parameters:
hostInfo- the info
-
getTimeZone
TimeZone getTimeZone()Gets the timezone.- Returns:
- the timezone
-
setTimeZone
Sets the timezone.- Parameters:
timeZone- the timezone
-
checkServerVersion
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
-