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

EJBHomeImpl

public abstract class EJBHomeImpl extends Object implements javax.ejb.EJBHome
This class implements the EJBHome interface. This class is also the base class for all generated concrete EJBHome implementations. At deployment time, one instance of the EJBHome is created for each EJB class in a JAR that has a remote home.

Fields Summary
private static final Logger
_logger
private BaseContainer
container
Constructors Summary
protected EJBHomeImpl()
This constructor is called from an EJBHome implementation's constructor.


                  
     
         
    
    
Methods Summary
public final EJBObjectImplcreateEJBObjectImpl()
Create a new EJBObject and new EJB if necessary. This is called from the generated "HelloEJBHomeImpl" create method. Return the EJBObject for the bean.

        return container.createEJBObjectImpl();
    
public EJBObjectImplcreateRemoteBusinessObjectImpl()

        return container.createRemoteBusinessObjectImpl();
    
protected final ContainergetContainer()
Called from EJBHome implementation.

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

        return this;
    
public final EJBMetaDatagetEJBMetaData()
This is the implementation of the javax.ejb.EJBHome method.

        container.authorizeRemoteMethod(BaseContainer.EJBHome_getEJBMetaData);
        
        return container.getEJBMetaData();
    
public final HomeHandlegetHomeHandle()
This is the implementation of the javax.ejb.EJBHome getHomeHandle method.

        container.authorizeRemoteMethod(BaseContainer.EJBHome_getHomeHandle);
        
        return new HomeHandleImpl(container.getEJBHomeStub());
    
public final voidremove(Handle handle)
This is the implementation of the javax.ejb.EJBHome remove method.

exception
RemoveException on error during removal

        container.authorizeRemoteMethod(BaseContainer.EJBHome_remove_Handle);
        
        EJBObject ejbo;
        try {
            ejbo = handle.getEJBObject();
        } catch ( RemoteException ex ) {
            _logger.log(Level.FINE, "Exception in method remove()", ex);
            NoSuchObjectException nsoe = 
                new NoSuchObjectException(ex.toString());
            nsoe.initCause(ex);
            throw nsoe;
        }
        ejbo.remove();
    
public final voidremove(java.lang.Object primaryKey)
This is the implementation of the javax.ejb.EJBHome remove method.

exception
RemoveException on error during removal

        if ( !(container instanceof EntityContainer) ) {
            // Session beans dont have primary keys. EJB2.0 Section 6.6
            throw new RemoveException("Invalid remove operation.");
        }
        
        container.authorizeRemoteMethod(BaseContainer.EJBHome_remove_Pkey);
        
        Method method=null;
        try {
            method = EJBHome.class.getMethod("remove",
                        new Class[]{Object.class});
        } catch ( NoSuchMethodException e ) {
            _logger.log(Level.FINE, "Exception in method remove()", e);
        }
        
        ((EntityContainer)container).removeBean(primaryKey, method, false);
    
final voidsetContainer(BaseContainer c)
Called from BaseContainer only.

        container = c;