Package org.osgi.service.packageadmin

Examples of org.osgi.service.packageadmin.ExportedPackage


        t1 = System.currentTimeMillis();

        Color colA = Util.rgbInterpolate(baseColor, burnColor, (double)depth/3);
        Collection pkgs = pm.getExportedPackages(b);
        for(Iterator it = pkgs.iterator(); it.hasNext(); ) {
          ExportedPackage pkg = (ExportedPackage)it.next();
          Color col = colA;
          if(pkg.isRemovalPending()) {
            col = Util.rgbInterpolate(colA, Color.black, .5);
          }
          Bundle[] bl = pkg.getImportingBundles();
          String sId = pkg.getName() +";" + pkg.getVersion();

          if(bl == null || bl.length == 0) {
            StringBuffer lId = new StringBuffer();
            lId.append(getId());
            lId.append("/");
View Full Code Here


        Color colA = Util.rgbInterpolate(baseColor, burnColor, (double)depth/5);

        colA = Util.rgbInterpolate(colA, Color.black, .3);
        for(Iterator it = importedPkgs.iterator(); it.hasNext(); ) {
          ExportedPackage pkg = (ExportedPackage)it.next();
          Color col = colA;
          if(pkg.isRemovalPending()) {
            col = Util.rgbInterpolate(col, Color.black, .5);
          }
          Bundle fromB = pkg.getExportingBundle();
          String sId = pkg.getName() +";" + pkg.getVersion();

          StringBuffer lId = new StringBuffer();
          lId.append(getId());
          lId.append("/");
          lId.append("in.");
View Full Code Here

        Collection okSet  = getImportedPackages(b);

        // Remove wired imports
        for(Iterator it = okSet.iterator(); it.hasNext(); ) {
          final ExportedPackage pkg = (ExportedPackage) it.next();
          missing.remove(pkg.getName());
        }

        // Remove imports of packages exported by the bundle (self
        // imports from the current classloader will not have any
        // wires)
        okSet = getExportedPackages(b);
        for(Iterator it = okSet.iterator(); it.hasNext(); ) {
          final ExportedPackage pkg = (ExportedPackage) it.next();
          missing.remove(pkg.getName());
        }

        missingImports.put(b, missing);
      }
View Full Code Here

  public boolean isWired(final String pkgName, final Bundle b)
  {
    final Collection pkgs = getImportedPackages(b);
    for (Iterator it = pkgs.iterator(); it.hasNext(); ) {
      final ExportedPackage epkg = (ExportedPackage) it.next();
      if (pkgName.equals(epkg.getName())) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

  static class ExportedPackageComparator implements Comparator
  {
    public int compare(Object o1, Object o2)
    {
      ExportedPackage ep1 = (ExportedPackage) o1;
      ExportedPackage ep2 = (ExportedPackage) o2;

      // First package name
      int res = ep1.getName().compareTo(ep2.getName());
      if (0!=res) return res;

      // Then package version
      res = ep1.getVersion().compareTo(ep2.getVersion());
      if (0!=res) return res;

      // Then pending removal
      if (ep1.isRemovalPending() && !ep2.isRemovalPending()) return -1;
      if (!ep1.isRemovalPending() && ep2.isRemovalPending()) return 1;

      // Then number of importing bundles
      res = ep2.getImportingBundles().length - ep1.getImportingBundles().length;
      if (0!=res) return res;

      // Finally object identity (hashCode is the closest approximation)
      res = ep2.hashCode() - ep1.hashCode();
      return res;
    }
View Full Code Here

      }
      if(pkgs.size() > 0) {
        sb.append("<b>Exported packages</b>");
        List exportDescr  = new ArrayList();
        for (Iterator it = pkgs.iterator(); it.hasNext(); ) {
          ExportedPackage pkg = (ExportedPackage)it.next();
          StringBuffer   sb1  = new StringBuffer();

          sb1.append(formatPackage(pkg, false));

          if (!pkg.isRemovalPending() && !pm.isWired(pkg.getName(), b)) {
            // An exporting bundle that imports a package from itself
            // will not have a wire for that package and thus not be
            // present amongs the bundles returned by
            // pkg.getImportingBundles().  There is one exception to
            // this: When removal pending is set in an pkg, that pkg
            // is from an older generation of the bundle and there
            // must be a wire from the bundle to the old pkg and thus
            // the bundle will be present in the list returned by
            // pkg.getImportingBundles().
            sb1.append("<br>");
            sb1.append("&nbsp;&nbsp;");
            Util.bundleLink(sb1, b);
          }

          Bundle[] bl = pkg.getImportingBundles();
          for(int j = 0; bl != null && j < bl.length; j++) {
            sb1.append("<br>");
            sb1.append("&nbsp;&nbsp;");
            Util.bundleLink(sb1, bl[j]);
          }
View Full Code Here

        sb.append("<p>");
      }
      if(importedPkgs.size() > 0) {
        sb.append("<b>Imported packages</b>");
        for (Iterator it = importedPkgs.iterator(); it.hasNext(); ) {
          final ExportedPackage epkg = (ExportedPackage) it.next();
          sb.append(formatPackage( epkg, false ));
          sb.append("<br>");
          sb.append("&nbsp;&nbsp;");
          final Bundle exporter = epkg.getExportingBundle();
          if (exporter != null) {
            Util.bundleLink(sb, exporter);
          } else {
            sb.append("STALE");
          }
View Full Code Here

      if(requiredPkgs.size() > 0) {
        if (useParagraph) sb.append("<p>");
        sb.append("<b>Packages available from required bundles</b>");
        for (Iterator it = requiredPkgs.iterator(); it.hasNext(); ) {
          ExportedPackage epkg = (ExportedPackage) it.next();
          sb.append(formatPackage( epkg, isPkgInList(epkg, importedPkgs)));
        }
        if (useParagraph) sb.append("</p>");
        useParagraph = true;
      }
View Full Code Here

     * of ExportedPackage objects named importPkgs.
     */
    private boolean isPkgInList(ExportedPackage epkg, Collection importedPkgs)
    {
      for (Iterator it = importedPkgs.iterator(); it.hasNext(); ) {
        ExportedPackage ipkg = (ExportedPackage) it.next();
        if (epkg.getName().equals(ipkg.getName())) return true;
      }
      return false;
    }
View Full Code Here

    protected final Mockery context = new JUnit4Mockery();

    @org.junit.Before public void setUp() throws Exception {
        am = new AdapterManagerImpl();
        final PackageAdmin pa = this.context.mock(PackageAdmin.class);
        final ExportedPackage ep = this.context.mock(ExportedPackage.class);
        this.context.checking(new Expectations(){{
            allowing(pa).getExportedPackage(with(any(String.class)));
            will(returnValue(ep));
        }});
        PrivateAccessor.setField(am, "packageAdmin", pa);
View Full Code Here

TOP

Related Classes of org.osgi.service.packageadmin.ExportedPackage

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.