Examples of Clazz


Examples of aQute.bnd.osgi.Clazz

     * descriptors can then be retrieved by invoking the getDescriptors/getDescriptorPaths methods.
     */
    public boolean execute() throws Exception
    {
        boolean annotationsFound = false;
        Clazz clazz = null;
        // Try to locate any classes in the wildcarded universe
        // that are annotated with the DependencyManager "Service" annotations.
        Collection<Clazz> expanded = m_analyzer.getClasses("",
                                                           // Parse everything
                                                           QUERY.NAMED.toString(), "*");
 
View Full Code Here

Examples of aQute.bnd.osgi.Clazz

        doReturn(dot).when(analyzer).getJar();
        doReturn(resource2).when(dot).getResource(eq("META-INF/metadata.xml"));

        Collection<Clazz> classes = new ArrayList<Clazz>();
        Resource typeResource = new URLResource(getClass().getResource("EmptyComponent.class"));
        Clazz clazz = new Clazz(analyzer, path, typeResource);
        clazz.parseClassFile();
        classes.add(clazz);
        doReturn(classes).when(analyzer).getClasses(Matchers.<String[]>anyVararg());

        Resource resource = new URLResource(getClass().getResource("/EMBED-MANIFEST-EMPTY.MF"));
        doReturn(resource).when(embed).getResource(eq("META-INF/MANIFEST.MF"));
View Full Code Here

Examples of aQute.lib.osgi.Clazz

                }

                // 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

Examples of aQute.lib.osgi.Clazz

                    }
                }
                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

Examples of aQute.lib.osgi.Clazz

     *
     * @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

Examples of aQute.lib.osgi.Clazz

        }

        // 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

Examples of aQute.lib.osgi.Clazz

          }
        }
        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

Examples of aQute.lib.osgi.Clazz

   *
   * @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

Examples of aQute.lib.osgi.Clazz

    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

Examples of aQute.lib.osgi.Clazz

    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
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.