Examples of Bundle


Examples of org.osgi.framework.Bundle

    // This callback method is marked as "NotThreadSafe" in the
    // javadoc, that implies that the thread calling it may hold
    // internal framework locks, thus since we need to call into the
    // framework all work must be done on a separate thread to avoid
    // dead-locks.
    final Bundle bundle = null!=ev ? ev.getBundle() : null;
    final String threadName = "Desktop.bundleChanged("
      +(null==ev ? "" :
        (Util.bundleEventName(ev.getType()) +", "
         +(null==bundle ? "*" : String.valueOf(bundle.getBundleId()))))
      +")";

    final Thread bct = new Thread(threadName) {
        public void run()
        {
          if (null!=ev) {
            if (BundleEvent.UPDATED==ev.getType()) {
              // An updated bundle may have changed icon...
              Util.clearBundleIcon(ev.getBundle());
            }
          }

          if(pm != null) {
            pm.refresh();
          }
          bundleCache = Activator.getBundles();

          SwingUtilities.invokeLater(new Runnable() {
              public void run() {
                if (ev!=null && BundleEvent.INSTALLED==ev.getType()) {
                  // Select bundle when installed
                  setSelected(bundle);
                  showBundle(bundle);
                } else if (null!=bundle && isSelected(bundle)) {
                  if (BundleEvent.UNINSTALLED==ev.getType()) {
                    bundleSelModel.setSelected(bundle.getBundleId(), false);
                  } else {
                    // Trigger a selection change notification to tell
                    // displayers to update their contents
                    if (bundleSelModel instanceof DefaultBundleSelectionModel) {
                      final DefaultBundleSelectionModel dbsm
                        = (DefaultBundleSelectionModel) bundleSelModel;
                      dbsm.fireChange(bundle.getBundleId());
                    }
                  }
                }
                updateStatusBar();
                updateMenus();
View Full Code Here

Examples of org.osgi.framework.Bundle

        String temp = name.substring(0, name.lastIndexOf("/"));
        String packageName = temp.replace('/', '.');

        for (int i = 0; i < exportedPackages.size(); i++) {
            Bundle b = ((Bundle) exportedPackages.get(i));
            ExportedPackage[] exp = packageAdmin.getExportedPackages(b);

            if (exp != null) {
                for (int j = 0; j < exp.length; j++) {
                    if (exp[j].getName().equals(packageName)) {
                        return b.getResource(name);
                    }
                }
            }
        }
View Full Code Here

Examples of org.osgi.framework.Bundle

                        Enumeration e = lr.getLog();
                        Vector lv = new Vector();
                        boolean rflag = opts.get("-r") == null;
                        while (e.hasMoreElements()) {
                            LogEntry le = (LogEntry) e.nextElement();
                            Bundle b = le.getBundle();
                            if (b == null && fflag || bv == null && !fflag
                                    || bv != null && bv.contains(b)) {
                                if (count-- <= 0) {
                                    break;
                                }
                                if (le.getLevel() > level) {
                                    continue;
                                }
                                if (le.getTime() < startTime) {
                                    break;
                                }
                                if (rflag) {
                                    lv.insertElementAt(le, 0);
                                } else {
                                    lv.addElement(le);
                                }
                            }
                        }

                        StringBuffer sb = new StringBuffer();
                        SimpleDateFormat tf = new SimpleDateFormat(
                                "MMM dd HH:mm:ss ");

                        for (e = lv.elements(); e.hasMoreElements();) {
                            LogEntry le = (LogEntry) e.nextElement();
                            sb.setLength(0);
                            sb.append(tf.format(new Date(le.getTime())));
                            pad(sb, 16);
                            switch (le.getLevel()) {
                            case LogService.LOG_INFO:
                                sb.append("INFO");
                                break;
                            case LogService.LOG_DEBUG:
                                sb.append("DEBUG");
                                break;
                            case LogService.LOG_WARNING:
                                sb.append("WARNING");
                                break;
                            case LogService.LOG_ERROR:
                                sb.append("ERROR");
                                break;
                            default:
                                sb.append("UNKNOWN");
                                break;
                            }
                            pad(sb, 23);
                            Bundle b = le.getBundle();
                            if (b != null) {
                                sb.append(" #" + b.getBundleId());
                                pad(sb, 28);
                                sb.append(Util.shortName(b));
                            } else {
                                sb.append(" FRAMEWORK");
                            }
View Full Code Here

Examples of org.osgi.framework.Bundle

            // Find either the local bundle or the bundle
            // record so we can get the update location attribute.
            String updateLocation = null;

            // First look for update location locally.
            Bundle bundle =
                findLocalBundle(pc.getTargetName(i), pc.getTargetVersion(i));
            if (bundle != null)
            {
                updateLocation = (String)
                    bundle.getHeaders().get(Constants.BUNDLE_UPDATELOCATION);
            }

            // If update location wasn't found locally, look in repository.
            if (updateLocation == null)
            {
View Full Code Here

Examples of org.osgi.framework.Bundle

            // Get the current target's name and version.
            String targetName = pc.getTargetName(targetIdx);
            String targetVersionString = pc.getTargetVersion(targetIdx);

            // Make sure the bundle is not already installed.
            Bundle bundle = findLocalBundle(targetName, targetVersionString);
            if (bundle == null)
            {
                // Find the targets bundle record.
                BundleRecord record = findBundleRecord(targetName, targetVersionString);
View Full Code Here

Examples of org.osgi.framework.Bundle

                // Get the current target's name and version.
                String targetName = pc.getTargetName(targetIdx);
                String targetVersionString = pc.getTargetVersion(targetIdx);

                // Find corresponding locally installed bundle.
                Bundle bundle = findLocalBundle(targetName, targetVersionString);

                // If we found a locally installed bundle, then
                // try to update it.
                if (bundle != null)
                {
                    m_brs.deployBundle(
                        out, // Output stream.
                        err, // Error stream.
                        (String) bundle.getHeaders().get(Constants.BUNDLE_UPDATELOCATION), // Local bundle to update.
                        pc.isResolve(), // Resolve dependencies.
                        false); // Start.
                }
                else
                {
View Full Code Here

Examples of org.osgi.framework.Bundle

      return record;
    }

    private Bundle findLocalBundle(String name, String versionString)
    {
      Bundle bundle = null;

      // Get the name only if there is no version, but error
      // if there are multiple matches for the same name.
      if (versionString == null) {
        // Perhaps the target name is a bundle ID and
View Full Code Here

Examples of org.osgi.framework.Bundle

    String location = null;
    for (int i = givenBundles.length - 1; i >= 0; i--) {
      location = givenBundles[i].trim();
      try {
        final long id = Long.parseLong(location);
        final Bundle bundle = LogCommands.bc.getBundle(id);
        if (null!=bundle) {
          final Dictionary d = bundle.getHeaders("");
          location = (String) d.get("Bundle-SymbolicName");
          if (location == null) {
            location = bundle.getLocation();
          }
        } else {
          location = null;
        }
      } catch (NumberFormatException nfe) {
View Full Code Here

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

Examples of org.rhq.core.clientapi.descriptor.plugin.Bundle

            for (ContentDescriptor contentDescriptor : resourceDescriptor.getContent()) {
                resourceType.addPackageType(ContentMetadataParser.parseContentDescriptor(contentDescriptor));
            }

            Bundle bundle = resourceDescriptor.getBundle();
            if (bundle != null) {
                String typeName = bundle.getType();
                resourceType.setBundleType(new BundleType(typeName, resourceType));
                // do NOT parse the target types of bundle type right now so that we don't
                // require the plugin writer to order the types herself
            }
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.