SPT Object Database API

com.sptci.prevayler.transaction
Class Transaction<P>

java.lang.Object
  extended by com.sptci.prevayler.transaction.Transaction<P>
All Implemented Interfaces:
Serializable, TransactionWithQuery
Direct Known Subclasses:
Delete, Save

public class Transaction<P>
extends Object
implements TransactionWithQuery

A general purpose transaction used to execute transactional methods on the prevalent system.

© Copyright 2008 Sans Pareil Technologies, Inc.

Version:
$Id: Transaction.java 4345 2008-06-30 21:22:03Z rakesh $
Author:
Rakesh Vidyadharan 2008-05-28
See Also:
Serialized Form

Nested Class Summary
static class Transaction.Parameter
          A mapping object used to capture the class type and instance of a parameter to a method defined on the prevalent system.
 
Field Summary
private  String method
          The name of the transactional method being invoked.
private static long serialVersionUID
           
private  Class[] types
          The types of the parameters for the transactional method.
private  Object[] values
          The values for types to specify in the method invocation.
 
Constructor Summary
Transaction(String method, Collection<Transaction.Parameter> parameters)
          Create a new instance of the transaction with the specified values.
Transaction(String method, Transaction.Parameter parameter)
          Create a new instance of the transaction with the specified values.
Transaction(String method, Transaction.Parameter[] parameters)
          Create a new instance of the transaction with the specified values.
 
Method Summary
 P executeAndQuery(Object prevalentSystem, Date executionTime)
          Implementation of the interface method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

method

private final String method
The name of the transactional method being invoked.


types

private final Class[] types
The types of the parameters for the transactional method.


values

private final Object[] values
The values for types to specify in the method invocation.

Constructor Detail

Transaction

public Transaction(String method,
                   Transaction.Parameter parameter)
Create a new instance of the transaction with the specified values.

Parameters:
method - The method name to use.
parameter - The parameter for the method.

Transaction

public Transaction(String method,
                   Collection<Transaction.Parameter> parameters)
Create a new instance of the transaction with the specified values.

Parameters:
method - The method name to use.
parameters - The parameters for the method.

Transaction

public Transaction(String method,
                   Transaction.Parameter[] parameters)
Create a new instance of the transaction with the specified values.

Parameters:
method - The method name to use.
parameters - The array of parameters for the method.
Method Detail

executeAndQuery

public P executeAndQuery(Object prevalentSystem,
                         Date executionTime)
                  throws Exception
Implementation of the interface method. Invokes the method on the prevalent system with the specified values.

Specified by:
executeAndQuery in interface TransactionWithQuery
Parameters:
prevalentSystem - The prevalent system on which the transaction is to be performed and the query executed.
executionTime - The timestamp for the transaction.
Returns:
The results of exeecuting the transaction.
Throws:
PrevalentException - Usually thrown when the prevalent system traps errors that are checked by the system.
Exception - If unknown errors are encountered while executing the transaction or query.

SPT Object Database API