|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.makumba.db.makumba.Database
public abstract class Database
A generic Makumba database (used by the MakumbaTransactionProvider
, that maps RecordInfos to tables. It also
takes care of creating and maintaining the schema. FIXME methods in here should get some documentation
Field Summary | |
---|---|
(package private) Properties |
config
|
(package private) String |
dataSourceName
the name of the configured dataSource |
(package private) int |
initConnections
|
(package private) int |
nconn
|
protected NameResolver |
nr
|
(package private) NamedResources |
queries
|
protected static boolean |
requestForeignKeys
|
protected static boolean |
requestUTF8
|
(package private) Class<?> |
tableclass
|
(package private) NamedResourceFactory |
tableFactory
|
(package private) NamedResources |
tables
|
protected TransactionProvider |
tp
|
(package private) NamedResources |
updates
|
Constructor Summary | |
---|---|
protected |
Database(Properties config)
|
Method Summary | |
---|---|
(package private) void |
addTable(String s)
|
void |
checkForeignKeys(String table)
|
void |
close()
|
protected abstract void |
closeResourcePool()
|
(package private) void |
configureTable(Table tbl,
DataDefinition ri)
|
void |
copyFrom(DBConnection c,
String[] tables,
DBConnection sourceDB,
boolean ignoreDbsv)
|
void |
copyFrom(DBConnection c,
String table,
DBConnection sourceDB,
boolean ignoreDbsv)
|
void |
copyFrom(String source,
boolean ignoreDbsv)
|
void |
copyFrom(String source,
String[] tables,
boolean ignoreDbsv)
|
void |
copyFrom(String sourceDB,
String table,
boolean ignoreDbsv)
|
void |
deleteFrom(DBConnection c,
String[] tables,
DBConnection sourceDB,
boolean ignoreDbsv)
|
void |
deleteFrom(DBConnection c,
String table,
DBConnection sourceDB,
boolean ignoreDbsv)
|
void |
deleteFrom(String source,
String[] tables,
boolean ignoreDbsv)
|
void |
deleteFrom(String sourceDB,
String table,
boolean ignoreDbsv)
|
protected void |
finalize()
|
static String |
findConfig(Properties cnf,
String pattern)
finds the longest configuration string that matches the pattern and returns the associated property |
String |
getConfiguration(String v)
|
Properties |
getConfigurationProperties()
|
DBConnection |
getDBConnection()
|
DBConnection |
getDBConnection(String dataSource)
|
int |
getDbsv()
return the unique index of this database |
abstract Map<String,String> |
getDuplicateFields(SQLException e)
|
String |
getFieldNameInSource(DataDefinition dd,
String field)
|
protected abstract int |
getIdleConnections()
|
abstract int |
getMaxPointerValue()
|
abstract int |
getMinPointerValue()
|
String |
getName()
|
NameResolver |
getNameResolver()
|
protected abstract int |
getOpenedConnections()
|
abstract Pointer |
getPointer(String type,
int uid)
|
protected abstract DBConnection |
getPooledDBConnection()
|
protected abstract int |
getResourcePoolSize()
|
Table |
getTable(DataDefinition ri)
get the table from this database associated with the given RecordInfo |
Table |
getTable(String name)
this method will return a table by macumba name. |
protected Class<?> |
getTableClassConfigured()
this method should be redefined by database classes that have a default table class. this returns null |
String |
getTypeNameInSource(DataDefinition dd)
|
void |
initialiseTables(String name)
|
boolean |
isAutoIncrement()
|
abstract boolean |
isDuplicateException(SQLException e)
|
protected abstract DBConnection |
makeDBConnection()
|
Table |
makePseudoTable(DataDefinition ri)
|
void |
openTable(String table)
|
void |
openTables(String[] _tables)
|
abstract String |
OQLDate(Date d)
write a date constant in OQL |
abstract Query |
prepareQueryImpl(String query,
String insertIn)
|
abstract Update |
prepareUpdateImpl(String type,
String set,
String where)
|
protected static boolean |
supportsForeignKeys()
|
boolean |
usesHibernateIndexes()
If this is true, i.e. hibernate is used, makumba will not take care of creating indexes itself FIXME this should somehow be more separated, e.g. through some schema configuration mechanism |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected TransactionProvider tp
NamedResources queries
NamedResources updates
int nconn
int initConnections
protected static boolean requestUTF8
protected static boolean requestForeignKeys
Properties config
Class<?> tableclass
String dataSourceName
protected NameResolver nr
NamedResources tables
NamedResourceFactory tableFactory
Constructor Detail |
---|
protected Database(Properties config)
Method Detail |
---|
public String getName()
protected static boolean supportsForeignKeys()
protected abstract void closeResourcePool()
protected abstract int getResourcePoolSize()
protected abstract int getOpenedConnections()
protected abstract int getIdleConnections()
protected abstract DBConnection getPooledDBConnection()
public void close()
public DBConnection getDBConnection(String dataSource)
public DBConnection getDBConnection()
protected abstract DBConnection makeDBConnection()
public abstract boolean isDuplicateException(SQLException e)
public abstract Map<String,String> getDuplicateFields(SQLException e)
public int getDbsv()
public boolean isAutoIncrement()
public abstract Pointer getPointer(String type, int uid)
public String getConfiguration(String v)
protected Class<?> getTableClassConfigured()
public abstract String OQLDate(Date d)
public Table getTable(String name)
public Table getTable(DataDefinition ri)
public static String findConfig(Properties cnf, String pattern)
public abstract Query prepareQueryImpl(String query, String insertIn)
public abstract Update prepareUpdateImpl(String type, String set, String where)
public abstract int getMinPointerValue()
public abstract int getMaxPointerValue()
public void deleteFrom(DBConnection c, String table, DBConnection sourceDB, boolean ignoreDbsv)
public void deleteFrom(String sourceDB, String table, boolean ignoreDbsv)
public void deleteFrom(String source, String[] tables, boolean ignoreDbsv)
public void deleteFrom(DBConnection c, String[] tables, DBConnection sourceDB, boolean ignoreDbsv)
public void copyFrom(String sourceDB, String table, boolean ignoreDbsv)
public void copyFrom(String source, String[] tables, boolean ignoreDbsv)
public void copyFrom(DBConnection c, String[] tables, DBConnection sourceDB, boolean ignoreDbsv)
public void copyFrom(DBConnection c, String table, DBConnection sourceDB, boolean ignoreDbsv)
public void copyFrom(String source, boolean ignoreDbsv)
public void openTables(String[] _tables)
public void openTable(String table)
public void checkForeignKeys(String table)
protected void finalize() throws Throwable
finalize
in class Object
Throwable
void addTable(String s)
public Table makePseudoTable(DataDefinition ri)
void configureTable(Table tbl, DataDefinition ri)
public boolean usesHibernateIndexes()
public String getTypeNameInSource(DataDefinition dd)
public String getFieldNameInSource(DataDefinition dd, String field)
public Properties getConfigurationProperties()
public NameResolver getNameResolver()
public void initialiseTables(String name)
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |