FileDocCategorySizeDatePackage
StatefulHandler.javaAPI DocGlassfish v2 API5120Fri May 04 22:31:34 BST 2007com.sun.enterprise.deployment.annotation.handlers

StatefulHandler

public class StatefulHandler extends AbstractEjbHandler
This handler is responsible for handling the javax.ejb.Stateful
author
Shing Wai Chan

Fields Summary
Constructors Summary
public StatefulHandler()
Creates a new instance of StatefulHandler

    
Methods Summary
protected com.sun.enterprise.deployment.EjbDescriptorcreateEjbDescriptor(java.lang.String elementName, com.sun.enterprise.deployment.annotation.AnnotationInfo ainfo)
Create a new EjbDescriptor for a given elementName and AnnotationInfo.

param
elementName
param
ainfo
return
a new EjbDescriptor


        AnnotatedElement ae = ainfo.getAnnotatedElement();
        Class ejbClass = (Class)ae;
        EjbSessionDescriptor newDescriptor = new EjbSessionDescriptor();
        newDescriptor.setName(elementName);
        newDescriptor.setEjbClassName(ejbClass.getName());
        newDescriptor.setSessionType(EjbSessionDescriptor.STATEFUL);
        return newDescriptor;
    
protected java.lang.StringgetAnnotatedName(java.lang.annotation.Annotation annotation)
Return the name attribute of given annotation.

param
annotation
return
name

        Stateful sfAn = (Stateful)annotation;
        return sfAn.name();
    
public java.lang.ClassgetAnnotationType()

return
the annoation type this annotation handler is handling

        return Stateful.class;
    
protected booleanisValidEjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor ejbDesc, java.lang.annotation.Annotation annotation)
Check if the given EjbDescriptor matches the given Annotation.

param
ejbDesc
param
annotation
return
boolean check for validity of EjbDescriptor

        return EjbSessionDescriptor.TYPE.equals(ejbDesc.getType());
    
protected com.sun.enterprise.deployment.annotation.HandlerProcessingResultsetEjbDescriptorInfo(com.sun.enterprise.deployment.EjbDescriptor ejbDesc, com.sun.enterprise.deployment.annotation.AnnotationInfo ainfo)
Set Annotation information to Descriptor. This method will also be invoked for an existing descriptor with annotation as user may not specific a complete xml.

param
ejbDesc
param
ainfo
return
HandlerProcessingResult


        EjbSessionDescriptor ejbSessionDesc = (EjbSessionDescriptor)ejbDesc;
        ejbSessionDesc.setStateless(false);

        Stateful sful = (Stateful) ainfo.getAnnotation();
        doDescriptionProcessing(sful.description(), ejbDesc);
        doMappedNameProcessing(sful.mappedName(), ejbDesc);

        return setBusinessAndHomeInterfaces(ejbDesc, ainfo);