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.Stateless ; 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 StatelessHandler extends AbstractEjbHandler { 43 44 45 public StatelessHandler() { 46 } 47 48 51 public Class <? extends Annotation > getAnnotationType() { 52 return Stateless .class; 53 } 54 55 60 protected String getAnnotatedName(Annotation annotation) { 61 Stateless slAn = (Stateless )annotation; 62 return slAn.name(); 63 } 64 65 71 protected boolean isValidEjbDescriptor(EjbDescriptor ejbDesc, 72 Annotation annotation) { 73 return EjbSessionDescriptor.TYPE.equals(ejbDesc.getType()); 74 } 75 76 82 protected EjbDescriptor createEjbDescriptor(String elementName, 83 AnnotationInfo ainfo) throws AnnotationProcessorException { 84 85 AnnotatedElement ae = ainfo.getAnnotatedElement(); 86 Class ejbClass = (Class )ae; 87 EjbSessionDescriptor newDescriptor = new EjbSessionDescriptor(); 88 newDescriptor.setName(elementName); 89 newDescriptor.setEjbClassName(ejbClass.getName()); 90 newDescriptor.setSessionType(EjbSessionDescriptor.STATELESS); 91 return newDescriptor; 92 } 93 94 102 protected HandlerProcessingResult setEjbDescriptorInfo( 103 EjbDescriptor ejbDesc, AnnotationInfo ainfo) 104 throws AnnotationProcessorException { 105 106 EjbSessionDescriptor ejbSessionDesc = (EjbSessionDescriptor)ejbDesc; 107 ejbSessionDesc.setStateless(true); 108 109 Stateless sless = (Stateless ) ainfo.getAnnotation(); 110 111 doDescriptionProcessing(sless.description(), ejbDesc); 112 doMappedNameProcessing(sless.mappedName(), ejbDesc); 113 114 return setBusinessAndHomeInterfaces(ejbDesc, ainfo); 115 } 116 } 117 | Popular Tags |