org.apache.servicemix.jbi.audit.jdbc
Class JdbcAuditor
java.lang.Object
org.apache.servicemix.jbi.management.BaseLifeCycle
org.apache.servicemix.jbi.management.BaseSystemService
org.apache.servicemix.jbi.audit.AbstractAuditor
org.apache.servicemix.jbi.audit.jdbc.JdbcAuditor
- All Implemented Interfaces:
- EventListener, LifeCycleMBean, AuditorMBean, ExchangeListener, ServiceMixListener, MBeanInfoProvider, org.springframework.beans.factory.InitializingBean
public class JdbcAuditor
- extends AbstractAuditor
- implements org.springframework.beans.factory.InitializingBean
Basic implementation of ServiceMix auditor on a jdbc store.
This implementation, for performance purposes, only relies
on one table SM_AUDIT with two columns:
- ID the exchange id (varchar)
- EXCHANGE the serialized exchange (blob)
To minimize overhead, the exchange serialized is the undelying
ExchangePacket.
- Since:
- 2.1
- Version:
- $Revision: 11366 $
- Author:
- Guillaume Nodet (gnt)
| Methods inherited from class org.apache.servicemix.jbi.audit.AbstractAuditor |
deleteAllExchanges, deleteExchangeById, deleteExchangeByIndex, deleteExchangesByRange, doStart, doStop, exchangeAccepted, getAllExchangeIds, getAllExchanges, getAttributeInfos, getContainer, getExchangeById, getExchangeByIndex, getExchangeIdByIndex, getExchangesByRange, getOperationInfos, getServiceMBean, isAsContainerListener, resendExchange, setAsContainerListener, setContainer, start, stop |
| Methods inherited from class org.apache.servicemix.jbi.management.BaseLifeCycle |
firePropertyChanged, getCurrentState, getObjectToManage, getSubType, init, isInitialized, isShutDown, isStarted, isStopped, isUnknown, setCurrentState, setPropertyChangeListener |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JdbcAuditor
public JdbcAuditor()
getDescription
public String getDescription()
- Specified by:
getDescription in interface MBeanInfoProvider
afterPropertiesSet
public void afterPropertiesSet()
throws Exception
- Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
- Throws:
Exception
exchangeSent
public void exchangeSent(ExchangeEvent event)
- Specified by:
exchangeSent in interface ExchangeListener
store
protected void store(Connection connection,
String id,
byte[] data)
throws Exception
- Throws:
Exception
getDataSource
public DataSource getDataSource()
setDataSource
public void setDataSource(DataSource dataSource)
getExchangeCount
public int getExchangeCount()
throws AuditorException
- Description copied from interface:
AuditorMBean
- Get the number of exchanges stored by this auditor.
- Specified by:
getExchangeCount in interface AuditorMBean- Specified by:
getExchangeCount in class AbstractAuditor
- Returns:
- the number of exchanges stored
- Throws:
AuditorException - if an error occurs accessing the data store.
getExchangeIdsByRange
public String[] getExchangeIdsByRange(int fromIndex,
int toIndex)
throws AuditorException
- Description copied from interface:
AuditorMBean
- Retrieve a range of message exchange ids.
The ids retrieved range from fromIndex (inclusive) to
toIndex (exclusive).
If fromIndex == toIndex, an empty array must be returned.
If fromIndex is less than zero, or if toIndex is less than
fromIndex, an exception will be thrown.
An array of exactly (toIndex - fromIndex) element should be
returned.
This array must be filled by null, for indexes that are greater
than the number of exchanges stored.
- Specified by:
getExchangeIdsByRange in interface AuditorMBean- Specified by:
getExchangeIdsByRange in class AbstractAuditor
- Parameters:
fromIndex - the lower bound index of the ids to be retrieved.
fromIndex must be greater or equal to zero.toIndex - the upper bound (exclusive) of the ids to be retrieved.
toIndex must be greater or equal to fromIndex
- Returns:
- an array of exchange ids
- Throws:
AuditorException - if an error occurs accessing the data store.
getExchangesByIds
public MessageExchange[] getExchangesByIds(String[] ids)
throws AuditorException
- Description copied from interface:
AuditorMBean
- Retrieve exchanges for the specified ids.
An array of exactly ids.length elements must be returned.
This array should be filled with null for exchanges that
have not been found in the store.
- Specified by:
getExchangesByIds in interface AuditorMBean- Specified by:
getExchangesByIds in class AbstractAuditor
- Parameters:
ids - the ids of exchanges to retrieve
- Returns:
- an array of exchanges
- Throws:
AuditorException - if an error occurs accessing the data store.
deleteExchangesByIds
public int deleteExchangesByIds(String[] ids)
throws AuditorException
- Description copied from interface:
AuditorMBean
- Delete exchanges given their ids.
- Specified by:
deleteExchangesByIds in interface AuditorMBean- Specified by:
deleteExchangesByIds in class AbstractAuditor
- Parameters:
ids - the ids of exchanges to retrieve
- Returns:
- an array of exchanges
- Throws:
AuditorException - if an error occurs accessing the data store.
getExchange
protected MessageExchange getExchange(byte[] data)
throws AuditorException
- Throws:
AuditorException
isAutoStart
public boolean isAutoStart()
setAutoStart
public void setAutoStart(boolean autoStart)
Copyright © 2005-2009 Apache Software Foundation. All Rights Reserved.