Example usage for java.io File isDirectory

List of usage examples for java.io File isDirectory

Introduction

In this page you can find the example usage for java.io File isDirectory.

Prototype

public boolean isDirectory() 

Source Link

Document

Tests whether the file denoted by this abstract pathname is a directory.

Usage

From source file:io.apiman.tools.i18n.TemplateScanner.java

public static void main(String[] args) throws IOException {
    if (args == null || args.length != 1) {
        System.out.println("Template directory not provided (no path provided).");
        System.exit(1);//from   ww w.  j a v a2 s .c o  m
    }
    File templateDir = new File(args[0]);
    if (!templateDir.isDirectory()) {
        System.out.println("Template directory not provided (provided path is not a directory).");
        System.exit(1);
    }

    if (!new File(templateDir, "dash.html").isFile()) {
        System.out.println("Template directory not provided (dash.html not found).");
        System.exit(1);
    }

    File outputDir = new File(templateDir, "../../../../../../tools/i18n/target");
    if (!outputDir.isDirectory()) {
        System.out.println("Output directory not found: " + outputDir);
        System.exit(1);
    }
    File outputFile = new File(outputDir, "scanner-messages.properties");
    if (outputFile.isFile() && !outputFile.delete()) {
        System.out.println("Couldn't delete the old messages.properties: " + outputFile);
        System.exit(1);
    }

    System.out.println("Starting scan.");
    System.out.println("Scanning template directory: " + templateDir.getAbsolutePath());

    String[] extensions = { "html", "include" };
    Collection<File> files = FileUtils.listFiles(templateDir, extensions, true);

    TreeMap<String, String> strings = new TreeMap<>();

    for (File file : files) {
        System.out.println("\tScanning file: " + file);
        scanFile(file, strings);
    }

    outputMessages(strings, outputFile);

    System.out.println("Scan complete.  Scanned " + files.size() + " files and discovered " + strings.size()
            + " translation strings.");
}

From source file:com.handany.base.generator.Generator.java

public static void main(String[] args) throws IOException {
    String directoryPath = "src/main/java";

    String modelDirectory = directoryPath + File.separator
            + StringUtils.replace(MODEL_PACKAGE, ".", File.separator) + File.separator;
    String daoDirectory = directoryPath + File.separator + StringUtils.replace(DAO_PACKAGE, ".", File.separator)
            + File.separator;// w w  w  .  j  a  va 2 s . c o  m
    String serviceDirectory = directoryPath + File.separator
            + StringUtils.replace(SERVICE_PACKAGE, ".", File.separator) + File.separator;
    String serviceImplDirectory = directoryPath + File.separator
            + StringUtils.replace(SERVICE_IMPL_PACKAGE, ".", File.separator) + File.separator;
    String controllerDirectory = directoryPath + File.separator
            + StringUtils.replace(CONTROLLER_PACKAGE, ".", File.separator) + File.separator;
    File fileDirectory = new File(directoryPath);
    if (!fileDirectory.isDirectory()) {
        FileUtils.forceMkdir(fileDirectory);
    }

    List<TableBean> tableBeanList = getTables();

    ArrayList<String> nameList = new ArrayList<>();

    //      nameList.add("bm_classroom_course");
    nameList.add("bm_sales_promotion");

    for (TableBean tableBean : tableBeanList) {
        System.out.println("table:" + tableBean.getTableName());
        String tableName = tableBean.getTableName();

        if (!nameList.contains(tableName.toLowerCase())) {
            continue;
        }

        Map<String, Object> varMap = new HashMap<>();
        varMap.put("tableBean", tableBean);
        varMap.put("schemaName", SCHEMA_NAME);
        varMap.put("modelPackage", MODEL_PACKAGE);
        varMap.put("daoPackage", DAO_PACKAGE);
        varMap.put("servicePackage", SERVICE_PACKAGE);
        varMap.put("serviceImplPackage", SERVICE_IMPL_PACKAGE);
        varMap.put("controllerPackage", CONTROLLER_PACKAGE);

        Template modelTemplate = FreemarkerUtil.getTemplate("model.ftl");
        FreemarkerUtil.outputProcessResult(modelDirectory + tableBean.getTableNameCapitalized() + ".java",
                modelTemplate, varMap);

        //            Template daoTemplate = FreemarkerUtil.getTemplate("dao.ftl");
        //            FreemarkerUtil.outputProcessResult(daoDirectory + tableBean.getTableNameCapitalized() + "Mapper.java", daoTemplate, varMap);

        Template mapperTemplate = FreemarkerUtil.getTemplate("mapper.ftl");
        FreemarkerUtil.outputProcessResult(daoDirectory + tableBean.getTableNameCapitalized() + "Mapper.xml",
                mapperTemplate, varMap);

        //            Template serviceTemplate = FreemarkerUtil.getTemplate("service.ftl");
        //            FreemarkerUtil.outputProcessResult(serviceDirectory + tableBean.getTableNameCapitalized() + "Service.java", serviceTemplate, varMap);
        //
        //            Template serviceImplTemplate = FreemarkerUtil.getTemplate("serviceimpl.ftl");
        //            FreemarkerUtil.outputProcessResult(serviceImplDirectory + tableBean.getTableNameCapitalized() + "ServiceImpl.java", serviceImplTemplate, varMap);
        //
        //            Template controllerTemplate = FreemarkerUtil.getTemplate("controller.ftl");
        //            FreemarkerUtil.outputProcessResult(controllerDirectory + tableBean.getTableNameCapitalized() + "Controller.java", controllerTemplate, varMap);
    }
}

