org.apache.servicemix.nmr.audit
Interface AuditorMBean

All Known Subinterfaces:
AuditorQueryMBean
All Known Implementing Classes:
AbstractAuditor, FileAuditor, JdbcAuditor, LuceneAuditor

public interface AuditorMBean

Main interface for ServiceMix auditor. This interface may be used to view and delete exchanges or to re-send an exchange on behalf of the component that initiated the exchange. The implementation is free to offer additional features for selecting message exchanges which are dependant of the underlying store.

Since:
1.0.0
Version:
$Revision: 492738 $
Author:
Guillaume Nodet (gnt)

Method Summary
 int deleteAllExchanges()
          Delete all exchanges =from the data store.
 boolean deleteExchangeById(String id)
          Delete the exchange with the specified id.
 boolean deleteExchangeByIndex(int index)
          Delete a message, given its index.
 int deleteExchangesByIds(String[] ids)
          Delete exchanges given their ids.
 int deleteExchangesByRange(int fromIndex, int toIndex)
          Delete exchanges ranging from fromIndex to toIndex.
 String[] getAllExchangeIds()
          Retrieve all exchanges ids from the data store.
 Exchange[] getAllExchanges()
          Retrieve all exchanges =from the data store.
 Exchange getExchangeById(String id)
          Retrieve the exchange for a specified id.
 Exchange getExchangeByIndex(int index)
          Retrieve the exchange at the specified index.
 int getExchangeCount()
          Get the number of exchanges stored by this auditor.
 String getExchangeIdByIndex(int index)
          Retrieve the exchange id of the exchange at the specified index.
 String[] getExchangeIdsByRange(int fromIndex, int toIndex)
          Retrieve a range of message exchange ids.
 Exchange[] getExchangesByIds(String[] ids)
          Retrieve exchanges for the specified ids.
 Exchange[] getExchangesByRange(int fromIndex, int toIndex)
          Retrieve a range of message exchange.
 void resendExchange(Exchange exchange)
          Resend an exchange on behalf of the consumer component that initiated this exchange.
 

Method Detail

getExchangeCount

int getExchangeCount()
                     throws AuditorException
Get the number of exchanges stored by this auditor.

Returns:
the number of exchanges stored
Throws:
AuditorException - if an error occurs accessing the data store.

getExchangeIdByIndex

String getExchangeIdByIndex(int index)
                            throws AuditorException
Retrieve the exchange id of the exchange at the specified index. Index must be a null or positive integer. If index is greater than the number of exchanges stored, a null string should be returned.

Parameters:
index - the index of the exchange
Returns:
the exchange id, or null of index is greater than the exchange count
Throws:
AuditorException - if an error occurs accessing the data store.
IllegalArgumentException - if index is less than zero

getAllExchangeIds

String[] getAllExchangeIds()
                           throws AuditorException
Retrieve all exchanges ids from the data store.

Returns:
an array of exchange ids
Throws:
AuditorException - if an error occurs accessing the data store.

getExchangeIdsByRange

String[] getExchangeIdsByRange(int fromIndex,
                               int toIndex)
                               throws AuditorException
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.

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.
IllegalArgumentException - if fromIndex is less than zero or if toIndex is less than fromIndex.

getExchangeByIndex

Exchange getExchangeByIndex(int index)
                            throws AuditorException
Retrieve the exchange at the specified index. Index must be a null or positive integer, and should be less than the current exchange count stored. If index is greater than the number of exchanges stored, a null exchange should be returned.

Parameters:
index - the index of the exchange
Returns:
the exchange, or null of index is greater than the exchange count
Throws:
AuditorException - if an error occurs accessing the data store.
IllegalArgumentException - if index is less than zero

getExchangeById

Exchange getExchangeById(String id)
                         throws AuditorException
Retrieve the exchange for a specified id. Id must be non null and non empty. If the exchange with the specified id is not found, null should be returned.

Parameters:
id - the id of the exchange
Returns:
the exchange with the specified id, or null if not found
Throws:
AuditorException - if an error occurs accessing the data store.
IllegalArgumentException - if id is null or empty

