public abstract class AbstractDBMediator extends AbstractMediator implements ManagedLifecycle
log, trace, traceState
Constructor and Description |
---|
AbstractDBMediator() |
Modifier and Type | Method and Description |
---|---|
void |
addDataSourceProperty(QName name,
String value) |
void |
addDataSourceProperty(String name,
String value) |
void |
addStatement(Statement stmnt) |
protected DataSource |
createCustomDataSource(DataSourceInformation dataSourceInformation)
Create a custom DataSource using the specified data source information.
|
void |
destroy()
Destroys the mediator.
|
DataSource |
getDataSource() |
Map<Object,String> |
getDataSourceProps() |
DBPoolView |
getDbPoolView() |
protected String |
getDSName()
Return the name or (hopefully) unique connection URL specific to the DataSource being used
This is used for logging purposes only
|
protected PreparedStatement |
getPreparedStatement(Statement stmnt,
Connection con,
MessageContext msgCtx)
Return a Prepared statement for the given Statement object, which is ready to be executed
|
List<Statement> |
getStatementList() |
protected void |
handleException(String message) |
void |
init(SynapseEnvironment se)
Initializes the mediator - either an existing data source will be looked up
from an in- or external JNDI provider or a custom data source will be created
based on the provide configuration (using Apache DBCP).
|
boolean |
mediate(MessageContext synCtx)
Process each SQL statement against the current message
|
protected abstract void |
processStatement(Statement query,
MessageContext msgCtx)
Subclasses must specify how each SQL statement is processed
|
void |
setDataSource(DataSource dataSource) |
void |
setDataSourceInformation(DataSourceInformation dataSourceInformation) |
void |
setDataSourceName(String dataSourceName) |
void |
setDbPoolView(DBPoolView dbPoolView) |
void |
setJndiProperties(Properties jndiProperties) |
auditLog, auditWarn, configure, disableStatistics, enableStatistics, getAspectConfiguration, getDescription, getLog, getTraceState, getType, handleException, handleException, isContentAware, isStatisticsEnable, isTraceOn, isTraceOrDebugOn, setDescription, setEffectiveTraceState, setTraceState, shouldTrace, traceOrDebug, traceOrDebugWarn
public void init(SynapseEnvironment se)
init
in interface ManagedLifecycle
se
- the Synapse environment referencepublic void destroy()
destroy
in interface ManagedLifecycle
public boolean mediate(MessageContext synCtx)
protected abstract void processStatement(Statement query, MessageContext msgCtx)
query
- the SQL statementmsgCtx
- current messageprotected String getDSName()
public void setDataSourceInformation(DataSourceInformation dataSourceInformation)
public void setJndiProperties(Properties jndiProperties)
public DataSource getDataSource()
public void setDataSource(DataSource dataSource)
public void setDataSourceName(String dataSourceName)
public void addStatement(Statement stmnt)
public DBPoolView getDbPoolView()
public void setDbPoolView(DBPoolView dbPoolView)
protected PreparedStatement getPreparedStatement(Statement stmnt, Connection con, MessageContext msgCtx) throws SQLException
stmnt
- SQL statement to be executedcon
- The connection to be usedmsgCtx
- Current message contextSQLException
- on errorprotected DataSource createCustomDataSource(DataSourceInformation dataSourceInformation)
dataSourceInformation
- the data source information to create a data sourceprotected void handleException(String message)
Copyright © 2005-2017 Apache Software Foundation. All Rights Reserved.