1 package org
.argeo
.cms
.internal
.kernel
;
5 import org
.apache
.commons
.logging
.Log
;
6 import org
.apache
.commons
.logging
.LogFactory
;
7 import org
.osgi
.framework
.BundleActivator
;
8 import org
.osgi
.framework
.BundleContext
;
11 * Activates the {@link Kernel} from the provided {@link BundleContext}. Gives
12 * access to kernel information for the rest of the bundle (and only it)
14 public class Activator
implements BundleActivator
{
15 public final static String SYSTEM_KEY_PROPERTY
= "argeo.security.systemKey";
16 private final Log log
= LogFactory
.getLog(Activator
.class);
18 private final static String systemKey
;
20 systemKey
= UUID
.randomUUID().toString();
21 System
.setProperty(SYSTEM_KEY_PROPERTY
, systemKey
);
24 private static BundleContext bundleContext
;
25 private static Kernel kernel
;
28 public void start(BundleContext context
) throws Exception
{
29 assert bundleContext
== null;
30 assert kernel
== null;
31 bundleContext
= context
;
33 kernel
= new Kernel();
35 } catch (Exception e
) {
36 log
.error("Cannot boot kernel", e
);
41 public void stop(BundleContext context
) throws Exception
{
48 * Singleton interface to the {@link BundleContext} related to the calling
53 public static BundleContext
getBundleContext() {
57 public static KernelHeader
getKernelHeader() {
62 * @return a String which is guaranteed to be unique between and constant
63 * within a Java static context (typically a VM launch)
66 public final static String
getSystemKey() {