Java Doc for Database.java in  » Database-DBMS » mckoi » com » mckoi » database » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » mckoi » com.mckoi.database 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.mckoi.database.Database

Database
final public class Database implements DatabaseConstants(Code)
The representation of a single database in the system. A database is a set of schema, a set of tables and table definitions of tables in the schema, and a description of the schema.

This class encapsulates the top level behaviour of a database. That is of creating itself, initializing itself, shutting itself down, deleting itself, creating/dropping a table, updating a table. It is not the responsibility of this class to handle table behaviour above this. Top level table behaviour is handled by DataTable through the DatabaseConnection interface.

The Database object is also responsible for various database management functions such a creating, editing and removing users, triggers, functions and services.
author:
   Tobias Downer



Field Summary
final public static  StringDEFAULT_SCHEMA
     The name of the default schema.
final public static  StringINTERNAL_SECURE_USERNAME
     The username of the internal secure user.
final public static  StringJDBC_SCHEMA
     The name of the schema that contains JDBC helper tables.
final public static  StringLOCK_GROUP
     The name of the lock group.
final public static  TableNameNEW_TRIGGER_TABLE
     The NEW table used inside a triggered procedure to represent a triggered row after the operation occurs.
final public static  TableNameOLD_TRIGGER_TABLE
     The OLD table used inside a triggered procedure to represent a triggered row before the operation occurs.
final public static  StringSCHEMA_MANAGER_GROUP
     The name of the schema manager group.
final public static  StringSECURE_GROUP
     THe name of the secure access group.
final public static  StringSYSTEM_SCHEMA
     The name of the system schema that contains tables refering to system information.
final public static  TableNameSYS_DATA_TRIGGER
     The system internally generated 'sUSRDataTrigger' table.
final public static  TableNameSYS_DB_STATISTICS
     The system internally generated 'sUSRDatabaseStatistics' table.
final public static  TableNameSYS_FUNCTION
     The function table.
final public static  TableNameSYS_FUNCTIONFACTORY
     The function factory table.
final public static  TableNameSYS_GRANTS
    
final public static  TableNameSYS_LABEL
     The label table.
final public static  TableNameSYS_PASSWORD
     The password privs and grants table.
final public static  TableNameSYS_SERVICE
     The services table.
final public static  TableNameSYS_TABLE_COLUMNS
     The system internally generated 'sUSRTableColumns' table.
final public static  TableNameSYS_TABLE_INFO
     The system internally generated 'sUSRTableInfo' table.
final public static  TableNameSYS_USERCONNECT
    
final public static  TableNameSYS_USERPRIV
    
final public static  TableNameSYS_VIEW
     The view table.
final public static  StringUSER_MANAGER_GROUP
     The name of the user manager group.

Constructor Summary
public  Database(DatabaseSystem system, String name)
     The Constructor.

Method Summary
final public  DebugLoggerDebug()
     Returns the DebugLogger implementation from the DatabaseSystem.
public  voidaddUserToGroup(DatabaseQueryContext context, String username, String group)
     Adds the user to the given group.
public  voidalterUserPassword(DatabaseQueryContext context, String username, String password)
     Alters the password of the user but otherwise does not change any information about the user.
public  UserauthenticateUser(String username, String password, String connection_string)
     Tries to authenticate a username/password against this database.
public  booleancanUserAlterTableObject(DatabaseQueryContext context, User user, TableName table)
     Returns true if the user can alter a table or view with the given name, otherwise returns false.
public  booleancanUserCompactTableObject(DatabaseQueryContext context, User user, TableName table)
     Returns true if the user can compact a table with the given name, otherwise returns false.
public  booleancanUserCreateAndDropSchema(DatabaseQueryContext context, User user, String schema)
     Returns true if the user is permitted to create and drop schema's in the database, otherwise returns false.
public  booleancanUserCreateAndDropUsers(DatabaseQueryContext context, User user)
     Returns true if the user is permitted to create, alter and drop user information from the database, otherwise returns false.
public  booleancanUserCreateProcedureObject(DatabaseQueryContext context, User user, TableName table)
     Returns true if the user can create a procedure with the given name, otherwise returns false.
public  booleancanUserCreateSequenceObject(DatabaseQueryContext context, User user, TableName table)
     Returns true if the user can create a sequence with the given name, otherwise returns false.
public  booleancanUserCreateTableObject(DatabaseQueryContext context, User user, TableName table)
     Returns true if the user can create a table or view with the given name, otherwise returns false.
