Search in sources :

Example 1 with ClassFileLoader

use of com.sun.enterprise.tools.verifier.apiscan.classfile.ClassFileLoader in project Payara by payara.

the class EjbClosureCompiler method main.

public static void main(String[] args) {
    Handler h = new ConsoleHandler();
    h.setLevel(Level.ALL);
    // NOI18N
    Logger.getLogger("apiscan").addHandler(h);
    // NOI18N
    Logger.getLogger("apiscan").setLevel(Level.ALL);
    int j = 0;
    String pcp = "";
    String specVer = "";
    for (j = 0; j < args.length; ++j) {
        if (args[j].equals("-prefixClassPath")) {
            // NOI18N
            pcp = args[++j];
            continue;
        } else if (args[j].equals("-specVer")) {
            // NOI18N
            specVer = args[++j];
            continue;
        }
    }
    if (args.length < 5) {
        System.out.println(// NOI18N
        "Usage: " + EjbClosureCompiler.class.getName() + // NOI18N
        " <-prefixClassPath> <prefix classpath> <-specVer> <something like ejb_2.1> <jar file name(s)>");
        return;
    }
    for (int i = 4; i < args.length; ++i) {
        try (JarFile jar = new JarFile(args[i])) {
            String cp = pcp + File.pathSeparator + ClassPathBuilder.buildClassPathForJar(jar);
            // NOI18N
            System.out.println("Using CLASSPATH " + cp);
            ClassFileLoader cfl = ClassFileLoaderFactory.newInstance(new Object[] { cp });
            EjbClosureCompiler ejbClosureCompiler = new EjbClosureCompiler(specVer, cfl);
            boolean result = ejbClosureCompiler.buildClosure(jar);
            jar.close();
            // NOI18N
            System.out.println("The closure is [\n");
            System.out.println(ejbClosureCompiler);
            if (result) {
                // NOI18N
                System.out.println("Did not find any non-standard APIs ");
            } else {
                System.out.println(// NOI18N
                "Found non-standard APIs for " + args[i]);
            }
        } catch (IOException e) {
            e.printStackTrace();
            continue;
        }
        // NOI18N
        System.out.println("\n]");
    }
// args[i]
}
Also used : ClassFileLoader(com.sun.enterprise.tools.verifier.apiscan.classfile.ClassFileLoader) ConsoleHandler(java.util.logging.ConsoleHandler) Handler(java.util.logging.Handler) IOException(java.io.IOException) JarFile(java.util.jar.JarFile) ConsoleHandler(java.util.logging.ConsoleHandler)

Aggregations

ClassFileLoader (com.sun.enterprise.tools.verifier.apiscan.classfile.ClassFileLoader)1 IOException (java.io.IOException)1 JarFile (java.util.jar.JarFile)1 ConsoleHandler (java.util.logging.ConsoleHandler)1 Handler (java.util.logging.Handler)1