org.sormula.active.operation
Class OperationDatabase

java.lang.Object
  extended by org.sormula.Database
      extended by org.sormula.active.operation.OperationDatabase
All Implemented Interfaces:
TypeTranslatorMap

public class OperationDatabase
extends Database

Database for one transaction within an ActiveOperation. Creates OperationTable for Database.getTable(Class) for all tables in operation.

Intended for use by ActiveOperation only.

Since:
1.7 and 2.1
Author:
Jeff Miller

Constructor Summary
OperationDatabase(ActiveDatabase activeDatabase)
          Constructs for an active database.
 
Method Summary
 ActiveDatabase getActiveDatabase()
          Gets the active database supplied in the constructor.
<R> Table<R>
getTable(java.lang.Class<R> rowClass)
          Gets table object for reading/writing row objects of type R from/to table. Cascade operations for Table may invoke getTable for some cascaded Table where T is different from R.
 
Methods inherited from class org.sormula.Database
addNameTranslatorClass, addTable, close, createOperationTime, getConnection, getDataSource, getDataSourceName, getNameTranslatorClass, getNameTranslatorClasses, getOperationTime, getOperationTimeMap, getSchema, getTable, getTotalOperationTime, getTransaction, getTypeTranslator, getTypeTranslator, init, initTransaction, initTypeTranslatorMap, isReadOnly, isTimings, logTimings, putTypeTranslator, putTypeTranslator, removeNameTranslatorClass, setNameTranslatorClass, setReadOnly, setTimings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationDatabase

public OperationDatabase(ActiveDatabase activeDatabase)
                  throws java.lang.Exception
Constructs for an active database.

Parameters:
activeDatabase - active database determines data source
Throws:
java.sql.SQLException - if error
java.lang.Exception
Method Detail

getActiveDatabase

public ActiveDatabase getActiveDatabase()
Gets the active database supplied in the constructor.

Returns:
active database

getTable

public <R> Table<R> getTable(java.lang.Class<R> rowClass)
                  throws SormulaException
Gets table object for reading/writing row objects of type R from/to table. Table objects are cahced in map by canonical class name. If one exists, it is returned, otherwise a default one is created.

This method is optional. A table object may also be created with Table constructor. Cascade operations for Table may invoke getTable for some cascaded Table where T is different from R.

Overrides:
getTable in class Database
Type Parameters:
R - row class type
Parameters:
rowClass - annotations on this class determine mapping from row objects to/from database
Returns:
table object for reading/writing row objects of type R from/to database
Throws:
SormulaException - if error