FileDocCategorySizeDatePackage
EJBLocalHomeImpl.javaAPI DocGlassfish v2 API6639Fri May 04 22:32:58 BST 2007com.sun.ejb.containers

EJBLocalHomeImpl

public abstract class EJBLocalHomeImpl extends Object implements com.sun.ejb.spi.io.IndirectlySerializable, EJBLocalHome
Implementation of the EJBLocalHome interface. This class is also the base class for all generated concrete EJBLocalHome implementations. At deployment time, one instance of the EJBLocalHome is created for each EJB class in a JAR that has a local home.
author
Mahesh Kannan

Fields Summary
protected BaseContainer
container
private static final Logger
_logger
Constructors Summary
Methods Summary
protected final EJBLocalObjectImplcreateEJBLocalBusinessObjectImpl()
Create a new EJBLocalBusinessObjectImpl and new EJB if necessary.

        return container.createEJBLocalBusinessObjectImpl();
    
protected final EJBLocalObjectImplcreateEJBLocalObjectImpl()
Create a new EJBLocalObjectImpl and new EJB if necessary. This is called from the concrete "HelloEJBHomeImpl" create method. Return the EJBObjectImpl for the bean.

        return container.createEJBLocalObjectImpl();
    
protected final BaseContainergetContainer()
Called from concrete EJBLocalHome implementation.

        return container;
    
protected EJBLocalHomegetEJBLocalHome()
Get the EJBLocalHome corresponding to an EJBLocalHomeImpl. These objects are one and the same when the local home is generated, but distinct in the case of dynamic proxies. Therefore, code can't assume it can cast an EJBLocalHomeImpl to the EJBLocalHome that the client uses, and vice-versa. This is overridden in the InvocationHandler.

        return this;
    
public com.sun.ejb.spi.io.SerializableObjectFactorygetSerializableObjectFactory()

        return new SerializableLocalHome(
            container.getEjbDescriptor().getUniqueId());
    
public final voidremove(java.lang.Object primaryKey)
This is the implementation of the javax.ejb.EJBLocalHome remove method.

        if ( !(container instanceof EntityContainer) ) {
            // Session beans dont have primary keys. EJB2.0 Section 6.6.
            throw new RemoveException("Attempt to call remove(Object primaryKey) on a session bean.");
        }
        
        container.authorizeLocalMethod(BaseContainer.EJBLocalHome_remove_Pkey);
        
        Method method=null;
        try {
            method = EJBLocalHome.class.getMethod("remove",
                                                  new Class[]{Object.class});
        } catch ( NoSuchMethodException e ) {
            _logger.log(Level.FINE, "Exception in method remove()", e);
        }
        
        try {
            ((EntityContainer)container).removeBean(primaryKey, method, true);
        } catch(java.rmi.RemoteException re) {
            // This should never be thrown for local invocations, but it's
            // part of the removeBean signature.  If for some strange
            // reason it happens, convert to EJBException
            EJBException ejbEx =new EJBException("unexpected RemoteException");
            ejbEx.initCause(re);
            throw ejbEx;
        }
    
final voidsetContainer(BaseContainer c)
Called from BaseContainer only.

    
             
        
        container = c;