org.ow2.petals.system.persistence
Class PersistenceServiceImpl

java.lang.Object
  extended by org.ow2.petals.system.persistence.PersistenceServiceImpl
All Implemented Interfaces:
PersistenceService

public class PersistenceServiceImpl
extends java.lang.Object
implements PersistenceService

The Persistence Service.

It is using a JDBC pool of connection to persist Petals data.

Since:
3.1
Author:
rnaudin

Field Summary
 
Fields inherited from interface org.ow2.petals.system.persistence.PersistenceService
DEFAULT_DURATION, DEFAULT_FETCHSIZE, DEFAULT_PASSWORD, DEFAULT_URL_PREFIX, DEFAULT_URL_SUFFIX, DEFAULT_USER, HSQLDB_DRIVER, MYSQL_DRIVER, ORACLE_DRIVER
 
Constructor Summary
PersistenceServiceImpl()
           
 
Method Summary
 void addMessageExchange(org.ow2.petals.jbi.messaging.exchange.MessageExchangeImpl exchange, boolean storeExchange, java.lang.Boolean isSent)
          Add a Message Exchange to the persistence service.
 void clearExchangeStorage()
          Clear the exchange storage.
 void deleteMessageExchange(java.lang.String exchangeId)
          Delete the exchange.
 long getExchangeStorageDuration()
          Get the exchange storage duration.
 org.ow2.petals.jbi.messaging.exchange.MessageExchangeImpl getMessageExchange(java.lang.String exchangeId)
          Retrieve a Message Exchange from the persistence.
 java.util.Map<java.lang.String,java.lang.Long> getMessageExchangeHistory(java.lang.String exchangeId)
          Get the Message Exchange sent/received history from the persistence.
 java.util.List<java.lang.String> getMessageExchangeIds(javax.xml.namespace.QName interfaceName, javax.xml.namespace.QName serviceName, java.lang.String endpointName, javax.xml.namespace.QName operationName, long startDate, long endDate)
          Retrieve a list of Message Exchange Ids from the persistence matching the given criteria and the exchange persistence duration
 java.util.List<java.lang.String> getMessageExchangeIds(java.lang.String propertyKey, java.lang.String propertyValue)
          Retrieve a list of Message Exchange Ids from the persistence matching the given the given exchange property and the exchange persistence duration
 int getMessageExchanges(javax.xml.namespace.QName interfaceName, javax.xml.namespace.QName serviceName, java.lang.String endpointName, javax.xml.namespace.QName operationName, long startDate, long endDate)
          Count the number of processed exchanges matching the given criteria.
 void setExchangeStorageDuration(long duration)
          Set the exchange storage duration.
protected  void start()
           
protected  void stop()
           
 void updateMessageExchange(org.ow2.petals.jbi.messaging.exchange.MessageExchangeImpl exchange, boolean storeExchange, java.lang.Boolean isSent)
          Update a Message Exchange in the persistence service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistenceServiceImpl

public PersistenceServiceImpl()
Method Detail

addMessageExchange

public void addMessageExchange(org.ow2.petals.jbi.messaging.exchange.MessageExchangeImpl exchange,
                               boolean storeExchange,
                               java.lang.Boolean isSent)
                        throws java.sql.SQLException,
                               java.io.IOException
Description copied from interface: PersistenceService
Add a Message Exchange to the persistence service.

Specified by:
addMessageExchange in interface PersistenceService
Parameters:
exchange - the exchange
storeExchange - if true, persist the body of the exchange. If false, persist only the exchangeId and the current timestamp
Throws:
java.sql.SQLException
java.io.IOException

clearExchangeStorage

public void clearExchangeStorage()
Description copied from interface: PersistenceService
Clear the exchange storage.

Specified by:
clearExchangeStorage in interface PersistenceService

deleteMessageExchange

public void deleteMessageExchange(java.lang.String exchangeId)
                           throws java.sql.SQLException
Description copied from interface: PersistenceService
Delete the exchange.

Specified by:
deleteMessageExchange in interface PersistenceService
Throws:
java.sql.SQLException

getExchangeStorageDuration

public long getExchangeStorageDuration()
Description copied from interface: PersistenceService
Get the exchange storage duration. When the duration is reached, the exchanges are removed from the Persistence Service.

Specified by:
getExchangeStorageDuration in interface PersistenceService

