1 8 package org.codehaus.aspectwerkz.hook; 9 10 import java.lang.instrument.Instrumentation ; 11 import java.lang.instrument.ClassFileTransformer ; 12 13 19 public class Agent { 20 21 24 private static Instrumentation s_instrumentation; 25 26 29 public static ClassFileTransformer s_transformer = new PreProcessorAdapter(); 30 31 34 public static void premain(String options, Instrumentation instrumentation) { 35 s_instrumentation = instrumentation; 36 s_instrumentation.addTransformer(s_transformer); 37 } 38 39 42 public static Instrumentation getInstrumentation() { 43 if (s_instrumentation == null) { 44 throw new UnsupportedOperationException ("Java 5 was not started with preMain -javaagent for AspectWerkz"); 45 } 46 return s_instrumentation; 47 } 48 49 } 50 | Popular Tags |