Improve subframework launch
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / internal / osgi / CmsActivator.java
index fe7c80d3b0b5c0a91fc2686cf48eebe4a52707d5..94b08da4d316a37d7d614c74904c91c09a72ced3 100644 (file)
@@ -21,19 +21,13 @@ import org.osgi.service.permissionadmin.PermissionInfo;
  */
 public class CmsActivator implements BundleActivator {
 //     private final static CmsLog log = CmsLog.getLog(CmsActivator.class);
+       private final static String PROP_ARGEO_OSGI_PARENT_UUID = "argeo.osgi.parent.uuid";
 
        // TODO make it configurable
        private boolean hardened = false;
 
        private static BundleContext bundleContext;
 
-       void init() {
-       }
-
-       void destroy() {
-               new GogoShellKiller().start();
-       }
-
        protected void initSecurity() {
                // code-level permissions
                String osgiSecurity = bundleContext.getProperty(Constants.FRAMEWORK_SECURITY);
@@ -96,15 +90,15 @@ public class CmsActivator implements BundleActivator {
                cmsState.start();
                bundleContext.registerService(new String[] { CmsState.class.getName(), NodeIdSupplier.class.getName() },
                                cmsState, null);
-               init();
-
        }
 
        @Override
        public void stop(BundleContext bc) throws Exception {
                try {
-                       destroy();
                        CmsStateImpl cmsState = (CmsStateImpl) getService(CmsState.class);
+                       String parentFrameworkuuid = bc.getProperty(PROP_ARGEO_OSGI_PARENT_UUID);
+                       if (parentFrameworkuuid == null)
+                               new GogoShellKiller().start();
                        cmsState.stop();
                } finally {
                        bundleContext = null;