Package org.osgi.framework

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


    boolean restart = opts.get("-r") != null;

      Bundle sysBundle = bc.getBundle(0);
      if (restart) {
        try {
          sysBundle.update(); // restart the framework
        } catch (Exception e) {
          out.println("Failed to restart the framework " + e);
          return 1;
        }
      } else {
View Full Code Here


    try {
      URL url = new URL(fromURL);
      URLConnection conn = url.openConnection();
      InputStream inStream = conn.getInputStream();
      b.update(inStream);
      out.println("Updated: " + showBundle(b));
    } catch (BundleException e) {
      Throwable t = e;
      while (t instanceof BundleException
             && ((BundleException) t).getNestedException() != null)
View Full Code Here

          if(n == 0) { // Update
            InputStream in = null;
            try {
              URL url = new URL(updateURL);
              in = new BufferedInputStream(url.openStream());
              b.update(in);
              obrNode.appendLog("Updated from " + url + "\n");
            } catch (Exception e) {
              obrNode.appendLog("Update failed: " + e + "\n");
            } finally {
              try { in.close(); } catch (Exception ignored) { }
View Full Code Here

                    try
                    {
                        InputStream in = open(loc);
                        try
                        {
                            b.update(in);
                            writeOk();
                        }
                        finally
                        {
                            in.close();
View Full Code Here

                        writeThrowable(e);
                    }
                }
                else
                {
                    b.update();
                    writeOk();
                }
            }
            catch (BundleException e)
            {
View Full Code Here

                    // stopping bundle 0 (system bundle) stops the framework
                    try
                    {
                        if ( restart )
                        {
                            systemBundle.update();
                        }
                        else
                        {
                            systemBundle.stop();
                        }
View Full Code Here

                    }
                    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

                            + getResource());
                    this.setFinishedState(ResourceState.IGNORED);
                    ctx.asyncTaskFailed(this);
                } else {
                    try {
                        systemBundle.update(is);
                    } catch (final BundleException e) {
                        getLogger().warn("Updating system bundle failed - unable to retry: " + this, e);
                        this.setFinishedState(ResourceState.IGNORED);
                        ctx.asyncTaskFailed(this);
                    }
View Full Code Here

            // restart the framework after completing the installation
            // or upgrade of all new bundles
            requireRestart = isSystemBundleFragment(installedBundle);

            try {
                installedBundle.update(ins);
                logger.log(Logger.LOG_INFO, "Bundle "
                    + installedBundle.getSymbolicName()
                    + " updated from " + bundleJar);
            } catch (BundleException be) {
                logger.log(Logger.LOG_ERROR, "Bundle update from "
View Full Code Here

        final Bundle b = this.getBundleContext().getBundle();
        if ( this.count == null ) {
            // first step: update bundle

            try {
                b.update(getResource().getInputStream());
                ctx.log("Updated bundle {} from resource {}", b, getResource());
            } catch (final Exception e) {
                getLogger().info("Removing failing tasks - unable to retry: " + this, e);
                this.setFinishedState(ResourceState.IGNORED);
                ctx.asyncTaskFailed(this);
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.