|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.datacrow.core.db.DatabaseManager
public class DatabaseManager
The database manager is responsible for all databases. This class is the only service providing access to the databases.
Field Summary | |
---|---|
static boolean |
initialized
|
Constructor Summary | |
---|---|
DatabaseManager()
|
Method Summary | |
---|---|
static void |
applySettings()
Apply settings on the databases. |
static void |
changePassword(User user,
java.lang.String password)
Change the password for the given user. |
static void |
closeDatabases(boolean compact)
Closes the database connections. |
static void |
createUser(User user,
java.lang.String password)
Creates a user with all the correct privileges |
static void |
delete(DcObject dco)
|
static void |
deleteUser(User user)
Removes a user from the database |
static java.sql.ResultSet |
executeSQL(java.lang.String sql)
Executes a query. |
static java.sql.Connection |
getAdminConnection()
Creates an admin connection to the database. |
static java.sql.Connection |
getConnection()
Returns a new connection to the database based on the logged on user. |
static java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
Returns a connection for the given user credentials. |
static java.util.Map<java.lang.String,java.lang.Integer> |
getKeys(DataFilter filter)
|
static Version |
getOriginalVersion()
Retrieves the original database version (the version before the database was upgraded). |
static int |
getQueueSize()
Retrieves the count of currently queued queries. |
static Version |
getVersion()
Retrieves the current database version. |
static void |
initialize()
Initializes the database. |
static void |
insert(DcObject dco)
Stores the item in the database. |
static boolean |
isLocked()
Checks whether the database is available. |
static boolean |
isUnique(DcObject o,
boolean isExisting)
Checks the database to see if the item already exists. |
protected static void |
setPriviliges(DcModule module,
java.lang.String user,
boolean admin)
Applies the users privileges on the database tables and columns. |
protected static void |
setPriviliges(DcModule module,
User user)
|
static void |
setPriviliges(java.lang.String user,
boolean admin)
Updates the privileges of an existing user. |
static void |
setPriviliges(User user)
Updates the privileges of an existing user. |
static void |
update(DcObject dco)
Update the item in the database with the values from the specified item. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean initialized
Constructor Detail |
---|
public DatabaseManager()
Method Detail |
---|
public static void initialize()
public static Version getOriginalVersion()
public static Version getVersion()
public static int getQueueSize()
public static void applySettings()
public static boolean isLocked()
public static void closeDatabases(boolean compact)
compact
- Indicates if the database should be compacted.public static java.sql.Connection getConnection()
public static java.sql.Connection getConnection(java.lang.String username, java.lang.String password)
getConnection()
or getAdminConnection()
.
username
- password
-
public static java.util.Map<java.lang.String,java.lang.Integer> getKeys(DataFilter filter)
public static java.sql.ResultSet executeSQL(java.lang.String sql) throws java.sql.SQLException
sql
- SQL statement.log
- Indicates if information on the query should be logged.
java.sql.SQLException
public static void update(DcObject dco)
dco
- public static void insert(DcObject dco)
dco
- public static void delete(DcObject dco)
public static boolean isUnique(DcObject o, boolean isExisting)
o
- The item to check.isExisting
- Indicates if the check is performed for a new or an existing item.public static java.sql.Connection getAdminConnection()
public static void changePassword(User user, java.lang.String password)
user
- password
- public static void deleteUser(User user)
public static void createUser(User user, java.lang.String password)
public static void setPriviliges(User user)
user
- public static void setPriviliges(java.lang.String user, boolean admin)
user
- admin
- Indicates if the user is an administrator.protected static void setPriviliges(DcModule module, User user)
protected static void setPriviliges(DcModule module, java.lang.String user, boolean admin)
module
- user
- admin
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |