1 23 24 package com.sun.enterprise.appverification.factory; 25 26 import com.sun.enterprise.util.LocalStringManagerImpl; 27 28 import java.util.logging.*; 30 import com.sun.logging.*; 31 33 37 public abstract class AppVerification { 38 39 static Logger _logger=LogDomains.getLogger(LogDomains.APPVERIFY_LOGGER); 41 43 private static boolean instrument_on = false; 44 private static boolean redeploy = false; 45 46 private static InstrumentLogger instrumentLogger; 47 private static LocalStringManagerImpl localStrings = 48 new LocalStringManagerImpl(AppVerification.class); 49 50 public static void redeploy (boolean hasRedeploy) { 51 redeploy = hasRedeploy; 52 } 53 54 public static boolean hasRedeployed () { 55 return redeploy; 56 } 57 58 public static void setInstrument (boolean on) { 59 if (on && getInstrumentLogger() == null) { 60 instrument_on = false; 61 71 if (_logger.isLoggable(Level.FINE)){ 73 _logger.log(Level.FINE,localStrings.getLocalString( 74 "appverification.instrument.on.failed", 75 "J2EE instrumentation implementation class NOT defined.")); 76 _logger.log(Level.FINE,localStrings.getLocalString( 77 "appverification.instrument.off", 78 "J2EE Application Verification is OFF...")); 79 80 } 81 } else { 83 instrument_on = on; 84 if (instrument_on) { 85 92 if (_logger.isLoggable(Level.FINE)) 94 _logger.log(Level.FINE,localStrings.getLocalString( 95 "appverification.instrument.on", 96 "J2EE Application Verification {0} is ON...", 97 new Object [] {instrumentLogger.getVersion()})); 98 } 100 } 101 } 102 103 public static boolean doInstrument() { 104 return instrument_on; 105 } 106 107 public static InstrumentLogger getInstrumentLogger() { 108 if (instrumentLogger == null) { 109 String name = null; 110 Class cls = null; 111 try { 112 name = System.getProperty( 113 "j2ee.instrument.logger", 114 "com.sun.enterprise.appverification.tools.InstrumentLoggerImpl"); 115 cls = Class.forName(name); 116 if (cls != null) { 117 instrumentLogger = (InstrumentLogger)cls.newInstance(); 118 } 119 } catch (ClassNotFoundException e) { 120 127 _logger.log(Level.SEVERE,"appverification.class_notfound", new Object [] {name}); 129 } catch (InstantiationException e) { 131 138 _logger.log(Level.SEVERE,"appverification.class_instantiate_error", new Object [] {name}); 140 } catch (IllegalAccessException e) { 142 149 _logger.log(Level.SEVERE,"appverification.class_access_error", new Object [] {name}); 151 152 } 154 } 155 return instrumentLogger; 156 } 157 } 158 | Popular Tags |