Package org.osgi.framework

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


    public void updateBundleFromURL(long bundleIdentifier, String url) throws IOException {
        Bundle bundle = FrameworkUtils.resolveBundle(context, bundleIdentifier);
        InputStream inputStream = null;
        try {
            inputStream = createStream(url);
            bundle.update(inputStream);
        } catch (Exception be) {
            IOException ioex = new IOException("Update of bundle with id " + bundleIdentifier + " from url " + url + " failed with message: " + be.getMessage());
            ioex.initCause(be);
            throw ioex;
        } finally {
View Full Code Here


     * @see org.osgi.jmx.framework.FrameworkMBean#updateFramework()
     */
    public void updateFramework() throws IOException {
        Bundle bundle = FrameworkUtils.resolveBundle(context, 0);
        try {
            bundle.update();
        } catch (Exception be) {
            IOException ioex = new IOException("Update of framework bundle failed with message: " + be.getMessage());
            ioex.initCause(be);
            throw ioex;
        }
View Full Code Here

      } else {
        if(bundle.getLastModified() < bundleFile.lastModified()) {
          try {
            log.log(Level.FINE, "Updating bundle {0}.", bundle.getLocation());
            startAttempted.remove(bundle.getBundleId());
            bundle.update(new FileInputStream(bundleFile));
          } catch (FileNotFoundException e) {
            errors.add(new BundleOperationException(bundle.getLocation(), "Error updating bundle, its bundle file may have been deleted.", e));
          } catch (BundleException e) {
            errors.add(new BundleOperationException(bundle.getLocation(), "Error updating bundle.", e));
          }
View Full Code Here

        saBundle.start();
        sa = getOsgiService(ServiceAssembly.class);
        assertNotNull(sa);
        assertEquals(LifeCycleMBean.STARTED, sa.getCurrentState());

        saBundle.update();
        sa = getOsgiService(ServiceAssembly.class);
        assertNotNull(sa);
        assertEquals(LifeCycleMBean.STARTED, sa.getCurrentState());

        smxHttp.stop();
View Full Code Here

    }

    public String update() throws BundleException {
        Bundle bundle = osgiHost.getBundles().get(id);
        try {
            bundle.update();
        } catch (Exception e) {
            addActionError(e.toString());
        }

        return view();
View Full Code Here

                    }
                    // If the bundle is already installed, then update it
                    // if the 'update' action is present.
                    else if ((b != null) && actionList.contains(AUTO_DEPLOY_UPDATE_VALUE))
                    {
                        b.update();
                    }

                    // If we have found and/or successfully installed a bundle,
                    // then add it to the list of bundles to potentially start
                    // and also set its start level accordingly.
View Full Code Here

      } else {
        if(bundle.getLastModified() < bundleFile.lastModified()) {
          try {
            log.log(Level.FINE, "Updating bundle {0}.", bundle.getLocation());
            startAttempted.remove(bundle.getBundleId());
            bundle.update(new FileInputStream(bundleFile));
          } catch (FileNotFoundException e) {
            errors.add(new BundleOperationException(bundle.getLocation(), "Error updating bundle, its bundle file may have been deleted.", e));
          } catch (BundleException e) {
            errors.add(new BundleOperationException(bundle.getLocation(), "Error updating bundle.", e));
          }
View Full Code Here

                InputStream in = (transformed != null)
                    ? transformed.openStream()
                    : new FileInputStream(path);
                try
                {
                    bundle.update(in);
                }
                finally
                {
                    in.close();
                }
View Full Code Here

                stopTransient(bundle);
                Util.storeChecksum(bundle, artifact.getChecksum(), context);
                InputStream in = new FileInputStream(transformed != null ? transformed : path);
                try
                {
                    bundle.update(in);
                }
                finally
                {
                    in.close();
                }
View Full Code Here

     * @see org.osgi.jmx.framework.FrameworkMBean#restartFramework()
     */
    public void restartFramework() throws IOException {
        Bundle bundle = FrameworkUtils.resolveBundle(context, 0);
        try {
            bundle.update();
        } catch (BundleException be) {
            IOException ioex = new IOException("Failed to restart framework");
            ioex.initCause(be);
            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.