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

ResourceContainerContextImpl

public class ResourceContainerContextImpl extends AnnotationContext implements ResourceContainerContext, ComponentContext, HandlerContext, ServiceReferenceContainerContext
This provides an abstraction for handle resource references.
Author
Shing Wai Chan

Fields Summary
protected com.sun.enterprise.deployment.Descriptor
descriptor
protected String
componentClassName
Constructors Summary
public ResourceContainerContextImpl()


       
    
public ResourceContainerContextImpl(com.sun.enterprise.deployment.Descriptor descriptor)

 
        this.descriptor = descriptor;         
    
Methods Summary
public voidaddEjbReferenceDescriptor(com.sun.enterprise.deployment.types.EjbReference ejbReference)
Add a reference to an ejb.

param
ejbReference the ejb reference

        getEjbReferenceContainer().addEjbReferenceDescriptor(ejbReference);
    
public voidaddEntityManagerFactoryReferenceDescriptor(com.sun.enterprise.deployment.EntityManagerFactoryReferenceDescriptor emfRefDesc)


        getEmfRefContainer().addEntityManagerFactoryReferenceDescriptor
            (emfRefDesc);

    
public voidaddEntityManagerReferenceDescriptor(com.sun.enterprise.deployment.EntityManagerReferenceDescriptor emRefDesc)


        getEmRefContainer().addEntityManagerReferenceDescriptor
            (emRefDesc);

    
public voidaddEnvEntryDescriptor(com.sun.enterprise.deployment.EnvironmentProperty envEntry)


        getEnvEntryContainer().addEnvironmentProperty(envEntry);

    
public voidaddJmsDestinationReferenceDescriptor(com.sun.enterprise.deployment.JmsDestinationReferenceDescriptor jmsDestReference)

        getJmsDestinationReferenceContainer(
        ).addJmsDestinationReferenceDescriptor(jmsDestReference);
    
public voidaddMessageDestinationReferenceDescriptor(com.sun.enterprise.deployment.MessageDestinationReferenceDescriptor msgDestReference)

        getMessageDestinationReferenceContainer(
        ).addMessageDestinationReferenceDescriptor(msgDestReference);
    
public voidaddPostConstructDescriptor(com.sun.enterprise.deployment.LifecycleCallbackDescriptor postConstructDesc)

param
postConstructDesc

        getPostConstructContainer().addPostConstructDescriptor(postConstructDesc);
    
public voidaddPreDestroyDescriptor(com.sun.enterprise.deployment.LifecycleCallbackDescriptor preDestroyDesc)

param
preDestroyDesc

        getPreDestroyContainer().addPreDestroyDescriptor(preDestroyDesc);
    
public voidaddResourceReferenceDescriptor(com.sun.enterprise.deployment.ResourceReferenceDescriptor resReference)

        getResourceReferenceContainer().addResourceReferenceDescriptor
            (resReference);
    
public java.lang.StringgetComponentClassName()

        return componentClassName;
    
public com.sun.enterprise.deployment.types.EjbReferencegetEjbReference(java.lang.String name)
Looks up an ejb reference with the given name. Return null if it is not found.

param
the name of the ejb-reference

        EjbReference ejbRef = null;
        try {
            ejbRef = getEjbReferenceContainer().getEjbReference(name);
            // annotation has a corresponding ejb-local-ref/ejb-ref
            // in xml.  Just add annotation info and continue.
            // This logic might change depending on overriding rules
            // and order in which annotations are read w.r.t. to xml.
            // E.g. sparse overriding in xml or loading annotations
            // first.  
        } catch(IllegalArgumentException e) {
            // DOL API is (unfortunately) defined to return 
            // IllegalStateException if name doesn't exist.
        }
        return ejbRef;
    
protected com.sun.enterprise.deployment.types.EjbReferenceContainergetEjbReferenceContainer()

        return (EjbReferenceContainer)descriptor;
    
protected com.sun.enterprise.deployment.WritableJndiNameEnvironmentgetEmRefContainer()

        return (WritableJndiNameEnvironment)descriptor;
    
protected com.sun.enterprise.deployment.WritableJndiNameEnvironmentgetEmfRefContainer()

        return (WritableJndiNameEnvironment)descriptor;
    
public com.sun.enterprise.deployment.EntityManagerFactoryReferenceDescriptorgetEntityManagerFactoryReference(java.lang.String name)


        EntityManagerFactoryReferenceDescriptor emfRefDesc = null;

        try {
            emfRefDesc = getEmfRefContainer().
                getEntityManagerFactoryReferenceByName(name);
            // annotation has a corresponding entry
            // in xml.  Just add annotation info and continue.
            // This logic might change depending on overriding rules
            // and order in which annotations are read w.r.t. to xml.
            // E.g. sparse overriding in xml or loading annotations
            // first.  
        } catch(IllegalArgumentException e) {
            // DOL API is (unfortunately) defined to return 
            // IllegalStateException if name doesn't exist.
        }

        return emfRefDesc;

    
public com.sun.enterprise.deployment.EntityManagerReferenceDescriptorgetEntityManagerReference(java.lang.String name)


        EntityManagerReferenceDescriptor emRefDesc = null;

        try {
            emRefDesc = getEmRefContainer().
                getEntityManagerReferenceByName(name);
            // annotation has a corresponding entry
            // in xml.  Just add annotation info and continue.
            // This logic might change depending on overriding rules
            // and order in which annotations are read w.r.t. to xml.
            // E.g. sparse overriding in xml or loading annotations
            // first.  
        } catch(IllegalArgumentException e) {
            // DOL API is (unfortunately) defined to return 
            // IllegalStateException if name doesn't exist.
        }

        return emRefDesc;

    