getAllExchanges

Exchange[] getAllExchanges()
                           throws AuditorException
Retrieve all exchanges =from the data store.

Returns:
an array of exchange
Throws:
AuditorException - if an error occurs accessing the data store.

getExchangesByRange

Exchange[] getExchangesByRange(int fromIndex,
                               int toIndex)
                               throws AuditorException
Retrieve a range of message exchange. The exchanges 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.

Parameters:
fromIndex - the lower bound index of the exchanges to be retrieved. fromIndex must be greater or equal to zero.
toIndex - the upper bound (exclusive) of the exchanges to be retrieved. toIndex must be greater or equal to fromIndex
Returns:
an array of exchange
Throws:
AuditorException - if an error occurs accessing the data store.
IllegalArgumentException - if fromIndex is less than zero or if toIndex is less than fromIndex.

getExchangesByIds

Exchange[] getExchangesByIds(String[] ids)
                             throws AuditorException
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.

Parameters:
ids - the ids of exchanges to retrieve
Returns:
an array of exchanges
Throws:
AuditorException - if an error occurs accessing the data store.
IllegalArgumentException - if ids is null, or one of its element is null or empty.

deleteAllExchanges

int deleteAllExchanges()
                       throws AuditorException
Delete all exchanges =from the data store.

Returns:
the number of exchanges deleted, or -1 if such information can not be provided
Throws:
AuditorException - if an error occurs accessing the data store.

deleteExchangeByIndex

boolean deleteExchangeByIndex(int index)
                              throws AuditorException
Delete a message, given its index. Index must be a null or positive integer, and should be less than the current exchange count stored. If index is greater than the number of exchanges stored, false should be returned.

Parameters:
index - the index of the exchange
Returns:
true if the exchange has been successfully deleted, false if index is greater than the number of exchanges stored
Throws:
AuditorException - if an error occurs accessing the data store.
IllegalArgumentException - if index is less than zero

deleteExchangeById

boolean deleteExchangeById(String id)
                           throws AuditorException
Delete the exchange with the specified id. Id must be non null and non empty.

Parameters:
id - the id of the exchange to delete
Returns:
true if the exchange has been successfully deleted, false if the exchange was not found
Throws:
AuditorException - if an error occurs accessing the data store.
IllegalArgumentException - if id is null or empty

deleteExchangesByRange

int deleteExchangesByRange(int fromIndex,
                           int toIndex)
                           throws AuditorException
Delete exchanges ranging from fromIndex to toIndex.

Parameters:
fromIndex - the lower bound index of the exchanges to be retrieved. fromIndex must be greater or equal to zero.
toIndex - the upper bound (exclusive) of the exchanges to be retrieved. toIndex must be greater or equal to fromIndex
Returns:
the number of exchanges deleted
Throws:
AuditorException - if an error occurs accessing the data store.
IllegalArgumentException - if fromIndex is less than zero or if toIndex is less than fromIndex.

deleteExchangesByIds

int deleteExchangesByIds(String[] ids)
                         throws AuditorException
Delete exchanges given their ids.

Parameters:
ids - the ids of exchanges to retrieve
Returns:
the number of exchanges deleted
Throws:
AuditorException - if an error occurs accessing the data store.
IllegalArgumentException - if ids is null, or one of its element is null or empty.

resendExchange

void resendExchange(Exchange exchange)
                    throws AuditorException
Resend an exchange on behalf of the consumer component that initiated this exchange. The exchange must have been retrieved from this auditor, else the behavior is undefined. The exchange will be given a new id and will be reset to its original state: the out and fault messages will be removed (if they exist), the error will be set to null, state to ACTIVE. The consumer component must be prepared to receive a response or a DONE status to an exchange it did not have directly initiated.

Parameters:
exchange - the exchange to be sent
Throws:
AuditorException - if an error occurs re-sending the exchange


Copyright © 2005-2012 FuseSource. All Rights Reserved.