com.onewebsql.util.jta
Class JtaUtil

java.lang.Object
  extended by com.onewebsql.util.jta.JtaUtil

public class JtaUtil
extends Object

Utility class which retrieves, opens and closes a JTA transaction; it handles exceptions which occur in JtaOp operation.


Constructor Summary
JtaUtil()
          Constructor.
JtaUtil(ContextProvider contextProvider)
          Constructor.
JtaUtil(UserTransaction userTransaction)
          Constructor.
 
Method Summary
static String getStatusName(int status)
          Zwraca ciąg znaków z nazwą statusu transakcji JTA.
<T> T
withUserTransaction(JtaOp<T> operation)
          Invokes an operation which needs access to JTA transaction object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JtaUtil

public JtaUtil()
Constructor.


JtaUtil

public JtaUtil(ContextProvider contextProvider)
Constructor.

Parameters:
contextProvider - provides JNDI context

JtaUtil

public JtaUtil(UserTransaction userTransaction)
Constructor.

Parameters:
userTransaction - JTA transaction object
Method Detail

withUserTransaction

public <T> T withUserTransaction(JtaOp<T> operation)
Invokes an operation which needs access to JTA transaction object. It retrieves a JTA transaction object from JNDI. It opens the transaction, then invokes the operation giving it the JTA transaction object. It closes the transaction in the right way if the transactions ends with commit or rollback or is an exception is thrown (rollback).

Type Parameters:
T - type of the object returned by the operation
Parameters:
operation - operation to invoke
Returns:
return of the operation

getStatusName

public static String getStatusName(int status)
Zwraca ciąg znaków z nazwą statusu transakcji JTA.

Parameters:
status - status transakcji JTA.
Returns:
ciąg znaków z nazwą statusu transakcji JTA.
See Also:
Status


Copyright © 2011-2013 e-point SA. All Rights Reserved.