From source file:com.act.biointerpretation.sars.SeqDBReactionGrouper.java

public static void main(String[] args) throws Exception {
    // Build command line parser.
    Options opts = new Options();
    for (Option.Builder b : OPTION_BUILDERS) {
        opts.addOption(b.build());/* w  w w .java 2  s  . c om*/
    }

    CommandLine cl = null;
    try {
        CommandLineParser parser = new DefaultParser();
        cl = parser.parse(opts, args);
    } catch (ParseException e) {
        LOGGER.error("Argument parsing failed: %s", e.getMessage());
        HELP_FORMATTER.printHelp(SeqDBReactionGrouper.class.getCanonicalName(), HELP_MESSAGE, opts, null, true);
        System.exit(1);
    }

    // Print help.
    if (cl.hasOption(OPTION_HELP)) {
        HELP_FORMATTER.printHelp(SeqDBReactionGrouper.class.getCanonicalName(), HELP_MESSAGE, opts, null, true);
        return;
    }

    // Handle arguments
    String mongoDBName = cl.getOptionValue(OPTION_DB);
    MongoDB mongoDB = new MongoDB(LOCAL_HOST, MONGO_PORT, mongoDBName);

    File outputFile = new File(cl.getOptionValue(OPTION_OUTPUT_PATH));
    if (outputFile.isDirectory() || outputFile.exists()) {
        LOGGER.error("Supplied output file is a directory or already exists.");
        System.exit(1);
    }
    outputFile.createNewFile();

    Integer limit = DEFAULT_LIMIT_INFINITY;
    if (cl.hasOption(OPTION_LIMIT)) {
        limit = Integer.parseInt(cl.getOptionValue(OPTION_LIMIT));
    }
    LOGGER.info("Only processing first %d entries in Seq DB.", limit);

    SeqDBReactionGrouper enzymeGrouper = new SeqDBReactionGrouper(mongoDB.getSeqIterator(), mongoDBName, limit);

    LOGGER.info("Scanning seq db for reactions with same seq.");
    ReactionGroupCorpus groupCorpus = enzymeGrouper.getReactionGroupCorpus();

    LOGGER.info("Writing output to file.");
    groupCorpus.printToJsonFile(outputFile);

    LOGGER.info("Complete!");
}

From source file:de.ee.hezel.PDFCompareMain.java

/**
 * Args[]//from   www.j  a v a  2s.  c  o  m
 *       [1. path]
 *       [2. path]
 *       -output [true/false]
 *       -visualise [output path] 
 * 
 * return value
 *       1 = not enough parameters
 *       2 = 
 * 
 * @param args 
 * @return int 
 */
