Package aQute.bnd.osgi.Descriptors

Examples of aQute.bnd.osgi.Descriptors.PackageRef


  void doUses(Packages exports, Map<PackageRef,List<PackageRef>> uses, Packages imports) {
    if ("true".equalsIgnoreCase(getProperty(NOUSES)))
      return;

    for (Iterator<PackageRef> i = exports.keySet().iterator(); i.hasNext();) {
      PackageRef packageRef = i.next();
      String packageName = packageRef.getFQN();
      setProperty(CURRENT_PACKAGE, packageName);
      try {
        doUses(packageRef, exports, uses, imports);
      }
      finally {
View Full Code Here


      sharedPackages.remove(packageRef);

      StringBuilder sb = new StringBuilder();
      String del = "";
      for (Iterator<PackageRef> u = sharedPackages.iterator(); u.hasNext();) {
        PackageRef usedPackage = u.next();
        if (!usedPackage.isJava()) {
          sb.append(del);
          sb.append(usedPackage.getFQN());
          del = ",";
        }
      }
      if (override.indexOf('$') >= 0) {
        setProperty(CURRENT_USES, sb.toString());
View Full Code Here

    unreachable.remove(name);

    List<PackageRef> ref = uses.get(name);
    if (ref != null) {
      for (Iterator<PackageRef> r = ref.iterator(); r.hasNext();) {
        PackageRef element = r.next();
        removeTransitive(element, unreachable);
      }
    }
  }
View Full Code Here

          int n = relativePath.lastIndexOf('/');
          if (n < 0)
            n = relativePath.length();
          String relativeDir = relativePath.substring(0, n);

          PackageRef packageRef = getPackageRef(relativeDir);
          learnPackage(jar, packageRef, contained);
        }

        // Check class resources, we need to analyze them
        if (path.endsWith(".class")) {
          Resource resource = jar.getResource(path);
          Clazz clazz;

          try {
            InputStream in = resource.openInputStream();
            clazz = new Clazz(this, path, resource);
            try {
              clazz.parseClassFile();
            }
            finally {
              in.close();
            }
          }
          catch (Throwable e) {
            error("Invalid class file %s (%s)", e, relativePath, e);
            e.printStackTrace();
            continue next;
          }

          String calculatedPath = clazz.getClassName().getPath();
          if (!calculatedPath.equals(relativePath)) {
            // If there is a mismatch we
            // warning
            if (okToIncludeDirs) // assume already reported
              mismatched.put(clazz.getAbsolutePath(), clazz);
          } else {
            classspace.put(clazz.getClassName(), clazz);
            PackageRef packageRef = clazz.getClassName().getPackageRef();
            learnPackage(jar, packageRef, contained);

            // Look at the referred packages
            // and copy them to our baseline
            Set<PackageRef> refs = Create.set();
View Full Code Here

  public boolean isNoBundle() {
    return isTrue(getProperty(RESOURCEONLY)) || isTrue(getProperty(NOMANIFEST));
  }

  public void referTo(TypeRef ref) {
    PackageRef pack = ref.getPackageRef();
    if (!referred.containsKey(pack))
      referred.put(pack, new Attrs());
  }
View Full Code Here

    for (Instruction instruction : filters) {
      boolean match = false;

      for (Iterator<PackageRef> i = refs.iterator(); i.hasNext();) {
        PackageRef packageRef = i.next();

        if (packageRef.isMetaData()) {
          i.remove(); // no use checking it again
          continue;
        }

        String packageName = packageRef.getFQN();

        if (instruction.matches(packageName)) {
          match = true;
          if (!instruction.isNegated()) {
            result.merge(packageRef, instruction.isDuplicate(), source.get(packageRef),
View Full Code Here

      return;

    Set<PackageRef> packages = Create.set();

    for (TypeRef typeRef : getClassspace().keySet()) {
      PackageRef packageRef = typeRef.getPackageRef();
      String sourcePath = typeRef.getSourcePath();
      String packagePath = packageRef.getPath();

      boolean found = false;
      String[] fixed = {
          "packageinfo", "package.html", "module-info.java", "package-info.java"
      };

      for (Iterator<File> i = getSourcePath().iterator(); i.hasNext();) {
        File root = i.next();

        // TODO should use bcp?

        File f = getFile(root, sourcePath);
        if (f.exists()) {
          found = true;
          if (!packages.contains(packageRef)) {
            packages.add(packageRef);
            File bdir = getFile(root, packagePath);
            for (int j = 0; j < fixed.length; j++) {
              File ff = getFile(bdir, fixed[j]);
              if (ff.isFile()) {
                String name = "OSGI-OPT/src/" + packagePath + "/" + fixed[j];
                dot.putResource(name, new FileResource(ff));
              }
            }
          }
          if (packageRef.isDefaultPackage())
            System.err.println("Duh?");
          dot.putResource("OSGI-OPT/src/" + sourcePath, new FileResource(f));
        }
      }
      if (!found) {
View Full Code Here

      for (Iterator<Entry<String,List<Jar>>> entry = index.entrySet().iterator(); entry.hasNext();) {
        Entry<String,List<Jar>> p = entry.next();

        String directory = p.getKey();
        PackageRef packageRef = getPackageRef(directory);

        // Skip * and meta data, we're talking packages!
        if (packageRef.isMetaData() && instruction.isAny())
          continue;

        if (!instruction.matches(packageRef.getFQN()))
          continue;

        // Ensure it is never matched again
        entry.remove();

View Full Code Here

    if (bactivator != null) {
      TypeRef ref = analyzer.getTypeRefFromFQN(bactivator);
      if (analyzer.getClassspace().containsKey(ref))
        return;

      PackageRef packageRef = ref.getPackageRef();
      if (packageRef.isDefaultPackage())
        error("The Bundle Activator is not in the bundle and it is in the default package ");
      else if (!analyzer.isImported(packageRef)) {
        error(Constants.BUNDLE_ACTIVATOR + " not found on the bundle class path nor in imports: " + bactivator);
      }
    }
View Full Code Here

    Domain domain = Domain.domain(m);
   
    Set<PackageRef> unresolvedReferences = new TreeSet<PackageRef>(analyzer.getReferred().keySet());
    unresolvedReferences.removeAll(analyzer.getContained().keySet());
    for ( String pname : domain.getImportPackage().keySet()) {
      PackageRef pref = analyzer.getPackageRef(pname);
      unresolvedReferences.remove(pref);
    }

    // Remove any java.** packages.
    for (Iterator<PackageRef> p = unresolvedReferences.iterator(); p.hasNext();) {
      PackageRef pack = p.next();
      if (pack.isJava())
        p.remove();
      else {
        // Remove any dynamic imports
        if (isDynamicImport(pack))
          p.remove();
View Full Code Here

TOP

Related Classes of aQute.bnd.osgi.Descriptors.PackageRef

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.