Interface ContainerHelper

  • All Known Implementing Classes:
    SunContainerHelper

    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());
        ...
     }
     
    • Method Detail

      • getEJBObject

        jakarta.ejb.EJBObject getEJBObject​(Object pk,
                                           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.
        Parameters:
        pk - the primary key instance.
        container - a Container instance for the request.
        Returns:
        a corresponding EJBObject instance (as an Object) to be used by the client.
        See Also:
        getContainer(java.lang.Object)
      • getEJBLocalObject

        jakarta.ejb.EJBLocalObject getEJBLocalObject​(Object pk,
                                                     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.
        Parameters:
        pk - the primary key instance.
        container - a Container instance for the request.
        Returns:
        a corresponding EJBLocalObject (as an Object) instance to be used by the client.
        See Also:
        getContainer(java.lang.Object)
      • getEJBLocalObject

        jakarta.ejb.EJBLocalObject getEJBLocalObject​(Object pk,
                                                     Object container,
                                                     jakarta.ejb.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.
        Parameters:
        pk - the primary key instance.
        container - a Container instance for the request.
        context - an EJBContext of the calling bean.
        Returns:
        a corresponding EJBLocalObject (as an Object) to be used by the client.
        See Also:
        getContainer(java.lang.Object)
      • removeByEJBLocalObject

        void removeByEJBLocalObject​(jakarta.ejb.EJBLocalObject ejb,
                                    Object containerHelper)
        Called in a CMP-supported environment to remove a bean for a given EJBLocalObject and Container instance.
        Parameters:
        ejb - the EJBLocalObject for the bean to be removed.
        containerHelper - a Container instance for the request.
        See Also:
        getContainer(java.lang.Object)
      • removeByPK

        void removeByPK​(Object pk,
                        Object container)
        Called in a CMP-supported environment to remove a bean for a given primary key and Container instance.
        Parameters:
        pk - the primary key for the bean to be removed.
        container - a Container instance for the request.
        See Also:
        getContainer(java.lang.Object)
      • assertValidLocalObject

        void assertValidLocalObject​(Object o,
                                    Object container)
        Called in a CMP-supported environment to verify that the specified object is of a valid local interface type.
        Parameters:
        o - the instance to validate.
        container - a Container instance for the request.
        See Also:
        getContainer(java.lang.Object)
      • assertValidRemoteObject

        void assertValidRemoteObject​(Object o,
                                     Object container)
        Called in a CMP-supported environment to verify that the specified object is of a valid remote interface type.
        Parameters:
        o - the instance to validate.
        container - a Container instance for the request.
        See Also:
        getContainer(java.lang.Object)
      • setCascadeDeleteAfterSuperEJBRemove

        void setCascadeDeleteAfterSuperEJBRemove​(jakarta.ejb.EntityContext context)
        Called in a CMP-supported environment to mark EntityContext as already removed during cascade-delete operation. Called by the generated ejbRemove method before calling ejbRemove of the related beans (via removeByEJBLocalObject) that are to be cascade-deleted.
        Parameters:
        context - the EntityContext of the bean beeing removed.
      • preSelect

        void preSelect​(Object container)
        Called in a CMP supported environment. Notifies the container that ejbSelect had been called.
        Parameters:
        container - a Container instance for the request.
        See Also:
        getContainer(java.lang.Object)
      • getPersistenceManagerFactory

        PersistenceManagerFactory getPersistenceManagerFactory​(Object container)
        Called in a CMP environment to lookup PersistenceManagerFactory referenced by this Container instance as the CMP resource.
        Parameters:
        container - a Container instance for the request.
        See Also:
        getContainer(java.lang.Object)
      • getNumericConverterPolicy

        int getNumericConverterPolicy​(Object container)
        Called in CMP environment to get NumericConverter policy referenced by this Container instance.
        Parameters:
        container - a Container instance for the request
        Returns:
        a valid NumericConverter policy type
        See Also:
        getContainer(java.lang.Object)
      • beginInternalTransaction

        void beginInternalTransaction​(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.
        Parameters:
        pm - PersistenceManager
      • commitInternalTransaction

        void commitInternalTransaction​(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.
        Parameters:
        pm - PersistenceManager
      • rollbackInternalTransaction

        void rollbackInternalTransaction​(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.
        Parameters:
        pm - PersistenceManager
      • suspendCurrentTransaction

        jakarta.transaction.Transaction suspendCurrentTransaction()
        Called from read-only beans to suspend current transaction. This will guarantee that PersistenceManager is not bound to any transaction.
        Returns:
        jakarta.transaction.Transaction object representing the suspended transaction. Returns null if the calling thread is not associated with a transaction.
      • resumeCurrentTransaction

        void resumeCurrentTransaction​(jakarta.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.
        Parameters:
        tx - - The jakarta.transaction.Transaction object that represents the transaction to be resumed.