public void launch()

in main/src/main/java/org/apache/servicemix/kernel/main/Main.java [151:213]


    public void launch() throws Exception {
        servicemixHome = getServiceMixHome();
        servicemixBase = getServiceMixBase(servicemixHome);

        //System.out.println("ServiceMix Home: "+main.servicemixHome.getPath());
        //System.out.println("ServiceMix Base: "+main.servicemixBase.getPath());

        System.setProperty(PROP_SERVICEMIX_HOME, servicemixHome.getPath());
        System.setProperty(PROP_SERVICEMIX_BASE, servicemixBase.getPath());

        // Load system properties.
        loadSystemProperties();

        // Read configuration properties.
        m_configProps = loadConfigProperties();

        // Copy framework properties from the system properties.
        Main.copySystemProperties(m_configProps);

        processSecurityProperties(m_configProps);

        m_configProps.setProperty(BundleCache.CACHE_ROOTDIR_PROP, servicemixBase.getPath() + "/data");
        m_configProps.setProperty(Constants.FRAMEWORK_STORAGE, "cache");

        // Register the Main class so that other bundles can inspect the command line args.
        BundleActivator activator = new BundleActivator() {
            private ServiceRegistration registration;

            public void start(BundleContext context) {
                registration = context.registerService(MainService.class.getName(), Main.this, null);
            }

            public void stop(BundleContext context) {
                registration.unregister();
                shutdown.countDown();
            }
        };
        List<BundleActivator> activations = new ArrayList<BundleActivator>();
        activations.add(this);
        activations.add(activator);

        m_configProps.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, activations);

        try {
            defaultStartLevel = Integer.parseInt(m_configProps.getProperty(Constants.FRAMEWORK_BEGINNING_STARTLEVEL));
            lockStartLevel = Integer.parseInt(m_configProps.getProperty(PROPERTY_LOCK_LEVEL, Integer.toString(lockStartLevel)));
            lockDelay = Integer.parseInt(m_configProps.getProperty(PROPERTY_LOCK_DELAY, Integer.toString(lockDelay)));
            m_configProps.setProperty(Constants.FRAMEWORK_BEGINNING_STARTLEVEL, Integer.toString(lockStartLevel));
            // Start up the OSGI framework
            m_felix = new Felix(new StringMap(m_configProps, false));
            m_felix.start();
            // Start lock monitor
            new Thread() {
                public void run() {
                    lock(m_configProps);
                }
            }.start();
        }
        catch (Exception ex) {
            setExitCode(-1);
            throw new Exception("Could not create framework", ex);
        }
    }