FileDocCategorySizeDatePackage
ContainerHelper.javaAPI DocGlassfish v2 API11280Fri May 04 22:35:02 BST 2007com.sun.jdo.spi.persistence.support.sqlstore.ejb

ContainerHelper

public interface ContainerHelper
Provide an implementation that supports CMP integration with information required for such support. This is an interface that a helper class implements that is specific to an application server.

This interface 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 internal code 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 blackHerringContainerHelper implements ContainerHelper {
static CMPHelper.register(new blackHerringContainerHelper());
...
}

Fields Summary
Constructors Summary
Methods Summary
public voidassertValidLocalObject(java.lang.Object o, java.lang.Object container)
Called in a CMP-supported environment to verify that the specified object is of a valid local interface type. The Container instance is acquired via #getContainer(Object).

see
getContainer(Object)
param
o the instance to validate.
param
container a Container instance for the request.

public voidassertValidRemoteObject(java.lang.Object o, java.lang.Object container)
Called in a CMP-supported environment to verify that the specified object is of a valid remote interface type. The Container instance is acquired via #getContainer(Object).

see
getContainer(Object)
param
o the instance to validate.
param
container a Container instance for the request.

public voidbeginInternalTransaction(com.sun.jdo.api.persistence.support.PersistenceManager pm)
Called in a unspecified transaction context of a managed environment. According to p.364 of EJB 2.0 spec, CMP may need to manage its own transaction when its transaction attribute is NotSupported, Never, Supports.

param
pm PersistenceManager

public voidcommitInternalTransaction(com.sun.jdo.api.persistence.support.PersistenceManager pm)
Called in a unspecified transaction context of a managed environment. According to p.364 of EJB 2.0 spec, CMP may need to manage its own transaction when its transaction attribute is NotSupported, Never, Supports.

param
pm PersistenceManager

public java.lang.ObjectgetContainer(java.lang.Object info)
Called in a CMP-supported environment to get a Container helper instance that will be passed unchanged to the required methods. In a non-managed environment should not be called and throws JDOFatalInternalException. The info argument can be an array of Objects if necessary.

see
getEJBObject(Object, Object)
see
getEJBLocalObject(Object, Object)
see
getEJBLocalObject(Object, Object, EJBContext)
see
removeByEJBLocalObject(EJBLocalObject, Object)
see
removeByPK(Object, Object)
param
info Object with the request information that is application server specific.
throws
JDOFatalInternalException.
return
a Container instance as an Object.

public EJBLocalObjectgetEJBLocalObject(java.lang.Object pk, java.lang.Object container)
Called in a CMP-supported environment to get an EJBLocalObject reference for this primary key instance and Container instance. In a non-managed environment is not called. The Container instance is acquired via #getContainer(Object).

see
getContainer(Object)
param
pk the primary key instance.
param
container a Container instance for the request.
return
a corresponding EJBLocalObject (as an Object) instance to be used by the client.

public EJBLocalObjectgetEJBLocalObject(java.lang.Object pk, java.lang.Object container, EJBContext context)
Called in a CMP-supported environment to get an EJBLocalObject reference for this primary key instance, Container object, and EJBContext of the calling bean. Allows the container to check if this method is called during ejbRemove that is part of a cascade-delete remove. The Container instance is acquired via #getContainer(Object).

see
getContainer(Object)
param
pk the primary key instance.
param
container a Container instance for the request.
param
context an EJBContext of the calling bean.
return
a corresponding EJBLocalObject (as an Object) to be used by the client.

public EJBObjectgetEJBObject(java.lang.Object pk, java.lang.Object container)
Called in a CMP-supported environment to get an EJBObject reference for this primary key instance and Container instance. In a non-managed environment is not called. The Container instance is acquired via #getContainer(Object).

see
getContainerHelper(Object)
param
pk the primary key instance.
param
container a Container instance for the request.
return
a corresponding EJBObject instance (as an Object) to be used by the client.

public intgetNumericConverterPolicy(java.lang.Object container)
Called in CMP environment to get NumericConverter policy referenced by this Container instance.

see
getContainer(Object)
param
container a Container instance for the request
return
a valid NumericConverter policy type

public com.sun.jdo.api.persistence.support.PersistenceManagerFactorygetPersistenceManagerFactory(java.lang.Object container)
Called in a CMP environment to lookup PersistenceManagerFactory referenced by this Container instance as the CMP resource. The Container instance is acquired via #getContainer(Object).

see
getContainer(Object)
param
container a Container instance for the request.

public voidpreSelect(java.lang.Object container)
Called in a CMP supported environment. Notifies the container that ejbSelect had been called. The Container instance is acquired via #getContainer(Object).

see
getContainer(Object)
param
container a Container instance for the request.

public voidremoveByEJBLocalObject(EJBLocalObject ejb, java.lang.Object containerHelper)
Called in a CMP-supported environment to remove a bean for a given EJBLocalObject and Container instance. The Container instance is acquired via #getContainerHelper(Object).

see
getContainer(Object)
param
ejb the EJBLocalObject for the bean to be removed.
param
container a Container instance for the request.

public voidremoveByPK(java.lang.Object pk, java.lang.Object container)
Called in a CMP-supported environment to remove a bean for a given primary key and Container instance. The Container instance is acquired via #getContainer(Object).

see
getContainer(Object)
param
pk the primary key for the bean to be removed.
param
container a Container instance for the request.

public voidresumeCurrentTransaction(javax.transaction.Transaction tx)
Called from read-only beans to resume current transaction. This will guarantee that the transaction continues to run after read-only bean accessed its PersistenceManager.

param
tx - The javax.transaction.Transaction object that represents the transaction to be resumed.

public voidrollbackInternalTransaction(com.sun.jdo.api.persistence.support.PersistenceManager pm)
Called in a unspecified transaction context of a managed environment. According to p.364 of EJB 2.0 spec, CMP may need to manage its own transaction when its transaction attribute is NotSupported, Never, Supports.

param
pm PersistenceManager

public voidsetCascadeDeleteAfterSuperEJBRemove(EntityContext context)
Called in a CMP-supported environment to mark EntityContext as already removed during cascade-delete operation. The Container instance is acquired via #getContainer(Object). Called by the generated ejbRemove method before calling ejbRemove of the related beans (via removeByEJBLocalObject) that are to be cascade-deleted.

param
context the EntityContext of the bean beeing removed.

public javax.transaction.TransactionsuspendCurrentTransaction()
Called from read-only beans to suspend current transaction. This will guarantee that PersistenceManager is not bound to any transaction.

return
javax.transaction.Transaction object representing the suspended transaction. Returns null if the calling thread is not associated with a transaction.