01: /*
02: * hgcommons 7
03: * Hammurapi Group Common Library
04: * Copyright (C) 2003 Hammurapi Group
05: *
06: * This program is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2 of the License, or (at your option) any later version.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: *
20: * URL: http://www.hammurapi.biz/hammurapi-biz/ef/xmenu/hammurapi-group/products/products/hgcommons/index.html
21: * e-Mail: support@hammurapi.biz
22: */
23: package biz.hammurapi.render.dom;
24:
25: import java.io.File;
26:
27: import org.apache.tools.ant.Task;
28:
29: /**
30: * @author Pavel Vlasov
31: * @version $Revision: 1.3 $
32: */
33: public class StyleCompiler extends Task {
34: final static String POSTFIX = "Translet";
35: final static char PROFILE_SEPARATOR = '!';
36: final static char TRANSLET_PROFILE_SEPARATOR = '_';
37:
38: /**
39: * Destination directory
40: * @ant.required
41: * @param destDir
42: */
43: public void setDestDir(File destDir) {
44: }
45:
46: /**
47: * Source directory
48: * @ant.required
49: * @param dir
50: */
51: public void setDir(File dir) {
52: }
53:
54: // public void execute() throws BuildException {
55: // if (dir==null) {
56: // throw new BuildException("Dir attribute is mandatory");
57: // }
58: // if (destDir==null) {
59: // throw new BuildException("DestDir attribute is mandatory");
60: // }
61: // FileSet fileSet=new FileSet();
62: // fileSet.setDir(dir);
63: // fileSet.setIncludes("**/*.xsl,**/*.xslt");
64: // String[] files = fileSet.getDirectoryScanner(getProject()).getIncludedFiles();
65: // for (int i=0; i<files.length; i++) {
66: // org.apache.xalan.xsltc.compiler.XSLTC xsltc=new org.apache.xalan.xsltc.compiler.XSLTC();
67: // xsltc.init();
68: // xsltc.setDestDirectory(destDir.getAbsolutePath());
69: //
70: // int idx=files[i].lastIndexOf(File.separator);
71: // xsltc.setPackageName(idx==-1 ? "" : files[i].substring(0, idx).replace(File.separatorChar, '.'));
72: // String className = idx==-1 ? files[i] : files[i].substring(idx+1);
73: // idx=className.lastIndexOf('.');
74: // if (idx!=-1) {
75: // className=className.substring(0, idx);
76: // }
77: // idx=className.indexOf(PROFILE_SEPARATOR);
78: // if (idx==-1) {
79: // className+=POSTFIX;
80: // } else {
81: // className=className.substring(0, idx)+POSTFIX+TRANSLET_PROFILE_SEPARATOR+className.substring(idx+1);
82: // }
83: // log("Compiling "+files[i]+" into "+className, Project.MSG_INFO);
84: // xsltc.setClassName(className);
85: // try {
86: // boolean result = xsltc.compile(new InputSource(new FileInputStream(new File(dir, files[i]))), null);
87: // xsltc.printWarnings();
88: // if (!result) {
89: // xsltc.printErrors();
90: // }
91: // } catch (FileNotFoundException e) {
92: // throw new BuildException(e);
93: // }
94: // }
95: // }
96:
97: public static void main(String[] args) {
98: }
99: }
|