if (!debug^nodebug && framework == null) {
System.out.printf("Current OSGi framework is %s%n", getFramework().getName());
return null;
}
Framework frwk = null;
if (framework != null) {
if (!Felix.NAME.equalsIgnoreCase(framework) && !Equinox.NAME.equalsIgnoreCase(framework)) {
System.err.printf("Unsupported framework: %s%n", framework);
return null;
}
if (Felix.NAME.equalsIgnoreCase(framework))
frwk = new Felix(new File(KARAF_BASE));
else
frwk = new Equinox(new File(KARAF_BASE));
Properties props = new Properties(new File(System.getProperty("karaf.base"), "etc/config.properties"));
props.put("karaf.framework", framework.toLowerCase());
props.save();
}
if (debug) {
if (frwk == null)
frwk = getFramework();
System.out.printf("Enabling debug for OSGi framework (%s)%n", frwk.getName());
frwk.enableDebug(new File(KARAF_BASE));
}
if (nodebug) {
if (frwk == null)
frwk = getFramework();
System.out.printf("Disabling debug for OSGi framework (%s)%n", frwk.getName());
frwk.disableDebug(new File(KARAF_BASE));
}
return null;
}