Hauptseite   Packages   Klassenhierarchie   ?bersicht   Auflistung der Dateien   Datenstruktur-Elemente  

PicanaAntTmpl.java

gehe zur Dokumentation dieser Datei
00001 /*
00002  * $Source: /shared/cvsroot/diplom/app/src/java/de/picana/main/PicanaAntTmpl.java,v $
00003  * $Author: mstolpe $
00004  * $Date: 2003/04/22 09:51:28 $
00005  * $Revision: 1.4 $
00006  * $Release$
00007  *
00008  * Created on 28. December, 21:45
00009  *
00010  * Copyright 2002 by Marco Stolpe
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 }

Erzeugt am Tue Apr 22 11:22:56 2003 f?r Picana von doxygen1.2.18