getMessageExchange

public org.ow2.petals.jbi.messaging.exchange.MessageExchangeImpl getMessageExchange(java.lang.String exchangeId)
                                                                             throws java.sql.SQLException,
                                                                                    java.io.IOException,
                                                                                    java.lang.ClassNotFoundException
Description copied from interface: PersistenceService
Retrieve a Message Exchange from the persistence.

Specified by:
getMessageExchange in interface PersistenceService
Parameters:
exchangeId - the Id of the exchange
Returns:
the recreated MessageExchangeImpl instance
Throws:
java.sql.SQLException
java.io.IOException
java.lang.ClassNotFoundException

getMessageExchangeHistory

public java.util.Map<java.lang.String,java.lang.Long> getMessageExchangeHistory(java.lang.String exchangeId)
                                                                         throws java.sql.SQLException
Description copied from interface: PersistenceService
Get the Message Exchange sent/received history from the persistence.

Specified by:
getMessageExchangeHistory in interface PersistenceService
Parameters:
exchangeId - the Id of the exchange
Returns:
a map of events, the type (sent or received) as key, the timestamp in millisecond as value.
Throws:
java.sql.SQLException

getMessageExchangeIds

public java.util.List<java.lang.String> getMessageExchangeIds(javax.xml.namespace.QName interfaceName,
                                                              javax.xml.namespace.QName serviceName,
                                                              java.lang.String endpointName,
                                                              javax.xml.namespace.QName operationName,
                                                              long startDate,
                                                              long endDate)
                                                       throws java.sql.SQLException
Description copied from interface: PersistenceService
Retrieve a list of Message Exchange Ids from the persistence matching the given criteria and the exchange persistence duration

Specified by:
getMessageExchangeIds in interface PersistenceService
Parameters:
interfaceName - The interface name that exchange targets. Can be null
serviceName - The service name that exchange targets. Can be null
endpointName - The endpoint name that exchange targets. Can be null
operationName - The operation name that exchange targets. Can be null
startDate - the start date
endDate - the end date
Returns:
the List of Exchange Ids.
Throws:
java.sql.SQLException

getMessageExchangeIds

public java.util.List<java.lang.String> getMessageExchangeIds(java.lang.String propertyKey,
                                                              java.lang.String propertyValue)
                                                       throws java.sql.SQLException,
                                                              java.io.IOException
Description copied from interface: PersistenceService
Retrieve a list of Message Exchange Ids from the persistence matching the given the given exchange property and the exchange persistence duration

Specified by:
getMessageExchangeIds in interface PersistenceService
Parameters:
propertyKey - The name of the property
propertyValue - The value of the property as a String
Returns:
the list of the exchange Ids
Throws:
java.sql.SQLException
java.io.IOException

getMessageExchanges

public int getMessageExchanges(javax.xml.namespace.QName interfaceName,
                               javax.xml.namespace.QName serviceName,
                               java.lang.String endpointName,
                               javax.xml.namespace.QName operationName,
                               long startDate,
                               long endDate)
                        throws java.sql.SQLException
Description copied from interface: PersistenceService
Count the number of processed exchanges matching the given criteria.

Specified by:
getMessageExchanges in interface PersistenceService
Throws:
java.sql.SQLException

setExchangeStorageDuration

public void setExchangeStorageDuration(long duration)
Description copied from interface: PersistenceService
Set the exchange storage duration. When the duration is reached, the exchanges are removed from the Persistence Service.

Specified by:
setExchangeStorageDuration in interface PersistenceService

updateMessageExchange

public void updateMessageExchange(org.ow2.petals.jbi.messaging.exchange.MessageExchangeImpl exchange,
                                  boolean storeExchange,
                                  java.lang.Boolean isSent)
                           throws java.sql.SQLException,
                                  java.io.IOException
Description copied from interface: PersistenceService
Update a Message Exchange in the persistence service.

Specified by:
updateMessageExchange in interface PersistenceService
Parameters:
exchange - the exchange
storeExchange - if true, persist the body of the exchange. If false, persist only the exchangeId and the current timestamp
Throws:
java.sql.SQLException
java.io.IOException

start

protected void start()
              throws java.sql.SQLException
Throws:
java.sql.SQLException

stop

protected void stop()


Copyright © 2005-2011 Petals Link (EBM Websourcing). All Rights Reserved.