Package org.osgi.framework.launch

Examples of org.osgi.framework.launch.FrameworkFactory


            InputStream is = classLoader.getResourceAsStream("META-INF/services/" + FrameworkFactory.class.getName());
            BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
            factoryClass = br.readLine();
            br.close();
        }
        FrameworkFactory factory = (FrameworkFactory) classLoader.loadClass(factoryClass).newInstance();
        framework = factory.newFramework(new StringMap(configProps, false));
        framework.start();
        processAutoProperties(framework.getBundleContext());
        // Start lock monitor
        new Thread() {
            public void run() {
View Full Code Here


    @Override
    public void execute(CrankstartContext crankstartContext, CrankstartCommandLine commandLine) throws Exception {
        // TODO this should work
        // FrameworkFactory frameworkFactory = java.util.ServiceLoader.load(FrameworkFactory.class).iterator().next();
        final FrameworkFactory frameworkFactory = (FrameworkFactory)getClass().getClassLoader().loadClass("org.apache.felix.framework.FrameworkFactory").newInstance();
        crankstartContext.setOsgiFramework(frameworkFactory.newFramework(crankstartContext.getOsgiFrameworkProperties()));
        crankstartContext.getOsgiFramework().start();
        final int nBundles = crankstartContext.getOsgiFramework().getBundleContext().getBundles().length;
        log.info("OSGi framework started, {} bundles installed", nBundles);
       
        // Unless specified otherwise, stop processing the crankstart file if this is not the first
View Full Code Here

            InputStream is = classLoader.getResourceAsStream("META-INF/services/" + FrameworkFactory.class.getName());
            BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
            factoryClass = br.readLine();
            br.close();
        }
        FrameworkFactory factory = (FrameworkFactory) classLoader.loadClass(factoryClass).newInstance();
        framework = factory.newFramework(new StringMap(configProps, false));
        framework.init();
        // Process properties
        loadStartupProperties(configProps);
        processAutoProperties(framework.getBundleContext());
       
View Full Code Here

        options.addOption("v", "verbose", false, "Verbose output");
    }

    public static void main(String[] args) throws Exception
    {
        FrameworkFactory factory = getFrameworkFactory();

        try
        {
            Parser parser = new PosixParser();
            CommandLine cl = parser.parse(options, args);

            if (cl.hasOption('?'))
            {
                printHelp();
            }
            else
            {
                verbose = cl.hasOption('v');

                Map<String, String> config = buildConfig(cl);

                framework = factory.newFramework(config);
                framework.init();
                framework.start();

                Server server = launch(cl);
View Full Code Here

        }

        try
        {
            // Create an instance of the framework.
            FrameworkFactory factory = getFrameworkFactory();
            m_fwk = factory.newFramework(configProps);
            // Initialize the framework, but don't start it yet.
            m_fwk.init();
            // Use the system bundle context to process the auto-deploy
            // and auto-install/auto-start properties.
            AutoProcessor.process(configProps, m_fwk.getBundleContext());
View Full Code Here

            }
        };
    }

    protected Framework createFramework(T conf) {
        FrameworkFactory factory = conf.getFrameworkFactory();
        if (factory == null)
            throw new IllegalStateException("Cannot obtain " + FrameworkFactory.class.getName());
        Map<String, String> config = conf.getFrameworkConfiguration();
        return factory.newFramework(config);
    }
View Full Code Here

    }

    private void launchOSGiFramework() throws Exception {
        // Start up the OSGI framework
        ServiceLoader<FrameworkFactory> loader = ServiceLoader.load(FrameworkFactory.class);
        FrameworkFactory factory = loader.iterator().next();
        framework = factory.newFramework(new StringMap(configProps, false));

        framework.init();

        BundleContext bundleContext = framework.getBundleContext();
View Full Code Here

        Map config = new HashMap(conf.getFrameworkConfiguration());
        if (config.get(FelixConstants.LOG_LOGGER_PROP) == null) {
            config.put(FelixConstants.LOG_LOGGER_PROP, logger);
        }

        FrameworkFactory factory = conf.getFrameworkFactory();
        return factory.newFramework(config);
    }
View Full Code Here

        List<File> bundleDirs = getBundleRepos();
        ArtifactResolver resolver = new SimpleMavenResolver(bundleDirs);

        // Start up the OSGI framework
        ClassLoader classLoader = createClassLoader(resolver);
        FrameworkFactory factory = loadFrameworkFactory(classLoader);
        framework = factory.newFramework(new StringMap(config.props, false));
        framework.init();
        framework.getBundleContext().addFrameworkListener(lockCallback);
        framework.start();

        FrameworkStartLevel sl = framework.adapt(FrameworkStartLevel.class);
View Full Code Here

            InputStream is = classLoader.getResourceAsStream("META-INF/services/" + FrameworkFactory.class.getName());
            BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
            factoryClass = br.readLine();
            br.close();
        }
        FrameworkFactory factory = (FrameworkFactory) classLoader.loadClass(factoryClass).newInstance();
        return factory;
    }
View Full Code Here

TOP

Related Classes of org.osgi.framework.launch.FrameworkFactory

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.