public  booleancanUserDeleteFromTableObject(DatabaseQueryContext context, User user, TableName table)
     Returns true if the user can delete from a table or view with the given name and given columns, otherwise returns false.
public  booleancanUserDropProcedureObject(DatabaseQueryContext context, User user, TableName table)
     Returns true if the user can drop a procedure with the given name, otherwise returns false.
public  booleancanUserDropSequenceObject(DatabaseQueryContext context, User user, TableName table)
     Returns true if the user can drop a sequence with the given name, otherwise returns false.
public  booleancanUserDropTableObject(DatabaseQueryContext context, User user, TableName table)
     Returns true if the user can drop a table or view with the given name, otherwise returns false.
public  booleancanUserExecuteStoredProcedure(DatabaseQueryContext context, User user, String procedure_name)
     Returns true if the user is allowed to execute the given stored procedure.
public  booleancanUserInsertIntoTableObject(DatabaseQueryContext context, User user, TableName table, Variable[] columns)
     Returns true if the user can insert into a table or view with the given name and given columns, otherwise returns false.
public  booleancanUserSelectFromTableObject(DatabaseQueryContext context, User user, TableName table, Variable[] columns)
     Returns true if the user can select from a table or view with the given name and given columns, otherwise returns false.
public  booleancanUserShutDown(DatabaseQueryContext context, User user)
     Returns true if the user can shut down the database server.
public  booleancanUserUpdateTableObject(DatabaseQueryContext context, User user, TableName table, Variable[] columns)
     Returns true if the user can update a table or view with the given name and given columns, otherwise returns false.
public  booleanconvertToCurrent(PrintStream out, String admin_username)
     Functionality for converting and old database format to the existing format.
public  voidcreate(String username, String password)
     Creates and sets up a new database to an initial empty state.
final public  ObjectcreateEvent(Runnable runner)
     Creates an event for the database dispatcher.
public  DatabaseConnectioncreateNewConnection(User user, DatabaseConnection.CallBack call_back)
     Returns a new DatabaseConnection instance that is used against this database.

When a new connection is made on this database, this method is called to create a new DatabaseConnection instance for the connection.

 voidcreateSchemaInfoTables(DatabaseConnection connection)
     Creates the schema information tables introducted in version 0.90.
public  voidcreateUser(DatabaseQueryContext context, String username, String password)
     Creates and adds a new user to this database.
public  voiddeleteAllUserGroups(DatabaseQueryContext context, String username)
     Deletes all the groups the user belongs to.
public  voiddeleteUser(DatabaseQueryContext context, String username)
     Deletes the user from the system.
final public  voidexecute(User user, DatabaseConnection database, Runnable runner)
     Executes database functions from the 'run' method of the given runnable instance on the first available worker thread.
public  booleanexists()
     Returns true if the database exists.
public  voidfinalize()
    
public  LoggetCommandsLog()
     Returns the log file where commands are recorded.
 TableDataConglomerategetConglomerate()
     Returns the conglomerate for this database.
public  DatabaseProceduregetDBProcedure(String procedure_name, DatabaseConnection connection)
     Resolves a procedure name into a DBProcedure object.
final public  DataCellCachegetDataCellCache()
     Returns the system DataCellCache.
public  StringgetName()
     Returns the name of this database.
final public  TablegetSingleRowTable()
     Returns a static table that has a single row but no columns.
final public  DatabaseSystemgetSystem()
     Returns the DatabaseSystem that this Database is from.
final public  TriggerManagergetTriggerManager()
     Returns the system trigger manager.
final public  UserManagergetUserManager()
     Returns the system user manager.
public  voidgrantHostAccessToUser(DatabaseQueryContext context, String user, String protocol, String host)
     Grants the given user access to connect to the database from the given host address.
public  String[]groupsUserBelongsTo(DatabaseQueryContext context, String username)
     Returns the list of all user groups the user belongs to.
final public  booleanhasShutDown()
     Returns true if the database has shut down.
public  voidinit()
     Initializes the database.
public  booleanisInitialized()
     Returns true if the database is initialised.
public  booleanisReadOnly()
     Returns true if this database is in read only mode.
public  voidliveCopyTo(File path)
     Copies all the persistent data in this database (the conglomerate) to the given destination path.
final public  voidpostEvent(int time, Object event)
     Posts an event on the database dispatcher.
final public  voidregisterShutDownDelegate(Runnable delegate)
     Registers the delegate that is executed when the shutdown thread is activated.
