Package org.osgi.framework

Examples of org.osgi.framework.Bundle.stop()


                    log.log(LogService.LOG_INFO, "Skipping fragment bundle '" + symbolicName + "'");
                }
                else {
                    addRollback(new StartBundleRunnable(session, bundle));
                    try {
                        bundle.stop();
                    }
                    catch (Exception e) {
                        log.log(LogService.LOG_WARNING, "Could not stop bundle '" + symbolicName + "'", e);
                    }
                }
View Full Code Here


            return;
        }
        final int state = b.getState();
        try {
            if (state == Bundle.ACTIVE || state == Bundle.STARTING) {
              b.stop();
            }
            b.uninstall();
            ctx.log("Uninstalled bundle {} from resource {}", b, getResource());
            // if the bundle exported packages, we need to refresh
            if ( BundleUtil.getFragmentHostHeader(b) == null ) {
View Full Code Here

            // in sequence, not right now
            final boolean reactivate = this.isBundleActive(b);
            // if this is not a fragment, stop the bundle
            final int state = b.getState();
            if (state == Bundle.ACTIVE || state == Bundle.STARTING) {
                b.stop();
            }

            // update bundle
            b.update(getResource().getInputStream());
            ctx.log("Updated bundle {} from resource {}", b, getResource());
View Full Code Here

            this.waitForBundleEvents("Bundle must be installed", listener,
                    new BundleEvent("osgi-installer-testB", "1.0", org.osgi.framework.BundleEvent.INSTALLED),
                    new BundleEvent("osgi-installer-testB", "1.0", org.osgi.framework.BundleEvent.STARTED));
            final Bundle b = findBundle("osgi-installer-testB");
            assertNotNull("Test bundle B must be found", b);
            b.stop();
        }

        assertBundle("Bundle A must be started", "osgi-installer-testA", null, Bundle.ACTIVE);
        assertBundle("Bundle B must be stopped", "osgi-installer-testB", null, Bundle.RESOLVED);
View Full Code Here

      // create new configuration object
      final Dictionary<String, Object> cfgData = new Hashtable<String, Object>();
      cfgData.put("foo", "bar");

      // Configuration installs must be deferred if ConfigAdmin service is stopped
        configAdmin.stop();
      waitForConfigAdmin(false);
     
      // add new configuration
        final InstallableResource[] rsrc = getInstallableResource(cfgPid, cfgData);
        installationEvents = 0;
View Full Code Here

        waitForInstallationEvents(2);
        waitForConfiguration("Config must be installed before stopping ConfigurationAdmin",
                cfgPid, TIMEOUT, true);

        // Configuration uninstalls must be deferred if ConfigAdmin service is stopped
        configAdmin.stop();
        waitForConfigAdmin(false);
       
        // remove configuration
        installationEvents = 0;
        installer.updateResources(URL_SCHEME, null, new String[] {rsrc[0].getId()});
View Full Code Here

        final Bundle b = findBundle(symbolicName);
        if (b == null) {
            fail("Bundle " + symbolicName + " not found");
        }
        log(LogService.LOG_INFO, "Restarting " + symbolicName + " bundle");
        b.stop();
        b.start();
        setupInstaller();
    }

    protected void generateBundleEvent() throws Exception {
View Full Code Here

       
        jarOut.close();
        out.close();
       
        if (existingBundle != null) {
            existingBundle.stop();
            existingBundle.uninstall();
        }

        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
View Full Code Here

     * @see org.osgi.jmx.framework.FrameworkMBean#shutdownFramework()
     */
    public void shutdownFramework() throws IOException {
        Bundle bundle = FrameworkUtils.resolveBundle(context, 0);
        try {
            bundle.stop();
        } catch (Exception be) {
            IOException ioex = new IOException("Failed to shutdown framework");
            ioex.initCause(be);
            throw ioex;
        }
View Full Code Here

     * @see org.osgi.jmx.framework.FrameworkMBean#stopBundle(long)
     */
    public void stopBundle(long bundleIdentifier) throws IOException {
        Bundle bundle = FrameworkUtils.resolveBundle(context, bundleIdentifier);
        try {
            bundle.stop();
        } catch (Exception e) {
            IOException ioex = new IOException("Failed to stop bundle with id " + bundleIdentifier);
            ioex.initCause(e);
            throw ioex;
        }
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.