Browse Source

Remove code that has never been used in any released version of Ant.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270645 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
7cbd5df017
12 changed files with 15 additions and 1141 deletions
  1. +0
    -10
      build.xml
  2. +10
    -10
      docs/manual/CoreTasks/style.html
  3. +1
    -3
      docs/manual/install.html
  4. +0
    -16
      src/main/org/apache/tools/ant/Constants.java
  5. +0
    -132
      src/main/org/apache/tools/ant/DesirableFilter.java
  6. +0
    -204
      src/main/org/apache/tools/ant/Launcher.java
  7. +0
    -118
      src/main/org/apache/tools/ant/taskdefs/CompileTask.java
  8. +0
    -127
      src/main/org/apache/tools/ant/taskdefs/JavacOutputStream.java
  9. +4
    -14
      src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
  10. +0
    -103
      src/main/org/apache/tools/ant/taskdefs/optional/AdaptxLiaison.java
  11. +0
    -332
      src/main/org/apache/tools/ant/taskdefs/optional/ManifestFile.java
  12. +0
    -72
      src/testcases/org/apache/tools/ant/taskdefs/optional/AdaptxLiaisonTest.java

+ 0
- 10
build.xml View File

@@ -174,9 +174,6 @@
classname="javax.servlet.Servlet" classname="javax.servlet.Servlet"
classpathref="classpath"/> classpathref="classpath"/>


<available property="adaptx.present"
classname="org.exolab.adaptx.xslt.XSLTProcessor"
classpathref="classpath" />
<available property="xerces.present" <available property="xerces.present"
classname="org.apache.xerces.parsers.SAXParser" classname="org.apache.xerces.parsers.SAXParser"
classpathref="classpath" /> classpathref="classpath" />
@@ -269,7 +266,6 @@
unless="trax.present" /> unless="trax.present" />
<exclude name="${optional.package}/XslpLiaison.java" unless="xslp.present" /> <exclude name="${optional.package}/XslpLiaison.java" unless="xslp.present" />
<exclude name="${optional.package}/XalanLiaison.java" unless="xalan.present" /> <exclude name="${optional.package}/XalanLiaison.java" unless="xalan.present" />
<exclude name="${optional.package}/AdaptxLiaison.java" unless="adaptx.present" />
<exclude name="${optional.package}/ejb/Ejbc*.java" unless="ejb.ejbc.present" /> <exclude name="${optional.package}/ejb/Ejbc*.java" unless="ejb.ejbc.present" />
<exclude name="${optional.package}/ejb/DDCreator*.java" unless="ejb.DDCreator.present" /> <exclude name="${optional.package}/ejb/DDCreator*.java" unless="ejb.DDCreator.present" />
<exclude name="${optional.package}/ejb/WLRun.java" unless="ejb.wls.present" /> <exclude name="${optional.package}/ejb/WLRun.java" unless="ejb.wls.present" />
@@ -813,8 +809,6 @@
unless="xslp.present"/> unless="xslp.present"/>
<exclude name="org/apache/tools/ant/taskdefs/optional/XalanLiaisonTest.java" <exclude name="org/apache/tools/ant/taskdefs/optional/XalanLiaisonTest.java"
unless="xalan.present"/> unless="xalan.present"/>
<exclude name="org/apache/tools/ant/taskdefs/optional/AdaptxLiaisonTest.java"
unless="adaptx.present"/>
<exclude name="${optional.package}/TraXLiaisonTest.java" <exclude name="${optional.package}/TraXLiaisonTest.java"
unless="trax.present"/> unless="trax.present"/>


@@ -897,10 +891,6 @@
<exclude name="org/apache/tools/ant/taskdefs/optional/XalanLiaisonTest.java" <exclude name="org/apache/tools/ant/taskdefs/optional/XalanLiaisonTest.java"
unless="xalan.present"/> unless="xalan.present"/>


<exclude name="org/apache/tools/ant/taskdefs/optional/AdaptxLiaisonTest.java"
unless="adaptx.present"/>
<exclude name="org/apache/tools/ant/taskdefs/optional/AdaptxLiaisonTest.java"
unless="xerces.present"/>
<exclude name="${optional.package}/perforce/*.java" <exclude name="${optional.package}/perforce/*.java"
unless="jakarta.oro.present" /> unless="jakarta.oro.present" />




+ 10
- 10
docs/manual/CoreTasks/style.html View File

