1 8 package org.codehaus.aspectwerkz.hook; 9 10 import org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper; 11 12 import java.lang.instrument.IllegalClassFormatException ; 13 import java.lang.instrument.ClassFileTransformer ; 14 import java.security.ProtectionDomain ; 15 16 21 public class PreProcessorAdapter implements ClassFileTransformer { 22 23 26 private static ClassPreProcessor s_preProcessor; 27 28 static { 29 try { 30 s_preProcessor = ClassPreProcessorHelper.getClassPreProcessor(); 31 } catch (Exception e) { 32 throw new ExceptionInInitializerError ("could not initialize JSR163 preprocessor due to: " + e.toString()); 33 } 34 } 35 36 46 public byte[] transform(ClassLoader loader, String className, Class <?> classBeingRedefined, 47 ProtectionDomain protectionDomain, byte[] bytes) throws IllegalClassFormatException { 48 if (classBeingRedefined == null) { 50 return s_preProcessor.preProcess(className, bytes, loader); 51 } else { 52 return bytes; 54 } 55 } 56 57 } 58 | Popular Tags |