|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.orbroker.Broker
The Broker between the JDBC data source and an application. The Broker holds the configuration and initiates Queries and Transactions.
Query
,
Transaction
Constructor Summary | |
Broker(DataSource dataSource)
Create Broker without a configuration. |
|
Broker(DataSource dataSource,
String username,
String password)
Create Broker without a configuration. |
|
Broker(InputStream configuration,
DataSource dataSource)
The Broker is configured by passing an InputStream containing an
XML file and a data source. |
|
Broker(InputStream configuration,
DataSource dataSource,
String username,
String password)
The Broker is configured by passing an InputStream containing an
XML file and a data source with username and password. |
Method Summary | |
static void |
addLoggingHandler(Handler handler)
Add logging handler. |
static void |
addLoggingHandler(Handler handler,
boolean keepDefaultHandler)
Add logging handler. |
void |
addStatement(String id,
String sql)
Add statement to Broker. |
void |
addStatement(String id,
String sql,
String resultObjectId)
Add statement to Broker. |
DataSource |
getDataSource()
Get the data source used by Broker. |
String |
getName()
Get brokerName of Broker. |
static void |
log(Level level,
String message)
Log a message. |
Executable |
obtainExecutable(Connection connection)
Obtain an Executable. |
void |
releaseExecutable(Executable executable)
Release Executable. |
void |
setCatalog(String catalog)
Set the catalog. |
void |
setDataSource(DataSource dataSource)
Set the data source. |
void |
setDataSource(DataSource dataSource,
String username,
String password)
Set data source and username/password. |
void |
setExceptionEvaluator(ExceptionEvaluator evaluator)
Set a new exception evaluator. |
static void |
setLoggingLevel(Level level)
Set the logging level. |
static void |
setLoggingLevel(String level)
Set the logging level. |
void |
setTextReplacement(String key,
String value)
Set a text replacement value. |
void |
setTextReplacements(Properties textReplacements)
Set text replacement values. |
Query |
startQuery()
Start a read-only query. |
Query |
startQuery(int isolationLevel)
Start a read-only query with a given transaction isolation level. |
Transaction |
startTransaction()
Start a new transaction. |
Transaction |
startTransaction(int isolationLevel)
Start a new transaction with a given transaction isolation level. |
String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Broker(DataSource dataSource)
dataSource
- A data sourceaddStatement(String, String)
public Broker(DataSource dataSource, String username, String password)
dataSource
- A data sourceusername
- Username to use that is different than on data sourcepassword
- Password for usernameaddStatement(String, String)
public Broker(InputStream configuration, DataSource dataSource) throws BrokerException
InputStream
containing an
XML file and a data source.
configuration
- The XML configurationdataSource
- A data source
BrokerException
public Broker(InputStream configuration, DataSource dataSource, String username, String password) throws BrokerException
InputStream
containing an
XML file and a data source with username and password.
configuration
- The XML configurationdataSource
- A data sourceusername
- Username to use that is different than on data sourcepassword
- Password for username
BrokerException
Method Detail |
public static void addLoggingHandler(Handler handler)
handler
- Logging handler.Handler
,
addLoggingHandler(Handler, boolean)
public static void addLoggingHandler(Handler handler, boolean keepDefaultHandler)
handler
- Logging handler.keepDefaultHandler
- true, if default console log handler should remainHandler
,
addLoggingHandler(Handler)
public static void log(Level level, String message)
level
- Log levelmessage
- Log messagepublic static void setLoggingLevel(Level level)
level
- Logging levelpublic static void setLoggingLevel(String level)
setLoggingLevel(Level)
.
level
- Logging levelLevel
public void addStatement(String id, String sql) throws BrokerException, ConfigurationException
id
- The statement id.sql
- The SQL statement
BrokerException
ConfigurationException
public void addStatement(String id, String sql, String resultObjectId) throws BrokerException, ConfigurationException
id
- The statement id.sql
- The SQL statementresultObjectId
- The result-object
id as defined in the XML
configuration file.
BrokerException
ConfigurationException
public DataSource getDataSource()
public String getName()
public Executable obtainExecutable(Connection connection)
releaseExecutable(Executable)
,
or unpredictable behavior can occur.
connection
- An externally managed connection.
releaseExecutable(Executable)
,
Transaction.obtainExecutable()
public void releaseExecutable(Executable executable)
Releasing the Executable will not close the connection.
executable
- The Executable to release
BrokerException
- if the Executable was not obtained from this BrokerobtainExecutable(Connection)
public void setCatalog(String catalog)
catalog
- The catalog namepublic void setDataSource(DataSource dataSource)
dataSource
- The data sourcepublic void setDataSource(DataSource dataSource, String username, String password)
dataSource
- The data sourceusername
- Username to use that is different than on data sourcepassword
- Password for usernamepublic void setExceptionEvaluator(ExceptionEvaluator evaluator)
evaluator
- The exception evaluator instancepublic void setTextReplacement(String key, String value)
{{key}}
string with the specific parameter value.
key
- Text replacement keyvalue
- Text replacement valuesetTextReplacements(Properties)
public void setTextReplacements(Properties textReplacements)
{{key}}
type properties in an sql-statement with the values.
textReplacements
- The replacement values to set.setTextReplacement(String, String)
public Query startQuery()
public Query startQuery(int isolationLevel)
Connection.TRANSACTION_NONE
Connection.TRANSACTION_READ_UNCOMMITTED
Connection.TRANSACTION_READ_COMMITTED
Connection.TRANSACTION_REPEATABLE_READ
Connection.TRANSACTION_SERIALIZABLE
isolationLevel
- The isolation level
public Transaction startTransaction() throws BrokerException
BrokerException
public Transaction startTransaction(int isolationLevel) throws BrokerException
Connection.TRANSACTION_NONE
Connection.TRANSACTION_READ_UNCOMMITTED
Connection.TRANSACTION_READ_COMMITTED
Connection.TRANSACTION_REPEATABLE_READ
Connection.TRANSACTION_SERIALIZABLE
isolationLevel
- The isolation level
BrokerException
public String toString()
Object.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |