StyleCompiler.java :  » J2EE » hgcommons » biz » hammurapi » render » dom » Java Open Source

Java Open Source » J2EE » hgcommons 
hgcommons » biz » hammurapi » render » dom » StyleCompiler.java
/*
 * hgcommons 7
 * Hammurapi Group Common Library 
 * Copyright (C) 2003  Hammurapi Group
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * URL: http://www.hammurapi.biz/hammurapi-biz/ef/xmenu/hammurapi-group/products/products/hgcommons/index.html
 * e-Mail: support@hammurapi.biz
 */
package biz.hammurapi.render.dom;

import java.io.File;

import org.apache.tools.ant.Task;

/**
 * @author Pavel Vlasov
 * @version $Revision: 1.3 $
 */
public class StyleCompiler extends Task {
    final static String POSTFIX="Translet";
    final static char PROFILE_SEPARATOR='!';
    final static char TRANSLET_PROFILE_SEPARATOR='_';
    
    /**
     * Destination directory
     * @ant.required
     * @param destDir
     */
    public void setDestDir(File destDir) {
    }
    /**
     * Source directory
     * @ant.required
     * @param dir
     */
    public void setDir(File dir) {
    }
    
//    public void execute() throws BuildException {
//        if (dir==null) {
//            throw new BuildException("Dir attribute is mandatory");
//        }
//        if (destDir==null) {
//            throw new BuildException("DestDir attribute is mandatory");
//        }
//        FileSet fileSet=new FileSet();
//        fileSet.setDir(dir);
//        fileSet.setIncludes("**/*.xsl,**/*.xslt");
//        String[] files = fileSet.getDirectoryScanner(getProject()).getIncludedFiles();
//        for (int i=0; i<files.length; i++) {
//            org.apache.xalan.xsltc.compiler.XSLTC xsltc=new org.apache.xalan.xsltc.compiler.XSLTC();
//            xsltc.init();            
//            xsltc.setDestDirectory(destDir.getAbsolutePath());
//                        
//            int idx=files[i].lastIndexOf(File.separator);            
//            xsltc.setPackageName(idx==-1 ? "" : files[i].substring(0, idx).replace(File.separatorChar, '.'));
//            String className = idx==-1 ? files[i] : files[i].substring(idx+1);
//            idx=className.lastIndexOf('.');
//            if (idx!=-1) {
//                className=className.substring(0, idx);                
//            }
//            idx=className.indexOf(PROFILE_SEPARATOR);
//            if (idx==-1) {
//                className+=POSTFIX;
//            } else {
//                className=className.substring(0, idx)+POSTFIX+TRANSLET_PROFILE_SEPARATOR+className.substring(idx+1);
//            }
//            log("Compiling "+files[i]+" into "+className, Project.MSG_INFO);
//            xsltc.setClassName(className);
//            try {
//                boolean result = xsltc.compile(new InputSource(new FileInputStream(new File(dir, files[i]))), null);
//                xsltc.printWarnings();
//                if (!result) {
//                    xsltc.printErrors();
//                }
//            } catch (FileNotFoundException e) {
//                throw new BuildException(e);
//            }
//        }
//    }
    
    public static void main(String[] args) {
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.