final public  voidsetDeleteOnShutdown(boolean status)
     If the 'deleteOnShutdown' flag is set, the database will delete the database from the file system when it is shutdown.
final public  voidsetIsExecutingCommands(boolean status)
     Controls whether the database is allowed to execute commands or not.
public  voidsetUserLock(DatabaseQueryContext context, User user, boolean lock_status)
     Sets the lock status for the given user.
public  voidsetupSystemFunctions(DatabaseConnection connection, String admin_user)
     Sets all the standard functions and procedures available to engine. This creates an entry in the SYS_FUNCTION table for all the dynamic functions and procedures.
public  voidshutdown()
     Cleanly shuts down the database.
final public  voidstartShutDownThread()
     Starts the shutdown thread which should contain delegates that shut the database and all its resources down.
final public  Statsstats()
     Convenience static for accessing the global Stats object.
final public  StoreSystemstoreSystem()
     Returns the StoreSystem for this Database.
public  booleanuserBelongsToGroup(DatabaseQueryContext context, String username, String group)
     Returns true if the given user belongs to the given group otherwise returns false.
public  booleanuserExists(DatabaseQueryContext context, String username)
     Returns true if a user exists in this database, otherwise returns false.
final public  voidwaitUntilShutdown()
     Blocks until the database has shut down.

Field Detail
DEFAULT_SCHEMA
final public static String DEFAULT_SCHEMA(Code)
The name of the default schema.



INTERNAL_SECURE_USERNAME
final public static String INTERNAL_SECURE_USERNAME(Code)
The username of the internal secure user. The internal secure user is only used for internal highly privileged operations. This user is given full privs to everything and is used to manage the system tables, for authentication, etc.



JDBC_SCHEMA
final public static String JDBC_SCHEMA(Code)
The name of the schema that contains JDBC helper tables.



LOCK_GROUP
final public static String LOCK_GROUP(Code)
The name of the lock group. If a user belongs to this group the user account is locked and they are not allowed to log into the database.



NEW_TRIGGER_TABLE
final public static TableName NEW_TRIGGER_TABLE(Code)
The NEW table used inside a triggered procedure to represent a triggered row after the operation occurs.



OLD_TRIGGER_TABLE
final public static TableName OLD_TRIGGER_TABLE(Code)
The OLD table used inside a triggered procedure to represent a triggered row before the operation occurs.



SCHEMA_MANAGER_GROUP
final public static String SCHEMA_MANAGER_GROUP(Code)
The name of the schema manager group. Users that belong in this group can create and drop schema from the system.



SECURE_GROUP
final public static String SECURE_GROUP(Code)
THe name of the secure access group. If a user belongs to this group they are permitted to perform a number of priviledged operations such as shutting down the database, and adding and removing users.



SYSTEM_SCHEMA
final public static String SYSTEM_SCHEMA(Code)
The name of the system schema that contains tables refering to system information.



SYS_DATA_TRIGGER
final public static TableName SYS_DATA_TRIGGER(Code)
The system internally generated 'sUSRDataTrigger' table.



SYS_DB_STATISTICS
final public static TableName SYS_DB_STATISTICS(Code)
The system internally generated 'sUSRDatabaseStatistics' table.



SYS_FUNCTION
final public static TableName SYS_FUNCTION(Code)
The function table.



SYS_FUNCTIONFACTORY
final public static TableName SYS_FUNCTIONFACTORY(Code)
The function factory table.



SYS_GRANTS
final public static TableName SYS_GRANTS(Code)



SYS_LABEL
final public static TableName SYS_LABEL(Code)
The label table.



SYS_PASSWORD
final public static TableName SYS_PASSWORD(Code)
The password privs and grants table.



SYS_SERVICE
final public static TableName SYS_SERVICE(Code)
The services table.



SYS_TABLE_COLUMNS
final public static TableName SYS_TABLE_COLUMNS(Code)
The system internally generated 'sUSRTableColumns' table.



SYS_TABLE_INFO
final public static TableName SYS_TABLE_INFO(Code)
The system internally generated 'sUSRTableInfo' table.



SYS_USERCONNECT
final public static TableName SYS_USERCONNECT(Code)



SYS_USERPRIV
final public static TableName SYS_USERPRIV(Code)



SYS_VIEW
final public static TableName SYS_VIEW(Code)
The view table.



USER_MANAGER_GROUP
final public static String USER_MANAGER_GROUP(Code)
The name of the user manager group. Users that belong in this group can create, alter and drop users from the system.




