|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.torque.map.DatabaseMap
public class DatabaseMap
DatabaseMap is used to model a database.
Field Summary | |
---|---|
protected static java.lang.String[] |
ERROR_MESSAGES_INIT
Error Messages for initialisation. |
static java.lang.String |
INIT_CLASS_NAME_FORMAT
Format used to create create the class name for initializing a DB specific map |
static char |
SCHEMA_SEPARATOR_CHAR
The character which separates the schema name from the table name. |
static char |
STD_SEPARATOR_CHAR
The character used by most implementations as the separator between name elements. |
Constructor Summary | |
---|---|
DatabaseMap()
Constructs a new DatabaseMap. |
|
DatabaseMap(java.lang.String name)
Deprecated. use DatabaseMap() instead. Will be removed in a future version of Torque. |
|
DatabaseMap(java.lang.String name,
int numberOfTables)
Deprecated. use DatabaseMap() instead. Will be removed in a future version of Torque. |
Method Summary | |
---|---|
void |
addIdGenerator(java.lang.String type,
IdGenerator idGen)
Deprecated. use DatabaseInfo.addGenerator() instead. Will be removed in a future version of Torque. |
void |
addTable(java.lang.String tableName)
Add a new table to the database by name. |
void |
addTable(java.lang.String tableName,
int numberOfColumns)
Add a new table to the database by name. |
void |
addTable(TableMap map)
Add a new TableMap to the database. |
boolean |
containsTable(java.lang.String name)
Does this database contain this specific table? |
boolean |
containsTable(TableMap table)
Does this database contain this specific table? |
IDBroker |
getIDBroker()
Deprecated. Will be removed in a future version of Torque. Use DatabaseInfo#getIdBroker() instead to access the IDBroker. |
IdGenerator |
getIdGenerator(java.lang.String type)
Deprecated. use DatabaseInfo.getIdGenerator() instead. Will be removed in a future version of Torque. |
TableMap |
getIdTable()
Get the ID table for this database. |
java.lang.String |
getName()
Deprecated. Will be removed in a future version of Torque. Use the name of the corresponding database instead. |
TableMap |
getTable(java.lang.String name)
Get a TableMap for the table by name. |
TableMap[] |
getTables()
Get a TableMap[] of all of the tables in the database. |
void |
initialize()
Fully populate this DatabaseMap with all the TablesMaps. |
protected java.lang.String |
javanameMethod(java.lang.String schemaName)
Converts a database schema name to java object name. |
void |
setIdTable(java.lang.String tableName)
Set the ID table for this database. |
void |
setIdTable(TableMap idTable)
Set the ID table for this database. |
boolean |
startIdBroker()
Deprecated. Will be removed in a future version of Torque. Use DatabaseInfo.startIdBroker() instead. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char STD_SEPARATOR_CHAR
public static final char SCHEMA_SEPARATOR_CHAR
public static final java.lang.String INIT_CLASS_NAME_FORMAT
protected static final java.lang.String[] ERROR_MESSAGES_INIT
Constructor Detail |
---|
public DatabaseMap()
public DatabaseMap(java.lang.String name, int numberOfTables)
name
- Name of the database.numberOfTables
- Number of tables in the database.public DatabaseMap(java.lang.String name)
name
- Name of the database.Method Detail |
---|
public boolean containsTable(TableMap table)
table
- The TableMap representation of the table.
public boolean containsTable(java.lang.String name)
name
- The String representation of the table.
public TableMap getIdTable()
public IDBroker getIDBroker()
public java.lang.String getName()
public TableMap getTable(java.lang.String name)
Note that by default Torque uses lazy initialization to minimize memory usage and startup time. However, if an OM or PEER class has not called the table's MapBuilder class, it will not be here. See the optional initialize method if you need full OM Mapping.
name
- Name of the table.
public TableMap[] getTables()
Note that by default Torque uses lazy initialization to minimize memory usage and startup time. However, if an OM or PEER class has not called the table's MapBuilder class, it will not be here. See the optional initialize method if you need full OM Mapping.
public void addTable(java.lang.String tableName)
tableName
- The name of the table.public void addTable(java.lang.String tableName, int numberOfColumns)
tableName
- The name of the table.numberOfColumns
- The number of columns in the table.public void addTable(TableMap map)
map
- The TableMap representation.public void setIdTable(TableMap idTable)
idTable
- The TableMap representation for the ID table.public void setIdTable(java.lang.String tableName)
tableName
- The name for the ID table.public void addIdGenerator(java.lang.String type, IdGenerator idGen)
type
- a String
valueidGen
- an IdGenerator
valuepublic IdGenerator getIdGenerator(java.lang.String type)
IDMethod
interface.
type
- a String
value
IdGenerator
valuepublic boolean startIdBroker()
public void initialize() throws TorqueException
DatabaseMap dbMap = Torque.getDatabaseMap( dbName );
try {
dbMap.initialize();
} catch ( TorqueException e ) {
... error handling
}
Note that Torque database names are case sensitive and this DB
map must be retrieved with the exact name used in the XML schema.
This uses Java reflection methods to locate and run the init() method of a class generated in the org.apache.torque.linkage package with a name based on the XML Database name value, e.g. org.apache.torque.linkage.DefaultMapInit
Some misconfiguration situations that could cause this method to fail are:
It was used with a Torque OM set of classes generated by V3.2 or older;
The class(es) in the org.apache.torque.linkage package were not included
with the other generated class files (e.g. the jar file creation process
only included com.* and not org.* files).
TorqueException
- If an error is encountered locating and calling
the init method.protected java.lang.String javanameMethod(java.lang.String schemaName)
schemaName
- name to be converted.
org.apache.torque.engine.database.model.NameGenerator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |