git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270156 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -1,60 +0,0 @@ | |||
| /* | |||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||
| * | |||
| * This software is published under the terms of the Apache Software License | |||
| * version 1.1, a copy of which has been included with this distribution in | |||
| * the LICENSE file. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional; | |||
| import java.io.File; | |||
| import java.io.FileOutputStream; | |||
| import java.io.OutputStreamWriter; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.taskdefs.XSLTLiaison; | |||
| import org.exolab.adaptx.xslt.XSLTProcessor; | |||
| import org.exolab.adaptx.xslt.XSLTReader; | |||
| import org.exolab.adaptx.xslt.XSLTStylesheet; | |||
| /** | |||
| * @author <a href="mailto:blandin@intalio.com">Arnaud Blandin</a> | |||
| * @version $Revision$ $Date$ | |||
| */ | |||
| public class AdaptxLiaison implements XSLTLiaison | |||
| { | |||
| protected XSLTProcessor processor; | |||
| protected XSLTStylesheet xslSheet; | |||
| public AdaptxLiaison() | |||
| { | |||
| processor = new XSLTProcessor(); | |||
| } | |||
| public void setOutputtype( String type ) | |||
| throws Exception | |||
| { | |||
| if( !type.equals( "xml" ) ) | |||
| throw new BuildException( "Unsupported output type: " + type ); | |||
| } | |||
| public void setStylesheet( File fileName ) | |||
| throws Exception | |||
| { | |||
| XSLTReader xslReader = new XSLTReader(); | |||
| xslSheet = xslReader.read( fileName.getAbsolutePath() ); | |||
| } | |||
| public void addParam( String name, String expression ) | |||
| { | |||
| processor.setProperty( name, expression ); | |||
| } | |||
| public void transform( File infile, File outfile ) | |||
| throws Exception | |||
| { | |||
| FileOutputStream fos = new FileOutputStream( outfile ); | |||
| OutputStreamWriter out = new OutputStreamWriter( fos, "UTF8" ); | |||
| processor.process( infile.getAbsolutePath(), xslSheet, out ); | |||
| } | |||
| }//-- AdaptxLiaison | |||
| @@ -1,84 +0,0 @@ | |||
| /* | |||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||
| * | |||
| * This software is published under the terms of the Apache Software License | |||
| * version 1.1, a copy of which has been included with this distribution in | |||
| * the LICENSE file. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional; | |||
| import java.util.Vector; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.taskdefs.Java; | |||
| /** | |||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||
| */ | |||
| public class Test | |||
| extends Java | |||
| { | |||
| protected Vector m_tests = new Vector(); | |||
| public Test() | |||
| { | |||
| setClassname( "org.apache.testlet.engine.TextTestEngine" ); | |||
| } | |||
| public void setForceShowTrace( final boolean forceShowTrace ) | |||
| { | |||
| createArg().setValue( "-f=" + forceShowTrace ); | |||
| } | |||
| public void setShowBanner( final String showBanner ) | |||
| { | |||
| createArg().setValue( "-b=" + showBanner ); | |||
| } | |||
| public void setShowSuccess( final boolean showSuccess ) | |||
| { | |||
| createArg().setValue( "-s=" + showSuccess ); | |||
| } | |||
| public void setShowTrace( final boolean showTrace ) | |||
| { | |||
| createArg().setValue( "-t=" + showTrace ); | |||
| } | |||
| public TestletEntry createTestlet() | |||
| { | |||
| final TestletEntry entry = new TestletEntry(); | |||
| m_tests.addElement( entry ); | |||
| return entry; | |||
| } | |||
| public void execute() | |||
| throws BuildException | |||
| { | |||
| final int size = m_tests.size(); | |||
| for( int i = 0; i < size; i++ ) | |||
| { | |||
| createArg().setValue( m_tests.elementAt( i ).toString() ); | |||
| } | |||
| super.execute(); | |||
| } | |||
| protected final static class TestletEntry | |||
| { | |||
| protected String m_testname = ""; | |||
| public void addText( final String testname ) | |||
| { | |||
| m_testname += testname; | |||
| } | |||
| public String toString() | |||
| { | |||
| return m_testname; | |||
| } | |||
| } | |||
| } | |||
| @@ -1,71 +0,0 @@ | |||
| /* | |||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||
| * | |||
| * This software is published under the terms of the Apache Software License | |||
| * version 1.1, a copy of which has been included with this distribution in | |||
| * the LICENSE file. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional; | |||
| import com.kvisco.xsl.XSLProcessor; | |||
| import com.kvisco.xsl.XSLReader; | |||
| import com.kvisco.xsl.XSLStylesheet; | |||
| import java.io.File; | |||
| import java.io.FileOutputStream; | |||
| import java.io.OutputStreamWriter; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.taskdefs.XSLTLiaison; | |||
| /** | |||
| * Concrete liaison for XSLP | |||
| * | |||
| * @author <a href="mailto:rubys@us.ibm.com">Sam Ruby</a> | |||
| * @author <a href="mailto:sbailliez@apache.org">Stephane Bailliez</a> | |||
| */ | |||
| public class XslpLiaison implements XSLTLiaison | |||
| { | |||
| protected XSLProcessor processor; | |||
| protected XSLStylesheet xslSheet; | |||
| public XslpLiaison() | |||
| { | |||
| processor = new XSLProcessor(); | |||
| // uh ?! I'm forced to do that otherwise a setProperty crashes with NPE ! | |||
| // I don't understand why the property map is static though... | |||
| // how can we do multithreading w/ multiple identical parameters ? | |||
| processor.getProperty( "dummy-to-init-properties-map" ); | |||
| } | |||
| public void setOutputtype( String type ) | |||
| throws Exception | |||
| { | |||
| if( !type.equals( "xml" ) ) | |||
| throw new BuildException( "Unsupported output type: " + type ); | |||
| } | |||
| public void setStylesheet( File fileName ) | |||
| throws Exception | |||
| { | |||
| XSLReader xslReader = new XSLReader(); | |||
| // a file:/// + getAbsolutePath() does not work here | |||
| // it is really the pathname | |||
| xslSheet = xslReader.read( fileName.getAbsolutePath() ); | |||
| } | |||
| public void addParam( String name, String expression ) | |||
| { | |||
| processor.setProperty( name, expression ); | |||
| } | |||
| public void transform( File infile, File outfile ) | |||
| throws Exception | |||
| { | |||
| FileOutputStream fos = new FileOutputStream( outfile ); | |||
| // XSLP does not support encoding...we're in hot water. | |||
| OutputStreamWriter out = new OutputStreamWriter( fos, "UTF8" ); | |||
| processor.process( infile.getAbsolutePath(), xslSheet, out ); | |||
| } | |||
| }//-- XSLPLiaison | |||
| @@ -1,60 +0,0 @@ | |||
| /* | |||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||
| * | |||
| * This software is published under the terms of the Apache Software License | |||
| * version 1.1, a copy of which has been included with this distribution in | |||
| * the LICENSE file. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional; | |||
| import java.io.File; | |||
| import java.io.FileOutputStream; | |||
| import java.io.OutputStreamWriter; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.taskdefs.XSLTLiaison; | |||
| import org.exolab.adaptx.xslt.XSLTProcessor; | |||
| import org.exolab.adaptx.xslt.XSLTReader; | |||
| import org.exolab.adaptx.xslt.XSLTStylesheet; | |||
| /** | |||
| * @author <a href="mailto:blandin@intalio.com">Arnaud Blandin</a> | |||
| * @version $Revision$ $Date$ | |||
| */ | |||
| public class AdaptxLiaison implements XSLTLiaison | |||
| { | |||
| protected XSLTProcessor processor; | |||
| protected XSLTStylesheet xslSheet; | |||
| public AdaptxLiaison() | |||
| { | |||
| processor = new XSLTProcessor(); | |||
| } | |||
| public void setOutputtype( String type ) | |||
| throws Exception | |||
| { | |||
| if( !type.equals( "xml" ) ) | |||
| throw new BuildException( "Unsupported output type: " + type ); | |||
| } | |||
| public void setStylesheet( File fileName ) | |||
| throws Exception | |||
| { | |||
| XSLTReader xslReader = new XSLTReader(); | |||
| xslSheet = xslReader.read( fileName.getAbsolutePath() ); | |||
| } | |||
| public void addParam( String name, String expression ) | |||
| { | |||
| processor.setProperty( name, expression ); | |||
| } | |||
| public void transform( File infile, File outfile ) | |||
| throws Exception | |||
| { | |||
| FileOutputStream fos = new FileOutputStream( outfile ); | |||
| OutputStreamWriter out = new OutputStreamWriter( fos, "UTF8" ); | |||
| processor.process( infile.getAbsolutePath(), xslSheet, out ); | |||
| } | |||
| }//-- AdaptxLiaison | |||
| @@ -1,84 +0,0 @@ | |||
| /* | |||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||
| * | |||
| * This software is published under the terms of the Apache Software License | |||
| * version 1.1, a copy of which has been included with this distribution in | |||
| * the LICENSE file. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional; | |||
| import java.util.Vector; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.taskdefs.Java; | |||
| /** | |||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||
| */ | |||
| public class Test | |||
| extends Java | |||
| { | |||
| protected Vector m_tests = new Vector(); | |||
| public Test() | |||
| { | |||
| setClassname( "org.apache.testlet.engine.TextTestEngine" ); | |||
| } | |||
| public void setForceShowTrace( final boolean forceShowTrace ) | |||
| { | |||
| createArg().setValue( "-f=" + forceShowTrace ); | |||
| } | |||
| public void setShowBanner( final String showBanner ) | |||
| { | |||
| createArg().setValue( "-b=" + showBanner ); | |||
| } | |||
| public void setShowSuccess( final boolean showSuccess ) | |||
| { | |||
| createArg().setValue( "-s=" + showSuccess ); | |||
| } | |||
| public void setShowTrace( final boolean showTrace ) | |||
| { | |||
| createArg().setValue( "-t=" + showTrace ); | |||
| } | |||
| public TestletEntry createTestlet() | |||
| { | |||
| final TestletEntry entry = new TestletEntry(); | |||
| m_tests.addElement( entry ); | |||
| return entry; | |||
| } | |||
| public void execute() | |||
| throws BuildException | |||
| { | |||
| final int size = m_tests.size(); | |||
| for( int i = 0; i < size; i++ ) | |||
| { | |||
| createArg().setValue( m_tests.elementAt( i ).toString() ); | |||
| } | |||
| super.execute(); | |||
| } | |||
| protected final static class TestletEntry | |||
| { | |||
| protected String m_testname = ""; | |||
| public void addText( final String testname ) | |||
| { | |||
| m_testname += testname; | |||
| } | |||
| public String toString() | |||
| { | |||
| return m_testname; | |||
| } | |||
| } | |||
| } | |||
| @@ -1,71 +0,0 @@ | |||
| /* | |||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||
| * | |||
| * This software is published under the terms of the Apache Software License | |||
| * version 1.1, a copy of which has been included with this distribution in | |||
| * the LICENSE file. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional; | |||
| import com.kvisco.xsl.XSLProcessor; | |||
| import com.kvisco.xsl.XSLReader; | |||
| import com.kvisco.xsl.XSLStylesheet; | |||
| import java.io.File; | |||
| import java.io.FileOutputStream; | |||
| import java.io.OutputStreamWriter; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.taskdefs.XSLTLiaison; | |||
| /** | |||
| * Concrete liaison for XSLP | |||
| * | |||
| * @author <a href="mailto:rubys@us.ibm.com">Sam Ruby</a> | |||
| * @author <a href="mailto:sbailliez@apache.org">Stephane Bailliez</a> | |||
| */ | |||
| public class XslpLiaison implements XSLTLiaison | |||
| { | |||
| protected XSLProcessor processor; | |||
| protected XSLStylesheet xslSheet; | |||
| public XslpLiaison() | |||
| { | |||
| processor = new XSLProcessor(); | |||
| // uh ?! I'm forced to do that otherwise a setProperty crashes with NPE ! | |||
| // I don't understand why the property map is static though... | |||
| // how can we do multithreading w/ multiple identical parameters ? | |||
| processor.getProperty( "dummy-to-init-properties-map" ); | |||
| } | |||
| public void setOutputtype( String type ) | |||
| throws Exception | |||
| { | |||
| if( !type.equals( "xml" ) ) | |||
| throw new BuildException( "Unsupported output type: " + type ); | |||
| } | |||
| public void setStylesheet( File fileName ) | |||
| throws Exception | |||
| { | |||
| XSLReader xslReader = new XSLReader(); | |||
| // a file:/// + getAbsolutePath() does not work here | |||
| // it is really the pathname | |||
| xslSheet = xslReader.read( fileName.getAbsolutePath() ); | |||
| } | |||
| public void addParam( String name, String expression ) | |||
| { | |||
| processor.setProperty( name, expression ); | |||
| } | |||
| public void transform( File infile, File outfile ) | |||
| throws Exception | |||
| { | |||
| FileOutputStream fos = new FileOutputStream( outfile ); | |||
| // XSLP does not support encoding...we're in hot water. | |||
| OutputStreamWriter out = new OutputStreamWriter( fos, "UTF8" ); | |||
| processor.process( infile.getAbsolutePath(), xslSheet, out ); | |||
| } | |||
| }//-- XSLPLiaison | |||