@@ -84,17 +84,17 @@ inclusion/exclusion of files works, and how to write patterns.</p>
</tr> </tr>
<tr> <tr>
<td valign="top">processor</td> <td valign="top">processor</td>

<td valign="top">name of the XSLT processor to use. Permissible values are <td valign="top">name of the XSLT processor to use. Permissible values are
&quot;trax&quot; for a TraX compliant processor, &quot;xslp&quot; for the
XSL:P processor, &quot;xalan&quot; for the Apache XML Xalan (version 1)
processor, &quot;adaptx&quot; for the Exolab Adaptx processor
or the name of an arbitrary XSLTLiaison class. Defaults to trax,
followed by xalan, then adaptx and then xslp (in that
order). The first one found in your class path is the one that
is used.
<em><strong>DEPRECATED</strong> - XSL:P and Adaptx are
deprecated and will be removed in the next version. Use trax or
xalan instead.</em>.
&quot;trax&quot; for a TraX compliant processor,
&quot;xslp&quot; for the XSL:P processor, &quot;xalan&quot; for
the Apache XML Xalan (version 1) processor the name of an
arbitrary XSLTLiaison class. Defaults to trax, followed by xalan
and then xslp (in that order). The first one found in your class
path is the one that is used.

<em><strong>DEPRECATED</strong> - XSL:P is deprecated and will
be removed in the next version. Use trax or xalan instead.</em>.
</td> </td>
<td align="center" valign="top">No</td> <td align="center" valign="top">No</td>
</tr> </tr>


+ 1
- 3
docs/manual/install.html View File

@@ -264,12 +264,10 @@ Installing Ant / Optional Tasks</a> section above.</p>
<td><b>Available At</b></td> <td><b>Available At</b></td>
</tr> </tr>
<tr> <tr>
<td>An XSL transformer like Xalan, Adaptx or XSL:P</td>
<td>An XSL transformer like Xalan or XSL:P</td>
<td>style task</td> <td>style task</td>
<td><a href="http://xml.apache.org/xalan-j/index.html" <td><a href="http://xml.apache.org/xalan-j/index.html"
target="_top">http://xml.apache.org/xalan-j/index.html</a> for Xalan.<br> target="_top">http://xml.apache.org/xalan-j/index.html</a> for Xalan.<br>
CVS module adaptx from :pserver:anoncvs@virtuals.intalio.com:/cvs/adaptx
with password anoncvs for AdaptX.<br>
XSL:P used to live at <a href="http://www.clc-marketing.com/xslp/" XSL:P used to live at <a href="http://www.clc-marketing.com/xslp/"
target="_top">http://www.clc-marketing.com/xslp/</a>, but the link target="_top">http://www.clc-marketing.com/xslp/</a>, but the link
doesn't work any longer and we are not aware of a replacement site.</td> doesn't work any longer and we are not aware of a replacement site.</td>


+ 0
- 16
src/main/org/apache/tools/ant/Constants.java View File

@@ -1,16 +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;

/**
* Abstract interface to hold constants.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
interface Constants {
}

+ 0
- 132
src/main/org/apache/tools/ant/DesirableFilter.java View File

@@ -1,132 +0,0 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/

package org.apache.tools.ant;

import java.io.File;
import java.io.FilenameFilter;


/**
* Filters filenames to determine whether or not the file is desirable.
*
* @author Jason Hunter [jhunter@servlets.com]
* @author james@x180.com
*/
public class DesirableFilter implements FilenameFilter {

/**
* Test the given filename to determine whether or not it's desirable.
* This helps tasks filter temp files and files used by CVS.
*/

public boolean accept(File dir, String name) {
// emacs save file
if (name.endsWith("~")) {
return false;
}

// emacs autosave file
if (name.startsWith("#") && name.endsWith("#")) {
return false;
}

// openwindows text editor does this I think
if (name.startsWith("%") && name.endsWith("%")) {
return false;
}

/* CVS stuff -- hopefully there won't be a case with
* an all cap file/dir named "CVS" that somebody wants
* to keep around...
*/
if (name.equals("CVS")) {
return false;
}
/* If we are going to ignore CVS might as well ignore
* this one as well...
*/
if (name.equals(".cvsignore")){
return false;
}

// CVS merge autosaves.
if (name.startsWith(".#")) {
return false;
}

// SCCS/CSSC/TeamWare:
if (name.equals("SCCS")) {
return false;
}
// Visual Source Save
if (name.equals("vssver.scc")) {
return false;
}

// default
return true;
}
}








+ 0
- 204
src/main/org/apache/tools/ant/Launcher.java View File

@@ -1,204 +0,0 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/

package org.apache.tools.ant;

import java.io.File;
import java.io.FilenameFilter;
import java.util.StringTokenizer;
import java.util.Properties;
import java.net.URL;
import java.net.MalformedURLException;
import java.lang.reflect.Method;

/**
* This is the Ant command line front end to end. This front end
* works out where ant is installed and loads the ant libraries before
* starting Ant proper.
*
* @author <a href="mailto:conor@apache.org">Conor MacNeill</a>
*/
public class Launcher {
private static File determineAntHome11() {
String classpath = System.getProperty("java.class.path");
StringTokenizer tokenizer = new StringTokenizer(classpath, System.getProperty("path.separator"));
while (tokenizer.hasMoreTokens()) {
String path = tokenizer.nextToken();
if (path.endsWith("ant.jar")) {
File antJarFile = new File(path);
File libDirectory = new File(antJarFile.getParent());
File antHome = new File(libDirectory.getParent());
return antHome;
}
}
return null;
}

private static File determineAntHome(ClassLoader systemClassLoader) {
try {
String className = Launcher.class.getName().replace('.', '/') + ".class";
URL classResource = systemClassLoader.getResource(className);
String fileComponent = classResource.getFile();
if (classResource.getProtocol().equals("file")) {
// Class comes from a directory of class files rather than
// from a jar.
int classFileIndex = fileComponent.lastIndexOf(className);
if (classFileIndex != -1) {
fileComponent = fileComponent.substring(0, classFileIndex);
}
File classFilesDir = new File(fileComponent);
File buildDir = new File(classFilesDir.getParent());
File devAntHome = new File(buildDir.getParent());
return devAntHome;
}
else if (classResource.getProtocol().equals("jar")) {
// Class is coming from a jar. The file component of the URL
// is actually the URL of the jar file
int classSeparatorIndex = fileComponent.lastIndexOf("!");
if (classSeparatorIndex != -1) {
fileComponent = fileComponent.substring(0, classSeparatorIndex);
}
URL antJarURL = new URL(fileComponent);
File antJarFile = new File(antJarURL.getFile());
File libDirectory = new File(antJarFile.getParent());
File antHome = new File(libDirectory.getParent());
return antHome;
}
}
catch (MalformedURLException e) {
e.printStackTrace();
}
return null;
}
private static void addDirJars(AntClassLoader classLoader, File jarDir) {
String[] fileList = jarDir.list(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".jar");
}
});

if (fileList != null) {
for (int i = 0; i < fileList.length; ++i) {
File jarFile = new File(jarDir, fileList[i]);
classLoader.addPathElement(jarFile.getAbsolutePath());
}
}
}
private static void addToolsJar(AntClassLoader antLoader) {
String javaHome = System.getProperty("java.home");
if (javaHome.endsWith("jre")) {
javaHome = javaHome.substring(0, javaHome.length() - 4);
}
System.out.println("Java home is " + javaHome);
File toolsJar = new File(javaHome, "lib/tools.jar");
if (!toolsJar.exists()) {
System.out.println("Unable to find tools.jar at " + toolsJar.getPath());
}
else {
antLoader.addPathElement(toolsJar.getAbsolutePath());
}
}

public static void main(String[] args) {
File antHome = null;
ClassLoader systemClassLoader = Launcher.class.getClassLoader();
if (systemClassLoader == null) {
antHome = determineAntHome11();
}
else {
antHome = determineAntHome(systemClassLoader);
}
if (antHome == null) {
System.err.println("Unable to determine ANT_HOME");
System.exit(1);
}
System.out.println("ANT_HOME is " + antHome);

// We now create the class loader with which we are going to launch ant
AntClassLoader antLoader = new AntClassLoader(systemClassLoader, false);

// need to find tools.jar
addToolsJar(antLoader);
// add everything in the lib directory to this classloader
File libDir = new File(antHome, "lib");
addDirJars(antLoader, libDir);
File optionalDir = new File(antHome, "lib/optional");
addDirJars(antLoader, optionalDir);

Properties launchProperties = new Properties();
launchProperties.put("ant.home", antHome.getAbsolutePath());
try {
Class mainClass = antLoader.loadClass("org.apache.tools.ant.Main");
antLoader.initializeClass(mainClass);
final Class[] param = {Class.forName("[Ljava.lang.String;"),
Properties.class, ClassLoader.class};
final Method startMethod = mainClass.getMethod("start", param);
final Object[] argument = {args, launchProperties, systemClassLoader};
startMethod.invoke(null, argument);
}
catch (Exception e) {
System.out.println("Exception running Ant: " + e.getClass().getName() + ": " + e.getMessage());
e.printStackTrace();
}
}
}