Constructor Detail
Database
public Database(DatabaseSystem system, String name)(Code)
The Constructor. This takes a directory path in which the database is stored.




Method Detail
Debug
final public DebugLogger Debug()(Code)
Returns the DebugLogger implementation from the DatabaseSystem.



addUserToGroup
public void addUserToGroup(DatabaseQueryContext context, String username, String group) throws DatabaseException(Code)
Adds the user to the given group. This makes an entry in the sUSRUserPriv for this user and the given group. If the user already belongs to the group then no changes are made.

It is important that any security checks for ensuring the grantee is allowed to give the user these privs are preformed before this method is called.

NOTE: Assumes exclusive lock on DatabaseConnection.




alterUserPassword
public void alterUserPassword(DatabaseQueryContext context, String username, String password) throws DatabaseException(Code)
Alters the password of the user but otherwise does not change any information about the user.

NOTE: Assumes exclusive lock on DatabaseConnection.




authenticateUser
public User authenticateUser(String username, String password, String connection_string)(Code)
Tries to authenticate a username/password against this database. If we fail to authenticate then a 'null' object is returned, otherwise a valid User object is returned. If a valid object is returned, the user will be logged into the engine via the UserManager object (in DatabaseSystem). The developer must ensure that 'close' is called before the object is disposed (logs out of the system).

This method also returns null if a user exists but was denied access from the given host string. The given 'host_name' object is formatted in the database host connection encoding. This method checks all the values from the sUSRUserConnectPriv table for this user for the given protocol. It first checks if the user is specifically DENIED access from the given host. It then checks if the user is ALLOWED access from the given host. If a host is neither allowed or denied then it is denied.




canUserAlterTableObject
public boolean canUserAlterTableObject(DatabaseQueryContext context, User user, TableName table) throws DatabaseException(Code)
Returns true if the user can alter a table or view with the given name, otherwise returns false.



canUserCompactTableObject
public boolean canUserCompactTableObject(DatabaseQueryContext context, User user, TableName table) throws DatabaseException(Code)
Returns true if the user can compact a table with the given name, otherwise returns false.



canUserCreateAndDropSchema
public boolean canUserCreateAndDropSchema(DatabaseQueryContext context, User user, String schema) throws DatabaseException(Code)
Returns true if the user is permitted to create and drop schema's in the database, otherwise returns false. Only members of the 'secure access' group, or the 'schema manager' group can do this.



canUserCreateAndDropUsers
public boolean canUserCreateAndDropUsers(DatabaseQueryContext context, User user) throws DatabaseException(Code)
Returns true if the user is permitted to create, alter and drop user information from the database, otherwise returns false. Only members of the 'secure access' group, or the 'user manager' group can do this.



canUserCreateProcedureObject
public boolean canUserCreateProcedureObject(DatabaseQueryContext context, User user, TableName table) throws DatabaseException(Code)
Returns true if the user can create a procedure with the given name, otherwise returns false.



canUserCreateSequenceObject
public boolean canUserCreateSequenceObject(DatabaseQueryContext context, User user, TableName table) throws DatabaseException(Code)
Returns true if the user can create a sequence with the given name, otherwise returns false.



canUserCreateTableObject
public boolean canUserCreateTableObject(DatabaseQueryContext context, User user, TableName table) throws DatabaseException(Code)
Returns true if the user can create a table or view with the given name, otherwise returns false.



canUserDeleteFromTableObject
public boolean canUserDeleteFromTableObject(DatabaseQueryContext context, User user, TableName table) throws DatabaseException(Code)
Returns true if the user can delete from a table or view with the given name and given columns, otherwise returns false.



canUserDropProcedureObject
public boolean canUserDropProcedureObject(DatabaseQueryContext context, User user, TableName table) throws DatabaseException(Code)
Returns true if the user can drop a procedure with the given name, otherwise returns false.



canUserDropSequenceObject
public boolean canUserDropSequenceObject(DatabaseQueryContext context, User user, TableName table) throws DatabaseException(Code)
Returns true if the user can drop a sequence with the given name, otherwise returns false.



canUserDropTableObject
public boolean canUserDropTableObject(DatabaseQueryContext context, User user, TableName table) throws DatabaseException(Code)
Returns true if the user can drop a table or view with the given name, otherwise returns false.



