1 6 7 package fr.emn.info.eaop; 8 9 import fr.emn.info.eaop.instrumentation.SelectiveInstrumentation; 10 11 import java.io.*; 12 import java.net.*; 13 14 import recoder.java.declaration.*; 15 16 29 public class IO { 30 private static SelectiveInstrumentation instrumentationContext = null; 31 32 public static void initializeSelectiveInstrumentation() { 33 if (instrumentationContext == null) { 34 try { 35 ClassLoader cl = IO.class.getClassLoader(); 36 Class instrClass = cl.loadClass("TestInstrumentation"); 37 instrumentationContext = 38 (SelectiveInstrumentation) instrClass.newInstance(); 39 } catch (Exception e) { 40 IO.fail(e, "[setup] Class loading failed"); 41 } 42 } 43 } 44 45 public static SelectiveInstrumentation getInstrumentationContext() { 46 return instrumentationContext; 47 } 48 49 public static void warn(String message) { 50 System.err.println(message); 51 } 52 53 public static void fail(String message) { 54 System.err.println(message); 55 System.exit(1); 56 } 57 58 public static void fail(Exception e, String message) { 59 e.printStackTrace(); 60 System.err.println(message); 61 System.exit(1); 62 } 63 64 } 65 | Popular Tags |