1 27 package org.objectweb.speedo.generation.enhancer; 28 29 import org.objectweb.asm.ClassReader; 30 import org.objectweb.speedo.api.SpeedoException; 31 import org.objectweb.speedo.api.SpeedoProperties; 32 import org.objectweb.speedo.generation.api.SpeedoCompilerParameter; 33 import org.objectweb.speedo.generation.mivisitor.AbstractMetaInfoVisitor; 34 import org.objectweb.speedo.generation.mivisitor.MetaInfoVisitor; 35 import org.objectweb.speedo.metadata.SpeedoClass; 36 import org.objectweb.util.monolog.api.BasicLevel; 37 import org.objectweb.util.monolog.api.Logger; 38 39 public class MetaDataAnalyzer extends AbstractMetaInfoVisitor { 40 41 private Loader loader; 42 43 public MetaDataAnalyzer() { 44 super(); 45 loader = new Loader(); 46 } 47 48 public MetaDataAnalyzer(MetaInfoVisitor mim) { 49 super(mim); 50 loader = new Loader(); 51 } 52 53 private class Loader extends EnhancerComponent { 54 55 public boolean init() throws SpeedoException { 56 isSrcJar = false; 57 return true; 58 } 59 60 public void process() throws SpeedoException { 61 } 63 public void setLogger(Logger logger) { 64 this.logger = logger; 65 } 66 } 67 68 protected String getLoggerName() { 69 return SpeedoProperties.LOGGER_NAME + ".generation.enhancer.analyzer"; 70 } 71 72 public void setLogger(Logger logger) { 73 super.setLogger(logger); 74 loader.setLogger(logger); 75 } 76 77 public void visitCompilerParameter(SpeedoCompilerParameter scp) throws SpeedoException { 78 loader.setSpeedoCompilerParameter(scp); 79 super.visitCompilerParameter(scp); 80 } 81 82 public void visitClass(SpeedoClass sc) throws SpeedoException { 83 logger.log(BasicLevel.DEBUG, "MetaDataAnalyzer.visitClass(" + sc.getFQName() + ")"); 84 boolean isSrcJar = false; 85 SpeedoCompilerParameter _scp = loader.getSpeedoCompilerParameter(); 86 ClassReader cr = loader.loadJavaClass( 87 isSrcJar, 88 sc.jdoPackage.name + '.' + sc.name, 89 _scp.output, 90 false); 91 92 cr.accept(new ClassInfoAnalyzer( 93 loader, sc, _scp.getXmldescriptor().values(), logger), true); 94 super.visitClass(sc); 95 } 96 } 97 | Popular Tags |