canUserExecuteStoredProcedure
public boolean canUserExecuteStoredProcedure(DatabaseQueryContext context, User user, String procedure_name) throws DatabaseException(Code)
Returns true if the user is allowed to execute the given stored procedure.



canUserInsertIntoTableObject
public boolean canUserInsertIntoTableObject(DatabaseQueryContext context, User user, TableName table, Variable[] columns) throws DatabaseException(Code)
Returns true if the user can insert into a table or view with the given name and given columns, otherwise returns false.



canUserSelectFromTableObject
public boolean canUserSelectFromTableObject(DatabaseQueryContext context, User user, TableName table, Variable[] columns) throws DatabaseException(Code)
Returns true if the user can select from a table or view with the given name and given columns, otherwise returns false.



canUserShutDown
public boolean canUserShutDown(DatabaseQueryContext context, User user) throws DatabaseException(Code)
Returns true if the user can shut down the database server. A user can shut down the database if they are a member of the 'secure acces' group.



canUserUpdateTableObject
public boolean canUserUpdateTableObject(DatabaseQueryContext context, User user, TableName table, Variable[] columns) throws DatabaseException(Code)
Returns true if the user can update a table or view with the given name and given columns, otherwise returns false.



convertToCurrent
public boolean convertToCurrent(PrintStream out, String admin_username) throws IOException(Code)
Functionality for converting and old database format to the existing format. This would typically be called from a convert tool program.

Returns true if the convert was successful or false if it wasn't (error message is output to the PrintWriter).




create
public void create(String username, String password)(Code)
Creates and sets up a new database to an initial empty state. The creation process involves creating all the system tables and views, adding an administrator user account, creating schema, and setting up the initial grant information for the administrator user.

The 'username' and 'password' parameter given are set for the administrator account.




createEvent
final public Object createEvent(Runnable runner)(Code)
Creates an event for the database dispatcher.



createNewConnection
public DatabaseConnection createNewConnection(User user, DatabaseConnection.CallBack call_back)(Code)
Returns a new DatabaseConnection instance that is used against this database.

When a new connection is made on this database, this method is called to create a new DatabaseConnection instance for the connection. This connection handles all transactional queries and modifications to the database.




createSchemaInfoTables
void createSchemaInfoTables(DatabaseConnection connection) throws DatabaseException(Code)
Creates the schema information tables introducted in version 0.90. The schema information tables are;



createUser
public void createUser(DatabaseQueryContext context, String username, String password) throws DatabaseException(Code)
Creates and adds a new user to this database. The User object for the user is returned.

If the user is already defined by the database then an error is generated.

NOTE: Assumes exclusive lock on DatabaseConnection.




deleteAllUserGroups
public void deleteAllUserGroups(DatabaseQueryContext context, String username) throws DatabaseException(Code)
Deletes all the groups the user belongs to. This is intended for a user alter command for setting the groups a user belongs to.

NOTE: Assumes exclusive lock on DatabaseConnection.




deleteUser
public void deleteUser(DatabaseQueryContext context, String username) throws DatabaseException(Code)
Deletes the user from the system. This also deletes all information associated with a user such as the groups they belong to. It does not delete the privs a user has set up.

NOTE: Assumes exclusive lock on DatabaseConnection.




execute
final public void execute(User user, DatabaseConnection database, Runnable runner)(Code)
Executes database functions from the 'run' method of the given runnable instance on the first available worker thread. All database functions must go through a worker thread. If we ensure this, we can easily stop all database functions from executing if need be. Also, we only need to have a certain number of threads active at any one time rather than a unique thread for each connection.



exists
public boolean exists()(Code)
Returns true if the database exists. This must be called before 'init' and 'create'. It checks that the database files exist and we can boot into the database.



finalize
public void finalize() throws Throwable(Code)



getCommandsLog
public Log getCommandsLog()(Code)
Returns the log file where commands are recorded.



getConglomerate
TableDataConglomerate getConglomerate()(Code)
Returns the conglomerate for this database.



getDBProcedure
public DatabaseProcedure getDBProcedure(String procedure_name, DatabaseConnection connection) throws DatabaseException(Code)
Resolves a procedure name into a DBProcedure object. This is used for finding a server side script. It throws a DatabaseException if the procedure could not be resolved or there was an error retrieving it.

ISSUE: Move this to DatabaseSystem?




getDataCellCache
final public DataCellCache getDataCellCache()(Code)
Returns the system DataCellCache.



getName
public String getName()(Code)
Returns the name of this database.



