Package aQute.lib.osgi

Examples of aQute.lib.osgi.Clazz$MethodDef


                }

                // 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(relativePath, resource);
                        try {
                            // Check if we have a package-info
                            if (relativePath.endsWith("/package-info.class")) {
                                // package-info can contain an Export annotation
                                Map<String, String> info = contained.get(pack);
                                parsePackageInfoClass(clazz, info);
                            } else {
                                // Otherwise we just parse it simply
                                clazz.parseClassFile();
                            }
                        } finally {
                            in.close();
                        }
                    } catch (Throwable e) {
                        error("Invalid class file: " + relativePath, e);
                        e.printStackTrace();
                        continue next;
                    }

                    String calculatedPath = clazz.getClassName() + ".class";
                    if (!calculatedPath.equals(relativePath))
                        error("Class in different directory than declared. Path from class name is "
                                + calculatedPath
                                + " but the path in the jar is "
                                + relativePath
                                + " from " + jar);

                    classSpace.put(relativePath, clazz);

                    // Look at the referred packages
                    // and copy them to our baseline
                    for (String p : clazz.getReferred()) {
                        Map<String, String> attrs = referred.get(p);
                        if (attrs == null) {
                            attrs = newMap();
                            referred.put(p, attrs);
                        }
                    }

                    // Add all the used packages
                    // to this package
                    Set<String> t = uses.get(pack);
                    if (t == null)
                        uses.put(pack, t = new LinkedHashSet<String>());
                    t.addAll(clazz.getReferred());
                    t.remove(pack);
                }
            }
        }
    }
View Full Code Here


                    }
                }
                instr = Instruction.getPattern(sb.toString());
            }
            for (Iterator<Clazz> c = matched.iterator(); c.hasNext();) {
                Clazz clazz = c.next();
                if (!clazz.is(type, instr, classspace)) {
                    c.remove();
                }
            }
        }
        return matched;
View Full Code Here

     *
     * @param path
     * @return
     */
    public Clazz findClass(String path) throws Exception {
        Clazz c = importedClassesCache.get(path);
        if (c != null)
            return c;

        Resource r = findResource(path);
        if (r != null) {
            c = new Clazz(path, r);
            c.parseClassFile();
            importedClassesCache.put(path, c);
        }
        return c;
    }
View Full Code Here

        }

        // 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(relativePath, resource);
            try {
              // Check if we have a package-info
              if (relativePath.endsWith("/package-info.class")) {
                // package-info can contain an Export annotation
                Map<String, String> info = contained.get(pack);
                parsePackageInfoClass(clazz, info);
              } else {
                // Otherwise we just parse it simply
                clazz.parseClassFile();
              }
            } finally {
              in.close();
            }
          } catch (Throwable e) {
            error("Invalid class file: " + relativePath, e);
            e.printStackTrace();
            continue next;
          }

          String calculatedPath = clazz.getClassName() + ".class";
          if (!calculatedPath.equals(relativePath)) {
            if (!isNoBundle()) {
              error("Class in different directory than declared. Path from class name is "
                  + calculatedPath
                  + " but the path in the jar is "
                  + relativePath + " from " + jar);
            }
          }

          classSpace.put(relativePath, clazz);

          // Look at the referred packages
          // and copy them to our baseline
          for (String p : clazz.getReferred()) {
            Map<String, String> attrs = referred.get(p);
            if (attrs == null) {
              attrs = newMap();
              referred.put(p, attrs);
            }
          }

          // Add all the used packages
          // to this package
          Set<String> t = uses.get(pack);
          if (t == null)
            uses.put(pack, t = new LinkedHashSet<String>());
          t.addAll(clazz.getReferred());
          t.remove(pack);
        }
      }
    }
  }
View Full Code Here

          }
        }
        instr = Instruction.getPattern(sb.toString());
      }
      for (Iterator<Clazz> c = matched.iterator(); c.hasNext();) {
        Clazz clazz = c.next();
        if (!clazz.is(type, instr, this)) {
          c.remove();
        }
      }
    }
    return matched;
View Full Code Here

   *
   * @param path
   * @return
   */
  public Clazz findClass(String path) throws Exception {
    Clazz c = classspace.get(path);
    if (c != null)
      return c;

    c = importedClassesCache.get(path);
    if (c != null)
      return c;

    Resource r = findResource(path);
    if (r != null) {
      c = new Clazz(path, r);
      c.parseClassFile();
      importedClassesCache.put(path, c);
    }
    return c;
  }
View Full Code Here

    private boolean designate(String name, String config, boolean factory) {
      if (config == null)
        return false;

      for (String c : Processor.split(config)) {
        Clazz clazz = analyzer.getClassspace().get(Clazz.fqnToPath(c));
        if (clazz != null) {
          analyzer.referTo(c);
          MetaTypeReader r = new MetaTypeReader(clazz, analyzer);
          r.setDesignate(name, factory);
          String rname = "OSGI-INF/metatype/" + name + ".xml";
View Full Code Here

    private boolean designate(String name, String config, boolean factory) {
      if (config == null)
        return false;

      for (String c : Processor.split(config)) {
        Clazz clazz = analyzer.getClassspace().get(Clazz.fqnToPath(c));
        if (clazz != null) {
          analyzer.referTo(c);
          MetaTypeReader r = new MetaTypeReader(clazz, analyzer);
          r.setDesignate(name, factory);
          String rname = "OSGI-INF/metatype/" + name + ".xml";
View Full Code Here

        }

        // 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(relativePath, resource);
            try {
              // Check if we have a package-info
              if (relativePath.endsWith("/package-info.class")) {
                // package-info can contain an Export annotation
                Map<String, String> info = contained.get(pack);
                parsePackageInfoClass(clazz, info);
              } else {
                // Otherwise we just parse it simply
                clazz.parseClassFile();
              }
            } finally {
              in.close();
            }
          } catch (Throwable e) {
            error("Invalid class file: " + relativePath, e);
            e.printStackTrace();
            continue next;
          }

          String calculatedPath = clazz.getClassName() + ".class";
          if (!calculatedPath.equals(relativePath)) {
            if (!isNoBundle()) {
              error("Class in different directory than declared. Path from class name is "
                  + calculatedPath
                  + " but the path in the jar is "
                  + relativePath + " from " + jar);
            }
          }

          classSpace.put(relativePath, clazz);

          // Look at the referred packages
          // and copy them to our baseline
          for (String p : clazz.getReferred()) {
            Map<String, String> attrs = referred.get(p);
            if (attrs == null) {
              attrs = newMap();
              referred.put(p, attrs);
            }
          }

          // Add all the used packages
          // to this package
          Set<String> t = uses.get(pack);
          if (t == null)
            uses.put(pack, t = new LinkedHashSet<String>());
          t.addAll(clazz.getReferred());
          t.remove(pack);
        }
      }
    }
  }
View Full Code Here

          }
        }
        instr = Instruction.getPattern(sb.toString());
      }
      for (Iterator<Clazz> c = matched.iterator(); c.hasNext();) {
        Clazz clazz = c.next();
        if (!clazz.is(type, instr, this)) {
          c.remove();
        }
      }
    }
    return matched;
View Full Code Here

TOP

Related Classes of aQute.lib.osgi.Clazz$MethodDef

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.