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(org.apache.synapse.commons.datasource.DataSourceInformation dataSourceInformation)
Create a custom DataSource using the specified data source information.
|
void |
destroy()
Destroys the mediator.
|
DataSource |
getDataSource() |
Map<Object,String> |
getDataSourceProps() |
org.apache.synapse.commons.datasource.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(org.apache.synapse.commons.datasource.DataSourceInformation dataSourceInformation) |
void |
setDataSourceName(String dataSourceName) |
void |
setDbPoolView(org.apache.synapse.commons.datasource.DBPoolView dbPoolView) |
void |
setJndiProperties(Properties jndiProperties) |
auditLog, auditWarn, configure, disableStatistics, disableTracing, divertMediationRoute, enableStatistics, enableTracing, getAspectConfiguration, getCommentsList, getDescription, getInputType, getLastSequenceFaultHandler, getLog, getMediatorName, getMediatorPosition, getOutputType, getRegisteredMediationFlowPoint, getShortDescription, getTraceState, getType, handleException, handleException, isBreakPoint, isContentAltering, isContentAware, isSkipEnabled, isStatisticsEnable, isTraceOn, isTraceOrDebugOn, isTracingEnabled, registerMediationFlowPoint, reportCloseStatistics, reportOpenStatistics, setBreakPoint, setCommentsList, setComponentStatisticsId, setDescription, setEffectiveTraceState, setMediatorPosition, setShortDescription, setSkipEnabled, setTraceState, shouldCaptureTracing, shouldTrace, shouldTrace, traceOrDebug, traceOrDebugWarn, unregisterMediationFlowPoint
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(org.apache.synapse.commons.datasource.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 org.apache.synapse.commons.datasource.DBPoolView getDbPoolView()
public void setDbPoolView(org.apache.synapse.commons.datasource.DBPoolView dbPoolView)
protected PreparedStatement getPreparedStatement(Statement stmnt, Connection con, MessageContext msgCtx) throws SQLException
stmnt
- SQL stataement to be executedcon
- The connection to be usedmsgCtx
- Current message contextSQLException
- on errorprotected DataSource createCustomDataSource(org.apache.synapse.commons.datasource.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.