getSingleRowTable
final public Table getSingleRowTable()(Code)
Returns a static table that has a single row but no columns. This table is useful for certain database operations.



getSystem
final public DatabaseSystem getSystem()(Code)
Returns the DatabaseSystem that this Database is from.



getTriggerManager
final public TriggerManager getTriggerManager()(Code)
Returns the system trigger manager.



getUserManager
final public UserManager getUserManager()(Code)
Returns the system user manager.



grantHostAccessToUser
public void grantHostAccessToUser(DatabaseQueryContext context, String user, String protocol, String host) throws DatabaseException(Code)
Grants the given user access to connect to the database from the given host address. The 'protocol' string is the connecting protocol which can be either 'TCP' or 'Local'. The 'host' string is the actual host that is connecting. For example, if the protocol was TCP then the client host may be '127.0.0.1' for localhost.



groupsUserBelongsTo
public String[] groupsUserBelongsTo(DatabaseQueryContext context, String username) throws DatabaseException(Code)
Returns the list of all user groups the user belongs to.



hasShutDown
final public boolean hasShutDown()(Code)
Returns true if the database has shut down.



init
public void init() throws DatabaseException(Code)
Initializes the database. This opens all the files that are required for the operation of the database. If it finds that the version of the data files are not a compatible version, this method throws an exception.

NOTE: Perhaps a better name for this method is 'open'.




isInitialized
public boolean isInitialized()(Code)
Returns true if the database is initialised.



isReadOnly
public boolean isReadOnly()(Code)
Returns true if this database is in read only mode.



liveCopyTo
public void liveCopyTo(File path) throws IOException(Code)
Copies all the persistent data in this database (the conglomerate) to the given destination path. This can copy information while the database is 'live'.



postEvent
final public void postEvent(int time, Object event)(Code)
Posts an event on the database dispatcher.



registerShutDownDelegate
final public void registerShutDownDelegate(Runnable delegate)(Code)
Registers the delegate that is executed when the shutdown thread is activated.



setDeleteOnShutdown
final public void setDeleteOnShutdown(boolean status)(Code)
If the 'deleteOnShutdown' flag is set, the database will delete the database from the file system when it is shutdown.

NOTE: Use with care - if this is set to true and the database is shutdown it will result in total loss of data.




setIsExecutingCommands
final public void setIsExecutingCommands(boolean status)(Code)
Controls whether the database is allowed to execute commands or not. If this is set to true, then calls to 'execute' will be executed as soon as there is a free worker thread available. Otherwise no commands are executed until this is enabled.



setUserLock
public void setUserLock(DatabaseQueryContext context, User user, boolean lock_status) throws DatabaseException(Code)
Sets the lock status for the given user. If a user account if locked, it is rejected from logging in to the database.

It is important that any security checks to determine if the process setting the user lock is allowed to do it is done before this method is called.

NOTE: Assumes exclusive lock on DatabaseConnection.




setupSystemFunctions
public void setupSystemFunctions(DatabaseConnection connection, String admin_user) throws DatabaseException(Code)
Sets all the standard functions and procedures available to engine. This creates an entry in the SYS_FUNCTION table for all the dynamic functions and procedures. This may not include the functions exposed though the FunctionFactory interface.



shutdown
public void shutdown() throws DatabaseException(Code)
Cleanly shuts down the database. It is important that this method is called just before the system closes down.

The main purpose of this method is to ensure any tables that are backed by files and in a 'safe' state and cleanly flushed to the file system.

If 'delete_on_shutdown' is true, the database will delete itself from the file system when it shuts down.




startShutDownThread
final public void startShutDownThread()(Code)
Starts the shutdown thread which should contain delegates that shut the database and all its resources down. This method returns immediately.



stats
final public Stats stats()(Code)
Convenience static for accessing the global Stats object. Perhaps this should be deprecated?



storeSystem
final public StoreSystem storeSystem()(Code)
Returns the StoreSystem for this Database.



userBelongsToGroup
public boolean userBelongsToGroup(DatabaseQueryContext context, String username, String group) throws DatabaseException(Code)
Returns true if the given user belongs to the given group otherwise returns false.

NOTE: Assumes exclusive lock on DatabaseConnection.




userExists
public boolean userExists(DatabaseQueryContext context, String username) throws DatabaseException(Code)
Returns true if a user exists in this database, otherwise returns false.

NOTE: Assumes exclusive lock on DatabaseConnection.




waitUntilShutdown
final public void waitUntilShutdown()(Code)
Blocks until the database has shut down.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.