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.TransactionManagement ; 29 import javax.ejb.TransactionManagementType ; 30 31 import com.sun.enterprise.deployment.EjbDescriptor; 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 import com.sun.enterprise.deployment.annotation.context.EjbContext; 37 38 43 public class TransactionManagementHandler extends AbstractAttributeHandler { 44 45 public TransactionManagementHandler() { 46 } 47 48 51 public Class <? extends Annotation > getAnnotationType() { 52 return TransactionManagement .class; 53 } 54 55 protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, 56 EjbContext[] ejbContexts) throws AnnotationProcessorException { 57 58 TransactionManagement tmAn = (TransactionManagement )ainfo.getAnnotation(); 59 60 String tmType = 61 TransactionManagementType.CONTAINER.equals(tmAn.value())? 62 EjbDescriptor.CONTAINER_TRANSACTION_TYPE : 63 EjbDescriptor.BEAN_TRANSACTION_TYPE; 64 65 for (EjbContext ejbContext : ejbContexts) { 66 EjbDescriptor ejbDesc = ejbContext.getDescriptor(); 67 if (ejbDesc.getTransactionType() == null) { 69 ejbDesc.setTransactionType(tmType); 70 } 71 } 72 73 return getDefaultProcessedResult(); 74 } 75 76 81 public Class <? extends Annotation >[] getTypeDependencies() { 82 return getEjbAnnotationTypes(); 83 } 84 } 85 | Popular Tags |