org.apache.servicemix.nmr.audit.file
Class FileAuditor

java.lang.Object
  extended by org.apache.servicemix.nmr.audit.AbstractAuditor
      extended by org.apache.servicemix.nmr.audit.file.FileAuditor
All Implemented Interfaces:
EventListener, ExchangeListener, Listener, AuditorMBean

public class FileAuditor
extends AbstractAuditor

Simple implementation of a ServiceMix auditor that stores messages in files in a directory. Currently, the file auditor will only store the message body for ACTIVE exchanges.


Field Summary
 
Fields inherited from class org.apache.servicemix.nmr.audit.AbstractAuditor
logger
 
Constructor Summary
FileAuditor()
           
 
Method Summary
 int deleteExchangesByIds(String[] ids)
          Delete exchanges given their ids.
 void exchangeSent(Exchange exchange)
          Method called each time an exchange is sent
 String getDescription()
          
 int getExchangeCount()
          Get the number of exchanges stored by this auditor.
 String[] getExchangeIdsByRange(int fromIndex, int toIndex)
          Retrieve a range of message exchange ids.
 Exchange[] getExchangesByIds(String[] ids)
          Retrieve exchanges for the specified ids.
 void setDirectory(File directory)
          The directory used for storing the audited messages
 
Methods inherited from class org.apache.servicemix.nmr.audit.AbstractAuditor
deleteAllExchanges, deleteExchangeById, deleteExchangeByIndex, deleteExchangesByRange, exchangeDelivered, exchangeFailed, getAllExchangeIds, getAllExchanges, getExchangeById, getExchangeByIndex, getExchangeIdByIndex, getExchangesByRange, resendExchange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileAuditor

public FileAuditor()
Method Detail

setDirectory

public void setDirectory(File directory)
The directory used for storing the audited messages

Parameters:
directory - the directory

exchangeSent

public void exchangeSent(Exchange exchange)
Method called each time an exchange is sent

Parameters:
exchange - the exchange sent

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:
the number of exchanges deleted
Throws:
AuditorException - if an error occurs accessing the data store.

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 Exchange[] 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.

getDescription

public String getDescription()



Copyright © 2005-2012 FuseSource. All Rights Reserved.