+ 0
- 118
src/main/org/apache/tools/ant/taskdefs/CompileTask.java View File

@@ -1,118 +0,0 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/

package org.apache.tools.ant.taskdefs;


import org.apache.tools.ant.types.PatternSet;

import java.util.Vector;
import java.util.Enumeration;

/**
* This task will compile and load a new taskdef all in one step.
* At times, this is useful for eliminating ordering dependencies
* which otherwise would require multiple executions of Ant.
*
* @author Sam Ruby <a href="mailto:rubys@us.ibm.com">rubys@us.ibm.com</a>
*
* @deprecated use &lt;taskdef&gt; elements nested into &lt;target&gt;s instead
*/

public class CompileTask extends Javac {

protected Vector taskList = new Vector();

/**
* add a new task entry on the task list
*/
public Taskdef createTaskdef() {
Taskdef task = new Taskdef();
taskList.addElement(task);
return task;
}
/**
* do all the real work in init
*/
public void init() {
log("!! CompileTask is deprecated. !!");
log("Use <taskdef> elements nested into <target>s instead");

// create all the include entries from the task defs
for (Enumeration e=taskList.elements(); e.hasMoreElements(); ) {
Taskdef task = (Taskdef)e.nextElement();
String source = task.getClassname().replace('.','/') + ".java";
PatternSet.NameEntry include = super.createInclude();
include.setName("**/" + source);
}

// execute Javac
super.init();
super.execute();

// now define all the new tasks
for (Enumeration e=taskList.elements(); e.hasMoreElements(); ) {
Taskdef task = (Taskdef)e.nextElement();
task.init();
}

}

/**
* have execute do nothing
*/
public void execute() {
}
}

+ 0
- 127
src/main/org/apache/tools/ant/taskdefs/JavacOutputStream.java View File

@@ -1,127 +0,0 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/

package org.apache.tools.ant.taskdefs;

import org.apache.tools.ant.Task;
import java.io.OutputStream;
import java.io.IOException;

/**
* Serves as an output stream to Javac. This let's us print messages
* out to the log and detect whether or not Javac had an error
* while compiling.
*
* @author James Duncan Davidson (duncan@x180.com)
* @deprecated use returnvalue of compile to detect compilation failure.
*/

class JavacOutputStream extends OutputStream {

private Task task;
private StringBuffer line;
private boolean errorFlag = false;

/**
* Constructs a new JavacOutputStream with the given task
* as the output source for messages.
*/
JavacOutputStream(Task task) {
this.task = task;
line = new StringBuffer();
}

/**
* Write a character to the output stream. This method looks
* to make sure that there isn't an error being reported and
* will flush each line of input out to the project's log stream.
*/
public void write(int c) throws IOException {
char cc = (char)c;
if (cc == '\r' || cc == '\n') {
// line feed
if (line.length() > 0) {
processLine();
}
} else {
line.append(cc);
}
}

/**
* Processes a line of input and determines if an error occured.
*/
private void processLine() {
String s = line.toString();
if (s.indexOf("error") > -1) {
errorFlag = true;
}
task.log(s);
line = new StringBuffer();
}

/**
* Returns the error status of the compile. If no errors occured,
* this method will return false, else this method will return true.
*/
boolean getErrorFlag() {
return errorFlag;
}
}


+ 4
- 14
src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java View File

