in src/main/java/org/apache/sling/launchpad/app/Main.java [347:423]
protected boolean doStart(final URL launcherJar) {
// prevent duplicate start
if ( this.started) {
info("Apache Sling has already been started", null);
return true;
}
info("Starting Apache Sling in " + slingHome, null);
this.started = true;
Loader loaderTmp = null;
try {
final File launchpadHome = getLaunchpadHome(slingHome,
commandLineArgs);
loaderTmp = new Loader(launchpadHome) {
@Override
protected void info(String msg) {
Main.info(msg, null);
}
};
} catch (IllegalArgumentException iae) {
error(
"Cannot launch: Launchpad folder cannot be used: "
+ iae.getMessage(), null);
return false;
}
this.loader = loaderTmp;
if (launcherJar != null) {
try {
loader.installLauncherJar(launcherJar);
} catch (IOException ioe) {
error("Cannot launch: Cannot install " + launcherJar
+ " for use", ioe);
return false;
}
} else {
info("No Launcher JAR to install", null);
}
Object object = null;
try {
object = loader.loadLauncher(SharedConstants.DEFAULT_SLING_MAIN);
} catch (IllegalArgumentException iae) {
error("Cannot launch: Failed loading Sling class "
+ SharedConstants.DEFAULT_SLING_MAIN, iae);
return false;
}
if (object instanceof Launcher) {
// configure the launcher
Launcher sling = (Launcher) object;
sling.setNotifiable(new Notified());
sling.setCommandLine(commandLineArgs);
sling.setSlingHome(slingHome);
// launch it
info("Starting launcher ...", null);
if (sling.start()) {
info("Startup completed", null);
this.sling = sling;
addShutdownHook();
return true;
}
error("Cannot launch: Launcher.start() returned false", null);
} else {
error("Cannot launch: Class " + SharedConstants.DEFAULT_SLING_MAIN + " is not a Launcher class", null);
}
return false;
}