Package org.osgi.framework

Examples of org.osgi.framework.Bundle


  private void printBundleLogLevels(final LogConfig configuration,
                                    final Bundle[] bundles,
                                    final PrintWriter out)
  {
    for (int i = 0; i < bundles.length; i++) {
      final Bundle bundle = bundles[i];
      if (bundle != null) {
        final String full_name = bundle.getLocation();
        final String short_name = Util.shortName(bundle);
        int level = getLevel(configuration, bundle);
        final boolean isDefaultLevel = level < 0;
        level = isDefaultLevel ? configuration.getFilter() : level;
        out.println(Util.showId(bundle)
View Full Code Here


    if (knownMessageType) {
      if(!Activator.handlerTracker.anyHandlersMatching(topic)) {
        return;
      }
      Dictionary props = new Hashtable();
      Bundle bundle = bundleEvent.getBundle();
      putProp(props, EventConstants.EVENT, bundleEvent);
      putProp(props, "bundle.id", new Long(bundle.getBundleId()));
      putProp(props, EventConstants.BUNDLE_SYMBOLICNAME, bundle.getSymbolicName());
      putProp(props, "bundle", bundle);
      /* Tries posting the event once the properties are set */
      try {
        Activator.eventAdmin.postEvent(new Event(topic, props));
      } catch (Exception e) {
View Full Code Here

    if(!Activator.handlerTracker.anyHandlersMatching(topic)) {
      return;
    }


    Bundle bundle = logEntry.getBundle();
    Dictionary props = new Hashtable();

    /* Stores the properties of the event in the dictionary */
    if (bundle != null) {
      putProp(props, "bundle.id", new Long(bundle.getBundleId()));
      putProp(props, EventConstants.BUNDLE_SYMBOLICNAME, bundle.getLocation());
      putProp(props, "bundle", bundle);
    }
    if (logEntry != null) {
      putProp(props, "log.level", new Integer(logEntry.getLevel()));
      putProp(props, EventConstants.MESSAGE, logEntry.getMessage());
View Full Code Here

    if (knownMessageType) {
      if(!Activator.handlerTracker.anyHandlersMatching(topic)) {
        return;
      }
      Dictionary props = new Hashtable();
      Bundle bundle = frameworkEvent.getBundle();
      putProp(props, "event", frameworkEvent);
      /* If the event contains a bundle, further properties shall be set */
      if (frameworkEvent.getBundle() != null) {
        putProp(props, "bundle.id", new Long(bundle.getBundleId()));
        putProp(props,
                EventConstants.BUNDLE_SYMBOLICNAME,
                bundle.getLocation());
        putProp(props, "bundle", bundle);
      }

      /* If the event contains an exception, further properties shall be set */
      if (frameworkEvent.getThrowable() != null) {
View Full Code Here

  public void prepare() {}
 
  public boolean runTest() {

    try {
      Bundle bundle = Util.installBundle(bc, "bundleEnd1_test-1.0.0.jar");
      bundle.start();
      bundle.stop();
      bundle.uninstall();
    } catch (BundleException e) {
      e.printStackTrace();
      return false;
    }
       
View Full Code Here

  public void prepare() {
  }

  public boolean runTest() {
    try {
      Bundle bundle = Util.installBundle(bc, "bundleEnd151_test-1.0.0.jar");
      bundle.start();
     
      for (int i = 0; i < loops; i++) {  
        for (int o = 0; o < locales.length; o++) {
          bundle.getHeaders(locales[o]);
        }
      }
     
      bundle.uninstall();
    } catch (BundleException e) {
      e.printStackTrace();
    }
    return true;
  }
View Full Code Here

      }
    }
    for (int i = 0; i < epkgs.length; i++) {
      if (epkgs[i] != null) {
        out.print("Package: " + epkgs[i].getName());
        Bundle b = epkgs[i].getExportingBundle();
        if (verbose) {
          out.println();
          out.println("   specification version: "
                      + epkgs[i].getVersion());
          out.println("   removal pending: "
View Full Code Here

  public int cmdShutdown(Dictionary opts, Reader in, PrintWriter out,
                         Session session) {

    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 {
        try {
          sysBundle.stop(); // shut down the framework
        } catch (Exception e) {
          out.println("Failed to stop using system bundle " + e);
          try {
            System.exit(0);
          } catch (Exception e2) {
View Full Code Here

                           Session session) {
    String bname = (String) opts.get("bundle");
    Bundle[] bl = getBundles(new String[] { bname }, true);
    String fromURL = completeLocation((String) opts.get("url"));

    Bundle b = bl[0];
    if (b == null) {
      out.println("ERROR! No matching bundle for '" + bname + "'");
      return 1;
    }

    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

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

TOP

Related Classes of org.osgi.framework.Bundle

Copyright © 2018 www.massapicom. 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.