Examples of Framework


Examples of org.osgi.framework.launch.Framework

        Properties props = new Properties();
        props.load(new FileInputStream(args[0]));
        Util.substVars(props);
        PrintStream out = new PrintStream(new FileOutputStream(args[1], true));
        long t0 = System.currentTimeMillis();
        Framework f = null;
        for (FrameworkFactory ff : ServiceLoader.load(FrameworkFactory.class)) {
            f = ff.newFramework(props);
            System.out.println("framework = " + f);
            break;
        }
        if (f == null) {
            throw new RuntimeException("no OSGi framework in classpath");
        }
        long t1 = System.currentTimeMillis();
        logger.log(Level.INFO, LogFacade.OSGI_LOCATE_TIME, (t1-t0));
        f.init();
        long t2 = System.currentTimeMillis();
        logger.log(Level.INFO, LogFacade.OSGI_INIT_TIME, (t2-t1));
        BundleProvisioner bundleProvisioner = createBundleProvisioner(f.getBundleContext(), props);
        bundleProvisioner.installBundles();
        long t3 = System.currentTimeMillis();
        logger.log(Level.INFO, LogFacade.BUNDLE_INSTALLATION_TIME, (t3-t2));
        int installed = bundleProvisioner.getNoOfInstalledBundles();
        int updated = bundleProvisioner.getNoOfUpdatedBundles();
        int uninstalled = bundleProvisioner.getNoOfUninstalledBundles();
        System.out.printf("installed = %d, updated = %d, uninstalled = %d\n", installed, updated, uninstalled);
        if (bundleProvisioner.hasAnyThingChanged()) {
            System.out.println("Refreshing framework");
            bundleProvisioner.refresh();
        }
        bundleProvisioner.startBundles();
        f.start();
        long t4 = System.currentTimeMillis();
        logger.log(Level.INFO, LogFacade.BUNDLE_STARTING_TIME, (t4-t3));
        logger.log(Level.INFO, LogFacade.TOTAL_START_TIME, (t4-t0));
        if (args.length == 3 && args[2].equalsIgnoreCase("wait-before-stopping")) {
            System.out.println("Hit enter to continue");
            System.in.read(); //
        }
        f.stop();
        f.waitForStop(0);
        long t5 = System.currentTimeMillis();
        logger.log(Level.INFO, LogFacade.BUNDLE_STOP_TIME, (t5 - t4));
        logger.log(Level.INFO, LogFacade.TOTAL_TIME, (t5-t0));
        out.printf("%d,%d,%d,%d,%d,%d,%d\n", t1-t0, t2-t1, t3-t2, t4-t3, t4-t0, t5-t4, t5-t0);
    }
View Full Code Here

Examples of org.osgi.framework.launch.Framework

        Properties props = new Properties();
        props.load(new FileInputStream(args[0]));
        Util.substVars(props);
        PrintStream out = new PrintStream(new FileOutputStream(args[1], true));
        long t0 = System.currentTimeMillis();
        Framework f = null;
        for (FrameworkFactory ff : ServiceLoader.load(FrameworkFactory.class)) {
            f = ff.newFramework(props);
            System.out.println("framework = " + f);
            break;
        }
        if (f == null) {
            throw new RuntimeException("no OSGi framework in classpath");
        }
        long t1 = System.currentTimeMillis();
        logger.logp(Level.INFO, "BundleProvisioner", "main", "timeTaken to locate OSGi framework = {0} ms",
                new Object[]{t1 - t0});
        f.init();
        long t2 = System.currentTimeMillis();
        logger.logp(Level.INFO, "BundleProvisioner", "main", "timeTaken to initialize OSGi framework = {0} ms",
                new Object[]{t2 - t1});
        BundleProvisioner bundleProvisioner = new BundleProvisioner(f.getBundleContext(), props);
        bundleProvisioner.installBundles();
        long t3 = System.currentTimeMillis();
        logger.logp(Level.INFO, "BundleProvisioner", "main", "timeTaken to finish installation of bundles = {0} ms",
                new Object[]{t3 - t2});
        int installed = bundleProvisioner.getNoOfInstalledBundles();
        int updated = bundleProvisioner.getNoOfUpdatedBundles();
        int uninstalled = bundleProvisioner.getNoOfUninstalledBundles();
        System.out.printf("installed %d, updated = %d, uninstalled = %d\n", installed, updated, uninstalled);
        if (bundleProvisioner.hasAnyThingChanged()) {
            System.out.println("Refreshing framework");
            bundleProvisioner.refresh();
        }
        bundleProvisioner.startBundles();
        f.start();
        long t4 = System.currentTimeMillis();
        logger.logp(Level.INFO, "BundleProvisioner", "main", "time taken to finish starting bundles = {0} ms",
                new Object[]{t4 - t3});
        logger.logp(Level.INFO, "BundleProvisioner", "main", "total time taken to start = {0}", new Object[]{t4-t0});
        if (args.length == 3 && args[2].equalsIgnoreCase("wait-before-stopping")) {
            System.out.println("Hit enter to continue");
            System.in.read(); //
        }
        f.stop();
        f.waitForStop(0);
        long t5 = System.currentTimeMillis();
        logger.logp(Level.INFO, "BundleProvisioner", "main", "time taken to stop = {0} ms", new Object[]{t5 - t4});
        logger.logp(Level.INFO, "BundleProvisioner", "main", "Total time taken = {0}", new Object[]{t5-t0});
        out.printf("%d,%d,%d,%d,%d,%d,%d\n", t1-t0, t2-t1, t3-t2, t4-t3, t4-t0, t5-t4, t5-t0);
    }
View Full Code Here

Examples of org.osgi.framework.launch.Framework

    };

    public void start(BundleContext context) throws Exception {
        this.context = context;
        if (nonEmbedded()) {
            Framework framework = (Framework) context.getBundle(0);
            gfr = new OSGiGlassFishRuntime(framework);
            context.registerService(GlassFishRuntime.class.getName(), gfr, null);
        } else {
            Properties properties = prepareStartupContext(context);
            final BootstrapProperties bsProperties = new BootstrapProperties(properties);
View Full Code Here

Examples of org.osgi.framework.launch.Framework

        Properties props = new Properties();
        props.load(new FileInputStream(args[0]));
        Util.substVars(props);
        PrintStream out = new PrintStream(new FileOutputStream(args[1], true));
        long t0 = System.currentTimeMillis();
        Framework f = null;
        for (FrameworkFactory ff : ServiceLoader.load(FrameworkFactory.class)) {
            f = ff.newFramework(props);
            System.out.println("framework = " + f);
            break;
        }
        if (f == null) {
            throw new RuntimeException("no OSGi framework in classpath");
        }
        long t1 = System.currentTimeMillis();
        logger.log(Level.INFO, LogFacade.OSGI_LOCATE_TIME, (t1-t0));
        f.init();
        long t2 = System.currentTimeMillis();
        logger.log(Level.INFO, LogFacade.OSGI_INIT_TIME, (t2-t1));
        BundleProvisioner bundleProvisioner = createBundleProvisioner(f.getBundleContext(), props);
        bundleProvisioner.installBundles();
        long t3 = System.currentTimeMillis();
        logger.log(Level.INFO, LogFacade.BUNDLE_INSTALLATION_TIME, (t3-t2));
        int installed = bundleProvisioner.getNoOfInstalledBundles();
        int updated = bundleProvisioner.getNoOfUpdatedBundles();
        int uninstalled = bundleProvisioner.getNoOfUninstalledBundles();
        System.out.printf("installed = %d, updated = %d, uninstalled = %d\n", installed, updated, uninstalled);
        if (bundleProvisioner.hasAnyThingChanged()) {
            System.out.println("Refreshing framework");
            bundleProvisioner.refresh();
        }
        bundleProvisioner.startBundles();
        f.start();
        long t4 = System.currentTimeMillis();
        logger.log(Level.INFO, LogFacade.BUNDLE_STARTING_TIME, (t4-t3));
        logger.log(Level.INFO, LogFacade.TOTAL_START_TIME, (t4-t0));
        if (args.length == 3 && args[2].equalsIgnoreCase("wait-before-stopping")) {
            System.out.println("Hit enter to continue");
            System.in.read(); //
        }
        f.stop();
        f.waitForStop(0);
        long t5 = System.currentTimeMillis();
        logger.log(Level.INFO, LogFacade.BUNDLE_STOP_TIME, (t5 - t4));
        logger.log(Level.INFO, LogFacade.TOTAL_TIME, (t5-t0));
        out.printf("%d,%d,%d,%d,%d,%d,%d\n", t1-t0, t2-t1, t3-t2, t4-t3, t4-t0, t5-t4, t5-t0);
    }
View Full Code Here

Examples of org.osgi.framework.launch.Framework

         * That will result in ClassCastException.
         */
        resetFrameworkProperties();

        ServiceLoader<FrameworkFactory> loader = ServiceLoader.load(FrameworkFactory.class);
        Framework framework = loader.iterator().next().newFramework(properties);
        framework.start();
        //enable mvn url handling
//        new org.ops4j.pax.url.mvn.internal.Activator().start(framework.getBundleContext());
        //don't allow mvn urls
        System.setProperty("geronimo.build.car", "true");

View Full Code Here

Examples of org.osgi.framework.launch.Framework

        boot.setBuildDir(outputDirectory);
        boot.setCarFile(getArtifactInRepositoryDir());
        boot.setLocalRepo(repository);
        boot.setPlan(planFile);
        Framework framework = getFramework();
        BundleContext bundleContext = framework.getBundleContext();
        boot.setBundleContext(bundleContext);

        // Keep the same behavior with RepositoryConfigurationStore
        boot.setExpanded(false);
View Full Code Here

Examples of org.osgi.framework.launch.Framework

        Main main = new Main(args);
        main.launch();
        Thread.sleep(1000);
       
        Framework framework = main.getFramework();
        String activatorName = TimeoutShutdownActivator.class.getName().replace('.', '/') + ".class";
        Bundle bundle = framework.getBundleContext().installBundle("foo",
                TinyBundles.newBundle()
                    .set( Constants.BUNDLE_ACTIVATOR, TimeoutShutdownActivator.class.getName() )
                    .add( activatorName, getClass().getClassLoader().getResourceAsStream( activatorName ) )
                    .build( withBnd() )
        );
        bundle.start();      
       
        BundleContext ctx = framework.getBundleContext();
        ServiceReference[] refs = ctx.getServiceReferences(StartLevel.class.getName(), null);
        StartLevel sl = (StartLevel) ctx.getService(refs[0]);

        MockLock lock = (MockLock) main.getLock();
View Full Code Here

Examples of org.osgi.impl.bundle.jmx.framework.Framework

            .getServiceReference(PackageAdmin.class
                .getCanonicalName()));
    StartLevel sl = (StartLevel) bundleContext.getService(bundleContext
        .getServiceReference(StartLevel.class.getCanonicalName()));
    try {
      framework = new StandardMBean(new Framework(bundleContext, admin,
          sl), FrameworkMBean.class);
    } catch (NotCompliantMBeanException e) {
      log.log(Level.SEVERE,
          "Unable to create StandardMBean for Framework", e);
      return;
View Full Code Here

Examples of org.owasp.webscarab.plugin.Framework

            }

            // Provide default Copy/Paste/etc actions on text components
            Toolkit.getDefaultToolkit().getSystemEventQueue().push(new TextComponentContextMenu());

            Framework framework = new Framework();

            boolean lite = Boolean.valueOf(Preferences.getPreference("WebScarab.lite", "false")).booleanValue();

            File t = null;
            if (args != null && args.length == 1) {
View Full Code Here

Examples of uk.co.brunella.osgi.bdt.junit.annotation.Framework

      throw new RuntimeException("Could not create framework starter for " + framework);
    }
  }
 
  public static OSGiFrameworkStarter create(BundleRepository bundleRepository, String frameworkName) {
    Framework framework = Framework.valueOf(frameworkName.toUpperCase());
    return create(bundleRepository, framework);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.