/** * The entry point for the command line tool japid.bat and japid.sh * * <p>The "gen" and "regen" are probably the most useful ones. * * @param args * @throws IOException */ public static void main(String[] args) throws IOException { if (args.length > 0) { String arg0 = args[0]; setTemplateRoot("."); if ("gen".equals(arg0)) { gen(templateRoot); } else if ("regen".equals(arg0)) { regen(templateRoot); } else if ("clean".equals(arg0)) { delAllGeneratedJava(getJapidviewsDir(templateRoot)); } else if ("mkdir".equals(arg0)) { mkdir(templateRoot); } else if ("changed".equals(arg0)) { changed(japidviews); } else { System.err.println("help: optionas are: gen, regen, mkdir and clean"); } } else { System.err.println("help: optionas are: gen, regen, mkdir and clean"); } }
/** * The <em>required</em> initialization step in using the JapidRender. * * @param opMode the operational mode of Japid. When set to OpMode.prod, it's assumed that all * Java derivatives are already been generated and used directly. When set to OpMode.dev, and * using none-static linking to using the renderer, file system changes are detected for every * rendering request given the refresh interval is respected. New Java files are generated and * compiled and new classes are loaded to serve the request. * @param templateRoot the root directory to contain the "japidviews" directory tree. * @param refreshInterval the minimal time, in second, that must elapse before trying to detect * any changes in the file system. */ public static void init(OpMode opMode, String templateRoot, int refreshInterval) { inited = true; JapidRenderer.opMode = opMode; setTemplateRoot(templateRoot); setRefreshInterval(refreshInterval); }