@@ -288,11 +288,6 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
final Class clazz = final Class clazz =
loadClass("org.apache.tools.ant.taskdefs.optional.XalanLiaison"); loadClass("org.apache.tools.ant.taskdefs.optional.XalanLiaison");
liaison = (XSLTLiaison)clazz.newInstance(); liaison = (XSLTLiaison)clazz.newInstance();
} else if (proc.equals("adaptx")) {
log("DEPRECATED - adaptx processor is deprecated. Use trax or xalan instead.");
final Class clazz =
loadClass("org.apache.tools.ant.taskdefs.optional.AdaptxLiaison");
liaison = (XSLTLiaison) clazz.newInstance();
} else { } else {
liaison = (XSLTLiaison) loadClass(proc).newInstance(); liaison = (XSLTLiaison) loadClass(proc).newInstance();
} }
@@ -422,16 +417,11 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
resolveProcessor("xalan"); resolveProcessor("xalan");
} catch (Throwable e2) { } catch (Throwable e2) {
try { try {
resolveProcessor("adaptx");
resolveProcessor("xslp");
} catch (Throwable e3) { } catch (Throwable e3) {
try {
resolveProcessor("xslp");
} catch (Throwable e4) {
e4.printStackTrace();
e3.printStackTrace();
e2.printStackTrace();
throw new BuildException(e1);
}
e3.printStackTrace();
e2.printStackTrace();
throw new BuildException(e1);
} }
} }
} }


+ 0
- 103
src/main/org/apache/tools/ant/taskdefs/optional/AdaptxLiaison.java View File

@@ -1,103 +0,0 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/

package org.apache.tools.ant.taskdefs.optional;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;

import org.apache.tools.ant.taskdefs.XSLTLiaison;
import org.apache.tools.ant.BuildException;

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 setStylesheet(File fileName) throws Exception {
XSLTReader xslReader = new XSLTReader();
xslSheet = xslReader.read( fileName.getAbsolutePath() );
};

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);
}

public void addParam(String name, String expression){
processor.setProperty(name, expression);
}

public void setOutputtype(String type) throws Exception {
if (!type.equals("xml")) {
throw new BuildException("Unsupported output type: " + type);
}
}

} //-- AdaptxLiaison

+ 0
- 332
src/main/org/apache/tools/ant/taskdefs/optional/ManifestFile.java View File

@@ -1,332 +0,0 @@
package org.apache.tools.ant.taskdefs.optional;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Vector;
import java.util.Enumeration;
import java.util.Comparator;
import java.util.ListIterator;
import java.util.StringTokenizer;
import java.util.ArrayList;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;


