Package org.osgi.framework

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


            if (state == Bundle.ACTIVE || state == Bundle.STARTING) {
                b.stop();
            }

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

            // start level handling - after update to avoid starting the bundle
            // just before the update
            final StartLevel startLevelService = this.getStartLevel();
View Full Code Here


        final Bundle b = assertBundle("After initial install", symbolicName, "1.0", Bundle.ACTIVE);

        // Update to 1.1, directly via bundle context
        final InputStream is = new FileInputStream(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.1.jar"));
        try {
          b.update(is);
        } finally {
          is.close();
        }
        assertBundle("After direct update", symbolicName, "1.1", Bundle.ACTIVE);
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 (Exception be) {
            IOException ioex = new IOException("Failed to restart framework");
            ioex.initCause(be);
            throw ioex;
        }
View Full Code Here

     * @see org.osgi.jmx.framework.FrameworkMBean#updateBundle(long)
     */
    public void updateBundle(long bundleIdentifier) throws IOException {
        Bundle bundle = FrameworkUtils.resolveBundle(context, bundleIdentifier);
        try {
            bundle.update();
        } catch (Exception be) {
            IOException ioex = new IOException("Failed to update bundle with id " + bundleIdentifier);
            ioex.initCause(be);
            throw ioex;
        }
View Full Code Here

    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("Can't update system bundle");
            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("Failed to update system bundle");
            ioex.initCause(be);
            throw ioex;
        }
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

                        addRollback(new UninstallBundleRunnable(bundle, log));
                    } else {
                        // existing bundle, update it
                        Version currentVersion = getVersion(bundle);
                        if (!sourceVersion.equals(currentVersion)) {
                            bundle.update(new BundleInputStream(source.getCurrentEntryStream()));
                            addRollback(new UpdateBundleRunnable(bundle, targetPackage, log));
                        }
                    }
                }
                catch (Exception be) {
View Full Code Here

            // update the bundle
            FileInputStream fi = null;
            try {
                fi = new FileInputStream(bundleFile);
                targetBundle.update(fi);
            } finally {
                IOUtils.close(fi);
            }

            reference = context.getServiceReference(PackageAdmin.class.getName());
View Full Code Here

                        addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.bundlemanager.info.stop", symbolicName, id));
                    } else if (UNINSTALL_OPERATION.equals(operation)) {
                        bundle.uninstall();
                        addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.bundlemanager.info.uninstall", symbolicName, id));
                    } else if (UPDATE_OPERATION.equals(operation)) {
                        bundle.update();
                        addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.bundlemanager.info.update", symbolicName, id));
                    } else if (REFRESH_OPERATION.equals(operation)) {
                        ServiceReference reference = bundleContext.getServiceReference(PackageAdmin.class.getName());
                        PackageAdmin packageAdmin = (PackageAdmin) bundleContext.getService(reference);
                        packageAdmin.refreshPackages(new Bundle[]{bundle});
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.