public static void main(String[] args) {
    // not enough parameters
    if (args.length < 1) {
        System.out.println("usage: java -jar PDFCompare.jar "
                + "<path 1> <path 2> [-output <true/false>] [-visualise <path 3>] [-log <path 4>] [-compare <compare type>] [-prefix <pdf prefix>]"
                + newline + newline + "<path 1> = path with PDF documents from old version" + newline
                + "<path 2> = path with PDF documents from new version" + newline + "[output] = console output"
                + newline + "[visualise] = output folder for visualizing differnces " + newline
                + "[log] = path for log files and differnce images" + newline
                + "[compare type] = type of comparison <\"SIMPLE\" | \"STRUCTURAL\" | \"VISUAL\">" + newline
                + "[prefix] = compare only pdfs where the name starts with this prefix" + newline);
        return;
    }

    boolean output = false;
    File targetPath = null, logPath = null;
    int compareType = 1; // simple (Modes: SIMPLE/STRUCTURAL/VISUAL)
    String prefix = null;

    // read the incoming arguments
    for (int i = 2; i < args.length; i++) {
        if (args[i].equals("-output")) {
            output = Boolean.parseBoolean(args[++i]);
        } else if (args[i].equals("-visualise")) {
            targetPath = new File(args[++i]);
        } else if (args[i].equals("-log")) {
            logPath = new File(args[++i]);
        } else if (args[i].equals("-compare")) {
            String nextArg = args[++i];
            if (nextArg.equalsIgnoreCase("STRUCTURAL"))
                compareType = 2;
            else if (nextArg.equalsIgnoreCase("VISUAL"))
                compareType = 3;
        } else if ((args[i]).equals("-prefix")) {
            prefix = args[++i];
        }
    }

    // create or clear the output path
    checkOutputPath(targetPath);

    // configure log4j
    Properties props = getLog4jProperties(output, logPath);
    LogManager.resetConfiguration();
    PropertyConfigurator.configure(props);

    // check the output paths
    File path1 = new File(args[0]);
    File path2 = new File(args[1]);
    if (!path1.isDirectory() || !path2.isDirectory()) {
        if (!path1.isDirectory())
            log.error("[Path 1] does not exist");
        if (!path2.isDirectory())
            log.error("[Path 2] does not exist");
    }

    // compare the files in path 1 with the files in path 2 and 
    // save the results in path 3 (if given)
    PDFComparator pdfComparer = new PDFComparator(logPath, compareType);
    boolean foundDifference = pdfComparer.run(path1, path2, targetPath, prefix);

    // exit parameter (interesting for jenkins)
    System.exit(foundDifference ? 1 : 0);
}

From source file:org.apache.s4.adapter.Adapter.java

public static void main(String args[]) {
    Options options = new Options();

    options.addOption(OptionBuilder.withArgName("corehome").hasArg().withDescription("core home").create("c"));

    options.addOption(//from  ww  w.  j  ava 2  s  . co  m
            OptionBuilder.withArgName("instanceid").hasArg().withDescription("instance id").create("i"));

    options.addOption(
            OptionBuilder.withArgName("configtype").hasArg().withDescription("configuration type").create("t"));

    options.addOption(OptionBuilder.withArgName("userconfig").hasArg()
            .withDescription("user-defined legacy data adapter configuration file").create("d"));

    CommandLineParser parser = new GnuParser();
    CommandLine commandLine = null;

    try {
        commandLine = parser.parse(options, args);
    } catch (ParseException pe) {
        System.err.println(pe.getLocalizedMessage());
        System.exit(1);
    }

    int instanceId = -1;
    if (commandLine.hasOption("i")) {
        String instanceIdStr = commandLine.getOptionValue("i");
        try {
            instanceId = Integer.parseInt(instanceIdStr);
        } catch (NumberFormatException nfe) {
            System.err.println("Bad instance id: %s" + instanceIdStr);
            System.exit(1);
        }
    }

    if (commandLine.hasOption("c")) {
        coreHome = commandLine.getOptionValue("c");
    }

    String configType = "typical";
    if (commandLine.hasOption("t")) {
        configType = commandLine.getOptionValue("t");
    }

    String userConfigFilename = null;
    if (commandLine.hasOption("d")) {
        userConfigFilename = commandLine.getOptionValue("d");
    }

    File userConfigFile = new File(userConfigFilename);
    if (!userConfigFile.isFile()) {
        System.err.println("Bad user configuration file: " + userConfigFilename);
        System.exit(1);
    }

    File coreHomeFile = new File(coreHome);
    if (!coreHomeFile.isDirectory()) {
        System.err.println("Bad core home: " + coreHome);
        System.exit(1);
    }

    if (instanceId > -1) {
        System.setProperty("instanceId", "" + instanceId);
    } else {
        System.setProperty("instanceId", "" + S4Util.getPID());
    }

    String configBase = coreHome + File.separatorChar + "conf" + File.separatorChar + configType;
    String configPath = configBase + File.separatorChar + "adapter-conf.xml";
    File configFile = new File(configPath);
    if (!configFile.exists()) {
        System.err.printf("adapter config file %s does not exist\n", configPath);
        System.exit(1);
    }

    // load adapter config xml
    ApplicationContext coreContext;
    coreContext = new FileSystemXmlApplicationContext("file:" + configPath);
    ApplicationContext context = coreContext;

    Adapter adapter = (Adapter) context.getBean("adapter");

    ApplicationContext appContext = new FileSystemXmlApplicationContext(
            new String[] { "file:" + userConfigFilename }, context);
    Map listenerBeanMap = appContext.getBeansOfType(EventProducer.class);
    if (listenerBeanMap.size() == 0) {
        System.err.println("No user-defined listener beans");
        System.exit(1);
    }
    EventProducer[] eventListeners = new EventProducer[listenerBeanMap.size()];

    int index = 0;
    for (Iterator it = listenerBeanMap.keySet().iterator(); it.hasNext(); index++) {
        String beanName = (String) it.next();
        System.out.println("Adding producer " + beanName);
        eventListeners[index] = (EventProducer) listenerBeanMap.get(beanName);
    }

    adapter.setEventListeners(eventListeners);
}

