You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by to...@apache.org on 2018/11/27 09:19:37 UTC
[sling-whiteboard] branch master updated: Register the
StartupService once the framework is started
This is an automated email from the ASF dual-hosted git repository.
tomekr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git
The following commit(s) were added to refs/heads/master by this push:
new 0072880 Register the StartupService once the framework is started
0072880 is described below
commit 007288058ced5acc3b5ed72241c69d97c50e8a08
Author: Tomek Rękawek <to...@apache.org>
AuthorDate: Tue Nov 27 10:19:26 2018 +0100
Register the StartupService once the framework is started
---
.../launchpad/startupmanager/StartupListenerTracker.java | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/startupmanager/src/main/java/org/apache/sling/launchpad/startupmanager/StartupListenerTracker.java b/startupmanager/src/main/java/org/apache/sling/launchpad/startupmanager/StartupListenerTracker.java
index 532acf6..c7d55de 100644
--- a/startupmanager/src/main/java/org/apache/sling/launchpad/startupmanager/StartupListenerTracker.java
+++ b/startupmanager/src/main/java/org/apache/sling/launchpad/startupmanager/StartupListenerTracker.java
@@ -19,6 +19,7 @@ package org.apache.sling.launchpad.startupmanager;
import org.apache.sling.launchpad.api.StartupHandler;
import org.apache.sling.launchpad.api.StartupListener;
import org.apache.sling.launchpad.api.StartupMode;
+import org.apache.sling.launchpad.api.StartupService;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
@@ -31,6 +32,8 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.Hashtable;
+
public class StartupListenerTracker implements FrameworkListener, BundleListener {
private static final Logger log = LoggerFactory.getLogger(StartupListenerTracker.class);
@@ -95,6 +98,14 @@ public class StartupListenerTracker implements FrameworkListener, BundleListener
for (StartupListener listener : tracker.getServices(new StartupListener[0])) {
listener.startupFinished(startupMode);
}
+
+ StartupService startupService = new StartupService() {
+ @Override
+ public StartupMode getStartupMode() {
+ return startupMode;
+ }
+ };
+ bundleContext.registerService(StartupService.class, startupService, new Hashtable<String, Object>());
}
}