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

WebBundleContext

public class WebBundleContext extends ResourceContainerContextImpl
This ClientContext implementation holds a top level reference to the DOL Web BundleDescriptor which will be used to populate any information processed from the annotations.
author
Shing Wai Chan

Fields Summary
Constructors Summary
public WebBundleContext(com.sun.enterprise.deployment.WebBundleDescriptor webBundleDescriptor)

        super(webBundleDescriptor);
    
Methods Summary
public com.sun.enterprise.deployment.annotation.AnnotatedElementHandlercreateContextForWeb()
This method create a context for web component(s) by using descriptor(s) associated to given webComponet impl class. Return null if corresponding descriptor is not found.

        AnnotatedElement anTypeElement =
                this.getProcessingContext().getProcessor(
                ).getLastAnnotatedElement(ElementType.TYPE);
        WebComponentDescriptor[] webComps = null;
        if (anTypeElement != null) {
            String implClassName = ((Class)anTypeElement).getName();
            webComps = getDescriptor().getWebComponentByImplName(implClassName);
        }

        AnnotatedElementHandler aeHandler = null;
        if (webComps != null && webComps.length > 1) {
            aeHandler = new WebComponentsContext(webComps);
        } else if (webComps != null && webComps.length == 1) {
            aeHandler = new WebComponentContext(webComps[0]);
        }

        if (aeHandler != null) {
            // push a WebComponent(s)Context to stack
            this.getProcessingContext().pushHandler(aeHandler);
        }
        return aeHandler;
    
public com.sun.enterprise.deployment.WebBundleDescriptorgetDescriptor()

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

        if(serviceSideHandlerChain) {
            List<WebServiceEndpoint> result = new ArrayList<WebServiceEndpoint>();            
            for (WebServiceEndpoint endpoint : getDescriptor().getWebServices().getEndpoints()) {
                if (endpoint.getWebComponentImpl().getWebComponentImplementation().equals(declaringClass.getName())) {
                    result.add(endpoint);
                }
            }            
            return(result.toArray(new HandlerChainContainer[0]));
        } else {
            List<ServiceReferenceDescriptor> result = new ArrayList<ServiceReferenceDescriptor>();
            result.addAll(getDescriptor().getServiceReferenceDescriptors());
            return(result.toArray(new HandlerChainContainer[0]));
        }