Package aQute.bnd.osgi.Descriptors

Examples of aQute.bnd.osgi.Descriptors.PackageRef


    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

        try {
          InputStream in = resource.openInputStream();
          Set<CharSequence> set = analyze(in);
          in.close();
          for (Iterator<CharSequence> r = set.iterator(); r.hasNext();) {
            PackageRef pack = analyzer.getPackageRef((String) r.next());
            if (!QN.matcher(pack.getFQN()).matches())
              analyzer.warning("Package does not seem a package in spring resource (" + path + "): "
                  + pack);
            if (!analyzer.getReferred().containsKey(pack))
              analyzer.getReferred().put(pack, new Attrs());
          }
View Full Code Here

    try {
      InputStream in = resource.openInputStream();
      Set<String> set = analyze(in);
      in.close();
      for (Iterator<String> r = set.iterator(); r.hasNext();) {
        PackageRef pack = analyzer.getPackageRef(r.next());
        if (!QN.matcher(pack.getFQN()).matches())
          analyzer.warning("Package does not seem a package in spring resource (" + path + "): " + pack);
        if (!analyzer.getReferred().containsKey(pack))
          analyzer.getReferred().put(pack);
      }
    }
View Full Code Here

    packages = new MultiMap<PackageRef,Element>();

    for (Clazz c : analyzer.getClassspace().values()) {
      if (c.isPublic() || c.isProtected()) {
        PackageRef packageName = c.getClassName().getPackageRef();

        if (exports.containsKey(packageName)) {
          Element cdef = classElement(c);
          packages.add(packageName, cdef);
        }
View Full Code Here

    if (xref != null)
      xref.add(typeRef);
    if (typeRef.isPrimitive())
      return;

    PackageRef packageRef = typeRef.getPackageRef();
    if (packageRef.isPrimitivePackage())
      return;

    imports.add(packageRef);

    if (api != null && (Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers)))
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.