public int writeWebProgram(WebProgram wp, String webRoot, String classpath) throws Exception { String javaClassesDir = webRoot + File.separator + "WEB-INF" + File.separator + "classes"; JavaProgram jp = wp.getJavaProgram(); int i = this.writeAndCompileJavaProgram(jp, javaClassesDir, classpath); for (Iterator itr = wp.getASPs().iterator(); itr.hasNext(); ) { ASP asp = (ASP) itr.next(); String aspFilename = Util.replaceString(asp.getName(), "aspx", "jsp"); FileOutputStream fos = new FileOutputStream(new File(webRoot, aspFilename)); asp.write(fos); // asp.write(System.out); } return i; }
protected void parseParamStrings(String paramString, ExpressionFactory expressionFactory) { List paramStrings = Util.tokenizeIgnoringEnclosers(paramString, ','); for (Iterator itr = paramStrings.iterator(); itr.hasNext(); ) { String nextParam = ((String) itr.next()).trim(); if (!(nextParam.equals(""))) { Debug.logn("Find match for param " + nextParam, this); if (CallExpression.isVariable(this.context, nextParam)) { DNVariable v = CallExpression.getVariable(this.context, nextParam); parameters.add(v); } else if (expressionFactory.getExpression(nextParam, this.context) != null) { parameters.add(expressionFactory.getExpression(nextParam, this.context)); } } } }
public int compileJavaProgram(JavaProgram jp, String writeDirectory, String classpath) throws Exception { if (!jp.isTypeResolved()) { System.out.println( "Compilation will not take place since there were type resolution errors."); return -1; } String fileList = jp.getFilesAsString(); String command = "javac -d " + writeDirectory + " -classpath " + classpath + " " + fileList; // System.out.println(command); System.out.print("Compiling..."); Process p = Runtime.getRuntime().exec(command); // need to squirt the output into the InputStream is = p.getErrorStream(); Util.read(is, "compiler"); // blocks here int exitValue = p.exitValue(); return exitValue; }