X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms%2Fsrc%2Forg%2Fargeo%2Fcms%2Finternal%2Fkernel%2FActivator.java;h=1b21f56635f8885242cef1e26443b87a1708c9ab;hb=a4a78ecbc3cfd119477264534c7d0cab541ae6ad;hp=5ec9f5087649474b1fc9284a502a8956070412ef;hpb=6ddb7b6b224a00344a182761e42b2241a721224f;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms/src/org/argeo/cms/internal/kernel/Activator.java b/org.argeo.cms/src/org/argeo/cms/internal/kernel/Activator.java index 5ec9f5087..1b21f5663 100644 --- a/org.argeo.cms/src/org/argeo/cms/internal/kernel/Activator.java +++ b/org.argeo.cms/src/org/argeo/cms/internal/kernel/Activator.java @@ -2,6 +2,9 @@ package org.argeo.cms.internal.kernel; import java.util.UUID; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.security.SystemAuthentication; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; @@ -10,7 +13,13 @@ import org.osgi.framework.BundleContext; * access to kernel information for the rest of the bundle (and only it) */ public class Activator implements BundleActivator { - private final static String systemKey = UUID.randomUUID().toString(); + private final Log log = LogFactory.getLog(Activator.class); + + private final static String systemKey; + static { + systemKey = UUID.randomUUID().toString(); + System.setProperty(SystemAuthentication.SYSTEM_KEY_PROPERTY, systemKey); + } private static BundleContext bundleContext; private Kernel kernel; @@ -19,10 +28,13 @@ public class Activator implements BundleActivator { public void start(BundleContext context) throws Exception { assert bundleContext == null; assert kernel == null; - bundleContext = context; - kernel = new Kernel(bundleContext); - kernel.init(); + try { + kernel = new Kernel(); + kernel.init(); + } catch (Exception e) { + log.error("Cannot boot kernel", e); + } } @Override @@ -34,7 +46,9 @@ public class Activator implements BundleActivator { /** * Singleton interface to the {@link BundleContext} related to the calling - * thread. Can be used only within the CMS bundle. + * thread. + * + * @BundleScope */ public static BundleContext getBundleContext() { return bundleContext; @@ -43,9 +57,9 @@ public class Activator implements BundleActivator { /** * @return a String which is guaranteed to be unique between and constant * within a Java static context (typically a VM launch) + * @BundleScope */ public final static String getSystemKey() { return systemKey; } - }