1 23 package com.sun.enterprise.deployment.annotation.handlers; 24 25 import java.lang.annotation.Annotation ; 26 import java.lang.reflect.AnnotatedElement ; 27 28 import javax.ejb.Stateful ; 29 30 import com.sun.enterprise.deployment.EjbDescriptor; 31 import com.sun.enterprise.deployment.EjbSessionDescriptor; 32 33 import com.sun.enterprise.deployment.annotation.AnnotationInfo; 34 import com.sun.enterprise.deployment.annotation.AnnotationProcessorException; 35 import com.sun.enterprise.deployment.annotation.HandlerProcessingResult; 36 37 42 public class StatefulHandler extends AbstractEjbHandler { 43 44 45 public StatefulHandler() { 46 } 47 48 49 52 public Class <? extends Annotation > getAnnotationType() { 53 return Stateful .class; 54 } 55 56 61 protected String getAnnotatedName(Annotation annotation) { 62 Stateful sfAn = (Stateful )annotation; 63 return sfAn.name(); 64 } 65 66 72 protected boolean isValidEjbDescriptor(EjbDescriptor ejbDesc, 73 Annotation annotation) { 74 return EjbSessionDescriptor.TYPE.equals(ejbDesc.getType()); 75 } 76 77 83 protected EjbDescriptor createEjbDescriptor(String elementName, 84 AnnotationInfo ainfo) throws AnnotationProcessorException { 85 86 AnnotatedElement ae = ainfo.getAnnotatedElement(); 87 Class ejbClass = (Class )ae; 88 EjbSessionDescriptor newDescriptor = new EjbSessionDescriptor(); 89 newDescriptor.setName(elementName); 90 newDescriptor.setEjbClassName(ejbClass.getName()); 91 newDescriptor.setSessionType(EjbSessionDescriptor.STATEFUL); 92 return newDescriptor; 93 } 94 95 103 protected HandlerProcessingResult setEjbDescriptorInfo( 104 EjbDescriptor ejbDesc, AnnotationInfo ainfo) 105 throws AnnotationProcessorException { 106 107 EjbSessionDescriptor ejbSessionDesc = (EjbSessionDescriptor)ejbDesc; 108 ejbSessionDesc.setStateless(false); 109 110 Stateful sful = (Stateful ) ainfo.getAnnotation(); 111 doDescriptionProcessing(sful.description(), ejbDesc); 112 doMappedNameProcessing(sful.mappedName(), ejbDesc); 113 114 return setBusinessAndHomeInterfaces(ejbDesc, ainfo); 115 } 116 } 117 | Popular Tags |