From source file:act.installer.reachablesexplorer.PatentFinder.java

public static void main(String[] args) throws Exception {
    CLIUtil cliUtil = new CLIUtil(Loader.class, HELP_MESSAGE, OPTION_BUILDERS);
    CommandLine cl = cliUtil.parseCommandLine(args);

    String host = cl.getOptionValue(OPTION_DB_HOST, DEFAULT_HOST);
    Integer port = Integer.parseInt(cl.getOptionValue(OPTION_DB_PORT, DEFAULT_PORT.toString()));
    String targetDB = cl.getOptionValue(OPTION_TARGET_DB, DEFAULT_TARGET_DATABASE);
    String collection = cl.getOptionValue(OPTION_TARGET_REACHABLES_COLLECTION, DEFAULT_TARGET_COLLECTION);
    LOGGER.info("Connecting to %s:%d/%s, using collection %s", host, port, targetDB, collection);

    Loader loader = new Loader(host, port, UNUSED_SOURCE_DB, targetDB, collection, UNUSED_SEQUENCES_COLLECTION,
            UNUSED_ASSETS_DIR);/*  w ww  . j ava 2s . c  o m*/

    File indexesTopDir = new File(cl.getOptionValue(OPTION_PATENT_INDEX_DIR, DEFAULT_PATENT_INDEX_LOCATION));
    if (!indexesTopDir.exists() || !indexesTopDir.isDirectory()) {
        cliUtil.failWithMessage("Index top-level directory at %s is not a directory",
                indexesTopDir.getAbsolutePath());
    }

    LOGGER.info("Using index top level dir: %s", indexesTopDir.getAbsolutePath());

    PatentFinder finder = new PatentFinder();
    try (Searcher searcher = Searcher.Factory.getInstance().build(indexesTopDir)) {
        finder.run(loader, searcher);
    }
}

From source file:com.linkedin.python.importer.ImporterCLI.java

public static void main(String[] args) throws Exception {

    Options options = createOptions();//w w w.  j  a  va2s .c  o m

    CommandLineParser parser = new DefaultParser();
    CommandLine line = parser.parse(options, args);

    if (line.hasOption("quite")) {
        Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
        root.setLevel(Level.WARN);
    }

    final File repoPath = new File(line.getOptionValue("repo"));
    final DependencySubstitution replacements = new DependencySubstitution(buildSubstitutionMap(line));

    repoPath.mkdirs();

    if (!repoPath.exists() || !repoPath.isDirectory()) {
        throw new RuntimeException(
                "Unable to continue, " + repoPath.getAbsolutePath() + " does not exist, or is not a directory");
    }

    for (String dependency : line.getArgList()) {
        new DependencyDownloader(dependency, repoPath, replacements).download();
    }

    logger.info("Execution Finished!");
}

From source file:dk.statsbiblioteket.netark.dvenabler.Command.java

