Package org.apache.bcel.util

Examples of org.apache.bcel.util.ClassLoaderRepository


        }
      }

      long t0 = System.nanoTime();
      final URL[] urls = classLoader.getURLs();
      final Repository repo = new ClassLoaderRepository(classLoader);
      ExecutorService service = Executors.newFixedThreadPool(10);
      try {
        List<Future<String>> tasks = new ArrayList<Future<String>>();
        for (final URL url : urls) {
          Callable<String> task = new Callable<String>() {
            // @Override
            public String call() throws Exception {
              String urlFile = url.getFile();
              Set<String> allClassNames = ClassUtils
                  .findAllClassNames(new File(urlFile));
              Set<String> skipNamesToProcess = new HashSet<String>();
              for (String className : allClassNames) {
                if (!mustProcessClass(className, filters)) {
                  skipNamesToProcess.add(className);
                }
              }
              allClassNames.removeAll(skipNamesToProcess);
              sLog.info("Processing " + allClassNames.size()
                  + " classes in " + urlFile);
              for (String className : allClassNames) {
                final Map<MethodInfo, Code> codeMap = new HashMap<MethodInfo, Code>();
                final JavaClass javaClass = repo
                    .loadClass(className);
                for (Method method : javaClass.getMethods()) {
                  codeMap.put(JavaClassProcessor.toMethod(
                      className, method), method
                      .getCode());
View Full Code Here


    return new BeanClassEnumerator(ignorePackages)
        .getAllCustomClassBytes(klass);
  }

  private byte[] getClassBytes(Class<?> klass) throws ClassNotFoundException {
    Repository rep = new ClassLoaderRepository(klass.getClassLoader());
    return rep.loadClass(klass.getName()).getBytes();
  }
View Full Code Here

  private final StringBuilder methodStr;
  private final StringBuilder umlMethodStr;

  public NullClassRenderingStrategy(ClassLoader classLoader) {
    super();
    repo = new ClassLoaderRepository(classLoader);
    methodStr = new StringBuilder();
    umlMethodStr = new StringBuilder();
  }
View Full Code Here

        final URLClassLoader urlClassLoader = ClassUtils
            .newURLClassLoader(classpathElements, null);
        final ClassHierarchyProcessor finder = new ClassHierarchyProcessor(
            urlClassLoader);
        @SuppressWarnings("unused")
        final Repository repository = new ClassLoaderRepository(
            urlClassLoader);
        final ClassRenderingStrategy strategy = DefaultClassRenderingStrategy.SHOW_ALL_DECLARED_METHODS;
        CallGraphGeneratorUtils
            .draw(
                new GraphTranscoder<ClassMetaData, String[]>()
                    .transcode(
                        finder.computeGraph(className),
                        new NodeConversionStrategy<ClassMetaData, String[]>() {
                          public String[] convert(
                              ClassMetaData input) {
                            try {
                              Graph<String[]> temp = new Graph<String[]>();
                              strategy
                                  .convert(
                                      temp,
                                      urlClassLoader,
                                      input
                                          .getClassName());
                              return temp
                                  .getUserData();
                            } catch (RuntimeException exc) {
                              throw new TranscodingException(
                                  exc);
                            }
                          }
                        }), new File(output));
      } else if (digest != null) {
        File digestFile = new File(digest);
        if (!digestFile.isAbsolute()) {
          digestFile = new File(getProject().getBaseDir(), digest);
        }
        if (!digestFile.exists()) {
          throw new IllegalArgumentException(
              "Cannot continue, since digest file not found - "
                  + digestFile.getAbsolutePath());
        }
        @SuppressWarnings("unchecked")
        Map<String, ClassMetaData> map = (Map<String, ClassMetaData>) FileUtils
            .loadSerializableObjectFromFile(digestFile);
        System.out.println(getClass().getName()
            + ".execute. classpathElements - " + classpathElements);
        final URLClassLoader urlClassLoader = ClassUtils
            .newURLClassLoader(classpathElements, null);
        final ClassHierarchyProcessor finder = new ClassHierarchyProcessor(
            urlClassLoader, map);
        @SuppressWarnings("unused")
        final Repository repository = new ClassLoaderRepository(
            urlClassLoader);
        final ClassRenderingStrategy strategy = DefaultClassRenderingStrategy.SHOW_ALL_DECLARED_METHODS;
        CallGraphGeneratorUtils
            .draw(
                new GraphTranscoder<ClassMetaData, String[]>()
View Full Code Here

    System.arraycopy(inputJars, 0, this.inputJars, 0, inputJars.length);
    URL[] urls = new URL[inputJars.length];
    for (int i = 0; i < inputJars.length; i++) {
      urls[i] = inputJars[i].toURI().toURL();
    }
    repository = new ClassLoaderRepository(new URLClassLoaderX(urls,
        getClass().getClassLoader()));
  }
View Full Code Here

    inputJars = new File[urlClassLoader.getURLs().length];
    for (int i = 0; i < inputJars.length; i++) {
      inputJars[i] = new File(urlClassLoader.getURLs()[i].getFile());
    }
    System.arraycopy(inputJars, 0, this.inputJars, 0, inputJars.length);
    repository = new ClassLoaderRepository(urlClassLoader);
  }
View Full Code Here

  }

  private Map<String, ClassInfo> getClassInfoMap(final String mainClassName,
      IClassFilter inputFilter) throws IOException,
      ClassNotFoundException {
    repository = new ClassLoaderRepository(ClassUtils.newURLClassLoader(
        Arrays.asList(inputJars), CallGraphGenerator.class
            .getClassLoader()));

    Map<String, ClassInfo> classInfoMap = new HashMap<String, ClassInfo>();
    update(classInfoMap, mainClassName, ClassUtils.newURLClassLoader(Arrays
View Full Code Here

  private final StringBuilder methodStr;
  private final StringBuilder umlMethodStr;

  public NullClassRenderingStrategy(ClassLoader classLoader) {
    super();
    repo = new ClassLoaderRepository(classLoader);
    methodStr = new StringBuilder();
    umlMethodStr = new StringBuilder();
  }
View Full Code Here

  public NodeRenderingStrategy(ClassRenderingStrategy strategy,
      ClassLoader classLoader) {
    super();
    this.strategy = strategy;
    this.classLoader = classLoader;
    repository = new ClassLoaderRepository(classLoader);
  }
View Full Code Here

      final ClassRenderingStrategy strategy,
      final Graph<ClassMetaData> classMetaDataGraph,
      final String imageFileName) throws IOException,
      InterruptedException {
    @SuppressWarnings("unused")
    final Repository repository = new ClassLoaderRepository(classLoader);
    CallGraphGeneratorUtils.draw(
        new GraphTranscoder<ClassMetaData, String[]>().transcode(
            classMetaDataGraph,
            new NodeConversionStrategy<ClassMetaData, String[]>() {
              public String[] convert(ClassMetaData input) {
View Full Code Here

TOP

Related Classes of org.apache.bcel.util.ClassLoaderRepository

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.