in eclipse/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java [88:158]
public void start(IProgressMonitor monitor) throws CoreException {
boolean success = false;
Result<ResourceProxy> result = null;
monitor = SubMonitor.convert(monitor, "Starting server", 10).setWorkRemaining(50);
Repository repository;
RepositoryInfo repositoryInfo;
try {
repository = ServerUtil.connectRepository(getServer(), monitor);
repositoryInfo = ServerUtil.getRepositoryInfo(getServer(), monitor);
} catch (CoreException e) {
setServerState(IServer.STATE_STOPPED);
throw e;
} catch (URISyntaxException e) {
setServerState(IServer.STATE_STOPPED);
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
}
monitor.worked(10); // 10/50 done
try (OsgiClient client = Activator.getDefault().getOsgiClientFactory().createOsgiClient(repositoryInfo)) {
try {
EmbeddedBundleLocator bundleLocator = Activator.getDefault().getEmbeddedBundleLocator();
installBundle(monitor,client, bundleLocator.getBundle(SUPPORT_SOURCE_BUNDLE_SYMBOLIC_NAME)); // 15/50 done
installBundle(monitor,client, bundleLocator.getBundle(SUPPORT_INSTALL_BUNDLE_SYMBOLIC_NAME)); // 20/50 done
} catch ( IOException | OsgiClientException e) {
Activator.getDefault().getPluginLogger()
.warn("Failed reading the installation support bundle", e);
}
try {
if (getServer().getMode().equals(ILaunchManager.DEBUG_MODE)) {
debuggerConnection = new JVMDebuggerConnection(client);
success = debuggerConnection.connectInDebugMode(launch, getServer(), SubMonitor.convert(monitor, 30));
// 50/50 done
} else {
Command<ResourceProxy> command = repository.newListChildrenNodeCommand("/");
result = command.execute();
success = result.isSuccess();
monitor.worked(30); // 50/50 done
}
if (success) {
setServerState(IServer.STATE_STARTED);
} else {
setServerState(IServer.STATE_STOPPED);
String message = "Unable to connect to the Server. Please make sure a server instance is running ";
if (result != null) {
message += " (" + result.toString() + ")";
}
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, message));
}
} catch ( CoreException | RuntimeException e ) {
setServerState(IServer.STATE_STOPPED);
throw e;
}
} catch (IOException e1) {
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error closing OSGi client", e1));
} finally {
monitor.done();
}
}