Examples of ClassLoaderRepository


Examples of org.apache.bcel.util.ClassLoaderRepository

    public BCELWrapperGenerator()
    {
        m_codeGenerator = new BCELCodeGenerator();
        ClassLoader contextClassLoader =
                Thread.currentThread().getContextClassLoader();
        m_repository = new ClassLoaderRepository( contextClassLoader );
        m_bcelClassLoader =
            new BCELClassLoader( contextClassLoader );
    }
View Full Code Here

Examples of org.apache.bcel.util.ClassLoaderRepository

     * Stores the class loader and makes it the Repository's class loader.
     * @param aClassLoader class loader to resolve classes with.
     */
    public void setClassLoader(ClassLoader aClassLoader)
    {
        Repository.setRepository(new ClassLoaderRepository(aClassLoader));
        mClassLoader = aClassLoader;
    }
View Full Code Here

Examples of org.apache.bcel.util.ClassLoaderRepository

    private static boolean currentMethodStatic;

    public ContinuationClassLoader(ClassLoader parent) {
        super(parent);
        Repository.setRepository(new ClassLoaderRepository(parent));
    }
View Full Code Here

Examples of org.apache.bcel.util.ClassLoaderRepository

    private static boolean currentMethodStatic;

    public ContinuationClassLoader(ClassLoader parent) {
        super(parent);
        Repository.setRepository(new ClassLoaderRepository(parent));
    }
View Full Code Here

Examples of org.apache.bcel.util.ClassLoaderRepository

  public ClassInfo(String className, URLClassLoader classLoader)
      throws ClassNotFoundException {
    super();
    this.className = className;
    this.classLoader = classLoader;
    this.repository = new ClassLoaderRepository(classLoader);
    localRepository = true;
    javaClass = this.repository.loadClass(className);
  }
View Full Code Here

Examples of org.apache.bcel.util.ClassLoaderRepository

      ClassNotFoundException {
    super();
    this.className = className;
    this.classLoader = ClassUtils.newURLClassLoader(
        Arrays.asList(jarFiles), getClass().getClassLoader());
    this.repository = new ClassLoaderRepository(classLoader);
    localRepository = true;
    javaClass = this.repository.loadClass(className);

  }
View Full Code Here

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

Examples of org.apache.bcel.util.ClassLoaderRepository

    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

Examples of org.apache.bcel.util.ClassLoaderRepository

  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

Examples of org.apache.bcel.util.ClassLoaderRepository

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