00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 package de.picana.main;
00014
00015 import org.apache.velocity.VelocityContext;
00016 import org.apache.velocity.Template;
00017 import org.apache.velocity.app.Velocity;
00018
00019 import java.io.*;
00020 import java.util.*;
00021
00022
00033 public class PicanaAntTmpl {
00034
00040 public PicanaAntTmpl(String path, String batchfile) throws Exception {
00041
00042 String resourcePath = (new File(batchfile)).getParentFile().getCanonicalPath();
00043 String resourceFile = (new File(batchfile)).getName();
00044
00045 Properties p = new Properties();
00046 p.setProperty("file.resource.loader.path", resourcePath);
00047
00048 Velocity.init(p);
00049
00050 VelocityContext context = new VelocityContext();
00051
00052 context.put( "name", new String("Velocity") );
00053
00054 Template template = Velocity.getTemplate(resourceFile + ".vm");
00055
00056 PrintWriter pw = new PrintWriter(new FileOutputStream(
00057 new File(resourcePath + File.separatorChar + resourceFile + ".xml")));
00058
00059 template.merge( context, pw );
00060
00061 pw.close();
00062
00063 System.exit(0);
00064 }
00065
00066
00071 public static void main (String args[]) throws Exception {
00072
00073 String path = System.getProperty("de.picana.path");
00074
00075 if (args.length == 0 ) {
00076 System.out.println("picana taskname");
00077
00078 } else {
00079 String batchfile = args[0];
00080 new PicanaAntTmpl(path, batchfile);
00081 }
00082 }
00083 }