@SuppressWarnings("CallToPrintStackTrace")
public static void main(String[] args) throws IOException {
    CommandLine cli;//www  . jav  a  2 s. c  om
    try {
        cli = new GnuParser().parse(getOptions(), args);
    } catch (ParseException e) {
        System.err.println("Exception parsing arguments");
        e.printStackTrace();
        usage();
        return;
    }

    if (cli.hasOption(HELP)) {
        usage();
        return;
    }

    if (!cli.hasOption(INPUT)) {
        System.err.println("input index must be specified");
        usage();
        return;
    }

    final File in = new File(cli.getOptionValue(INPUT));
    if (!in.exists() || !in.isDirectory()) {
        System.err.println("Unable to access index folder '" + in + "'");
        usage();
        return;
    }

    final boolean verbose = cli.hasOption(VERBOSE);
    if (cli.hasOption(LIST)) {
        list(in, verbose);
        return;
    }

    if (cli.hasOption(CONVERT)) {
        if (!cli.hasOption(OUTPUT)) {
            System.err.println("convert is specified but output is missing");
            usage();
            return;
        }
        final File out = new File(cli.getOptionValue(OUTPUT));
        if (!cli.hasOption(FIELDS)) {
            System.err.println("convert is specified but no fields are defined.\n"
                    + "Use '.' to signal that no fields should be changed");
            usage();
            return;
        }
        final String[] rawFields = cli.getOptionValues(FIELDS);
        List<DVConfig> dvFields = getTweakedFields(in, rawFields);
        if (dvFields == null) {
            System.err.println("Invalid field specification");
            usage();
            return;
        }
        convert(in, out, dvFields, verbose);
        return;
    }

    System.out.println("Nothing to do");
    usage();
}

From source file:com.quangphuong.crawler.util.HighlightsOfflineCrawler.java

public static void main(String[] args) {
    webClient.getOptions().setJavaScriptEnabled(false);
    webClient.getOptions().setCssEnabled(false);
    webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
    //        webClient.setJavaScriptTimeout(2 * 1000);
    int y = startY;
    int m = startM;
    int d = startD;
    int date = 0;
    File f = new File(cachePath);
    if (f.exists() && !f.isDirectory()) {
        date = (Integer) ObjectIO.read(cachePath);
        y = date / 10000;/*from   w w  w .  j  ava 2  s .  com*/
        m = date % 10000;
        d = m % 100;
        System.out.println("D: " + d + "-M: " + m + "-Y: " + y);
    }
    boolean goNext = true;
    while (date != stopDate) {
        date = y + m + d;
        // Crawler
        String dateStr = String.valueOf(date);
        String link = AppConstant.videoPrefix + dateStr;
        try {
            System.out.println("Link: " + link);
            HtmlPage page = webClient.getPage(link);
            goNext = page.getWebResponse().getStatusCode() != 503;
            List<HtmlElement> tables = (List<HtmlElement>) page.getByXPath(AppConstant.hightlightTables);
            int count = 0;
            String kind = "";
            String tournament = "";
            for (HtmlElement table : tables) {
                count++;

                //Get kind
                HtmlElement span = table.getFirstByXPath(AppConstant.highlightKind);
                if (span != null && span.getAttribute("class").equals("whitetitle")) {
                    kind = span.getTextContent();
                    System.out.println(kind);
                }

                // Get Tournament
                if (table.getAttribute("background") != null && !"".equals(table.getAttribute("background"))) {
                    HtmlElement el = table.getFirstByXPath(AppConstant.highlightTournament);
                    tournament = el.getTextContent();
                    System.out.println(tournament);
                } else // Get matches
                {
                    if (count != 1 && (table.getAttribute("bgcolor").equals(""))) {
                        List<HtmlElement> matches = (List<HtmlElement>) table
                                .getByXPath(AppConstant.highlightMatches);
                        for (HtmlElement el : matches) {
                            //                            System.out.println(el.asXml());
                            HtmlElement tmp = el.getFirstByXPath(AppConstant.highlightMatch);
                            String match = tmp.getTextContent().trim();

                            tmp = el.getFirstByXPath(AppConstant.highlightMatchTime);
                            String time = tmp.getTextContent().trim();
                            tmp = el.getFirstByXPath(AppConstant.highlightMatchLogoTeam1);
                            String logoTeam1;
                            try {
                                logoTeam1 = tmp.getAttribute("src");
                            } catch (Exception e) {
                                logoTeam1 = "";
                            }
                            tmp = el.getFirstByXPath(AppConstant.highlightMatchScore);
                            String score = tmp.getTextContent().trim();
                            tmp = el.getFirstByXPath(AppConstant.highlightMatchLogoTeam2);
                            String logoTeam2;
                            try {
                                logoTeam2 = tmp.getAttribute("src");
                            } catch (Exception e) {
                                logoTeam2 = "";
                            }
                            //                            webClient.waitForBackgroundJavaScript(10 * 1000);
                            tmp = el.getFirstByXPath(AppConstant.highlightMatchLink);
                            String highlightLink;
                            try {
                                highlightLink = tmp.getAttribute("href");
                            } catch (Exception e) {
                                highlightLink = "";
                            }
                            tmp = el.getFirstByXPath(AppConstant.highlightMatchFullLink);
                            String fullMatchLink;
                            try {
                                fullMatchLink = tmp.getAttribute("href");
                            } catch (Exception e) {
                                fullMatchLink = "";
                            }
                            tmp = el.getFirstByXPath(AppConstant.highlightMatchLongLink);
                            String longHighlightLink;
                            try {
                                longHighlightLink = tmp.getAttribute("href");
                            } catch (Exception e) {
                                longHighlightLink = "";
                            }
                            System.out.println("----" + match + "-" + time + "-" + logoTeam1 + "-" + score + "-"
                                    + logoTeam2 + "-" + highlightLink + "-" + fullMatchLink + "-"
                                    + longHighlightLink);
                            //                            System.out.println("kindddddddddddddddd: " + kind);
                            Highlight highlight = new Highlight(0, kind, tournament, match, logoTeam1,
                                    logoTeam2, highlightLink, longHighlightLink, fullMatchLink, score, dateStr,
                                    time);

                            DBWrapper dBWrapper = new DBWrapper(false);
                            dBWrapper.updateEntity(highlight);
                        }
                    }
                }
            }
            //                System.out.println("-------------------");
            //                System.out.println("Page memory: " + Agent.sizeOf(page));
        } catch (Exception ex) {
            Logger.getLogger(HighlightsOfflineCrawler.class.getName()).log(Level.SEVERE, null, ex);
        }
        ObjectIO.write(cachePath, date);
        if (goNext) {
            if (m == 1200 && isLastDayOfMonth(d, m, y)) {
                y += 10000;
                m = 100;
                d = 1;
            } else if (isLastDayOfMonth(d, m, y)) {
                m += 100;
                d = 1;
            } else {
                d += 1;
            }
        }
    }
}

