* @author Patrick Linskey
*/
public class PCEnhancerAgent {
public static void premain(String args, Instrumentation inst) {
Options opts = Configurations.parseProperties(args);
if (opts.containsKey("ClassLoadEnhancement") ||
opts.containsKey("classLoadEnhancement")) {
if (opts.getBooleanProperty(
"ClassLoadEnhancement", "classLoadEnhancement", true))
registerClassLoadEnhancer(inst, opts);
}
else if (opts.containsKey("RuntimeEnhancement") ||
opts.containsKey("runtimeEnhancement")) {
// Deprecated property setting
if (opts.getBooleanProperty(
"RuntimeEnhancement", "runtimeEnhancement", true))
registerClassLoadEnhancer(inst, opts);
} else {
// if neither is set, then we should be turning it on. We need this
// logic instead of just a getBooleanProperty() because of the
// backwards-compat logic flow.
registerClassLoadEnhancer(inst, opts);
}
if (opts.getBooleanProperty(
"RuntimeRedefinition", "runtimeRedefinition", true)) {
InstrumentationFactory.setInstrumentation(inst);
} else {
InstrumentationFactory.setDynamicallyInstallAgent(false);
}