FileDocCategorySizeDatePackage
EjbBundleContext.javaAPI DocGlassfish v2 API6616Fri May 04 22:31:32 BST 2007com.sun.enterprise.deployment.annotation.context

EjbBundleContext

public class EjbBundleContext extends ResourceContainerContextImpl
This ClientContext implementation holds a top level reference to the DOL EJB BundleDescriptor which will be used to populate any information processed from the annotations.
author
Jerome Dochez

Fields Summary
Constructors Summary
public EjbBundleContext(com.sun.enterprise.deployment.EjbBundleDescriptor descriptor)
Creates a new instance of EjbBundleContext

        super(descriptor);
    
Methods Summary
public com.sun.enterprise.deployment.annotation.AnnotatedElementHandlercreateContextForEjb()
This methods create a context for Ejb(s) by using descriptor(s) associated to given ejbClassName. Return null if corresponding descriptor is not found.

        Class ejbClass = (Class)this.getProcessingContext().getProcessor(
                ).getLastAnnotatedElement(ElementType.TYPE);
        EjbDescriptor[] ejbDescs = null;
        String ejbClassName = null;
        if (ejbClass != null) {
            ejbClassName = ejbClass.getName();
            ejbDescs = this.getDescriptor().getEjbByClassName(ejbClassName);
        }

        AnnotatedElementHandler aeHandler = null;
        if (ejbDescs != null && ejbDescs.length > 1) {
            aeHandler = new EjbsContext(ejbDescs, ejbClass);
        } else if (ejbDescs != null && ejbDescs.length == 1) {
            aeHandler = new EjbContext(ejbDescs[0], ejbClass);
        }

        if (aeHandler != null) {
            // push a EjbContext to stack
            this.getProcessingContext().pushHandler(aeHandler);
        }
        return aeHandler;
    
public com.sun.enterprise.deployment.annotation.AnnotatedElementHandlercreateContextForEjbInterceptor()
This methods create a context for EjbInterceptor associated to given className. Return null if corresponding descriptor is not found.

        Class interceptorClass =
                (Class)this.getProcessingContext().getProcessor(
                ).getLastAnnotatedElement(ElementType.TYPE);
        EjbInterceptor ejbInterceptor =
                this.getDescriptor().getInterceptorByClassName(
                interceptorClass.getName());
        
        AnnotatedElementHandler aeHandler = null;
        if (ejbInterceptor != null) {
            aeHandler = new EjbInterceptorContext(ejbInterceptor);
            // push a EjbInterceptorContext to stack
            this.getProcessingContext().pushHandler(aeHandler);
        }
        return aeHandler;
    
public com.sun.enterprise.deployment.EjbBundleDescriptorgetDescriptor()

        return (EjbBundleDescriptor)descriptor;
    
public com.sun.enterprise.deployment.types.HandlerChainContainer[]getHandlerChainContainers(boolean serviceSideHandlerChain, java.lang.Class declaringClass)

        if(serviceSideHandlerChain) {
            EjbDescriptor[] ejbs;
            if(declaringClass.isInterface()) {
                ejbs = getDescriptor().getEjbBySEIName(declaringClass.getName());
            } else {
                ejbs = getDescriptor().getEjbByClassName(declaringClass.getName());
            }
            List<WebServiceEndpoint> result = new ArrayList<WebServiceEndpoint>();
            for (EjbDescriptor ejb : ejbs) {
                result.addAll(getDescriptor().getWebServices().getEndpointsImplementedBy(ejb));
            }
            return(result.toArray(new HandlerChainContainer[0]));
        } else {
            List<ServiceReferenceDescriptor> result = new ArrayList<ServiceReferenceDescriptor>();
            result.addAll(getDescriptor().getServiceReferenceDescriptors());
            return(result.toArray(new HandlerChainContainer[0]));
        }
    
public com.sun.enterprise.deployment.types.ServiceReferenceContainer[]getServiceRefContainers()

        ServiceReferenceContainer[] container = 
                new ServiceReferenceContainer[getDescriptor().getEjbs().size()];
        ServiceReferenceContainer[] ret = 
                (ServiceReferenceContainer[])getDescriptor().getEjbs().toArray(container);
        return ret;