From source file:com.kynetx.ParseRuleset.java

public static void main(String[] args) throws Exception {
    File f = new File(args[0]);
    int notparsed = 0;
    int parsed = 0;

    File[] files = null;//from   ww  w.ja va 2s.  com
    if (f.isDirectory()) {
        files = f.listFiles();
    } else {
        files = new File[1];
        files[0] = new File(args[0]);
    }
    for (int i = 0; i < files.length; i++) {
        File thefile = files[i];
        long start = System.currentTimeMillis();
        boolean skipfile = false;
        for (int ii = 0; ii < ignore.length; ii++) {
            if (thefile.getCanonicalPath().indexOf(ignore[ii] + ".krl") > 0) {
                skipfile = true;
                break;
            }
        }
        if (thefile.length() == 0 || thefile.length() == 31 || thefile.length() == 162 || skipfile) {
            notparsed = notparsed + 1;
            //               System.out.println("Skipping: " + thefile + " in " + (System.currentTimeMillis() - start) + "ms." );
            //               System.out.println("Skipping " + thefile);
            continue;
        }
        parsed = parsed + 1;
        try {
            ANTLRFileStream input = new ANTLRFileStream(thefile.getCanonicalPath());
            com.kynetx.RuleSetLexer lexer = new com.kynetx.RuleSetLexer(input);
            CommonTokenStream tokens = new CommonTokenStream(lexer);
            com.kynetx.RuleSetParser parser = new com.kynetx.RuleSetParser(tokens);
            parser.ruleset();
            JSONObject js = new JSONObject(parser.rule_json);
            if (parser.parse_errors.size() > 0) {
                for (int ii = 0; ii < parser.parse_errors.size(); ii++) {
                    System.err
                            .println("ERROR FOUND " + parser.parse_errors.get(ii) + " - " + thefile.toString());
                }
            }
            //               System.out.println("Parsed: " + thefile + " in " + (System.currentTimeMillis() - start) + "ms." );
            //System.out.println(unescapeUnicode(js.toString()));
            System.out.println(js.toString());
            //System.out.println("=============");
            //System.out.println(js.toString());
        } catch (Exception e) {
            //               System.out.println("Error: " + thefile + " in " + (System.currentTimeMillis() - start) + "ms." );
            System.out.println("Error " + thefile + " " + e.getMessage());
            e.printStackTrace();
        }
    }
    //         System.out.println("Not Parsed " + notparsed);
    //         System.out.println("Parsed " + parsed);

}