Package org.apache.felix.framework.util

Examples of org.apache.felix.framework.util.StringMap


        {
            return;
        }

        // Setup OSGi configuration propery map
        StringMap configMap = new StringMap(false);

        // Add the bundle provided service interface package and the core OSGi
        // packages to be exported from the class path via the system bundle.
        configMap.put(FRAMEWORK_SYSTEMPACKAGES,
                "org.osgi.framework; version=1.3.0," +
                "org.osgi.service.packageadmin; version=1.2.0," +
                "org.osgi.service.startlevel; version=1.0.0," +
                "org.osgi.service.url; version=1.0.0," +
                "org.osgi.util.tracker; version=1.0.0," +
                "org.apache.qpid.junit.extensions.util; " + QPID_VER_SUFFIX +
                "org.apache.qpid; " + QPID_VER_SUFFIX +
                "org.apache.qpid.common; " + QPID_VER_SUFFIX +
                "org.apache.qpid.exchange; " + QPID_VER_SUFFIX +
                "org.apache.qpid.framing; " + QPID_VER_SUFFIX +
                "org.apache.qpid.management.common.mbeans.annotations; " + QPID_VER_SUFFIX +
                "org.apache.qpid.protocol; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.binding; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.configuration; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.configuration.plugins; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.configuration.management; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.exchange; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.logging; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.logging.actors; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.logging.subjects; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.management; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.persistent; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.plugins; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.protocol; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.queue; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.registry; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.security; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.security.access; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.security.access.plugins; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.virtualhost; " + QPID_VER_SUFFIX +
                "org.apache.qpid.server.virtualhost.plugins; " + QPID_VER_SUFFIX +
                "org.apache.qpid.util; " + QPID_VER_SUFFIX +
                "org.apache.commons.configuration; version=1.0.0," +
                "org.apache.commons.lang; version=1.0.0," +
                "org.apache.commons.lang.builder; version=1.0.0," +
                "org.apache.commons.logging; version=1.0.0," +
                "org.apache.log4j; version=1.2.12," +
                "javax.management.openmbean; version=1.0.0," +
                "javax.management; version=1.0.0"
            );
       
        // No automatic shutdown hook
        configMap.put("felix.shutdown.hook", "false");
       
        // Add system activator
        List<BundleActivator> activators = new ArrayList<BundleActivator>();
        _activator = new Activator();
        activators.add(_activator);
        configMap.put(SYSTEMBUNDLE_ACTIVATORS_PROP, activators);

        if (cachePath != null)
        {
            File cacheDir = new File(cachePath);
            if (!cacheDir.exists() && cacheDir.canWrite())
            {
                _logger.info("Creating plugin cache directory: " + cachePath);
                cacheDir.mkdir();
            }
           
            // Set plugin cache directory and empty it
            _logger.info("Cache bundles in directory " + cachePath);
            configMap.put(FRAMEWORK_STORAGE, cachePath);
        }
        configMap.put(FRAMEWORK_STORAGE_CLEAN, FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT);
       
        // Set directory with plugins to auto-deploy
        _logger.info("Auto deploying bundles from directory " + pluginPath);
        configMap.put(AUTO_DEPLOY_DIR_PROPERY, pluginPath);
        configMap.put(AUTO_DEPLOY_ACTION_PROPERY, AUTO_DEPLOY_INSTALL_VALUE + "," + AUTO_DEPLOY_START_VALUE);       
       
        // Start plugin manager and trackers
        _felix = new Felix(configMap);
        try
        {
View Full Code Here


        // workaround for log4j classloading issues
        System.setProperty("log4j.ignoreTCL", "true");
       
        // Create a case-insensitive configuration property map.
        Map configMap = new StringMap(false);
        configMap.putAll(config);
        // Configure the Felix instance to be embedded.

        // Explicitly specify the directory to use for caching bundles.
        String targetCache = "target/felix-cache/";
        String tempDir = System.getProperty("java.io.tmpdir");
        File targetDir = new File(tempDir, targetCache);
        File targetCacheDir = new File(targetDir, "cache");

        if (HostManager.isVirtualHostEnabled()) {
            // locate empty cache directory to use
            boolean proceed = false;
            int count = 0;
            while (!proceed) {
                // check for existing cache
                String dirName = "cache" + count;
                targetCacheDir = new File(targetDir, dirName);
                File[] bundles = targetCacheDir.listFiles();
                proceed = bundles == null || bundles.length <= 1;
                count++;
            }
        }
        // set configuration
        configMap.put("org.osgi.framework.storage", targetCacheDir.getAbsolutePath());
        configMap.put("felix.log.level", "0");
        configMap.put("org.osgi.framework.storage.clean", "onFirstInit");
        configMap.put("felix.cache.locking", "false");

        try {
            if (felix == null) {
                felix = new Felix(configMap);
                felix.start();
View Full Code Here

            // Add the bundle provided service interface package and the core OSGi
            // packages to be exported from the class path via the system bundle.

            // Setup OSGi configuration property map
            final StringMap configMap = new StringMap(false);
            configMap.put(FRAMEWORK_SYSTEMPACKAGES, OSGI_SYSTEM_PACKAGES);

            // No automatic shutdown hook
            configMap.put("felix.shutdown.hook", "false");

            // Add system activator
            List<BundleActivator> activators = new ArrayList<BundleActivator>();
            _activator = new Activator();
            activators.add(_activator);
            configMap.put(SYSTEMBUNDLE_ACTIVATORS_PROP, activators);

            if (cachePath != null)
            {
                File cacheDir = new File(cachePath);
                if (!cacheDir.exists() && cacheDir.canWrite())
                {
                    _logger.info("Creating plugin cache directory: " + cachePath);
                    cacheDir.mkdir();
                }

                // Set plugin cache directory and empty it
                _logger.info("Cache bundles in directory " + cachePath);
                configMap.put(FRAMEWORK_STORAGE, cachePath);
            }
            configMap.put(FRAMEWORK_STORAGE_CLEAN, FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT);

            // Set directory with plugins to auto-deploy
            _logger.info("Auto deploying bundles from directory " + pluginPath);
            configMap.put(AUTO_DEPLOY_DIR_PROPERY, pluginPath);
            configMap.put(AUTO_DEPLOY_ACTION_PROPERY, AUTO_DEPLOY_INSTALL_VALUE + "," + AUTO_DEPLOY_START_VALUE);

            // Start plugin manager
            _felix = new Felix(configMap);
            try
            {
View Full Code Here

        activations.add(activator);
        activations.add(main);

        try {
            // Start up the OSGI framework
            m_felix = new Felix(new StringMap(m_configProps, false), activations);
            m_felix.start();
        }
        catch (Exception ex) {
            System.err.println("Could not create framework: " + ex);
            ex.printStackTrace();
View Full Code Here

        activations.add(activator);
        activations.add(main);

        try {
            // Start up the OSGI framework
            m_felix = new Felix(new StringMap(m_configProps, false), activations);
            m_felix.start();
        }
        catch (Exception ex) {
            System.err.println("Could not create framework: " + ex);
            ex.printStackTrace();
View Full Code Here

    return (is14 ? configureFelix14X(ctr, params) : configureFelix10X_12X(ctr, params));
  }

  private Felix configureFelix10X_12X(Constructor ctr, Object[] params) throws Exception {
    // Create a case-insensitive property map
    Map configMap = new StringMap((Map) params[0], false);
    return (Felix) ctr.newInstance(new Object[] { configMap, params[1] });
  }
View Full Code Here

TOP

Related Classes of org.apache.felix.framework.util.StringMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.