// And do this only one time.
enhanceSuperClass(classAnnotationMetadata, null);
// Create ClassReader/Writer
ClassReader cr = getClassReader(classAnnotationMetadata);
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
InterceptorClassAdapter cv = new InterceptorClassAdapter(classAnnotationMetadata, cw);
InjectionClassAdapter cv2 = new InjectionClassAdapter(classAnnotationMetadata, cv, this.map, null, false);
cr.accept(cv2, 0);
classAnnotationMetadata.setModified();
defineClass(this.loader, classAnnotationMetadata.getClassName().replace("/", "."), cw.toByteArray());
}
}
// search all beans
logger.info("Beans found are {0}", this.ejbJarAnnotationMetadata.getBeanNames());
List<String> beanNames = this.ejbJarAnnotationMetadata.getBeanNames();
for (String beanName : beanNames) {
for (EasyBeansEjbJarClassMetadata classAnnotationMetadata : this.ejbJarAnnotationMetadata
.getClassesForBean(beanName)) {
if (classAnnotationMetadata.isBean()) {
// First, enhance all super classes of the bean. (if any)
// And do this only one time.
enhanceSuperClass(classAnnotationMetadata, classAnnotationMetadata);
//logger.info("Enhancement of {0} done !", classAnnotationMetadata);
// Create ClassReader/Writer
ClassReader cr = getClassReader(classAnnotationMetadata);
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
BeanClassAdapter cv = new BeanClassAdapter(classAnnotationMetadata, cw);
InterceptorClassAdapter itcpClassAdapter = new InterceptorClassAdapter(classAnnotationMetadata, cv);
InjectionClassAdapter cv2 = new InjectionClassAdapter(classAnnotationMetadata, itcpClassAdapter, this.map,
classAnnotationMetadata, false);
ClassVisitor beanVisitor = cv2;
// EJb 2.1 view ?
if (classAnnotationMetadata.getRemoteHome() != null || classAnnotationMetadata.getLocalHome() != null) {
Migration21ClassAdapter ejb21Adapter = new Migration21ClassAdapter(classAnnotationMetadata, cv2);
beanVisitor = ejb21Adapter;
}
cr.accept(beanVisitor, 0);
// define subclasses if interceptor enabled
loadDefinedClasses(this.loader, itcpClassAdapter.getDefinedClasses());
defineClass(this.loader, classAnnotationMetadata.getClassName().replace("/", "."), cw.toByteArray());
}
}
}
}