public class DefaultSessionInfo extends Object implements SessionInfo, Serializable, Cloneable
The password is encrypted if a Cryptor is configured.
| Constructor and Description |
|---|
DefaultSessionInfo()
Creates a session info from the default properties file.
The property file's name is "backend". |
DefaultSessionInfo(Properties properties)
Creates a session from a properties object.
|
DefaultSessionInfo(String propertiesName)
Creates a session info from a property file holding the connection parameters.
|
DefaultSessionInfo(String username,
char[] password,
String propertiesName)
Creates a session info from an optional username, optional password and
a property file holding the connection parameters.
|
| Modifier and Type | Method and Description |
|---|---|
void |
applyProperties()
Applies the properties to this session info.
Sets user and password from properties, if given. |
protected void |
assertMutable()
Asserts that this session info is mutable.
|
void |
checkServerVersionInfo(Serializable serverVersionInfo)
Checks the version information (of the server).
|
void |
clearCloned()
Cleares the cloned flag.
|
void |
clearPassword()
Clears the password.
|
DefaultSessionInfo |
clone()
Clones a userinfo.
The password is copied, if not null. The properties are cloned as well. Cloned session infos are mutable by default. |
boolean |
equals(Object obj)
Session infos are equal if their login credentials are equal.
|
long |
getApplicationId()
Returns the application id.
|
String |
getApplicationName()
Gets the application name.
|
Serializable |
getClientVersionInfo()
Gets the client version info.
|
String |
getHostInfo()
Gets the host info.
|
Logger.Level |
getImmutableLoggingLevel() |
Locale |
getLocale()
Gets the session's locale.
Returns the JVM's default locale if not set explicitly via SessionInfo.setLocale(java.util.Locale). |
String |
getOsInfo()
Gets the operating system info.
|
char[] |
getPassword()
Gets the password.
|
Properties |
getProperties()
Gets the connection properties.
If the properties are not set so far, the method will load the properties file by adding the extension ".properties"
to propertiesName (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 the db errorhandler will be invoked (which will usually terminate the application). |
String |
getPropertiesName()
Gets the name of the property file.
|
long |
getSince()
Gets the time since when logged in.
|
TimeZone |
getTimeZone()
Gets the timezone.
|
int |
getUserClassId()
Gets the class id of the current user.
|
long |
getUserId()
Gets the user id.
|
String |
getUserName()
Gets the username.
|
String |
getVmInfo()
Gets the info string describing the JVM.
|
int |
hashCode() |
boolean |
isCloned()
Checks whether this DefaultSessionInfo is cloned.
|
boolean |
isImmutable() |
void |
setApplicationId(long applicationId)
Sets the application id.
Should be unique among the same application name. |
void |
setApplicationName(String application)
Sets the application name.
|
void |
setClientVersionInfo(Serializable clientVersionInfo)
Sets the client's version info.
|
void |
setHostInfo(String hostInfo)
Sets the host info.
|
void |
setImmutable(boolean immutable) |
void |
setImmutableLoggingLevel(Logger.Level immutableLoggingLevel) |
void |
setLocale(Locale locale)
Sets the session's locale.
|
void |
setOsInfo(String osInfo)
Sets the operating system info.
|
void |
setPassword(char[] password)
Sets the password.
|
void |
setProperties(Properties properties)
Sets the connection properties.
|
void |
setPropertiesName(String propertiesName)
Sets the name of the property file, i.e.
|
void |
setSince(long since)
Sets the epochal time when the user logged in.
|
void |
setTimeZone(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(String userName)
Sets the username
|
void |
setVmInfo(String vmInfo)
Sets the info string describing the JVM.
|
String |
toString() |
public DefaultSessionInfo(String username, char[] password, String propertiesName)
username - is the name of the user, null if System.getProperty("user.name")password - is the password, null if nonepropertiesName - name of the session's properties file, null if "backend"public DefaultSessionInfo(String propertiesName)
propertiesName - name of the session's properties file, null if "backend"public DefaultSessionInfo()
"backend".public DefaultSessionInfo(Properties properties)
properties - the propertiespublic boolean equals(Object obj)
public boolean isImmutable()
isImmutable in interface Immutablepublic void setImmutable(boolean immutable)
setImmutable in interface Immutablepublic void setImmutableLoggingLevel(Logger.Level immutableLoggingLevel)
setImmutableLoggingLevel in interface Immutablepublic Logger.Level getImmutableLoggingLevel()
getImmutableLoggingLevel in interface Immutableprotected void assertMutable()
public void setSince(long since)
setSince in interface SessionInfosince - logged in sincepublic long getSince()
getSince in interface SessionInfopublic void setUserName(String userName)
setUserName in interface SessionInfouserName - the usernamepublic String getUserName()
getUserName in interface SessionInfopublic void setPassword(char[] password)
setPassword in interface SessionInfopassword - the passwordpublic void clearPassword()
Sadly enough, the JDBC api requires passwords as strings :-(
clearPassword in interface SessionInfopublic char[] getPassword()
getPassword in interface SessionInfopublic Serializable getClientVersionInfo()
getClientVersionInfo in interface SessionInfopublic void setClientVersionInfo(Serializable clientVersionInfo)
setClientVersionInfo in interface SessionInfoclientVersionInfo - the version infopublic Locale getLocale()
SessionInfoSessionInfo.setLocale(java.util.Locale).getLocale in interface SessionInfopublic void setLocale(Locale locale)
SessionInfosetLocale in interface SessionInfolocale - the locale, null to use JVM's localepublic String getVmInfo()
SessionInfogetVmInfo in interface SessionInfopublic void setVmInfo(String vmInfo)
SessionInfosetVmInfo in interface SessionInfovmInfo - the jvm infopublic TimeZone getTimeZone()
SessionInfogetTimeZone in interface SessionInfopublic void setTimeZone(TimeZone timeZone)
SessionInfosetTimeZone in interface SessionInfotimeZone - the timezonepublic String getOsInfo()
SessionInfogetOsInfo in interface SessionInfopublic void setOsInfo(String osInfo)
SessionInfosetOsInfo in interface SessionInfoosInfo - the OS infopublic String getHostInfo()
SessionInfogetHostInfo in interface SessionInfopublic void setHostInfo(String hostInfo)
SessionInfosetHostInfo in interface SessionInfohostInfo - the infopublic DefaultSessionInfo clone()
clone in interface SessionInfoclone in class Objectpublic boolean isCloned()
isCloned in interface SessionInfopublic void clearCloned()
clearCloned in interface SessionInfopublic String getPropertiesName()
getPropertiesName in interface SessionInfopublic void setPropertiesName(String propertiesName)
.properties.setPropertiesName in interface SessionInfopropertiesName - the filenamepublic Properties getProperties()
".properties"
to propertiesName (if it does not contain an extension already).
However, if propertiesName is null, empty properties are returned.
getProperties in interface SessionInfopublic void setProperties(Properties properties)
setProperties in interface SessionInfoproperties - the connection properties.public void applyProperties()
SessionInfoapplyProperties in interface SessionInfopublic String getApplicationName()
getApplicationName in interface SessionInfopublic void setApplicationName(String application)
setApplicationName in interface SessionInfoapplication - the namepublic void setApplicationId(long applicationId)
setApplicationId in interface SessionInfoapplicationId - the optional application idpublic long getApplicationId()
getApplicationId in interface SessionInfopublic void checkServerVersionInfo(Serializable serverVersionInfo) throws VersionInfoIncompatibleException
The default implementation does nothing.
It is invoked from Session.open() for remote connections.
checkServerVersionInfo in interface SessionInfoserverVersionInfo - the server's version infoVersionInfoIncompatibleException - if versions are not compatiblepublic long getUserId()
SessionInfogetUserId in interface SessionInfopublic void setUserId(long userId)
SessionInfosetUserId in interface SessionInfouserId - the object ID of the userpublic int getUserClassId()
SessionInfogetUserClassId in interface SessionInfopublic void setUserClassId(int userClassId)
SessionInfosetUserClassId in interface SessionInfouserClassId - the class idTentackle - distributed, domain- and model-driven