public interface TransactionHelper
This interface is specific to Forte for Java, version 3.0, and is subject to change without notice. In particular, as additional experience is gained with specific application servers, this interface may have methods added and removed, even with patch releases. Therefore, this interface should be considered very volatile, and any class that implements it might have to be reimplemented whenever an upgrade to either the application server or Forte for Java occurs.
The class that implements this interface must register itself by a static method at class initialization time. For example,
import com.sun.jdo.spi.persistence.support.sqlstore.ejb.*;
class blackHerringTransactionHelper implements TransactionHelper {
static EJBHelper.register(new blackHerringTransactionHelper());
...
}
| Modifier and Type | Method and Description |
|---|---|
Connection |
getConnection(Object resource,
String username,
char[] password)
Called in a managed environment to get a Connection from the application
server specific resource.
|
String |
getDDLNamePrefix(Object info)
Returns name prefix for DDL files extracted from the info instance by the
application server specific code.
|
TransactionManager |
getLocalTransactionManager()
Called in a managed environment to access a TransactionManager
for managing local transaction boundaries and registering synchronization
for call backs during completion of a local transaction.
|
Connection |
getNonTransactionalConnection(Object resource,
String username,
char[] password)
Called in a managed environment to get a non-transactional Connection
from the application server specific resource.
|
Transaction |
getTransaction()
Identify the Transaction context for the calling thread, and return a
Transaction instance that can be used to register synchronizations,
and used as the key for HashMaps.
|
UserTransaction |
getUserTransaction()
Returns the UserTransaction associated with the calling thread.
|
boolean |
isManaged()
Identifies the managed environment behavior.
|
void |
notifyApplicationUnloaded(ClassLoader cl)
Called to notify a ApplicationLifeCycleEventListeners that an application
is unloaded.
|
void |
postInvoke(Object im)
Called at the end of the Transaction.beforeCompletion() to
de-register the component with the app server if necessary.
|
Object |
preInvoke(Object component)
Called at the beginning of the Transaction.beforeCompletion() to
register the component with the app server if necessary.
|
void |
registerApplicationLifeCycleEventListener(ApplicationLifeCycleEventListener listener)
Called to register a ApplicationLifeCycleEventListener.
|
void |
registerSynchronization(Transaction jta,
Synchronization sync)
Called in a managed environment to register internal Synchronization object
with the Transaction Synchronization.
|
PersistenceManagerFactory |
replaceInternalPersistenceManagerFactory(PersistenceManagerFactory pmf)
Replace newly created instance of PersistenceManagerFactory
with the hashed one if it exists.
|
void |
setPersistenceManagerFactoryDefaults(PersistenceManagerFactory pmf)
Set environment specific default values for the given PersistenceManagerFactory.
|
int |
translateStatus(int st)
Translate local representation of the Transaction Status to
javax.transaction.Status value if necessary.
|
Statement |
unwrapStatement(Statement stmt)
This method unwrap given Statement and return the Statement from
JDBC driver.
|
UserTransaction getUserTransaction()
Transaction getTransaction()
equals() and hashCode() based on the global transaction id.
All Transaction instances returned by this method called in the same Transaction context must compare equal and return the same hashCode. The Transaction instance returned will be held as the key to an internal HashMap until the Transaction completes. If there is no transaction associated with the current thread, this method returns null.
int translateStatus(int st)
This method is used during afterCompletion callbacks to translate
the parameter value passed by the application server to the
afterCompletion method. The return value must be one of:
javax.transaction.Status.STATUS_COMMITTED or
javax.transaction.Status.STATUS_ROLLED_BACK.
st - local Status valuePersistenceManagerFactory replaceInternalPersistenceManagerFactory(PersistenceManagerFactory pmf)
pmf - PersistenceManagerFactory instance to be replacedObject preInvoke(Object component)
component - an array of Objectsvoid postInvoke(Object im)
im - implementation-specific Objectvoid registerSynchronization(Transaction jta, Synchronization sync) throws RollbackException, SystemException
jta - the Transaction instance for the calling thread.sync - the internal Synchronization instance to register.javax.transaction.RollbackException.SystemExceptionRollbackExceptionConnection getConnection(Object resource, String username, char[] password) throws SQLException
resource - the application server specific resource.username - the resource username. If null, Connection is requested
without username and password validation.password - the password for the resource username.java.sql.SQLException.SQLExceptionConnection getNonTransactionalConnection(Object resource, String username, char[] password) throws SQLException
resource - the application server specific resource.username - the resource username. If null, Connection is requested
without username and password validation.password - the password for the resource username.java.sql.SQLException.SQLExceptionTransactionManager getLocalTransactionManager()
boolean isManaged()
Statement unwrapStatement(Statement stmt)
void setPersistenceManagerFactoryDefaults(PersistenceManagerFactory pmf)
pmf - the PersistenceManagerFactory.String getDDLNamePrefix(Object info)
info - the instance to use for the name generation.void registerApplicationLifeCycleEventListener(ApplicationLifeCycleEventListener listener)
listener - An instance of ApplicationLifeCycleEventListener.void notifyApplicationUnloaded(ClassLoader cl)
cl - An instance of the ClassLoader that loaded the application.Copyright © 2019. All rights reserved.