1 18 19 package org.apache.tools.ant.taskdefs.optional.jsp.compilers; 20 21 import java.io.File ; 22 import java.util.Enumeration ; 23 import java.util.Vector ; 24 import org.apache.tools.ant.Project; 25 import org.apache.tools.ant.taskdefs.optional.jsp.JspC; 26 import org.apache.tools.ant.types.CommandlineJava; 27 28 34 public abstract class DefaultJspCompilerAdapter 35 implements JspCompilerAdapter { 36 37 private static String lSep = System.getProperty("line.separator"); 38 39 46 protected void logAndAddFilesToCompile(JspC jspc, 47 Vector compileList, 48 CommandlineJava cmd) { 49 jspc.log("Compilation " + cmd.describeJavaCommand(), 50 Project.MSG_VERBOSE); 51 52 StringBuffer niceSourceList = new StringBuffer ("File"); 53 if (compileList.size() != 1) { 54 niceSourceList.append("s"); 55 } 56 niceSourceList.append(" to be compiled:"); 57 58 niceSourceList.append(lSep); 59 60 Enumeration e = compileList.elements(); 61 while (e.hasMoreElements()) { 62 String arg = (String ) e.nextElement(); 63 cmd.createArgument().setValue(arg); 64 niceSourceList.append(" "); 65 niceSourceList.append(arg); 66 niceSourceList.append(lSep); 67 } 68 69 jspc.log(niceSourceList.toString(), Project.MSG_VERBOSE); 70 } 71 72 74 77 protected JspC owner; 78 79 81 85 public void setJspc(JspC owner) { 86 this.owner = owner; 87 } 88 89 92 public JspC getJspc() { 93 return owner; 94 } 95 96 97 102 protected void addArg(CommandlineJava cmd, String argument) { 103 if (argument != null && argument.length() != 0) { 104 cmd.createArgument().setValue(argument); 105 } 106 } 107 108 109 115 protected void addArg(CommandlineJava cmd, String argument, String value) { 116 if (value != null) { 117 cmd.createArgument().setValue(argument); 118 cmd.createArgument().setValue(value); 119 } 120 } 121 122 128 protected void addArg(CommandlineJava cmd, String argument, File file) { 129 if (file != null) { 130 cmd.createArgument().setValue(argument); 131 cmd.createArgument().setFile(file); 132 } 133 } 134 135 140 public boolean implementsOwnDependencyChecking() { 141 return false; 142 } 143 144 148 public Project getProject() { 149 return getJspc().getProject(); 150 } 151 } 152 153 | Popular Tags |