public com.sun.enterprise.deployment.EnvironmentPropertygetEnvEntry(java.lang.String name)

        EnvironmentProperty envEntry = null;
        try {
            envEntry = getEnvEntryContainer().
                getEnvironmentPropertyByName(name);
            // annotation has a corresponding env-entry
            // in xml.  Just add annotation info and continue.
            // This logic might change depending on overriding rules
            // and order in which annotations are read w.r.t. to xml.
            // E.g. sparse overriding in xml or loading annotations
            // first.  
        } catch(IllegalArgumentException e) {
            // DOL API is (unfortunately) defined to return 
            // IllegalStateException if name doesn't exist.
        }
        return envEntry;

    
protected com.sun.enterprise.deployment.WritableJndiNameEnvironmentgetEnvEntryContainer()

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

        // by default return null; appropriate contextx should override this
        return null;
    
public com.sun.enterprise.deployment.JmsDestinationReferenceDescriptorgetJmsDestinationReference(java.lang.String name)

        JmsDestinationReferenceDescriptor jmsDestRef = null;
        try {
            jmsDestRef = getJmsDestinationReferenceContainer().
                getJmsDestinationReferenceByName(name);
            // annotation has a corresponding resource-env-ref
            // in xml.  Just add annotation info and continue.
            // This logic might change depending on overriding rules
            // and order in which annotations are read w.r.t. to xml.
            // E.g. sparse overriding in xml or loading annotations
            // first.  
        } catch(IllegalArgumentException e) {
            // DOL API is (unfortunately) defined to return
            // IllegalStateException if name doesn't exist.
        }
        return jmsDestRef;
    
protected com.sun.enterprise.deployment.WritableJndiNameEnvironmentgetJmsDestinationReferenceContainer()

        return (WritableJndiNameEnvironment)descriptor;
    
public com.sun.enterprise.deployment.MessageDestinationReferenceDescriptorgetMessageDestinationReference(java.lang.String name)

        MessageDestinationReferenceDescriptor msgDestRef = null;
        try {
            msgDestRef = getMessageDestinationReferenceContainer().
                getMessageDestinationReferenceByName(name);
            // annotation has a corresponding message-destination-ref
            // in xml.  Just add annotation info and continue.
            // This logic might change depending on overriding rules
            // and order in which annotations are read w.r.t. to xml.
            // E.g. sparse overriding in xml or loading annotations
            // first.  
        } catch(IllegalArgumentException e) {
            // DOL API is (unfortunately) defined to return 
            // IllegalStateException if name doesn't exist.
        }
        return msgDestRef;
    
protected com.sun.enterprise.deployment.types.MessageDestinationReferenceContainergetMessageDestinationReferenceContainer()

        return (MessageDestinationReferenceContainer)descriptor;
    
public com.sun.enterprise.deployment.LifecycleCallbackDescriptorgetPostConstruct(java.lang.String className)
Look up an post-construct LifecycleCallbackDescriptor with the given name. Return null if it is not found

param
className

        LifecycleCallbackDescriptor postConstructDesc = 
            getPostConstructContainer().getPostConstructDescriptorByClass(className);
        return postConstructDesc;
    
protected com.sun.enterprise.deployment.WritableJndiNameEnvironmentgetPostConstructContainer()

        return (WritableJndiNameEnvironment)descriptor;
    
public com.sun.enterprise.deployment.LifecycleCallbackDescriptorgetPreDestroy(java.lang.String className)
Look up an pre-destroy LifecycleCallbackDescriptor with the given name. Return null if it is not found

param
className

        LifecycleCallbackDescriptor preDestroyDesc = 
            getPreDestroyContainer().getPreDestroyDescriptorByClass(className);
        return preDestroyDesc;
    
protected com.sun.enterprise.deployment.WritableJndiNameEnvironmentgetPreDestroyContainer()

        return (WritableJndiNameEnvironment)descriptor;
    
public com.sun.enterprise.deployment.ResourceReferenceDescriptorgetResourceReference(java.lang.String name)
Looks up an resource reference with the given name. Return null if it is not found.

param
the name of the resource-reference

        ResourceReferenceDescriptor resourceRef = null;
        try {
            resourceRef = getResourceReferenceContainer().
                getResourceReferenceByName(name);
            // annotation has a corresponding resource-ref
            // in xml.  Just add annotation info and continue.
            // This logic might change depending on overriding rules
            // and order in which annotations are read w.r.t. to xml.
            // E.g. sparse overriding in xml or loading annotations
            // first.  
        } catch(IllegalArgumentException e) {
            // DOL API is (unfortunately) defined to return 
            // IllegalStateException if name doesn't exist.
        }
        return resourceRef;
    
protected com.sun.enterprise.deployment.types.ResourceReferenceContainergetResourceReferenceContainer()

        return (ResourceReferenceContainer)descriptor;
    
public com.sun.enterprise.deployment.types.ServiceReferenceContainer[]getServiceRefContainers()

        // by default we return our descriptor;
        ServiceReferenceContainer[] containers = new ServiceReferenceContainer[1];
        containers[0] = (ServiceReferenceContainer) descriptor;
        return containers;