org.makumba.db.makumba
Class MakumbaTransactionProvider

java.lang.Object
  extended by org.makumba.providers.TransactionProvider
      extended by org.makumba.db.makumba.MakumbaTransactionProvider
All Implemented Interfaces:
SingletonHolder

public class MakumbaTransactionProvider
extends TransactionProvider

Makumba-specific implementation of the TransactionProvider.

Version:
$Id: MakumbaTransactionProvider.java,v 1.1 21.11.2007 17:06:25 Manuel Exp $
Author:
Manuel Gay

Field Summary
static String CONNECTION_DATABASE
           
static String CONNECTION_ENGINE
           
static String CONNECTION_HOST
           
static String CONNECTION_PORT
           
static String DATABASE_CLASS
           
(package private) static int dbs
           
static String TABLE_CLASS
           
(package private) static Class<?>[] theProp
           
 
Fields inherited from class org.makumba.providers.TransactionProvider
CONNECTION_PASSWORD, CONNECTION_PREFIX, CONNECTION_URL, CONNECTION_USERNAME
 
Method Summary
 void _copy(String sourceDB, String destinationDB, String[] typeNames, boolean ignoreDbsv)
           
 void _delete(String whereDB, String provenienceDB, String[] typeNames, boolean ignoreDbsv)
           
 void closeDataSource(String dataSourceName)
           
 Transaction getConnectionTo(String name)
          Opens a Transaction with the specified dataSource.
 CRUDOperationProvider getCRUD()
           
protected  CRUDOperationProvider getCRUDInternal()
           
static Database getDatabase(String name)
          The Makumba database layer handles the following properties: sql.
static String getDatabaseProperty(String name, String propName)
          Access the properties of a database.
static TransactionProvider getInstance()
           
protected  Configuration.DataSourceType getLastConnectionType()
           
 String getQueryLanguage()
           
protected  String getQueryLanguageInternal()
           
protected  Transaction getTransaction(String name)
           
protected  void setLastConnectionType(Configuration.DataSourceType type)
           
 
Methods inherited from class org.makumba.providers.TransactionProvider
getConnectionTo, getConnectionToDefault, getCRUD, getDefaultDataSourceName, getQueryLanguage, release
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATABASE_CLASS

public static final String DATABASE_CLASS
See Also:
Constant Field Values

TABLE_CLASS

public static final String TABLE_CLASS
See Also:
Constant Field Values

CONNECTION_HOST

public static final String CONNECTION_HOST
See Also:
Constant Field Values

CONNECTION_PORT

public static final String CONNECTION_PORT
See Also:
Constant Field Values

CONNECTION_ENGINE

public static final String CONNECTION_ENGINE
See Also:
Constant Field Values

CONNECTION_DATABASE

public static final String CONNECTION_DATABASE
See Also:
Constant Field Values

theProp

static Class<?>[] theProp

dbs

static int dbs
Method Detail

getInstance

public static TransactionProvider getInstance()

getDatabase

public static Database getDatabase(String name)
The Makumba database layer handles the following properties:
sql.*
properties that are passed directly to the JDBC driver
dbsv
the DBSV will be used to set the most significant 8 bits of all primary keys generated for the new records created by this makumba client. Using different DBSVs can help to ensure key uniqueness among multiple clients using (or synchronizing with) the same database. Database inserts of records that have the same primary key as an already existing record in that table (i.e. a record created by a client that used the same DBSV) will fail. You cannot specify both dbsv and auto_increment in the same configuration file, but you can access the same database with some clients using (different) dbsv-s, and others using autoIncrement.
autoIncrement
if autoIncrement is on, makumba will use the server-side primary key generation. You cannot specify both dbsv and auto_increment in the same configuration file, but you can access the same database with some clients using (different) dbsv-s, and others using autoIncrement.
initConnections
if autoIncrement is on, makumba will use the server-side primary key generation. You cannot specify both dbsv and auto_increment in the same configuration file, but you can access the same database with some clients using (different) dbsv-s, and others using autoIncrement.
database_class
The main class of the makumba database driver. This is normally read from org/makumba/db/sql/sqlEngines.properties, but other, more powerful drivers can be plugged in.
table_class
Table handler of the database driver (optional, norlally known by the dbclass or read from org/makumba/db/sql/sqlEngines.properties)
typename = SQLtableName
Sets the name of the SQL table representing the given type to SQLtableName (to inhibit automatic table name generation)
typename->field=SQLfieldName
Sets the name of the SQL field representing the given object attribute to SQLfieldName (to inhibit automatic field name generation)
typenamePrefix=typenameShorthand
Before automatic tablename generation; shortens the names of all the types that begin with the indicated prefix by replacing it with the indicated shorthand. Useful for SQL engines that have severe limitations on tablename length
alter#typenameShorthand=true|false
If true allows automatic alteration of the SQL table representing the type(s) when the SQL table doesn't match the type definition. For example: alter#=true
alter#general=false
will allow alteration of all tables from the database except for tables whose names begin with "general"
admin#typenameShorthand=true|false
If true allows deletion of multiple records of the respective types during org.makumba.delete and org.makumba.copy the type(s) when the SQL table doesn't match the type definition.
addUnderscore=true|false
Specifies whether to add an underscore at the end of the generated field and table names during automatic name generation. It is true by default. (Introduced to avoid conflicts with reserved words on some SQL engines)


getConnectionTo

public Transaction getConnectionTo(String name)
Description copied from class: TransactionProvider
Opens a Transaction with the specified dataSource.

Overrides:
getConnectionTo in class TransactionProvider
Parameters:
name - the name of the dataSource to connect to
Returns:
a Transaction

getDatabaseProperty

public static String getDatabaseProperty(String name,
                                         String propName)
Access the properties of a database. Besides the properties defined in the database connection file, the following are available
sql_engine.name name of the SQL engine used
sql_engine.version version of the SQL engine used
sql.jdbc_driver.name name of the JDBC driver used
jdbc_driver.name name of the JDBC driver used
jdbc_driver.version version of the JDBC driver used
jdbc_url JDBC url connected to
jdbc_connections number of jdbc connections open

Since:
makumba-0.5.5.7

_copy

public void _copy(String sourceDB,
                  String destinationDB,
                  String[] typeNames,
                  boolean ignoreDbsv)

_delete

public void _delete(String whereDB,
                    String provenienceDB,
                    String[] typeNames,
                    boolean ignoreDbsv)

getQueryLanguage

public String getQueryLanguage()
Specified by:
getQueryLanguage in class TransactionProvider

getCRUD

public CRUDOperationProvider getCRUD()
Specified by:
getCRUD in class TransactionProvider

getTransaction

protected Transaction getTransaction(String name)
Specified by:
getTransaction in class TransactionProvider

getCRUDInternal

protected CRUDOperationProvider getCRUDInternal()
Specified by:
getCRUDInternal in class TransactionProvider

getQueryLanguageInternal

protected String getQueryLanguageInternal()
Specified by:
getQueryLanguageInternal in class TransactionProvider

getLastConnectionType

protected Configuration.DataSourceType getLastConnectionType()
Specified by:
getLastConnectionType in class TransactionProvider

setLastConnectionType

protected void setLastConnectionType(Configuration.DataSourceType type)
Specified by:
setLastConnectionType in class TransactionProvider

closeDataSource

public void closeDataSource(String dataSourceName)
Specified by:
closeDataSource in class TransactionProvider