Package com.mckoi.database
Class User
- java.lang.Object
-
- com.mckoi.database.User
-
public final class User extends java.lang.ObjectEncapsulates the information about a single user logged into the system. The class provides access to information in the user database.This object also serves as a storage for session state information. For example, this object stores the triggers that this session has created.
NOTE: This object is not immutable. The same user may log into the system and it will result in a new User object being created.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringconnection_stringThe connection string that identifies how this user is connected to the database.private DatabasedatabaseThe database object that this user is currently logged into.private longlast_command_timeThe last time this user executed a command on the connection.private longtime_connectedThe time this user connected.private java.lang.Stringuser_nameThe name of the user.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetConnectionString()Returns the string that describes how this user is connected to the engine.DatabasegetDatabase()Returns the Database object that this user belongs to.longgetLastCommandTime()Returnst the last time a command was executed by this user.longgetTimeConnected()Returns the time the user connected.java.lang.StringgetUserName()Returns the name of the user.voidlogout()Logs out this user object.voidrefreshLastCommandTime()Refreshes the last time a command was executed by this user.
-
-
-
Field Detail
-
user_name
private java.lang.String user_name
The name of the user.
-
database
private Database database
The database object that this user is currently logged into.
-
connection_string
private java.lang.String connection_string
The connection string that identifies how this user is connected to the database.
-
time_connected
private long time_connected
The time this user connected.
-
last_command_time
private long last_command_time
The last time this user executed a command on the connection.
-
-
Constructor Detail
-
User
User(java.lang.String user_name, Database database, java.lang.String connection_string, long time_connected)The Constructor. This takes a user name and gets the privs for them.Note that this method should only be created from within a Database object.
-
-
Method Detail
-
getUserName
public java.lang.String getUserName()
Returns the name of the user.
-
getConnectionString
public java.lang.String getConnectionString()
Returns the string that describes how this user is connected to the engine. This is set by the protocol layer.
-
getTimeConnected
public long getTimeConnected()
Returns the time the user connected.
-
getLastCommandTime
public long getLastCommandTime()
Returnst the last time a command was executed by this user.
-
getDatabase
public Database getDatabase()
Returns the Database object that this user belongs to.
-
refreshLastCommandTime
public final void refreshLastCommandTime()
Refreshes the last time a command was executed by this user.
-
logout
public void logout()
Logs out this user object. This will log the user out of the user manager.
-
-