|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tentackle.db.UserInfo
public class UserInfo
Information about the user connecting to a database.
| Field Summary | |
|---|---|
static int |
SOCKETCONFIG_COMPRESSED
compressed socket (no ssl) |
static int |
SOCKETCONFIG_COMPRESSED_SSL
ssl + compression |
static int |
SOCKETCONFIG_PLAIN
plain socket (no compression, no ssl) |
static int |
SOCKETCONFIG_SESSION
use session config (default for all RemoteDelegates) |
static int |
SOCKETCONFIG_SSL
ssl socket (no compression) |
| Constructor Summary | |
|---|---|
UserInfo(String username,
char[] password,
String dbPropertiesName)
Create a db connection info from a username, password and property file holding the connection parameters. |
|
| Method Summary | |
|---|---|
void |
bindDb(Db db)
Binds the UserInfo to a logical db connection. |
void |
clearCloned()
Cleares the cloned flag. |
void |
clearPassword()
Clears the password. |
UserInfo |
clone()
Clones a userinfo. |
void |
configureSsl()
Configures the SSL system properties according to the settings in the dbProperties file. |
String |
getApplication()
Gets the application name. |
Properties |
getDbProperties()
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 dbPropertiesName (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 the db errorhandler will be invoked (which will usually terminate the application). |
String |
getDbPropertiesName()
Gets the name of the property file. |
char[] |
getPassword()
Gets the password. |
String |
getPasswordAsString()
Gets the password as a string. |
long |
getSince()
Gets the time since when logged in. |
int |
getSocketConfig()
Gets the socket config from according to the current connection properties. |
static int |
getSocketConfig(Properties props)
Gets the socket config from according to given connection properties. |
String |
getUsername()
Gets the username. |
boolean |
isCloned()
Checks whether this UserInfo is cloned. |
Properties |
loadDbProperties(boolean asResource)
Loads the properties according to getDbPropertiesName(). |
void |
setApplication(String application)
Sets the application name. |
void |
setDbProperties(Properties dbProperties)
Sets the connection properties. |
void |
setDbPropertiesName(String dbPropertiesName)
Sets the name of the property file, i.e. |
void |
setPassword(char[] password)
Sets the password. |
void |
setSince(long since)
Sets the epochal time when the user logged in. |
void |
setUsername(String username)
Sets the username |
String |
toString()
Returns a string representation of the object. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int SOCKETCONFIG_SESSION
public static final int SOCKETCONFIG_PLAIN
public static final int SOCKETCONFIG_COMPRESSED
public static final int SOCKETCONFIG_SSL
public static final int SOCKETCONFIG_COMPRESSED_SSL
| Constructor Detail |
|---|
public UserInfo(String username,
char[] password,
String dbPropertiesName)
username - is the name of the user, null if System.getProperty("user.name")password - is the password, null if nonedbPropertiesName - name of the db-properties, null if "Db"| Method Detail |
|---|
public void bindDb(Db db)
db - the db connectionpublic void setSince(long since)
since - logged in sincepublic long getSince()
public void setUsername(String username)
username - the usernamepublic String getUsername()
public void setPassword(char[] password)
password - the passwordpublic void clearPassword()
Sadly enough, the JDBC api requires passwords as strings :-(
public char[] getPassword()
public String getPasswordAsString()
public String toString()
java.lang.ObjecttoString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
toString in class Objectpublic UserInfo clone()
clone in class ObjectCloneablepublic boolean isCloned()
public void clearCloned()
public String getDbPropertiesName()
public void setDbPropertiesName(String dbPropertiesName)
.properties.
dbPropertiesName - the filename
public Properties loadDbProperties(boolean asResource)
throws FileNotFoundException,
IOException
getDbPropertiesName().
Does not setDbProperties(java.util.Properties) !
asResource - true if load from the classpath, false if from filesystem
FileNotFoundException - if no such property file
IOException - if reading the property file failedpublic Properties getDbProperties()
".properties"
to dbPropertiesName (if it does not contain an extension already).
public void setDbProperties(Properties dbProperties)
dbProperties - the connection properties.public String getApplication()
public void setApplication(String application)
application - the namepublic void configureSsl()
public static int getSocketConfig(Properties props)
props - the connection properties
public int getSocketConfig()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||