Package org.apache.torque
Klasse Database
java.lang.Object
org.apache.torque.Database
Bundles all information about a database. This includes the database adapter,
the database Map and the Data Source Factory.
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
addIdGenerator
(IDMethod type, IdGenerator idGen) Adds an IdGenerator to the database.boolean
Creates the IDBroker for this Database and registers it with Torque.Returns the adapter to this database.Returns the database map for this database.Returns the DataSourceFactory for this database.Get the IDBroker for this database.getIdGenerator
(IDMethod type) Returns the IdGenerator of the given type for this Database.Get the ID table for this database.getName()
Rturns the name of the database.Returns the database schema for this Database.void
setAdapter
(Adapter anAdapter) Sets the adapter for this database.void
setDataSourceFactory
(DataSourceFactory aDataSourceFactory) Sets the DataSourceFactory for this database.void
setIdTable
(String tableName) Set the ID table for this database.void
setIdTable
(TableMap idTable) Set the ID table for this database.void
Sets the schema for this database.
-
Methodendetails
-
getName
Rturns the name of the database.- Gibt zurück:
- the name of the database, not null.
-
getAdapter
Returns the adapter to this database.- Gibt zurück:
- the adapter to this database, or null if no adapter is set.
-
setAdapter
Sets the adapter for this database.- Parameter:
anAdapter
- The adapter for this database, or null to remove the current adapter from this database.
-
getDatabaseMap
Returns the database map for this database.- Gibt zurück:
- the DatabaseMap for this database, or null if no DatabaseMap exists for this database.
-
getDataSourceFactory
Returns the DataSourceFactory for this database. The DataSourceFactory is responsible to create connections to this database.- Gibt zurück:
- the DataSourceFactory for this database, or null if no DataSourceFactory exists for this database.
-
setDataSourceFactory
Sets the DataSourceFactory for this database. The DataSourceFactory is responsible to create connections to this database.- Parameter:
aDataSourceFactory
- The new DataSorceFactory for this database, or null to remove the current DataSourceFactory.
-
getIdTable
Get the ID table for this database.- Gibt zurück:
- A TableMap, or null if not yet initialized or no id table exists for this database.
-
setIdTable
Set the ID table for this database.- Parameter:
idTable
- The TableMap representation for the ID table.
-
setIdTable
Set the ID table for this database.- Parameter:
tableName
- The name for the ID table.
-
getIdBroker
Get the IDBroker for this database.- Gibt zurück:
- The IDBroker for this database, or null if no IdBroker has been started for this database.
-
createAndRegisterIdBroker
public boolean createAndRegisterIdBroker()Creates the IDBroker for this Database and registers it with Torque. so it is either started instantly if Torque is already initialized or it is started when Torque is initialized. The information about the IdTable is stored in the databaseMap. If an IDBroker already exists for this Database, the method does nothing.- Gibt zurück:
- true if a new IDBroker was created, false otherwise.
-
getIdGenerator
Returns the IdGenerator of the given type for this Database.- Parameter:
type
- The type (i.e.name) of the IdGenerator.- Gibt zurück:
- The IdGenerator of the requested type, or null if no IdGenerator exists for the requested type.
-
addIdGenerator
Adds an IdGenerator to the database.- Parameter:
type
- The type of the IdGenerator.idGen
- The new IdGenerator for the type, or null to remove the IdGenerator of the given type.
-
getSchema
Returns the database schema for this Database.- Gibt zurück:
- the database schema for this database, or null if no schema has been set.
-
setSchema
Sets the schema for this database.- Parameter:
schema
- the name of the database schema to set, or null to remove the current schema.
-