/**
* Task for creating a manifest file for a jar archiv.
* use:
* <pre>
* <taskdef name="manifest" classname="ManifestFile"/>
* <target name="jar_manifest">
* <manifest file="manifest.mf" method="replaceAll">
* <entry value="Manifest-Version: 1_0"/>
* </manifest>
* </target>
* </pre>
*
*@version 1.0 2001-10-11
*@author Thomas Kerle
*/
public class ManifestFile extends Task {

private final static String newLine = System.getProperty("line.separator");
private final static String keyValueSeparator = ":";
private final static String UPDATE_ = "update";
private final static String REPLACEALL_ = "replaceAll";

private File manifestFile;
private Vector entries;
private EntryContainer container;
private String currentMethod;

public ManifestFile() {
entries = new Vector();
container = new EntryContainer();
}

/**
* execute task
* @exception BuildException : Failure in building
*/
public void execute() throws BuildException {
checkParameters();
if (isUpdate(currentMethod)) {
readFile();
}

executeOperation();
writeFile();
}

/**
* adding entries to a container
* @exception BuildException
*/
private void executeOperation() throws BuildException {
Enumeration enum = entries.elements();

while (enum.hasMoreElements()) {
Entry entry = (Entry) enum.nextElement();
entry.addTo (container);
}
}

/**
* creating entries by Ant
*
*
*/
public Entry createEntry() {
Entry entry = new Entry();
entries.addElement(entry);
return entry;
}


private boolean isUpdate (String method) {
return method.equals(UPDATE_.toUpperCase());
}

private boolean isReplaceAll (String method) {
return method.equals(REPLACEALL_.toUpperCase());
}

/**
* Setter for the method attribute (update/replaceAll)
* @param method Method to set task
*/
public void setMethod (String method) {
currentMethod = method.toUpperCase();
}

/**
* Setter for the file attribute
* @param filename for the manifest
*/
public void setFile(File f) {
manifestFile = f;
}


private StringBuffer buildBuffer () {
StringBuffer buffer = new StringBuffer ();

ListIterator iterator = container.elements();

while (iterator.hasNext()) {
Entry entry = (Entry) iterator.next();

String key = (String) entry.getKey();
String value = (String) entry.getValue();
String entry_string = key + keyValueSeparator + value;

buffer.append (entry_string + this.newLine);
}

return buffer;
}


private void writeFile() throws BuildException {
try {
manifestFile.delete();
log ("Replacing or creating new manifest file " + manifestFile.getAbsolutePath());
if (manifestFile.createNewFile()) {
FileOutputStream fos = new FileOutputStream(manifestFile);

StringBuffer buffer = buildBuffer();

int size = buffer.length();

for (int i=0; i<size; i++) {
fos.write( (char) buffer.charAt(i));
}

fos.flush();
fos.close();
} else {
throw new BuildException ("Can't create manifest file");
}

} catch (IOException ioe) {
throw new BuildException ("An input/ouput error occured" + ioe.toString());
}
}

private StringTokenizer getLineTokens (StringBuffer buffer) {
String manifests = buffer.toString();
StringTokenizer strTokens = new StringTokenizer(manifests, newLine);
return strTokens;
}

private void addLine (String line) {
Entry entry = new Entry();

entry.setValue (line);
entry.addTo(container);
}

private void readFile() throws BuildException {

if (manifestFile.exists()) {
this.log("update existing manifest file " + manifestFile.getAbsolutePath());

if (container != null) {
try {
FileInputStream fis = new FileInputStream(manifestFile);

int c;
StringBuffer buffer = new StringBuffer("");
boolean stop = false;
while (!stop) {
c = fis.read();
if (c == -1){
stop =true;
} else {
buffer.append( (char) c);
}
}
fis.close();
StringTokenizer lineTokens = getLineTokens (buffer);
while (lineTokens.hasMoreElements()) {
String currentLine = (String) lineTokens.nextElement();
addLine (currentLine);
}
}
catch (FileNotFoundException fnfe) {
throw new BuildException ("File not found exception " + fnfe.toString());
}
catch (IOException ioe) {
throw new BuildException ("Unknown input/output exception " + ioe.toString());
}
}
}

}

private void checkParameters() throws BuildException {
if (!checkParam(manifestFile)) {
throw new BuildException ("file token must not be null.", location);
}
}

private boolean checkParam (String param) {
return !((param==null) || (param.equals("null")));
}

private boolean checkParam (File param) {
return !(param == null);
}

public class EntryContainer {

private ArrayList list = null;

public EntryContainer () {
list = new ArrayList();
}

public void set (Entry entry) {

if (list.contains(entry)) {
int index = list.indexOf(entry);

list.remove(index);
list.add(index, entry);
} else {
list.add(entry);
}
}

public ListIterator elements() {
ListIterator iterator = list.listIterator();
return iterator;
}
}

public class Entry implements Comparator {
//extern format
private String value = null;

//intern representation
private String val = null;
private String key = null;

public Entry () {

}

public void setValue (String value) {
this.value = new String(value);
}

public String getKey () {
return key;
}

public String getValue() {
return val;
}

private void checkFormat () throws BuildException {

if (value==null) {
throw new BuildException ("no argument for value");
}

StringTokenizer st = new StringTokenizer(value, ManifestFile.keyValueSeparator);
int size = st.countTokens();

if (size < 2 ) {
throw new BuildException ("value has not the format of a manifest entry");
}
}

private void split () {
StringTokenizer st = new StringTokenizer(value, ManifestFile.keyValueSeparator);
key = (String) st.nextElement();
val = (String) st.nextElement();
}

public int compare (Object o1, Object o2) {
int result = -1;

try {
Entry e1 = (Entry) o1;
Entry e2 = (Entry) o2;

String key_1 = e1.getKey();
String key_2 = e2.getKey();


result = key_1.compareTo(key_2);
} catch (Exception e) {

}
return result;
}


public boolean equals (Object obj) {
Entry ent = new Entry();
boolean result = false;
int res = ent.compare (this,(Entry) obj );
if (res==0) {
result =true;
}

return result;
}


protected void addTo (EntryContainer container) throws BuildException {
checkFormat();
split();
container.set(this);
}

}
}

+ 0
- 72
src/testcases/org/apache/tools/ant/taskdefs/optional/AdaptxLiaisonTest.java View File

@@ -1,72 +0,0 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Jakarta-Regexp", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/

package org.apache.tools.ant.taskdefs.optional;

import org.apache.tools.ant.taskdefs.XSLTLiaison;

/**
* Adaptx Liaison testcase
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
*/
public class AdaptxLiaisonTest extends AbstractXSLTLiaisonTest {
public AdaptxLiaisonTest(String name){
super(name);
}

protected XSLTLiaison createLiaison() throws Exception {
return new AdaptxLiaison();
}
}

Loading…
Cancel
Save