use of org.apache.sling.launchpad.api.StartupHandler in project sling by apache.
the class ServicesListener method notifyChange.
/**
* Notify of service changes from the listeners.
* If all services are available, register listener and pass resources
* to the OSGi installer.
*/
public synchronized void notifyChange() {
// check if all services are available
final OsgiInstaller installer = (OsgiInstaller) this.installerListener.getService();
final LaunchpadContentProvider lcp = (LaunchpadContentProvider) this.providerListener.getService();
final StartupHandler handler = (StartupHandler) this.startupListener.getService();
final SlingSettingsService settings = (SlingSettingsService) this.settingsListener.getService();
if (installer != null && lcp != null && handler != null && settings != null) {
if (!this.installed) {
this.installed = true;
this.launchpadListener = new LaunchpadListener(handler);
final Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(Constants.SERVICE_DESCRIPTION, "Apache Sling Launchpad Startup Listener");
props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
this.launchpadListenerReg = this.bundleContext.registerService(InstallationListener.class.getName(), launchpadListener, props);
LaunchpadConfigInstaller.install(installer, lcp, settings.getRunModes());
}
}
}
use of org.apache.sling.launchpad.api.StartupHandler in project sling by apache.
the class SlingSetupTest method setup.
@Before
public void setup() {
// In Sling launchpad 7 the SlingSettings service
// requires a StartupHandler, and that's usually provided
// by the launchpad bootstrap code. Supply our own so that
// everything starts properly.
// TODO should be provided by a utility/bootstrap bundle
final StartupHandler h = new StartupHandler() {
public void waitWithStartup(boolean b) {
}
public boolean isFinished() {
return true;
}
public StartupMode getMode() {
return StartupMode.INSTALL;
}
};
startupHandlerRegistration = bundleContext.registerService(StartupHandler.class.getName(), h, null);
}
use of org.apache.sling.launchpad.api.StartupHandler in project sling by apache.
the class ContentBundleTestBase method registerStartupHandler.
private void registerStartupHandler() {
// SLING-4917 (org.apache.sling.paxexam.util.SlingSetupTest)
// In Sling launchpad 7 the SlingSettings service
// requires a StartupHandler, and that's usually provided
// by the launchpad bootstrap code. Supply our own so that
// everything starts properly.
// TODO should be provided by a utility/bootstrap bundle
final StartupHandler h = new StartupHandler() {
public void waitWithStartup(boolean b) {
}
public boolean isFinished() {
return true;
}
public StartupMode getMode() {
return StartupMode.INSTALL;
}
};
bundleContext.registerService(StartupHandler.class.getName(), h, null);
}
Aggregations