1 19 20 package org.netbeans.modules.web.project.ant; 21 22 import java.io.File ; 23 import java.io.IOException ; 24 import java.io.PrintWriter ; 25 import java.util.LinkedList ; 26 import java.util.StringTokenizer ; 27 import java.util.ArrayList ; 28 import org.apache.jasper.JasperException; 29 import org.apache.tools.ant.BuildException; 30 import org.apache.tools.ant.PathTokenizer; 31 import org.apache.tools.ant.Task; 32 import org.apache.tools.ant.Project; 33 import org.apache.tools.ant.types.FileSet; 34 35 41 public class JspCSingle extends JspC { 42 43 public static final String FILES_PARAM = "-jspc.files"; 44 public static final String URIROOT_PARAM = "-uriroot"; 45 46 60 61 public static void main(String args[]) { 62 ArrayList newArgs = new ArrayList (); 63 String uriRoot = null; 64 for (int i = 0; i < args.length; i++) { 65 String p = args[i]; 66 67 if (URIROOT_PARAM.equals(p)) { 69 newArgs.add(p); 70 i++; 71 if (i < args.length) { 72 uriRoot = args[i]; 73 newArgs.add(uriRoot); 74 } 75 continue; 76 } 77 78 if (FILES_PARAM.equals(p)) { 80 i++; 81 if (i < args.length) { 82 p = args[i]; 83 StringTokenizer st = new StringTokenizer (p, File.pathSeparator); 84 while (st.hasMoreTokens()) { 85 if (uriRoot != null) { 86 newArgs.add(st.nextToken()); 89 } 90 } 91 } 92 continue; 93 } 94 95 newArgs.add(p); 97 } 98 String newArgsS[] = (String [])newArgs.toArray(new String [newArgs.size()]); 99 100 JspC.main(newArgsS); 101 } 102 103 private String uriroot; 104 private String jspFiles; 105 106 public void setUriroot( String s ) { 107 this.uriroot = s; 108 super.setUriroot ( s ); 109 setPages (); 110 } 111 112 public void setJspIncludes (String jspFiles) throws BuildException { 113 this.jspFiles = jspFiles; 114 setPages (); 115 } 116 117 private void setPages () throws BuildException { 118 if (uriroot != null && jspFiles != null) { 119 try { 120 StringTokenizer tok = new StringTokenizer (jspFiles, " ,"); LinkedList list = new LinkedList (); 122 while (tok.hasMoreTokens ()) { 123 String jsp = uriroot + "/" + tok.nextToken (); 124 list.add (jsp); 125 } 126 setArgs( (String []) list.toArray (new String [list.size ()])); 127 } catch (JasperException e) { 128 throw new BuildException (e); 129 } 130 } 131 } 132 133 134 } 135 | Popular Tags |