/** * Check if the given EjbDescriptor matches the given Annotation. * @param ejbDesc * @param annotation * @return boolean check for validity of EjbDescriptor */ protected boolean isValidEjbDescriptor(EjbDescriptor ejbDesc, Annotation annotation) { boolean isValid = EjbSessionDescriptor.TYPE.equals(ejbDesc.getType()); if( isValid ) { EjbSessionDescriptor sessionDesc = (EjbSessionDescriptor) ejbDesc; // Only check specific session-bean type if it's set in the descriptor. // Otherwise it was probably populated with a sparse ejb-jar.xml and // we'll set the type later. if( sessionDesc.isSessionTypeSet() && !sessionDesc.isStateless() ) { isValid = false; } } return isValid; }
/** * Check if the given EjbDescriptor matches the given Annotation. * @param ejbDesc * @param annotation * @return boolean check for validity of EjbDescriptor */ protected boolean isValidEjbDescriptor(EjbDescriptor ejbDesc, Annotation annotation) { boolean isValid = EjbSessionDescriptor.TYPE.equals(ejbDesc.getType()); if( isValid ) { EjbSessionDescriptor sessionDesc = (EjbSessionDescriptor) ejbDesc; // Only check specific session-bean type if it's set in the descriptor. // Otherwise it was probably populated with a sparse ejb-jar.xml and // we'll set the type later. if( sessionDesc.isSessionTypeSet() && !sessionDesc.isSingleton() ) { isValid = false; } } return isValid; }
/** * Check if the given EjbDescriptor matches the given Annotation. * @param ejbDesc * @param annotation * @return boolean check for validity of EjbDescriptor */ protected boolean isValidEjbDescriptor(EjbDescriptor ejbDesc, Annotation annotation) { boolean isValid = EjbSessionDescriptor.TYPE.equals(ejbDesc.getType()); if( isValid ) { EjbSessionDescriptor sessionDesc = (EjbSessionDescriptor) ejbDesc; // Only check specific session-bean type if it's set in the descriptor. // Otherwise it was probably populated with a sparse ejb-jar.xml and // we'll set the type later. if( sessionDesc.isSessionTypeSet() && !sessionDesc.isStateful() ) { isValid = false; } } return isValid; }
/** * 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 */ protected HandlerProcessingResult setEjbDescriptorInfo( EjbDescriptor ejbDesc, AnnotationInfo ainfo) throws AnnotationProcessorException { EjbSessionDescriptor ejbSessionDesc = (EjbSessionDescriptor)ejbDesc; // set session bean type in case it wasn't set in a sparse ejb-jar.xml. if( !ejbSessionDesc.isSessionTypeSet() ) { ejbSessionDesc.setSessionType(EjbSessionDescriptor.STATEFUL); } Stateful sful = (Stateful) ainfo.getAnnotation(); doDescriptionProcessing(sful.description(), ejbDesc); doMappedNameProcessing(sful.mappedName(), ejbDesc); return setBusinessAndHomeInterfaces(ejbDesc, 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 */ protected HandlerProcessingResult setEjbDescriptorInfo( EjbDescriptor ejbDesc, AnnotationInfo ainfo) throws AnnotationProcessorException { EjbSessionDescriptor ejbSessionDesc = (EjbSessionDescriptor)ejbDesc; // set session bean type in case it wasn't set in a sparse ejb-jar.xml. if( !ejbSessionDesc.isSessionTypeSet() ) { ejbSessionDesc.setSessionType(EjbSessionDescriptor.STATELESS); } Stateless sless = (Stateless) ainfo.getAnnotation(); doDescriptionProcessing(sless.description(), ejbDesc); doMappedNameProcessing(sless.mappedName(), ejbDesc); return setBusinessAndHomeInterfaces(ejbDesc, 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 */ protected HandlerProcessingResult setEjbDescriptorInfo( EjbDescriptor ejbDesc, AnnotationInfo ainfo) throws AnnotationProcessorException { EjbSessionDescriptor ejbSingletonDescriptor = (EjbSessionDescriptor) ejbDesc; Class ejbClass = (Class) ainfo.getAnnotatedElement(); Singleton singleton = (Singleton) ainfo.getAnnotation(); // set session bean type in case it wasn't set in a sparse ejb-jar.xml. if( !ejbSingletonDescriptor.isSessionTypeSet() ) { ejbSingletonDescriptor.setSessionType(EjbSessionDescriptor.SINGLETON); } doDescriptionProcessing(singleton.description(), ejbDesc); doMappedNameProcessing(singleton.mappedName(), ejbDesc); doSingletonSpecificProcessing(ejbSingletonDescriptor, ejbClass); return setBusinessAndHomeInterfaces(ejbDesc, ainfo); }
EjbSessionDescriptor sd = (EjbSessionDescriptor) ejbDescriptor; if( !sd.isSessionTypeSet() ) { throw new RuntimeException("Invalid ejb Descriptor. Session type not set for " + " ejb " + sd.getName() + " : " + sd);