|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> [ db overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.impl.db
Class BasicDatabase

java.lang.Objectorg.apache.derby.impl.db.BasicDatabase
- All Implemented Interfaces:
- org.apache.derby.database.Database, org.apache.derby.iapi.db.Database, org.apache.derby.iapi.services.loader.JarReader, org.apache.derby.iapi.services.i18n.LocaleFinder, org.apache.derby.iapi.services.monitor.ModuleControl, org.apache.derby.iapi.services.monitor.ModuleSupportable, org.apache.derby.iapi.services.property.PropertySetCallback
- public class BasicDatabase
- extends java.lang.Object
- implements org.apache.derby.iapi.services.monitor.ModuleControl, org.apache.derby.iapi.services.monitor.ModuleSupportable, org.apache.derby.iapi.services.property.PropertySetCallback, org.apache.derby.iapi.db.Database, org.apache.derby.iapi.services.loader.JarReader
- extends java.lang.Object
The Database interface provides control over the physical database (that is, the stored data and the files the data are stored in), connections to the database, operations on the database such as backup and recovery, and all other things that are associated with the database itself.
The Database interface does not provide control over things that are part of the Domain, such as users.
I'm not sure what this will hold in a real system, for now it simply provides connection-creation for us. Perhaps when it boots, it creates the datadictionary object for the database, which all users will then interact with?
| Field Summary | |
private boolean |
active
|
protected org.apache.derby.iapi.store.access.AccessFactory |
af
|
protected java.util.Properties |
allParams
|
private org.apache.derby.iapi.jdbc.AuthenticationService |
authenticationService
|
protected org.apache.derby.iapi.services.loader.ClassFactory |
cfDB
|
private java.util.Locale |
databaseLocale
|
private java.text.DateFormat |
dateFormat
|
protected boolean |
lastToBoot
|
protected org.apache.derby.iapi.sql.conn.LanguageConnectionFactory |
lcf
|
protected org.apache.derby.iapi.sql.LanguageFactory |
lf
|
private org.apache.derby.catalog.UUID |
myUUID
|
private boolean |
normalizeToUpper
|
protected org.apache.derby.iapi.services.property.PropertyFactory |
pf
|
protected java.lang.Object |
resourceAdapter
|
private java.text.RuleBasedCollator |
ruleBasedCollator
|
private int |
spaceInt
|
private boolean |
spaceIntSet
|
private java.text.DateFormat |
timeFormat
|
private java.text.DateFormat |
timestampFormat
|
| Constructor Summary | |
BasicDatabase()
|
|
| Method Summary | |
org.apache.derby.iapi.services.daemon.Serviceable |
apply(java.lang.String key,
java.io.Serializable value,
java.util.Dictionary p)
Apply a property change. |
void |
backup(java.io.File backupDir)
Backup the database to a backup directory. |
void |
backup(java.lang.String backupDir)
Backup the database to a backup directory. |
void |
backupAndEnableLogArchiveMode(java.io.File backupDir,
boolean deleteOnlineArchivedLogFiles)
Backup the database to a backup directory and enable the log archive mode that will keep the archived log files required for roll-forward from this version backup. |
void |
backupAndEnableLogArchiveMode(java.lang.String backupDir,
boolean deleteOnlineArchivedLogFiles)
Backup the database to a backup directory and enable the log archive mode that will keep the archived log files required for roll-forward from this version backup. |
void |
boot(boolean create,
java.util.Properties startParams)
Boot this module with the given properties. |
protected org.apache.derby.iapi.jdbc.AuthenticationService |
bootAuthenticationService(boolean create,
java.util.Properties props)
|
protected void |
bootClassFactory(boolean create,
java.util.Properties startParams)
|
protected void |
bootResourceAdapter(boolean create,
java.util.Properties startParams)
|
protected void |
bootStore(boolean create,
java.util.Properties startParams)
|
protected void |
bootValidation(boolean create,
java.util.Properties startParams)
|
boolean |
canSupport(java.util.Properties startParams)
See if this implementation can support any attributes that are listed in properties. |
void |
checkpoint()
Checkpoints the database, that is, flushes all dirty data to disk. |
protected void |
createFinished()
|
void |
disableLogArchiveMode(boolean deleteOnlineArchivedLogFiles)
Disables the log archival process, i.e No old log files will be kept around for a roll-forward recovery. |
void |
dropAllJDBCMetaDataSPSes()
Drop all Stored Prepared Statements that have been created for JDBC MetaData queries. |
void |
freeze()
Freeze the database temporarily so a backup can be taken. |
protected java.util.Properties |
getAllDatabaseProperties()
|
org.apache.derby.iapi.jdbc.AuthenticationService |
getAuthenticationService()
This method returns the authentication service handle for the database. |
protected java.lang.String |
getClasspath(java.util.Properties startParams)
|
java.text.RuleBasedCollator |
getCollator()
Get a RuleBasedCollator corresponding to the Locale returned by getCurrentLocale(). |
protected org.apache.derby.iapi.store.access.TransactionController |
getConnectionTransaction(org.apache.derby.iapi.services.context.ContextManager cm)
|
java.util.Locale |
getCurrentLocale()
|
java.text.DateFormat |
getDateFormat()
Get a formatter for formatting dates. |
int |
getEngineType()
|
org.apache.derby.catalog.UUID |
getId()
Return the UUID of this database. |
java.util.Locale |
getLocale()
Get the Locale for this database. |
java.lang.Object |
getResourceAdapter()
Get a Resource Adapter - only used by XA system. |
java.text.DateFormat |
getTimeFormat()
Get a formatter for formatting times. |
java.text.DateFormat |
getTimestampFormat()
Get a formatter for formatting timestamps. |
void |
init(boolean dbOnly,
java.util.Dictionary p)
Initialize the properties for this callback. |
boolean |
isActive()
Is the database active (open). |
boolean |
isReadOnly()
Tells whether the Database is configured as read-only, or the Database was started in read-only mode. |
protected org.apache.derby.catalog.UUID |
makeDatabaseID(boolean create,
java.util.Properties startParams)
|
java.io.Serializable |
map(java.lang.String key,
java.io.Serializable value,
java.util.Dictionary p)
Map a proposed new value for a property to an official value. |
private static org.apache.derby.iapi.error.StandardException |
noLocale()
|
protected void |
pushClassFactoryContext(org.apache.derby.iapi.services.context.ContextManager cm,
org.apache.derby.iapi.services.loader.ClassFactory cf)
|
void |
pushDbContext(org.apache.derby.iapi.services.context.ContextManager cm)
Push a DbContext onto the provided context stack. |
java.lang.Object |
readJarFile(java.lang.String schemaName,
java.lang.String sqlName)
Load the contents of a Jarfile. |
void |
setLocale(java.util.Locale locale)
Set the Locale that is returned by this LocaleFinder |
org.apache.derby.iapi.sql.conn.LanguageConnectionContext |
setupConnection(org.apache.derby.iapi.services.context.ContextManager cm,
java.lang.String user,
java.lang.String drdaID,
java.lang.String dbname)
Sets up a connection to the Database, owned by the given user. |
void |
stop()
Stop the module. |
void |
unfreeze()
Unfreeze the database after a backup has been taken. |
boolean |
validate(java.lang.String key,
java.io.Serializable value,
java.util.Dictionary p)
Validate a property change. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
active
private boolean active
authenticationService
private org.apache.derby.iapi.jdbc.AuthenticationService authenticationService
af
protected org.apache.derby.iapi.store.access.AccessFactory af
pf
protected org.apache.derby.iapi.services.property.PropertyFactory pf
cfDB
protected org.apache.derby.iapi.services.loader.ClassFactory cfDB
lcf
protected org.apache.derby.iapi.sql.conn.LanguageConnectionFactory lcf
lf
protected org.apache.derby.iapi.sql.LanguageFactory lf
resourceAdapter
protected java.lang.Object resourceAdapter
databaseLocale
private java.util.Locale databaseLocale
ruleBasedCollator
private java.text.RuleBasedCollator ruleBasedCollator
spaceInt
private int spaceInt
spaceIntSet
private boolean spaceIntSet
dateFormat
private java.text.DateFormat dateFormat
timeFormat
private java.text.DateFormat timeFormat
timestampFormat
private java.text.DateFormat timestampFormat
myUUID
private org.apache.derby.catalog.UUID myUUID
normalizeToUpper
private boolean normalizeToUpper
lastToBoot
protected boolean lastToBoot
allParams
protected java.util.Properties allParams
| Constructor Detail |
BasicDatabase
public BasicDatabase()
| Method Detail |
canSupport
public boolean canSupport(java.util.Properties startParams)
- Description copied from interface:
org.apache.derby.iapi.services.monitor.ModuleSupportable - See if this implementation can support any attributes that are listed in properties.
This call may be made on a newly created instance before the
boot() method has been called, or after the boot method has
been called for a running module.
The module can check for attributes in the properties to see if it can fulfill the required behaviour. E.g. the raw store may define an attribute called RawStore.Recoverable. If a temporary raw store is required the property RawStore.recoverable=false would be added to the properties before calling bootServiceModule. If a raw store cannot support this attribute its canSupport method would return null. Also see the Monitor class's prologue to see how the identifier is used in looking up properties.
Actually a better way maybe to have properties of the form RawStore.Attributes.mandatory=recoverable,smallfootprint and RawStore.Attributes.requested=oltp,fast- Specified by:
canSupportin interfaceorg.apache.derby.iapi.services.monitor.ModuleSupportable
boot
public void boot(boolean create,
java.util.Properties startParams)
throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.services.monitor.ModuleControl - Boot this module with the given properties. Creates a module instance
that can be found using the findModule() methods of Monitor.
The module can only be found using one of these findModule() methods
once this method has returned.
An implementation's boot method can throw StandardException. If it is thrown the module is not registered by the monitor and therefore cannot be found through a findModule(). In this case the module's stop() method is not called, thus throwing this exception must free up any resources.
When create is true the contents of the properties object will be written to the service.properties of the persistent service. Thus any code that requires an entry in service.properties must explicitly place the value in this properties set using the put method.
Typically the properties object contains one or more default properties sets, which are not written out to service.properties. These default sets are how callers modify the create process. In a JDBC connection database create the first set of defaults is a properties object that contains the attributes that were set on the jdbc:derby: URL. This attributes properties set has the second default properties set as its default. This set (which could be null) contains the properties that the user set on their DriverManager.getConnection() call, and are thus not owned by cloudscape code, and thus must not be modified by cloudscape code.When create is false the properties object contains all the properties set in the service.properties file plus a limited number of attributes from the JDBC URL attributes or connection properties set. This avoids properties set by the user compromising the boot process. An example of a property passed in from the JDBC world is the bootPassword for encrypted databases.
Code should not hold onto the passed in properties reference after boot time as its contents may change underneath it. At least after the complete boot is completed, the links to all the default sets will be removed.
- Specified by:
bootin interfaceorg.apache.derby.iapi.services.monitor.ModuleControl
stop
public void stop()
- Description copied from interface:
org.apache.derby.iapi.services.monitor.ModuleControl - Stop the module.
The module may be found via a findModule() method until some time after
this method returns. Therefore the factory must be prepared to reject requests
to it once it has been stopped. In addition other modules may cache a reference
to the module and make requests of it after it has been stopped, these requests
should be rejected as well.
- Specified by:
stopin interfaceorg.apache.derby.iapi.services.monitor.ModuleControl
getEngineType
public int getEngineType()
- Specified by:
getEngineTypein interfaceorg.apache.derby.iapi.db.Database
isReadOnly
public boolean isReadOnly()
- Description copied from interface:
org.apache.derby.database.Database - Tells whether the Database is configured as read-only, or the
Database was started in read-only mode.
- Specified by:
isReadOnlyin interfaceorg.apache.derby.database.Database
setupConnection
public org.apache.derby.iapi.sql.conn.LanguageConnectionContext setupConnection(org.apache.derby.iapi.services.context.ContextManager cm, java.lang.String user, java.lang.String drdaID, java.lang.String dbname) throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.db.Database - Sets up a connection to the Database, owned by the given user.
The JDBC version of getConnection takes a URL. The purpose
of the URL is to tell the driver where the database system is.
By the time we get here, we have found the database system
(that's how we're making this method call), so the URL is not
necessary to establish the connection here. The driver should
remember the URL that was used to establish the connection,
so it can implement the DatabaseMetaData.getURL() method.
- Specified by:
setupConnectionin interfaceorg.apache.derby.iapi.db.Database
pushDbContext
public void pushDbContext(org.apache.derby.iapi.services.context.ContextManager cm)
- Description copied from interface:
org.apache.derby.iapi.db.Database - Push a DbContext onto the provided context stack. This conext will
shut down the database in case of a DatabaseException being
cleaned up.
- Specified by:
pushDbContextin interfaceorg.apache.derby.iapi.db.Database
getAuthenticationService
public final org.apache.derby.iapi.jdbc.AuthenticationService getAuthenticationService()
- Description copied from interface:
org.apache.derby.iapi.db.Database - This method returns the authentication service handle for the
database.
NOTE: There is always a Authentication Service per database
and at the system level.
- Specified by:
getAuthenticationServicein interfaceorg.apache.derby.iapi.db.Database
freeze
public void freeze()
throws java.sql.SQLException
- Description copied from interface:
org.apache.derby.database.Database - Freeze the database temporarily so a backup can be taken.
Please see Cloudscape on line documentation on backup and restore.
- Specified by:
freezein interfaceorg.apache.derby.database.Database
unfreeze
public void unfreeze()
throws java.sql.SQLException
- Description copied from interface:
org.apache.derby.database.Database - Unfreeze the database after a backup has been taken.
Please see Cloudscape on line documentation on backup and restore.
- Specified by:
unfreezein interfaceorg.apache.derby.database.Database
backup
public void backup(java.lang.String backupDir) throws java.sql.SQLException
- Description copied from interface:
org.apache.derby.database.Database - Backup the database to a backup directory. See on line documentation
for more detail about how to use this feature.
- Specified by:
backupin interfaceorg.apache.derby.database.Database
backup
public void backup(java.io.File backupDir) throws java.sql.SQLException
- Description copied from interface:
org.apache.derby.database.Database - Backup the database to a backup directory. See on line documentation
for more detail about how to use this feature.
- Specified by:
backupin interfaceorg.apache.derby.database.Database
backupAndEnableLogArchiveMode
public void backupAndEnableLogArchiveMode(java.lang.String backupDir, boolean deleteOnlineArchivedLogFiles) throws java.sql.SQLException
- Description copied from interface:
org.apache.derby.database.Database - Backup the database to a backup directory and enable the log archive
mode that will keep the archived log files required for roll-forward
from this version backup.
- Specified by:
backupAndEnableLogArchiveModein interfaceorg.apache.derby.database.Database
backupAndEnableLogArchiveMode
public void backupAndEnableLogArchiveMode(java.io.File backupDir, boolean deleteOnlineArchivedLogFiles) throws java.sql.SQLException
- Description copied from interface:
org.apache.derby.database.Database - Backup the database to a backup directory and enable the log archive
mode that will keep the archived log files required for roll-forward
from this version backup.
- Specified by:
backupAndEnableLogArchiveModein interfaceorg.apache.derby.database.Database
disableLogArchiveMode
public void disableLogArchiveMode(boolean deleteOnlineArchivedLogFiles)
throws java.sql.SQLException
- Description copied from interface:
org.apache.derby.database.Database - Disables the log archival process, i.e No old log files
will be kept around for a roll-forward recovery. Only restore that can
be performed after disabling log archive mode is version recovery.
- Specified by:
disableLogArchiveModein interfaceorg.apache.derby.database.Database
checkpoint
public void checkpoint()
throws java.sql.SQLException
- Description copied from interface:
org.apache.derby.database.Database - Checkpoints the database, that is, flushes all dirty data to disk.
Records a checkpoint in the transaction log, if there is a log.
- Specified by:
checkpointin interfaceorg.apache.derby.database.Database
getLocale
public java.util.Locale getLocale()
- Description copied from interface:
org.apache.derby.database.Database - Get the Locale for this database.
- Specified by:
getLocalein interfaceorg.apache.derby.database.Database
getId
public final org.apache.derby.catalog.UUID getId()
- Return the UUID of this database.
- Specified by:
getIdin interfaceorg.apache.derby.database.Database
getCurrentLocale
public java.util.Locale getCurrentLocale() throws org.apache.derby.iapi.error.StandardException
- Specified by:
getCurrentLocalein interfaceorg.apache.derby.iapi.services.i18n.LocaleFinder
getCollator
public java.text.RuleBasedCollator getCollator() throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.services.i18n.LocaleFinder - Get a RuleBasedCollator corresponding to the Locale returned by
getCurrentLocale().
- Specified by:
getCollatorin interfaceorg.apache.derby.iapi.services.i18n.LocaleFinder
getDateFormat
public java.text.DateFormat getDateFormat() throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.services.i18n.LocaleFinder - Get a formatter for formatting dates. The implementation may cache this
value, since it never changes for a given Locale.
- Specified by:
getDateFormatin interfaceorg.apache.derby.iapi.services.i18n.LocaleFinder
getTimeFormat
public java.text.DateFormat getTimeFormat() throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.services.i18n.LocaleFinder - Get a formatter for formatting times. The implementation may cache this
value, since it never changes for a given Locale.
- Specified by:
getTimeFormatin interfaceorg.apache.derby.iapi.services.i18n.LocaleFinder
getTimestampFormat
public java.text.DateFormat getTimestampFormat() throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.services.i18n.LocaleFinder - Get a formatter for formatting timestamps. The implementation may cache
this value, since it never changes for a given Locale.
- Specified by:
getTimestampFormatin interfaceorg.apache.derby.iapi.services.i18n.LocaleFinder
noLocale
private static org.apache.derby.iapi.error.StandardException noLocale()
setLocale
public void setLocale(java.util.Locale locale)
- Description copied from interface:
org.apache.derby.iapi.db.Database - Set the Locale that is returned by this LocaleFinder
- Specified by:
setLocalein interfaceorg.apache.derby.iapi.db.Database
isActive
public boolean isActive()
- Is the database active (open).
- Specified by:
isActivein interfaceorg.apache.derby.iapi.db.Database
makeDatabaseID
protected org.apache.derby.catalog.UUID makeDatabaseID(boolean create, java.util.Properties startParams) throws org.apache.derby.iapi.error.StandardException
dropAllJDBCMetaDataSPSes
public void dropAllJDBCMetaDataSPSes()
throws java.sql.SQLException
- Drop all Stored Prepared Statements that
have been created for JDBC MetaData queries.
Does NOT commit the current transaction
upon completation.
- Specified by:
dropAllJDBCMetaDataSPSesin interfaceorg.apache.derby.database.Database
getResourceAdapter
public java.lang.Object getResourceAdapter()
- Description copied from interface:
org.apache.derby.iapi.db.Database - Get a Resource Adapter - only used by XA system. There is one and only
one resource adapter per cloudscape database.
- Specified by:
getResourceAdapterin interfaceorg.apache.derby.iapi.db.Database
init
public void init(boolean dbOnly,
java.util.Dictionary p)
- Description copied from interface:
org.apache.derby.iapi.services.property.PropertySetCallback - Initialize the properties for this callback.
Called when addPropertySetNotification() is called
with a non-null transaction controller.
This allows code to set read its initial property
values at boot time.
Code within an init() method should use the 3 argument PropertyUtil method getPropertyFromSet() to obtain a property's value.
- Specified by:
initin interfaceorg.apache.derby.iapi.services.property.PropertySetCallback
validate
public boolean validate(java.lang.String key, java.io.Serializable value, java.util.Dictionary p) throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.services.property.PropertySetCallback - Validate a property change.
- Specified by:
validatein interfaceorg.apache.derby.iapi.services.property.PropertySetCallback
apply
public org.apache.derby.iapi.services.daemon.Serviceable apply(java.lang.String key, java.io.Serializable value, java.util.Dictionary p) throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.services.property.PropertySetCallback - Apply a property change. Will only be called after validate has been called
and only if validate returned true. If this method is called then the
new value is the value to be used, ie. the property is not set in the
overriding JVM system set.
- Specified by:
applyin interfaceorg.apache.derby.iapi.services.property.PropertySetCallback
map
public java.io.Serializable map(java.lang.String key, java.io.Serializable value, java.util.Dictionary p)
- Description copied from interface:
org.apache.derby.iapi.services.property.PropertySetCallback - Map a proposed new value for a property to an official value.
Will only be called after apply() has been called.
- Specified by:
mapin interfaceorg.apache.derby.iapi.services.property.PropertySetCallback
createFinished
protected void createFinished()
throws org.apache.derby.iapi.error.StandardException
getClasspath
protected java.lang.String getClasspath(java.util.Properties startParams)
bootClassFactory
protected void bootClassFactory(boolean create,
java.util.Properties startParams)
throws org.apache.derby.iapi.error.StandardException
getConnectionTransaction
protected org.apache.derby.iapi.store.access.TransactionController getConnectionTransaction(org.apache.derby.iapi.services.context.ContextManager cm) throws org.apache.derby.iapi.error.StandardException
bootAuthenticationService
protected org.apache.derby.iapi.jdbc.AuthenticationService bootAuthenticationService(boolean create, java.util.Properties props) throws org.apache.derby.iapi.error.StandardException
bootValidation
protected void bootValidation(boolean create,
java.util.Properties startParams)
throws org.apache.derby.iapi.error.StandardException
bootStore
protected void bootStore(boolean create,
java.util.Properties startParams)
throws org.apache.derby.iapi.error.StandardException
getAllDatabaseProperties
protected java.util.Properties getAllDatabaseProperties() throws org.apache.derby.iapi.error.StandardException
bootResourceAdapter
protected void bootResourceAdapter(boolean create,
java.util.Properties startParams)
pushClassFactoryContext
protected void pushClassFactoryContext(org.apache.derby.iapi.services.context.ContextManager cm, org.apache.derby.iapi.services.loader.ClassFactory cf)
readJarFile
public java.lang.Object readJarFile(java.lang.String schemaName, java.lang.String sqlName) throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.services.loader.JarReader - Load the contents of a Jarfile. The return is either
an java.io.InputStream representing the contents of the JarFile
or a java.io.File representing the location of the file.
If the jar does not exist an exception is thrown.
- Specified by:
readJarFilein interfaceorg.apache.derby.iapi.services.loader.JarReader
|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> [ db overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.derby.impl.db.BasicDatabase