org.apache.jdo.ejb
Class EJBImplHelper

java.lang.Object
  extended byorg.apache.jdo.ejb.EJBImplHelper

public class EJBImplHelper
extends java.lang.Object

Provides helper methods for a Forte for Java implementation with the application server specific information in the distributed transaction environment. Calls corresponding methods on the registered class which implements EJBHelper interface.

Author:
Marina Vatkina

Constructor Summary
EJBImplHelper()
           
 
Method Summary
static void delistBeforeCompletion(java.lang.Object im)
          Called a non-managed environment at the end of the Transaction.beforeCompletion() to de-register the component with the app server if necessary.
static java.lang.Object enlistBeforeCompletion(java.lang.Object component)
          Called at the beginning of the Transaction.beforeCompletion() to register the component with the app server if necessary.
static javax.transaction.Transaction getTransaction()
          Returns Transaction instance that can be used to register synchronizations.
static javax.transaction.UserTransaction getUserTransaction()
          Returns the UserTransaction associated with the calling thread.
static boolean isManaged()
          Identifies the managed environment behavior.
static void registerEJBHelper(EJBHelper h)
          Register class that implements EJBHelper interface Should be called by a static method at class initialization time.
static javax.jdo.PersistenceManagerFactory replacePersistenceManagerFactory(javax.jdo.PersistenceManagerFactory pmf)
          Returns the hashed instance of internal PersistenceManagerFactory that compares equal to the newly created instance or the instance itself if it is not found.
static int translateStatus(int st)
          Translates local representation of the Transaction Status to javax.transaction.Status value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EJBImplHelper

public EJBImplHelper()
Method Detail

registerEJBHelper

public static void registerEJBHelper(EJBHelper h)
Register class that implements EJBHelper interface Should be called by a static method at class initialization time.

Parameters:
h - application server specific implemetation of the EJBHelper interface.

getTransaction

public static javax.transaction.Transaction getTransaction()
Returns Transaction instance that can be used to register synchronizations. In a non-managed environment or if there is no transaction associated with the current thread, this method returns null.

Returns:
the Transaction instance for the calling thread
See Also:
EJBHelper.getTransaction()

getUserTransaction

public static javax.transaction.UserTransaction getUserTransaction()
Returns the UserTransaction associated with the calling thread. In a non-managed environment or if there is no transaction currently in progress, this method returns null.

Returns:
the UserTransaction instance for the calling thread
See Also:
EJBHelper.getUserTransaction()

isManaged

public static boolean isManaged()
Identifies the managed environment behavior.

Returns:
true if there is a helper class registered.

translateStatus

public static int translateStatus(int st)
Translates local representation of the Transaction Status to javax.transaction.Status value. In a non-managed environment returns the value passed to it as an argument.

Parameters:
st - Status value
Returns:
the javax.transaction.Status value of the status
See Also:
EJBHelper.translateStatus(int st)

replacePersistenceManagerFactory

public static javax.jdo.PersistenceManagerFactory replacePersistenceManagerFactory(javax.jdo.PersistenceManagerFactory pmf)
Returns the hashed instance of internal PersistenceManagerFactory that compares equal to the newly created instance or the instance itself if it is not found. In a non-managed environment returns the value passed to it as an argument.

Parameters:
pmf - PersistenceManagerFactory instance to be replaced
Returns:
the PersistenceManagerFactory known to the runtime
See Also:
EJBHelper.replacePersistenceManagerFactory( PersistenceManagerFactory pmf)

enlistBeforeCompletion

public static java.lang.Object enlistBeforeCompletion(java.lang.Object component)
Called at the beginning of the Transaction.beforeCompletion() to register the component with the app server if necessary. In a non-managed environment or if the delistBeforeCompletion method does not use the value, this method returns null.

Parameters:
component - an array of Objects
Returns:
implementation-specific Object
See Also:
EJBHelper.enlistBeforeCompletion(Object component)

delistBeforeCompletion

public static void delistBeforeCompletion(java.lang.Object im)
Called a non-managed environment at the end of the Transaction.beforeCompletion() to de-register the component with the app server if necessary.

Parameters:
im - implementation-specific Object
See Also:
EJBHelper.delistBeforeCompletion(Object im)


Copyright © 2005 Apache Software Foundation. All Rights Reserved.