|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.synapse.mediators.AbstractMediator org.apache.synapse.mediators.db.AbstractDBMediator
public abstract class AbstractDBMediator
This abstract DB mediator will perform common DB connection pooling etc. for all DB mediators
Field Summary |
---|
Fields inherited from class org.apache.synapse.mediators.AbstractMediator |
---|
log, trace, traceState |
Constructor Summary | |
---|---|
AbstractDBMediator()
|
Method Summary | |
---|---|
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,
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)
|
Methods inherited from class org.apache.synapse.mediators.AbstractMediator |
---|
auditLog, auditWarn, configure, disableStatistics, enableStatistics, getAspectConfiguration, getDescription, getLog, getTraceState, getType, handleException, handleException, isStatisticsEnable, isTraceOn, isTraceOrDebugOn, setDescription, setEffectiveTraceState, setTraceState, shouldTrace, traceOrDebug, traceOrDebugWarn |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractDBMediator()
Method Detail |
---|
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)
mediate
in interface Mediator
synCtx
- the current message
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 addDataSourceProperty(QName name, String value)
public void addDataSourceProperty(String name, String value)
public void addStatement(Statement stmnt)
public List<Statement> getStatementList()
public DBPoolView getDbPoolView()
public void setDbPoolView(DBPoolView dbPoolView)
protected PreparedStatement getPreparedStatement(Statement stmnt, MessageContext msgCtx) throws SQLException
stmnt
- SQL stataement to be executedmsgCtx
- Current message context
SQLException
- on errorprotected DataSource createCustomDataSource(DataSourceInformation dataSourceInformation)
dataSourceInformation
- the data source information to create a data source
protected void handleException(String message)
public Map<Object,String> getDataSourceProps()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |