summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Donald <donaldp@apache.org>2002-04-16 10:53:17 +0000
committerPeter Donald <donaldp@apache.org>2002-04-16 10:53:17 +0000
commit175e2f5254434d619745ee818337a5f48eca6ff1 (patch)
treeb8a36aa2346c1831ff4e725782768761a958368a
parentd5cdaa9da9f146dd01172096796b8c084be65cc6 (diff)
downloadant-175e2f5254434d619745ee818337a5f48eca6ff1.tar.gz
Zap some antlibs
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272457 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/archive/BUnzip2.java45
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/archive/BZip2.java34
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/archive/GUnzip.java38
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/archive/GZip.java33
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/archive/Pack.java121
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/archive/Unpack.java154
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/build/BuildNumber.java200
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/build/Checksum.java437
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/build/Patch.java171
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/build/Resources.properties13
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/build/SleepTask.java124
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/build/UpToDateCondition.java130
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/AbstractAntTask.java161
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/AbstractAvailableCondition.java51
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/AntCallTask.java69
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/AntParam.java89
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/AntTask.java79
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/ClassAvailableCondition.java64
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/ConditionTask.java80
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/Equals.java53
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/ExtFileNameMapper.java43
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/Fail.java59
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/FileTokenSet.java81
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/FlatFileNameMapper.java41
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/IfTask.java123
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/LoadProperties.java126
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/Log.java82
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/PrefixFileNameMapper.java56
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/Property.java89
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/PropertyDump.java68
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/PropertyLoader.java34
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/PropertyTokenSet.java38
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/ResourceAvailableCondition.java61
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/Resources.properties39
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/SingletonTokenSet.java82
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/StringToEnumConverter.java101
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/StringToFileConverter.java50
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/core/TryCatchTask.java129
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/dotnet/CSharp.java827
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/dotnet/Ilasm.java395
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/file/CopyTask.java450
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/file/Delete.java240
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/file/FilteredCopyTask.java132
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/file/ListPathTask.java49
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/file/Mkdir.java67
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/file/MoveTask.java48
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/file/Resources.properties36
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/file/Touch.java203
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/java/ExternalCompilerAdaptor.java92
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/java/JavaCompilerAdaptor.java247
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/java/JavaTask.java121
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/java/JavacAdaptor.java114
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/java/JavacTask.java54
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/java/JikesAdaptor.java82
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/nativelib/Exec.java112
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/nativelib/LoadEnvironment.java99
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/nativelib/OsCondition.java79
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/nativelib/Resources.properties3
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/runtime/ConverterDef.java46
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/runtime/Facility.java89
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/runtime/Import.java59
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/runtime/Resources.properties10
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeAvailableCondition.java102
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeDef.java41
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/security/DistinguishedName.java75
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/security/DnameParam.java34
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/security/GenerateKey.java236
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/security/SignJar.java363
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/selftest/ExtensionsTest.java47
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/selftest/PrimitiveTypesTest.java91
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/selftest/extension1/ExtensionsLoadedClass.java21
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/sound/AntSoundPlayer.java237
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/sound/BuildAlert.java81
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/sound/Resources.properties4
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/sound/SoundTask.java134
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/CopyFilesTask.java156
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/DefaultFileList.java78
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/DefaultFileSet.java120
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/DefaultFileSetResult.java50
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/FileList.java35
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/FileSet.java36
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/FileSetAdaptor.java39
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/FileSetResult.java28
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/FileSetToFileListConverter.java39
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/FilteredFileList.java73
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/FlatFileSet.java54
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/ListFileSetTask.java54
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/ListFilesTask.java47
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/MappedFileSet.java95
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/PathFileList.java61
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/Resources.properties10
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/SingletonFileList.java40
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/StringToFileObjectConverter.java58
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/AbstractNameFileSelector.java137
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/AndFileSelector.java56
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/BaseNameFileSelector.java31
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/ConditionSelector.java47
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/ExistenceFileSelector.java43
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/FileSelector.java34
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/FileTestCondition.java63
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/IsEmptyFolderSelector.java46
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/IsFileSelector.java44
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/IsFolderSelector.java44
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/NameFileSelector.java43
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/NotFileSelector.java55
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/OrFileSelector.java57
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/Resources.properties9
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/UrlFileSelector.java31
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/xml/DTDLocation.java34
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/xml/LocalResolver.java136
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/xml/TraxErrorListener.java86
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/xml/ValidatorErrorHandler.java92
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/xml/XMLValidateTask.java383
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTParam.java34
-rw-r--r--proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTProcess.java399
115 files changed, 0 insertions, 11545 deletions
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/archive/BUnzip2.java b/proposal/myrmidon/src/java/org/apache/antlib/archive/BUnzip2.java
deleted file mode 100644
index b3de6b3eb..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/archive/BUnzip2.java
+++ /dev/null
@@ -1,45 +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.txt file.
- */
-package org.apache.antlib.archive;
-
-import java.io.IOException;
-import java.io.InputStream;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.excalibur.bzip2.CBZip2InputStream;
-
-/**
- * Expands a file that has been compressed with the BZIP2 algorithm. Normally
- * used to compress non-compressed archives such as TAR files.
- *
- * @author <a href="mailto:umagesh@rediffmail.com">Magesh Umasankar</a>
- * @ant.task name="bunzip2"
- */
-public class BUnzip2
- extends Unpack
-{
- private static final String DEFAULT_EXTENSION = ".bz2";
-
- protected String getDefaultExtension()
- {
- return DEFAULT_EXTENSION;
- }
-
- protected InputStream getUnpackingStream( final InputStream input )
- throws TaskException, IOException
- {
- final int b1 = input.read();
- final int b2 = input.read();
- if( b1 != 'B' || b2 != 'Z' )
- {
- final String message = "Invalid bz2 file.";
- throw new TaskException( message );
- }
-
- return new CBZip2InputStream( input );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/archive/BZip2.java b/proposal/myrmidon/src/java/org/apache/antlib/archive/BZip2.java
deleted file mode 100644
index a4ec4d241..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/archive/BZip2.java
+++ /dev/null
@@ -1,34 +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.txt file.
- */
-package org.apache.antlib.archive;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import org.apache.excalibur.bzip2.CBZip2OutputStream;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * Compresses a file with the BZip2 algorithm. Normally used to compress
- * non-compressed archives such as TAR files.
- *
- * @author <a href="mailto:umagesh@rediffmail.com">Magesh Umasankar</a>
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @ant.task name="bzip2"
- */
-public class BZip2
- extends Pack
-{
- private static final byte[] HEADER = new byte[]{(byte)'B', (byte)'Z'};
-
- protected OutputStream getPackingStream( OutputStream output )
- throws TaskException, IOException
- {
- output.write( HEADER );
- return new CBZip2OutputStream( output );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/archive/GUnzip.java b/proposal/myrmidon/src/java/org/apache/antlib/archive/GUnzip.java
deleted file mode 100644
index e77b37e4e..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/archive/GUnzip.java
+++ /dev/null
@@ -1,38 +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.txt file.
- */
-package org.apache.antlib.archive;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.zip.GZIPInputStream;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * Expands a file that has been compressed with the GZIP algorithm. Normally
- * used to compress non-compressed archives such as TAR files.
- *
- * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
- * @author <a href="mailto:umagesh@rediffmail.com">Magesh Umasankar</a>
- * @ant.task name="gunzip"
- */
-public class GUnzip
- extends Unpack
-{
- private static final String DEFAULT_EXTENSION = ".gz";
-
- protected String getDefaultExtension()
- {
- return DEFAULT_EXTENSION;
- }
-
- protected InputStream getUnpackingStream( InputStream input )
- throws TaskException, IOException
- {
- return new GZIPInputStream( input );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/archive/GZip.java b/proposal/myrmidon/src/java/org/apache/antlib/archive/GZip.java
deleted file mode 100644
index 055098f0e..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/archive/GZip.java
+++ /dev/null
@@ -1,33 +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.txt file.
- */
-package org.apache.antlib.archive;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.zip.GZIPOutputStream;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * Compresses a file with the GZIP algorithm. Normally used to compress
- * non-compressed archives such as TAR files.
- *
- * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a>
- * @author Jon S. Stevens <a href="mailto:jon@clearink.com">jon@clearink.com</a>
- * @author <a href="mailto:umagesh@rediffmail.com">Magesh Umasankar</a>
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @ant.task name="gzip"
- */
-public class GZip
- extends Pack
-{
- protected OutputStream getPackingStream( final OutputStream output )
- throws TaskException, IOException
- {
- return new GZIPOutputStream( output );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/archive/Pack.java b/proposal/myrmidon/src/java/org/apache/antlib/archive/Pack.java
deleted file mode 100644
index dc753687b..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/archive/Pack.java
+++ /dev/null
@@ -1,121 +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.txt file.
- */
-package org.apache.antlib.archive;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import org.apache.avalon.excalibur.io.IOUtil;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * Abstract Base class for pack tasks.
- *
- * @author <a href="mailto:umagesh@rediffmail.com">Magesh Umasankar</a>
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- */
-public abstract class Pack
- extends AbstractTask
-{
- private File m_src;
- private File m_zipFile;
-
- public void setSrc( final File src )
- {
- m_src = src;
- }
-
- public void setZipfile( final File zipFile )
- {
- m_zipFile = zipFile;
- }
-
- public void execute()
- throws TaskException
- {
- validate();
- final String message = "Building: " + m_zipFile.getAbsolutePath();
- getContext().verbose( message );
- pack();
- }
-
- private void pack()
- throws TaskException
- {
- OutputStream output = null;
- try
- {
- final FileOutputStream fileOutput = new FileOutputStream( getZipFile() );
- output = getPackingStream( fileOutput );
- copy( getSrc(), output );
- }
- catch( final IOException ioe )
- {
- final String message = "Problem creating " + getContext().getName() +
- ":" + ioe.getMessage();
- throw new TaskException( message, ioe );
- }
- finally
- {
- IOUtil.shutdownStream( output );
- }
- }
-
- protected abstract OutputStream getPackingStream( OutputStream output )
- throws TaskException, IOException;
-
- protected final void copy( final File file, final OutputStream output )
- throws IOException
- {
- final FileInputStream input = new FileInputStream( file );
- try
- {
- IOUtil.copy( input, output );
- }
- finally
- {
- IOUtil.shutdownStream( input );
- }
- }
-
- private void validate()
- throws TaskException
- {
- if( null == m_zipFile )
- {
- final String message = "zipfile attribute is required";
- throw new TaskException( message );
- }
-
- if( null == m_src )
- {
- final String message = "src attribute is required";
- throw new TaskException( message );
- }
-
- if( m_src.isDirectory() )
- {
- final String message = "Src attribute must not " +
- "represent a directory!";
- throw new TaskException( message );
- }
- }
-
- protected final File getSrc()
- {
- return m_src;
- }
-
- protected final File getZipFile()
- {
- return m_zipFile;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/archive/Unpack.java b/proposal/myrmidon/src/java/org/apache/antlib/archive/Unpack.java
deleted file mode 100644
index 96b4f670d..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/archive/Unpack.java
+++ /dev/null
@@ -1,154 +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.txt file.
- */
-package org.apache.antlib.archive;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import org.apache.avalon.excalibur.io.IOUtil;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * Abstract Base class for unpack tasks.
- *
- * @author <a href="mailto:umagesh@rediffmail.com">Magesh Umasankar</a>
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
- */
-public abstract class Unpack
- extends AbstractTask
-{
- private File m_dest;
- private File m_src;
-
- public void setDest( final File dest )
- {
- m_dest = dest;
- }
-
- public void setSrc( final File src )
- {
- m_src = src;
- }
-
- public void execute()
- throws TaskException
- {
- validate();
-
- final File src = getSrc();
- final File dest = getDest();
-
- if( src.lastModified() > dest.lastModified() )
- {
- final String message = "Expanding " + src.getAbsolutePath() +
- " to " + dest.getAbsolutePath();
- getContext().verbose( message );
-
- extract();
- }
- }
-
- protected abstract String getDefaultExtension();
-
- protected abstract InputStream getUnpackingStream( InputStream input )
- throws TaskException, IOException;
-
- private void extract()
- throws TaskException
- {
- OutputStream output = null;
- InputStream input = null;
- InputStream fileInput = null;
- try
- {
- output = new FileOutputStream( getDest() );
- fileInput = new FileInputStream( getSrc() );
- input = getUnpackingStream( fileInput );
- IOUtil.copy( input, output );
- }
- catch( final IOException ioe )
- {
- final String message = "Problem expanding " + getSrc() +
- ":" + ioe.getMessage();
- throw new TaskException( message, ioe );
- }
- finally
- {
- IOUtil.shutdownStream( fileInput );
- IOUtil.shutdownStream( output );
- IOUtil.shutdownStream( input );
- }
- }
-
- private File createDestFile()
- {
- final String extension = getDefaultExtension();
- final String sourceName = m_src.getName();
- final int length = sourceName.length();
- final int index = length - extension.length();
-
- if( null != extension &&
- length > extension.length() &&
- extension.equalsIgnoreCase( sourceName.substring( index ) ) )
- {
- final String child = sourceName.substring( 0, index );
- return new File( m_dest, child );
- }
- else
- {
- return new File( m_dest, sourceName );
- }
- }
-
- private void validate()
- throws TaskException
- {
- if( null == m_src )
- {
- final String message = "No Src for " + getContext().getName() + " specified";
- throw new TaskException( message );
- }
-
- if( !m_src.exists() )
- {
- final String message = "Src doesn't exist";
- throw new TaskException( message );
- }
-
- if( m_src.isDirectory() )
- {
- final String message = "Cannot expand a directory";
- throw new TaskException( message );
- }
-
- if( null == m_dest )
- {
- m_dest = new File( m_src.getParent() );
- }
-
- if( m_dest.isDirectory() )
- {
- m_dest = createDestFile();
- }
- }
-
- protected final File getDest()
- {
- return m_dest;
- }
-
- protected final File getSrc()
- {
- return m_src;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/build/BuildNumber.java b/proposal/myrmidon/src/java/org/apache/antlib/build/BuildNumber.java
deleted file mode 100644
index 023a90568..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/build/BuildNumber.java
+++ /dev/null
@@ -1,200 +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.txt file.
- */
-package org.apache.antlib.build;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Properties;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.avalon.excalibur.io.IOUtil;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * This is a basic task that can be used to track build numbers.
- *
- * It will first attempt to read a build number from a file, then
- * set the property "build.number" to the value that was read in
- * (or 0 if no such value). Then it will increment the build number
- * by one and write it back out into the file.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @version $Revision$ $Date$
- * @ant.task name="build-number"
- */
-public class BuildNumber
- extends AbstractTask
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( BuildNumber.class );
-
- /**
- * The name of the property in which the build number is stored.
- */
- private static final String DEFAULT_PROPERTY_NAME = "build.number";
-
- /**
- * The default filename to use if no file specified.
- */
- private static final String DEFAULT_FILENAME = DEFAULT_PROPERTY_NAME;
-
- /**
- * The File in which the build number is stored.
- */
- private File m_file;
-
- /**
- * Specify the file in which the build numberis stored.
- * Defaults to "build.number" if not specified.
- *
- * @param file the file in which build number is stored.
- */
- public void setFile( final File file )
- {
- m_file = file;
- }
-
- /**
- * Run task.
- *
- * @exception TaskException if an error occurs
- */
- public void execute()
- throws TaskException
- {
- validate();
-
- final Properties properties = loadProperties();
- final int buildNumber = getBuildNumber( properties );
-
- properties.put( DEFAULT_PROPERTY_NAME,
- String.valueOf( buildNumber + 1 ) );
-
- // Write the properties file back out
- FileOutputStream output = null;
- try
- {
- final String header = REZ.getString( "buildnumber.header.info" );
-
- output = new FileOutputStream( m_file );
- properties.store( output, header );
- }
- catch( final IOException ioe )
- {
- final String message =
- REZ.getString( "buildnumber.badwrite.error", m_file );
- throw new TaskException( message, ioe );
- }
- finally
- {
- IOUtil.shutdownStream( output );
- }
-
- //Finally set the property
- getContext().setProperty( DEFAULT_PROPERTY_NAME,
- String.valueOf( buildNumber ) );
- }
-
- /**
- * Utility method to retrieve build number from properties object.
- *
- * @param properties the properties to retrieve build number from
- * @return the build number or if no number in properties object
- * @throws TaskException if build.number property is not an integer
- */
- private int getBuildNumber( final Properties properties )
- throws TaskException
- {
- final String buildNumber =
- properties.getProperty( DEFAULT_PROPERTY_NAME, "0" ).trim();
-
- // Try parsing the line into an integer.
- try
- {
- return Integer.parseInt( buildNumber );
- }
- catch( final NumberFormatException nfe )
- {
- final String message =
- REZ.getString( "buildnumber.noparse.error", m_file, buildNumber );
- throw new TaskException( message, nfe );
- }
- }
-
- /**
- * Utility method to load properties from file.
- *
- * @return the loaded properties
- * @throws TaskException
- */
- private Properties loadProperties()
- throws TaskException
- {
- FileInputStream input = null;
- try
- {
- final Properties properties = new Properties();
- input = new FileInputStream( m_file );
- properties.load( input );
- return properties;
- }
- catch( final IOException ioe )
- {
- throw new TaskException( ioe.getMessage(), ioe );
- }
- finally
- {
- IOUtil.shutdownStream( input );
- }
- }
-
- /**
- * Validate that the task parameters are valid.
- *
- * @throws TaskException if parameters are invalid
- */
- private void validate()
- throws TaskException
- {
- if( null == m_file )
- {
- m_file = getContext().resolveFile( DEFAULT_FILENAME );
- }
-
- if( !m_file.exists() )
- {
- try
- {
- m_file.createNewFile();
- }
- catch( final IOException ioe )
- {
- final String message =
- REZ.getString( "buildnumber.nocreate.error", m_file );
- throw new TaskException( message, ioe );
- }
- }
-
- if( !m_file.canRead() )
- {
- final String message =
- REZ.getString( "buildnumber.noread.error", m_file );
- throw new TaskException( message );
- }
-
- if( !m_file.canWrite() )
- {
- final String message =
- REZ.getString( "buildnumber.nowrite.error", m_file );
- throw new TaskException( message );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/build/Checksum.java b/proposal/myrmidon/src/java/org/apache/antlib/build/Checksum.java
deleted file mode 100644
index f7ebfebe0..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/build/Checksum.java
+++ /dev/null
@@ -1,437 +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.txt file.
- */
-package org.apache.antlib.build;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.DigestInputStream;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import org.apache.avalon.excalibur.io.IOUtil;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.AbstractMatchingTask;
-import org.apache.myrmidon.framework.FileSet;
-import org.apache.tools.todo.types.DirectoryScanner;
-import org.apache.tools.todo.types.ScannerUtil;
-
-/**
- * This task can be used to create checksums for files. It can also be used to
- * verify checksums.
- *
- * @ant.task name="checksum"
- * @author <a href="mailto:umagesh@rediffmail.com">Magesh Umasankar</a>
- * @version $Revision$ $Date$
- */
-public class Checksum
- extends AbstractMatchingTask
-{
- /**
- * File for which checksum is to be calculated.
- */
- private File m_file;
-
- /**
- * MessageDigest algorithm to be used.
- */
- private String m_algorithm = "MD5";
-
- /**
- * MessageDigest Algorithm provider
- */
- private String m_provider;
-
- /**
- * ArrayList to hold source file sets.
- */
- private ArrayList m_filesets = new ArrayList();
-
- /**
- * Stores SourceFile, DestFile pairs and SourceFile, Property String pairs.
- */
- private Hashtable m_includeFileMap = new Hashtable();
-
- /**
- * File Extension that is be to used to create or identify destination file
- */
- private String m_fileext;
-
- /**
- * Create new destination file? Defaults to false.
- */
- private boolean m_forceOverwrite;
-
- /**
- * Message Digest instance
- */
- private MessageDigest m_messageDigest;
-
- /**
- * Holds generated checksum and gets set as a Project Property.
- */
- private String m_property;
-
- /**
- * Contains the result of a checksum verification. ("true" or "false")
- */
- private String m_verifyProperty;
-
- /**
- * Sets the MessageDigest algorithm to be used to calculate the checksum.
- */
- public void setAlgorithm( final String algorithm )
- {
- m_algorithm = algorithm;
- }
-
- /**
- * Sets the file for which the checksum is to be calculated.
- */
- public void setFile( final File file )
- {
- m_file = file;
- }
-
- /**
- * Sets the File Extension that is be to used to create or identify
- * destination file
- */
- public void setFileext( final String fileext )
- {
- m_fileext = fileext;
- }
-
- /**
- * Overwrite existing file irrespective of whether it is newer than the
- * source file? Defaults to false.
- */
- public void setForceOverwrite( boolean forceOverwrite )
- {
- this.m_forceOverwrite = forceOverwrite;
- }
-
- /**
- * Sets the property to hold the generated checksum
- */
- public void setProperty( String property )
- {
- this.m_property = property;
- }
-
- /**
- * Sets the MessageDigest algorithm provider to be used to calculate the
- * checksum.
- *
- * @param provider The new Provider value
- */
- public void setProvider( final String provider )
- {
- m_provider = provider;
- }
-
- /**
- * Sets verify property. This project property holds the result of a
- * checksum verification - "true" or "false"
- */
- public void setVerifyproperty( final String verifyProperty )
- {
- m_verifyProperty = verifyProperty;
- }
-
- /**
- * Adds a set of files (nested fileset attribute).
- */
- public void addFileset( final FileSet set )
- {
- m_filesets.add( set );
- }
-
- /**
- * Calculate the checksum(s).
- */
- public void execute()
- throws TaskException
- {
- final boolean value = validateAndExecute();
- if( m_verifyProperty != null )
- {
- getContext().setProperty( m_verifyProperty, "" + value );
- }
- }
-
- /**
- * Add key-value pair to the hashtable upon which to later operate upon.
- *
- * @param file The feature to be added to the ToIncludeFileMap attribute
- * @exception TaskException Description of Exception
- */
- private void addToIncludeFileMap( final File file )
- throws TaskException
- {
- if( file != null )
- {
- if( file.exists() )
- {
- if( m_property == null )
- {
- final File dest = new File( file.getParent(), file.getName() + m_fileext );
- if( m_forceOverwrite ||
- ( file.lastModified() > dest.lastModified() ) )
- {
- m_includeFileMap.put( file, dest );
- }
- else
- {
- final String message = file + " omitted as " + dest +
- " is up to date.";
- getContext().debug( message );
- }
- }
- else
- {
- m_includeFileMap.put( file, m_property );
- }
- }
- else
- {
- final String message = "Could not find file " + file.getAbsolutePath() +
- " to generate checksum for.";
- throw new TaskException( message );
- }
- }
- }
-
- /**
- * Generate checksum(s) using the message digest created earlier.
- */
- private boolean generateChecksums()
- throws TaskException
- {
- boolean checksumMatches = true;
- final Enumeration includes = m_includeFileMap.keys();
- while( includes.hasMoreElements() )
- {
- final File src = (File)includes.nextElement();
- final String message = "Calculating " + m_algorithm + " checksum for " + src;
- getContext().verbose( message );
-
- checksumMatches = z( src, checksumMatches );
- }
-
- return checksumMatches;
- }
-
- private boolean z( final File src, final boolean checksumMatches )
- throws TaskException
- {
- boolean match = checksumMatches;
- FileInputStream fis = null;
- FileOutputStream fos = null;
- try
- {
- fis = new FileInputStream( src );
- final byte[] fileDigest = buildDigest( fis );
- IOUtil.shutdownStream( fis );
-
- final StringBuffer sb = new StringBuffer();
- for( int i = 0; i < fileDigest.length; i++ )
- {
- final String hexStr = Integer.toHexString( 0x00ff & fileDigest[ i ] );
- if( hexStr.length() < 2 )
- {
- sb.append( '0' );
- }
- sb.append( hexStr );
- }
-
- final String checksum = sb.toString();
-
- //can either be a property name string or a file
- final Object destination = m_includeFileMap.get( src );
- if( destination instanceof String )
- {
- final String prop = (String)destination;
- match = checksum.equals( m_property );
- getContext().setProperty( prop, checksum );
- }
- else if( destination instanceof File )
- {
- final File file = (File)destination;
- fos = new FileOutputStream( file );
- fos.write( checksum.getBytes() );
- fos.close();
- fos = null;
- }
- }
- catch( final Exception e )
- {
- throw new TaskException( e.getMessage(), e );
- }
- finally
- {
- IOUtil.shutdownStream( fis );
- IOUtil.shutdownStream( fos );
- }
- return match;
- }
-
- private byte[] buildDigest( final InputStream input )
- throws IOException
- {
- m_messageDigest.reset();
-
- final DigestInputStream digester =
- new DigestInputStream( input, m_messageDigest );
-
- while( digester.read() != -1 )
- {
- }
-
- digester.close();
- return m_messageDigest.digest();
- }
-
- /**
- * Validate attributes and get down to business.
- */
- private boolean validateAndExecute()
- throws TaskException
- {
- if( null == m_file && 0 == m_filesets.size() )
- {
- final String message = "Specify at least one source - a file or a fileset.";
- throw new TaskException( message );
- }
-
- if( null != m_file && m_file.exists() && m_file.isDirectory() )
- {
- final String message = "Checksum cannot be generated for directories";
- throw new TaskException( message );
- }
-
- if( null != m_property && null != m_fileext )
- {
- final String message = "Property and FileExt cannot co-exist.";
- throw new TaskException( message );
- }
-
- if( m_property != null )
- {
- if( m_forceOverwrite )
- {
- final String message =
- "ForceOverwrite cannot be used when Property is specified";
- throw new TaskException( message );
- }
-
- if( m_file != null )
- {
- if( m_filesets.size() > 0 )
- {
- final String message =
- "Multiple files cannot be used when Property is specified";
- throw new TaskException( message );
- }
- }
- else
- {
- if( m_filesets.size() > 1 )
- {
- final String message =
- "Multiple files cannot be used when Property is specified";
- throw new TaskException( message );
- }
- }
- }
-
- if( m_verifyProperty != null && m_forceOverwrite )
- {
- final String message = "VerifyProperty and ForceOverwrite cannot co-exist.";
- throw new TaskException( message );
- }
-
- if( m_fileext == null )
- {
- m_fileext = "." + m_algorithm;
- }
- else if( m_fileext.trim().length() == 0 )
- {
- final String message = "File extension when specified must not be an empty string";
- throw new TaskException( message );
- }
-
- setupMessageDigest();
-
- if( m_messageDigest == null )
- {
- final String message = "Unable to create Message Digest";
- throw new TaskException( message );
- }
-
- addIncludes();
-
- return generateChecksums();
- }
-
- private void setupMessageDigest()
- throws TaskException
- {
- m_messageDigest = null;
- if( m_provider != null )
- {
- try
- {
- m_messageDigest = MessageDigest.getInstance( m_algorithm, m_provider );
- }
- catch( final NoSuchAlgorithmException nsae )
- {
- throw new TaskException( nsae.toString(), nsae );
- }
- catch( final NoSuchProviderException nspe )
- {
- throw new TaskException( nspe.toString(), nspe );
- }
- }
- else
- {
- try
- {
- m_messageDigest = MessageDigest.getInstance( m_algorithm );
- }
- catch( final NoSuchAlgorithmException nsae )
- {
- throw new TaskException( nsae.toString(), nsae );
- }
- }
- }
-
- private void addIncludes()
- throws TaskException
- {
- addToIncludeFileMap( m_file );
-
- final int size = m_filesets.size();
- for( int i = 0; i < size; i++ )
- {
- final FileSet fileSet = (FileSet)m_filesets.get( i );
- final DirectoryScanner scanner = ScannerUtil.getDirectoryScanner( fileSet );
- final String[] srcFiles = scanner.getIncludedFiles();
- for( int j = 0; j < srcFiles.length; j++ )
- {
- final File src = new File( fileSet.getDir(), srcFiles[ j ] );
- addToIncludeFileMap( src );
- }
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/build/Patch.java b/proposal/myrmidon/src/java/org/apache/antlib/build/Patch.java
deleted file mode 100644
index f0cff6585..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/build/Patch.java
+++ /dev/null
@@ -1,171 +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.txt file.
- */
-package org.apache.antlib.build;
-
-import java.io.File;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.nativelib.Execute;
-
-/**
- * Task as a layer on top of patch. Patch applies a diff file to an original.
- *
- * @ant.task name="patchx"
- * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @version $Revision$ $Date$
- */
-public class Patch
- extends AbstractTask
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( Patch.class );
-
- private File m_originalFile;
- private File m_patchFile;
- private boolean m_backups;
- private boolean m_ignorewhitespace;
- private boolean m_reverse;
- private boolean m_quiet;
- private Integer m_strip;
-
- /**
- * Shall patch write backups.
- *
- * @param backups The new Backups value
- */
- public void setBackups( final boolean backups )
- {
- m_backups = backups;
- }
-
- /**
- * Ignore whitespace differences.
- */
- public void setIgnorewhitespace( final boolean ignorewhitespace )
- {
- m_ignorewhitespace = ignorewhitespace;
- }
-
- /**
- * The file to patch.
- */
- public void setOriginalfile( final File originalFile )
- {
- m_originalFile = originalFile;
- }
-
- /**
- * The file containing the diff output.
- */
- public void setPatchfile( final File patchFile )
- {
- m_patchFile = patchFile;
- }
-
- /**
- * Work silently unless an error occurs.
- */
- public void setQuiet( final boolean quiet )
- {
- m_quiet = quiet;
- }
-
- /**
- * Assume patch was created with old and new files swapped.
- */
- public void setReverse( final boolean reverse )
- {
- m_reverse = reverse;
- }
-
- /**
- * Strip the smallest prefix containing <i>num</i> leading slashes from
- * filenames. <p>
- *
- * patch's <i>-p</i> option.
- *
- * @param strip The new Strip value
- */
- public void setStrip( final Integer strip )
- {
- m_strip = strip;
- }
-
- public void execute()
- throws TaskException
- {
- validate();
-
- final Execute exe = buildCommand();
- exe.execute( getContext() );
- }
-
- private void validate()
- throws TaskException
- {
- if( null == m_patchFile )
- {
- final String message = REZ.getString( "patch.missing-file.error" );
- throw new TaskException( message );
- }
-
- if( !m_patchFile.exists() )
- {
- final String message = REZ.getString( "patch.file-noexist.error", m_patchFile );
- throw new TaskException( message );
- }
-
- if( null != m_strip && m_strip.intValue() < 0 )
- {
- final String message = REZ.getString( "patch.neg-strip.error" );
- throw new TaskException( message );
- }
- }
-
- private Execute buildCommand( )
- {
- final Execute cmd = new Execute();
- cmd.setExecutable( "patch" );
- if( m_backups )
- {
- cmd.addArgument( "-b" );
- }
-
- if( null != m_strip )
- {
- cmd.addArgument( "-p" + m_strip.intValue() );
- }
-
- if( m_quiet )
- {
- cmd.addArgument( "-s" );
- }
-
- if( m_reverse )
- {
- cmd.addArgument( "-R" );
- }
-
- cmd.addArgument( "-i" );
- cmd.addArgument( m_patchFile );
-
- if( m_ignorewhitespace )
- {
- cmd.addArgument( "-l" );
- }
-
- if( null != m_originalFile )
- {
- cmd.addArgument( m_originalFile );
- }
- return cmd;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/build/Resources.properties b/proposal/myrmidon/src/java/org/apache/antlib/build/Resources.properties
deleted file mode 100644
index aa33bcc21..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/build/Resources.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-sleep.duration.notice=Sleeping for {0} milliseconds.
-sleep.neg-time.error=Negative sleep periods are not supported.
-
-patch.missing-file.error=Patchfile argument is required.
-patch.file-noexist.error=Patchfile "{0}" doesn\'t exist.
-patch.neg-strip.error=Strip has to be >= 0
-
-buildnumber.nocreate.error={0} doesn't exist and new file can't be created.
-buildnumber.noread.error=Unable to read from {0}.
-buildnumber.nowrite.error=Unable to write to {0}.
-buildnumber.noparse.error={0} contains a non integer build number: {1}
-buildnumber.badwrite.error=Error while writing {0}.
-buildnumber.header.info=Build Number for ANT. Do not edit! \ No newline at end of file
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/build/SleepTask.java b/proposal/myrmidon/src/java/org/apache/antlib/build/SleepTask.java
deleted file mode 100644
index 84df99859..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/build/SleepTask.java
+++ /dev/null
@@ -1,124 +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.txt file.
- */
-package org.apache.antlib.build;
-
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A task to sleep for a period of time
- *
- * @ant.task name="sleep"
- * @author steve_l@iseran.com steve loughran
- * @version $Revision$ $Date$
- */
-public class SleepTask
- extends AbstractTask
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( SleepTask.class );
-
- private int m_seconds;
- private int m_hours;
- private int m_minutes;
- private int m_milliseconds;
-
- /**
- * Sets the Hours attribute of the Sleep object
- */
- public void setHours( final int hours )
- {
- m_hours = hours;
- }
-
- /**
- * Sets the Milliseconds attribute of the Sleep object
- */
- public void setMilliseconds( final int milliseconds )
- {
- m_milliseconds = milliseconds;
- }
-
- /**
- * Sets the Minutes attribute of the Sleep object
- */
- public void setMinutes( final int minutes )
- {
- m_minutes = minutes;
- }
-
- /**
- * Sets the Seconds attribute of the Sleep object
- */
- public void setSeconds( final int seconds )
- {
- m_seconds = seconds;
- }
-
- /**
- * sleep for a period of time
- *
- * @param millis time to sleep
- */
- private void doSleep( final long millis )
- {
- try
- {
- Thread.sleep( millis );
- }
- catch( InterruptedException ie )
- {
- }
- }
-
- /**
- * Executes this build task. throws org.apache.tools.ant.TaskException if
- * there is an error during task execution.
- *
- * @exception TaskException Description of Exception
- */
- public void execute()
- throws TaskException
- {
- validate();
- final long sleepTime = getSleepTime();
-
- final String message = REZ.getString( "sleep.duration.notice", new Long( sleepTime ) );
- getContext().debug( message );
-
- doSleep( sleepTime );
- }
-
- /**
- * verify parameters
- *
- * @throws TaskException if something is invalid
- */
- private void validate()
- throws TaskException
- {
- if( getSleepTime() < 0 )
- {
- final String message = REZ.getString( "sleep.neg-time.error" );
- throw new TaskException( message );
- }
- }
-
- /**
- * return time to sleep
- *
- * @return sleep time. if below 0 then there is an error
- */
- private long getSleepTime()
- {
- return ( ( ( (long)m_hours * 60 ) + m_minutes ) * 60 + m_seconds ) * 1000 + m_milliseconds;
- }
-}
-
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/build/UpToDateCondition.java b/proposal/myrmidon/src/java/org/apache/antlib/build/UpToDateCondition.java
deleted file mode 100644
index 3c7b40f85..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/build/UpToDateCondition.java
+++ /dev/null
@@ -1,130 +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.txt file.
- */
-package org.apache.antlib.build;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.FileNameMapper;
-import org.apache.myrmidon.framework.FileSet;
-import org.apache.myrmidon.framework.conditions.Condition;
-import org.apache.tools.todo.types.DirectoryScanner;
-import org.apache.tools.todo.types.ScannerUtil;
-import org.apache.tools.todo.types.SourceFileScanner;
-import org.apache.tools.todo.util.mappers.MergingMapper;
-
-/**
- * A condition which evaluates to true when the specified target has a
- * timestamp greater than all of the source files.
- *
- * @author William Ferguson <a href="mailto:williamf@mincom.com">
- * williamf@mincom.com</a>
- * @author Hiroaki Nakamura <a href="mailto:hnakamur@mc.neweb.ne.jp">
- * hnakamur@mc.neweb.ne.jp</a>
- * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
- *
- * @ant.type type="condition" name="uptodate"
- */
-public class UpToDateCondition
- implements Condition
-{
- private final ArrayList m_fileSets = new ArrayList();
- private FileNameMapper m_mapper;
- private File m_targetFile;
-
- /**
- * The file which must be more up to date than each of the source files if
- * the property is to be set.
- *
- * @param file the file which we are checking against.
- */
- public void setTargetFile( final File file )
- {
- m_targetFile = file;
- }
-
- /**
- * Nested &lt;srcfiles&gt; element.
- *
- * @param fs The feature to be added to the Srcfiles attribute
- */
- public void addSrcfiles( final FileSet fs )
- {
- m_fileSets.add( fs );
- }
-
- /**
- * Defines the FileNameMapper to use (nested mapper element).
- */
- public void add( final FileNameMapper mapper )
- throws TaskException
- {
- if( m_mapper != null )
- {
- throw new TaskException( "Cannot define more than one mapper" );
- }
- m_mapper = mapper;
- }
-
- /**
- * Evaluates this condition.
- *
- * @param context
- * The context to evaluate the condition in.
- */
- public boolean evaluate( TaskContext context )
- throws TaskException
- {
- if( m_targetFile == null && m_mapper == null )
- {
- throw new TaskException( "The targetfile attribute or a nested mapper element must be set" );
- }
-
- // if not there then it can't be up to date
- if( m_targetFile != null && !m_targetFile.exists() )
- {
- return false;
- }
-
- final Iterator enum = m_fileSets.iterator();
- while( enum.hasNext() )
- {
- final FileSet fs = (FileSet)enum.next();
- final DirectoryScanner ds = ScannerUtil.getDirectoryScanner( fs );
- if ( !scanDir( fs.getDir(), ds.getIncludedFiles(), context ) )
- {
- return false;
- }
- }
- return true;
- }
-
- private boolean scanDir( final File srcDir,
- final String files[],
- final TaskContext context )
- throws TaskException
- {
- final SourceFileScanner scanner = new SourceFileScanner();
- FileNameMapper mapper = null;
- File dir = srcDir;
- if( m_mapper == null )
- {
- final MergingMapper mm = new MergingMapper();
- mm.setTo( m_targetFile.getAbsolutePath() );
- mapper = mm;
- dir = null;
- }
- else
- {
- mapper = m_mapper;
- }
- return scanner.restrict( files, srcDir, dir, mapper, context ).length == 0;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/AbstractAntTask.java b/proposal/myrmidon/src/java/org/apache/antlib/core/AbstractAntTask.java
deleted file mode 100644
index f97c15cdb..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/AbstractAntTask.java
+++ /dev/null
@@ -1,161 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.interfaces.embeddor.Embeddor;
-import org.apache.myrmidon.interfaces.model.Project;
-import org.apache.myrmidon.interfaces.workspace.Workspace;
-
-/**
- * Abstract base class for Tasks which execute targets.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
- * @version $Revision$ $Date$
- */
-public abstract class AbstractAntTask
- extends AbstractTask
-{
- /**
- * If true, inherit all properties from parent Project
- * If false, inherit only userProperties and those defined
- * inside the ant call itself
- */
- private boolean m_inheritAll;
-
- /**
- * The target to process in build file. If not specified
- * will use default in specified build file.
- */
- private String m_target;
-
- /**
- * The parameters/properties which will be passed to the workspace
- * for the target execution.
- */
- private final ArrayList m_parameters = new ArrayList();
-
- /**
- * Specify whether should inherit properties in sub-build.
- *
- * @param inheritAll true to inherit else false
- */
- public void setInheritAll( final boolean inheritAll )
- {
- m_inheritAll = inheritAll;
- }
-
- /**
- * set the target to process. If none is defined it will
- * execute the default target of the build file
- */
- public void setTarget( final String target )
- {
- m_target = target;
- }
-
- /**
- * Add a parameter to processing of build file.
- *
- * @param param the parameter
- */
- public void addParam( final AntParam param )
- {
- m_parameters.add( param );
- }
-
- /**
- * Execute the specified build, with specified parameters.
- *
- * @throws TaskException if an error occurs.
- */
- public void execute()
- throws TaskException
- {
- try
- {
- Project project = getProject();
-
- Embeddor embeddor = getEmbeddor();
-
- final Workspace workspace =
- embeddor.createWorkspace( buildParameters() );
-
- // TODO - inherit listeners, and services (TypeManager specifically)
- workspace.addProjectListener( embeddor.createListener("default"));
-
- if( null == m_target )
- {
- m_target = project.getDefaultTargetName();
- }
-
- workspace.executeProject( project, m_target );
- }
- catch( final Exception e )
- {
- throw new TaskException( e.toString(), e );
- }
- }
-
- /**
- * A convenience method for obtaining the Embeddor from the
- * TaskContext.
- * @return The Embeddor contained in the TaskContext
- * @throws TaskException if the Embeddor could not be obtained.
- */
- protected Embeddor getEmbeddor() throws TaskException
- {
- final Embeddor embeddor =
- (Embeddor)getContext().getService( Embeddor.class );
- return embeddor;
- }
-
- /**
- * Get/create/build the project containing the target to be executed.
- * Subclasses will override this method to provide different means
- * of obtaining a project to execute.
- * @return The project containing the target to execute.
- * @throws Exception If a problem occurred building the project.
- */
- protected abstract Project getProject() throws Exception;
-
- /**
- * Build the parameters to pass to sub-project.
- * These include the current tasks properties
- * (if inheritall=true) and any supplied by the user.
- *
- * @return the created parameters
- */
- private Map buildParameters()
- throws TaskException
- {
- final Map parameters = new HashMap();
-
- if( m_inheritAll )
- {
- parameters.putAll( getContext().getProperties() );
- }
-
- final int size = m_parameters.size();
- for( int i = 0; i < size; i++ )
- {
- final AntParam param = (AntParam)m_parameters.get( i );
- param.validate();
- final String name = param.getName();
- final Object value = param.getValue();
- parameters.put( name, value );
- }
-
- return parameters;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/AbstractAvailableCondition.java b/proposal/myrmidon/src/java/org/apache/antlib/core/AbstractAvailableCondition.java
deleted file mode 100644
index 92ed1c851..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/AbstractAvailableCondition.java
+++ /dev/null
@@ -1,51 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.conditions.Condition;
-import org.apache.myrmidon.framework.file.Path;
-import org.apache.myrmidon.framework.file.FileListUtil;
-
-/**
- * An abstract condition which checks for the availability of a particular
- * resource in a classpath.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- */
-public abstract class AbstractAvailableCondition
- implements Condition
-{
- private Path m_classpath = new Path();
-
- /**
- * Adds a classpath element.
- */
- public void setClasspath( final Path classpath )
- {
- m_classpath.add( classpath );
- }
-
- /**
- * Adds a classpath element.
- */
- public void addClasspath( final Path classpath )
- {
- m_classpath.add( classpath );
- }
-
- /**
- * Builds the ClassLoader to use to check resources.
- */
- protected ClassLoader buildClassLoader( final TaskContext context ) throws TaskException
- {
- return FileListUtil.createClassLoader( m_classpath, context );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/AntCallTask.java b/proposal/myrmidon/src/java/org/apache/antlib/core/AntCallTask.java
deleted file mode 100644
index 1bbe78ef4..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/AntCallTask.java
+++ /dev/null
@@ -1,69 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.interfaces.model.Project;
-
-/**
- * A task which executes a target in the current project,
- * or a referenced project.
- *
- * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
- * @version $Revision$ $Date$
- * @ant.task name="ant-call"
- */
-public class AntCallTask
- extends AbstractAntTask
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( AntCallTask.class );
-
- private String m_project;
-
- /**
- * Specifies the project to execute. If not specified, the current
- * project is used.
- * @param project the name of the Project to execute.
- */
- public void setProject( String project )
- {
- m_project = project;
- }
-
- /**
- * Get/create/build the project which will be executed.
- * Subclasses will override this method to provide different means
- * of obtaining a project to execute.
- * @return The project containing the target to execute.
- * @throws Exception If a problem occurred building the project.
- */
- protected Project getProject() throws Exception
- {
- Project currentProject =
- (Project)getContext().getService( Project.class );
-
- // By default, use the current project.
- Project referencedProject = currentProject;
-
- if( m_project != null )
- {
- referencedProject = currentProject.getProject( m_project );
- if( referencedProject == null )
- {
- final String message =
- REZ.getString( "antcall.invalid-project.error" );
- throw new TaskException( message );
- }
- }
-
- return referencedProject;
- }
-} \ No newline at end of file
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/AntParam.java b/proposal/myrmidon/src/java/org/apache/antlib/core/AntParam.java
deleted file mode 100644
index 54736fcde..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/AntParam.java
+++ /dev/null
@@ -1,89 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * Simple holder for parameters.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @version $Revision$ $Date$
- * @todo Refactor this and all the other parameter, sysproperty,
- * property etc into a single class in framework
- */
-public class AntParam
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( AntParam.class );
-
- private String m_name;
- private Object m_value;
-
- /**
- * Set the name of the parameter.
- *
- * @param name the name of parameter
- */
- public void setName( final String name )
- {
- m_name = name;
- }
-
- /**
- * Set the value of the parameter.
- *
- * @param value the parameter value
- */
- public void setValue( final Object value )
- {
- m_value = value;
- }
-
- /**
- * Retrieve name of parameter.
- *
- * @return the name of parameter.
- */
- public String getName()
- {
- return m_name;
- }
-
- /**
- * Retrieve the value of parameter.
- *
- * @return the value of parameter.
- */
- public Object getValue()
- {
- return m_value;
- }
-
- /**
- * Make sure that neither the name or the value
- * is null.
- */
- public void validate()
- throws TaskException
- {
- if( null == m_name )
- {
- final String message = REZ.getString( "param.noname.error" );
- throw new TaskException( message );
- }
- else if( null == m_value )
- {
- final String message =
- REZ.getString( "param.novalue.error", m_name );
- throw new TaskException( message );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/AntTask.java b/proposal/myrmidon/src/java/org/apache/antlib/core/AntTask.java
deleted file mode 100644
index ad9b9a426..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/AntTask.java
+++ /dev/null
@@ -1,79 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import java.io.File;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.myrmidon.interfaces.model.Project;
-
-/**
- * Executes a target in a named build file.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @ant.task name="ant"
- */
-public class AntTask
-
- extends AbstractAntTask
-{
- /**
- * Default build file.
- */
- private static final String DEFAULT_BUILD_FILE = "build.ant";
-
- /**
- * The build file which to execute. If not set defaults to
- * using "build.ant" in the basedir of current project.
- */
- private File m_file;
-
- /**
- * The "type" of the build file. By default this is null which
- * means the type will be determined by the build file extension.
- */
- private String m_type;
-
- /**
- * set the build file to process.
- *
- * @param file the build file
- */
- public void setFile( final File file )
- {
- m_file = file;
- }
-
- /**
- * set the type of build file.
- *
- * @param type the type of build file
- */
- public void setType( final String type )
- {
- m_type = type;
- }
-
- /**
- * @return The project containing the target to execute.
- * @throws Exception If a problem occurred building the project.
- */
- protected Project getProject() throws Exception
- {
- if( null == m_file )
- {
- m_file = getContext().resolveFile( DEFAULT_BUILD_FILE );
- }
-
- final Project project =
- getEmbeddor().createProject( m_file.toString(),
- m_type,
- new Parameters() );
- return project;
- }
-
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/ClassAvailableCondition.java b/proposal/myrmidon/src/java/org/apache/antlib/core/ClassAvailableCondition.java
deleted file mode 100644
index e3e21de2e..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/ClassAvailableCondition.java
+++ /dev/null
@@ -1,64 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.conditions.Condition;
-
-/**
- * A condition that evaluates to true if the requested class is available
- * at runtime.
- *
- * @author Stefano Mazzocchi <a href="mailto:stefano@apache.org">
- * stefano@apache.org</a>
- * @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a>
- *
- * @ant.type type="condition" name="class-available"
- */
-public class ClassAvailableCondition
- extends AbstractAvailableCondition
- implements Condition
-{
- private String m_classname;
-
- /**
- * Sets the name of the class to search for.
- */
- public void setClassname( final String classname )
- {
- m_classname = classname;
- }
-
- /**
- * Evaluates the condition.
- */
- public boolean evaluate( final TaskContext context )
- throws TaskException
- {
- if( m_classname == null )
- {
- throw new TaskException( "Classname not specified." );
- }
-
- // Build the classloader to use to check resources
- final ClassLoader classLoader = buildClassLoader( context );
-
- // Do the check
- try
- {
- classLoader.loadClass( m_classname );
- return true;
- }
- catch( final Exception e )
- {
- return false;
- }
- }
-
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/ConditionTask.java b/proposal/myrmidon/src/java/org/apache/antlib/core/ConditionTask.java
deleted file mode 100644
index 4d6aac283..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/ConditionTask.java
+++ /dev/null
@@ -1,80 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.conditions.AndCondition;
-import org.apache.myrmidon.framework.conditions.Condition;
-
-/**
- * &lt;condition&gt; task as a generalization of &lt;available&gt; and
- * &lt;uptodate&gt; <p>
- *
- * This task supports boolean logic as well as pluggable conditions to decide,
- * whether a property should be set.</p> <p>
- *
- * This task does not extend Task to take advantage of ConditionBase.</p>
- *
- * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
- * @version $Revision$
- *
- * @ant.task name="condition"
- */
-public class ConditionTask
- extends AbstractTask
-{
- private AndCondition m_condition = new AndCondition();
- private String m_property;
- private String m_value = "true";
-
- /**
- * Adds a condition.
- */
- public void add( final Condition condition )
- {
- m_condition.add( condition );
- }
-
- /**
- * The name of the property to set. Required.
- *
- * @param p The new Property value
- */
- public void setProperty( final String p )
- {
- m_property = p;
- }
-
- /**
- * The value for the property to set. Defaults to "true".
- *
- * @param v The new Value value
- */
- public void setValue( final String v )
- {
- m_value = v;
- }
-
- /**
- * See whether our nested condition holds and set the property.
- */
- public void execute()
- throws TaskException
- {
- if( m_property == null )
- {
- throw new TaskException( "No property was specified" );
- }
-
- if( m_condition.evaluate( getContext() ) )
- {
- getContext().setProperty( m_property, m_value );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/Equals.java b/proposal/myrmidon/src/java/org/apache/antlib/core/Equals.java
deleted file mode 100644
index 819ae1c46..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/Equals.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.apache.antlib.core;
-
-/*
- * 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.txt file.
- */
-
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.framework.conditions.Condition;
-
-/**
- * Simple String comparison condition.
- *
- * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
- * @version $Revision$
- *
- * @ant.type type="condition" name="equals"
- */
-public class Equals implements Condition
-{
-
- private String arg1, arg2;
-
- public void setArg1( String a1 )
- {
- arg1 = a1;
- }
-
- public void setArg2( String a2 )
- {
- arg2 = a2;
- }
-
- /**
- * Evaluates this condition.
- *
- * @param context
- * The context to evaluate the condition in.
- */
- public boolean evaluate( final TaskContext context )
- throws TaskException
- {
- if( arg1 == null || arg2 == null )
- {
- throw new TaskException( "both arg1 and arg2 are required in equals" );
- }
- return arg1.equals( arg2 );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/ExtFileNameMapper.java b/proposal/myrmidon/src/java/org/apache/antlib/core/ExtFileNameMapper.java
deleted file mode 100644
index 51092c289..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/ExtFileNameMapper.java
+++ /dev/null
@@ -1,43 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import org.apache.avalon.excalibur.io.FileUtil;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.FileNameMapper;
-
-/**
- * Maps file extensions.
- *
- * @ant.type type="mapper" name="map-extension"
- */
-public class ExtFileNameMapper
- implements FileNameMapper
-{
- private String m_extension;
-
- public void setExtension( final String extension )
- {
- m_extension = extension;
- }
-
- public String[] mapFileName( final String filename, TaskContext context )
- throws TaskException
- {
- final String name = FileUtil.removeExtension( filename );
- if( m_extension != null )
- {
- return new String[]{ name + '.' + m_extension };
- }
- else
- {
- return new String[]{ name };
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/Fail.java b/proposal/myrmidon/src/java/org/apache/antlib/core/Fail.java
deleted file mode 100644
index 407a7834e..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/Fail.java
+++ /dev/null
@@ -1,59 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * This is a task used to throw a TaskException.
- * Useful for forcing a build to fail on a certain condition.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @ant.task name="fail"
- */
-public class Fail
- extends AbstractTask
-{
- private String m_message;
-
- public void setMessage( final String message )
- {
- checkNullMessage();
- m_message = message;
- }
-
- public void addContent( final String message )
- {
- checkNullMessage();
- m_message = message;
- }
-
- public void execute()
- throws TaskException
- {
- if( null != m_message )
- {
- throw new TaskException( m_message );
- }
- else
- {
- throw new TaskException();
- }
- }
-
- private void checkNullMessage()
- {
- if( null != m_message )
- {
- final String message = "Message can only be set once by " +
- "either nested content or the message attribute";
- throw new IllegalStateException( message );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/FileTokenSet.java b/proposal/myrmidon/src/java/org/apache/antlib/core/FileTokenSet.java
deleted file mode 100644
index c48a2921e..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/FileTokenSet.java
+++ /dev/null
@@ -1,81 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.avalon.excalibur.io.IOUtil;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.filters.TokenSet;
-
-/**
- * A set of tokens that are read from a file.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="token-set" name="tokens-file"
- */
-public class FileTokenSet
- implements TokenSet
-{
- private static final Resources REZ
- = ResourceManager.getPackageResources( FileTokenSet.class );
-
- private Map m_tokens = new HashMap();
-
- /**
- * set the file containing the tokens for this tokenset.
- */
- public void setFile( final File file )
- throws TaskException
- {
- // TODO - defer loading the tokens
- if( !file.isFile() )
- {
- final String message = REZ.getString( "filetokenset.not-a-file.error", file );
- throw new TaskException( message );
- }
-
- try
- {
- FileInputStream instr = new FileInputStream( file );
-
- try
- {
- Properties props = new Properties();
- props.load( instr );
- m_tokens.putAll( props );
- }
- finally
- {
- IOUtil.shutdownStream( instr );
- }
- }
- catch( final Exception e )
- {
- final String message = REZ.getString( "filetokenset.read-tokens.error", file );
- throw new TaskException( message, e );
- }
- }
-
- /**
- * Evaluates the value for a token.
- */
- public String getValue( String token, TaskContext context )
- throws TaskException
- {
- return (String)m_tokens.get( token );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/FlatFileNameMapper.java b/proposal/myrmidon/src/java/org/apache/antlib/core/FlatFileNameMapper.java
deleted file mode 100644
index 6ce758615..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/FlatFileNameMapper.java
+++ /dev/null
@@ -1,41 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import org.apache.avalon.excalibur.io.FileUtil;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.FileNameMapper;
-
-/**
- * Implementation of FileNameMapper that always returns the source file name
- * without any leading directory information. <p>
- *
- * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
- *
- * @ant.type type="mapper" name="flatten"
- */
-public class FlatFileNameMapper
- extends PrefixFileNameMapper
- implements FileNameMapper
-{
-
- /**
- * Returns an one-element array containing the source file name without any
- * leading directory information.
- *
- * @param sourceFileName Description of Parameter
- * @return Description of the Returned Value
- */
- public String[] mapFileName( final String sourceFileName, TaskContext context )
- throws TaskException
- {
- final String baseName = FileUtil.removePath( sourceFileName, '/' );
- return super.mapFileName( baseName, context );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/IfTask.java b/proposal/myrmidon/src/java/org/apache/antlib/core/IfTask.java
deleted file mode 100644
index b3467c387..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/IfTask.java
+++ /dev/null
@@ -1,123 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import java.util.ArrayList;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.AbstractContainerTask;
-import org.apache.myrmidon.framework.conditions.AndCondition;
-import org.apache.myrmidon.framework.conditions.Condition;
-import org.apache.myrmidon.framework.conditions.IsTrueCondition;
-import org.apache.myrmidon.framework.conditions.NotCondition;
-
-/**
- * A simple task to test a supplied condition. If the condition is true
- * then it will execute the inner tasks, else it won't.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @version $Revision$ $Date$
- * @ant.task name="if"
- */
-public class IfTask
- extends AbstractContainerTask
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( IfTask.class );
-
- private Condition m_condition;
- private ArrayList m_tasks = new ArrayList();
-
- /**
- * Set if clause on pattern.
- *
- * @param condition the condition
- * @exception TaskException if an error occurs
- */
- public void setTest( final String condition )
- throws TaskException
- {
- verifyConditionNull();
- m_condition = new IsTrueCondition( condition );
- }
-
- /**
- * Set unless clause of pattern.
- *
- * @param condition the unless clause
- * @exception TaskException if an error occurs
- */
- public void setNotTest( final String condition )
- throws TaskException
- {
- verifyConditionNull();
- m_condition = new NotCondition( new IsTrueCondition( condition ) );
- }
-
- /**
- * Add a nested "condition" element, which provides an AndCondition
- * container for any type of condition.
- * @param andCondition The configured Condition
- * @throws TaskException If a condition has already been set.
- */
- public void addCondition( final AndCondition andCondition )
- throws TaskException
- {
- verifyConditionNull();
- m_condition = andCondition;
- }
-
- public void add( final Configuration task )
- {
- m_tasks.add( task );
- }
-
- public void execute()
- throws TaskException
- {
- if( null == m_condition )
- {
- final String message = REZ.getString( "if.no-condition.error" );
- throw new TaskException( message );
- }
-
- // Evaluate the condition
- if( !m_condition.evaluate( getContext() ) )
- {
- return;
- }
-
- final Configuration[] tasks =
- (Configuration[])m_tasks.toArray( new Configuration[ m_tasks.size() ] );
-
- executeTasks( tasks );
- }
-
- public String toString()
- {
- return "If['" + m_condition + "]";
- }
-
- /**
- * Utility method to make sure condition unset.
- * Made so that it is not possible for both if and unless to be set.
- *
- * @exception TaskException if an error occurs
- */
- private void verifyConditionNull()
- throws TaskException
- {
- if( null != m_condition )
- {
- final String message = REZ.getString( "if.ifelse-duplicate.error" );
- throw new TaskException( message );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/LoadProperties.java b/proposal/myrmidon/src/java/org/apache/antlib/core/LoadProperties.java
deleted file mode 100644
index dcbd2b4ba..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/LoadProperties.java
+++ /dev/null
@@ -1,126 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Properties;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.avalon.excalibur.io.IOUtil;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * This task loads properties from a property file and places them in the context.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @ant.task name="load-properties"
- */
-public class LoadProperties
- extends AbstractTask
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( LoadProperties.class );
-
- private String m_prefix;
- private File m_file;
-
- /**
- * Specify the prefix to be placed before all properties (if any).
- */
- public void setPrefix( final String prefix )
- {
- m_prefix = prefix;
- }
-
- public void setFile( final File file )
- {
- m_file = file;
- }
-
- public void execute()
- throws TaskException
- {
- if( null == m_file )
- {
- final String message = REZ.getString( "loadprop.no-file.error" );
- throw new TaskException( message );
- }
-
- //Make sure prefix ends with a '.' if specified
- if( null == m_prefix )
- {
- m_prefix = "";
- }
- else if( !m_prefix.endsWith( "." ) )
- {
- m_prefix += ".";
- }
-
- loadFile( m_file );
- }
-
- /**
- * Utility method to load properties file.
- */
- private void loadFile( final File file )
- throws TaskException
- {
- if( getContext().isDebugEnabled() )
- {
- final String message =
- REZ.getString( "loadprop.file.notice", file.getAbsolutePath() );
- getContext().debug( message );
- }
-
- if( !file.exists() )
- {
- final String message =
- REZ.getString( "loadprop.missing-file.notice", file.getAbsolutePath() );
- getContext().debug( message );
- }
- else
- {
- FileInputStream input = null;
-
- try
- {
- input = new FileInputStream( file );
- final Properties properties = new PropertyLoader( this );
- properties.load( input );
- }
- catch( final IOException ioe )
- {
- throw new TaskException( ioe.getMessage(), ioe );
- }
-
- IOUtil.shutdownStream( input );
- }
- }
-
- /**
- * Utility method that will resolve and add specified proeprty.
- * Used by external PropertyLoader class as a call back method.
- */
- protected final void addUnresolvedValue( final String name, final String value )
- {
- try
- {
- final Object objectValue = getContext().resolveValue( value.toString() );
- final String name1 = m_prefix + name;
- getContext().setProperty( name1, objectValue );
- }
- catch( final TaskException te )
- {
- final String message = REZ.getString( "loadprop.bad-resolve.error", name, value );
- getContext().info( message, te );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/Log.java b/proposal/myrmidon/src/java/org/apache/antlib/core/Log.java
deleted file mode 100644
index 08acd5cc4..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/Log.java
+++ /dev/null
@@ -1,82 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.LogLevel;
-
-/**
- * This is a task used to log messages in the build file.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @ant.task name="log"
- */
-public class Log
- extends AbstractTask
-{
- /**
- * The message to printout when logging
- */
- private String m_message;
-
- /**
- * The level at which to print out messages.
- */
- private LogLevel m_level = LogLevel.INFO;
-
- /**
- * Set the level at which the message will be logged.
- *
- * @param level the level at which message will be logged
- */
- public void setLevel( final LogLevel level )
- {
- m_level = level;
- }
-
- /**
- * Set the message to print out when logging message
- */
- public void setMessage( final String message )
- {
- checkNullMessage();
- m_message = message;
- }
-
- /**
- * Set the message to print out when logging message
- */
- public void addContent( final String message )
- {
- checkNullMessage();
- m_message = message;
- }
-
- /**
- * Log message at specified level.
- */
- public void execute()
- throws TaskException
- {
- LogLevel.log( getContext(), m_level, m_message );
- }
-
- /**
- * Utility message to verify that the message has not already been set.
- */
- private void checkNullMessage()
- {
- if( null != m_message )
- {
- final String message = "Message can only be set once by " +
- "either nested content or the message attribute";
- throw new IllegalStateException( message );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/PrefixFileNameMapper.java b/proposal/myrmidon/src/java/org/apache/antlib/core/PrefixFileNameMapper.java
deleted file mode 100644
index 6a0ba701c..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/PrefixFileNameMapper.java
+++ /dev/null
@@ -1,56 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.FileNameMapper;
-
-/**
- * A filename mapper that applies a prefix to each file.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="mapper" name="prefix"
- */
-public class PrefixFileNameMapper
- implements FileNameMapper
-{
- private String m_prefix;
-
- /**
- * Sets the prefix.
- */
- public void setPrefix( final String prefix )
- {
- m_prefix = prefix;
- if( ! m_prefix.endsWith( "/" ) )
- {
- m_prefix = m_prefix + '/';
- }
- }
-
- /**
- * Returns an array containing the target filename(s) for the given source
- * file.
- */
- public String[] mapFileName( final String sourceFileName,
- final TaskContext context )
- throws TaskException
- {
- if( m_prefix == null )
- {
- return new String[]{ sourceFileName };
- }
- else
- {
- return new String[] { m_prefix + sourceFileName };
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/Property.java b/proposal/myrmidon/src/java/org/apache/antlib/core/Property.java
deleted file mode 100644
index 0bfb56e63..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/Property.java
+++ /dev/null
@@ -1,89 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.DataType;
-
-/**
- * This is the property "task" to declare a binding of a datatype to a name.
- *
- * TODO: Determine final format of property task.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @version $Revision$ $Date$
- * @ant.task name="property"
- */
-public class Property
- extends AbstractTask
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( Property.class );
-
- private String m_name;
- private Object m_value;
-
- public void setName( final String name )
- {
- m_name = name;
- }
-
- /**
- * Sets the property value from a nested element.
- */
- public void add( final DataType value )
- throws TaskException
- {
- setValue( value );
- }
-
- /**
- * Sets the property value from text content.
- */
- public void addContent( final String value )
- throws TaskException
- {
- setValue( value );
- }
-
- /**
- * Sets the property value from an attribute.
- */
- public void setValue( final Object value )
- throws TaskException
- {
- if( null != m_value )
- {
- final String message = REZ.getString( "property.multi-set.error" );
- throw new TaskException( message );
- }
-
- m_value = value;
- }
-
- public void execute()
- throws TaskException
- {
- if( null == m_name )
- {
- final String message = REZ.getString( "property.no-name.error" );
- throw new TaskException( message );
- }
-
- if( null == m_value )
- {
- final String message = REZ.getString( "property.no-value.error" );
- throw new TaskException( message );
- }
-
- getContext().setProperty( m_name, m_value );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/PropertyDump.java b/proposal/myrmidon/src/java/org/apache/antlib/core/PropertyDump.java
deleted file mode 100644
index dbca9073f..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/PropertyDump.java
+++ /dev/null
@@ -1,68 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import java.util.Iterator;
-import java.util.Map;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * This is a simple task used to dump out all the proeprtys in the
- * runtime. Useful for debugging behaviour in ant build directives.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @author <a href="mailto:jimcook@visualxs.com">Jim Cook</a>
- * @version $Revision$ $Date$
- * @ant.task name="property-dump"
- * @todo Consider moving to new antlib
- */
-public class PropertyDump
- extends AbstractTask
-{
- /**
- * The prefix which the keys must start with if they are
- * to be dumped.
- */
- private String m_prefix;
-
- /**
- * Set the prefix which the keys must start with if they are
- * to be dumped. If not specified then all keys are dumped.
- *
- * @param prefix the prefix
- */
- public void setPrefix( final String prefix )
- {
- m_prefix = prefix;
- }
-
- /**
- * Printout all the properties in ant runtime.
- */
- public void execute()
- throws TaskException
- {
- final Map properties = getContext().getProperties();
- final Iterator iterator = properties.keySet().iterator();
- while( iterator.hasNext() )
- {
- final String key = (String)iterator.next();
- final Object value = properties.get( key );
-
- //Check to see if property starts with specified prefix
- //and if it doesn't then skip property
- if( null != m_prefix && !key.startsWith( m_prefix ) )
- {
- continue;
- }
-
- getContext().info( key + "=" + value );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/PropertyLoader.java b/proposal/myrmidon/src/java/org/apache/antlib/core/PropertyLoader.java
deleted file mode 100644
index ebb742c13..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/PropertyLoader.java
+++ /dev/null
@@ -1,34 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import java.util.Properties;
-
-/**
- * This class is an UGLY HACK utility class to enable us to reuse
- * the property parsing and loading code from Properties object.
- */
-class PropertyLoader
- extends Properties
-{
- private LoadProperties m_loadProperties;
-
- public PropertyLoader( LoadProperties loadProperties )
- {
- m_loadProperties = loadProperties;
- }
-
- /**
- * Overidden put to add unresolved values.
- */
- public synchronized Object put( Object key, Object value )
- {
- m_loadProperties.addUnresolvedValue( key.toString(), value.toString() );
- return null;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/PropertyTokenSet.java b/proposal/myrmidon/src/java/org/apache/antlib/core/PropertyTokenSet.java
deleted file mode 100644
index 03d902941..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/PropertyTokenSet.java
+++ /dev/null
@@ -1,38 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.filters.TokenSet;
-
-/**
- * A token set that uses the project's properties as tokens.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="token-set" name="properties"
- */
-public class PropertyTokenSet
- implements TokenSet
-{
- /**
- * Evaluates the value for a token.
- */
- public String getValue( String token, TaskContext context )
- throws TaskException
- {
- final Object propValue = context.getProperty( token );
- if( propValue == null )
- {
- return null;
- }
- return propValue.toString();
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/ResourceAvailableCondition.java b/proposal/myrmidon/src/java/org/apache/antlib/core/ResourceAvailableCondition.java
deleted file mode 100644
index c5931afca..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/ResourceAvailableCondition.java
+++ /dev/null
@@ -1,61 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import java.io.InputStream;
-import org.apache.avalon.excalibur.io.IOUtil;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.conditions.Condition;
-
-/**
- * A condition that evaluates to true if the requested resource is available
- * at runtime.
- *
- * @author Stefano Mazzocchi <a href="mailto:stefano@apache.org">
- * stefano@apache.org</a>
- * @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a>
- *
- * @ant.type type="condition" name="resource-available"
- */
-public class ResourceAvailableCondition
- extends AbstractAvailableCondition
- implements Condition
-{
- private String m_resource;
-
- /**
- * Sets the name of the resource to look for.
- */
- public void setResource( final String resource )
- {
- m_resource = resource;
- }
-
- /**
- * Evaluates the condition.
- */
- public boolean evaluate( final TaskContext context )
- throws TaskException
- {
- if( m_resource == null )
- {
- throw new TaskException( "Resource was not specified." );
- }
-
- // Check whether the resource is available
- final ClassLoader classLoader = buildClassLoader( context );
- final InputStream instr = classLoader.getResourceAsStream( m_resource );
- if( instr != null )
- {
- IOUtil.shutdownStream( instr );
- return true;
- }
- return false;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/Resources.properties b/proposal/myrmidon/src/java/org/apache/antlib/core/Resources.properties
deleted file mode 100644
index 2f0c47a3c..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/Resources.properties
+++ /dev/null
@@ -1,39 +0,0 @@
-property.no-set.error=Unable to set datatype.
-property.multi-set.error=Value can not be set multiple times.
-property.no-name.error=Name must be specified.
-property.no-value.error=Value must be specified.
-
-loadprop.no-file.error=No file specified to load properties from.
-loadprop.file.notice=Loading proeprties from {0}.
-loadprop.missing-file.notice=Unable to find property file: {0}.
-loadprop.bad-resolve.error=Unable to resolve and set property named "{0}" to value "{1}".
-
-convert.bad-boolean.error=Error converting object ({0}) to Boolean.
-convert.bad-byte.error=Error converting object ({0}) to Byte.
-convert.bad-class.error=Error converting object ({0}) to Class.
-convert.bad-double.error=Error converting object ({0}) to Double.
-convert.bad-file.error=Error converting object ({0}) to File.
-
-getByName.error=Failed to retrieve enum by calling getByName on "{0}". (Reason: {1}).
-enum.missing.getByName.error=Enum class "{0}" is missing a public static method named "getByName" that accepts a single string parameter.
-enum.missing.getNames.error=Enum class "{0}" is missing a public static method named "getNames" that returns a String array of all enum names.
-invalid.enum.error=Invalid value "{0}" for enum, expected one of {1}.
-
-if.ifelse-duplicate.error=Can only set one condition for If task type. Conditions may be 'test' or 'not-test' attributes, or nested 'condition' elements.
-if.no-condition.error=No condition was specified for If task.
-
-trycatch.multiple-trys.error=Multiple <try/> elements can not be placed inside <try-catch/> task.
-trycatch.missing-try-before-catch.error=There needs to be a <try/> element before <catch/> element.
-trycatch.multiple-catches.error=Multiple <catch/> elements can not be placed inside <try-catch/> task.
-trycatch.missing-try-before-finally.error=There needs to be a <try/> element before <finally/> element.
-trycatch.multiple-finallys.error=Multiple <finally/> elements can not be placed inside <try-catch/> task.
-trycatch.no-try.error=Missing <try/> element from <try-catch/> task.
-trycatch.missing-second.error=Missing <catch/> or <finally/> elements from <try-catch/> task.
-
-filetokenset.not-a-file.error=File {0} does not exist, or is not a file.
-filetokenset.read-tokens.error=Could not read tokens from {0}.
-
-param.noname.error=Missing name from parameter.
-param.novalue.error=Missing value from parameter "{0}".
-
-antcall.invalid-project.error=Project-reference "{0}" not found. \ No newline at end of file
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/SingletonTokenSet.java b/proposal/myrmidon/src/java/org/apache/antlib/core/SingletonTokenSet.java
deleted file mode 100644
index 37a8aabd2..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/SingletonTokenSet.java
+++ /dev/null
@@ -1,82 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.filters.TokenSet;
-
-/**
- * A single token and its value.
- *
- * @author Michael McCallum
- * @created 14 March 2001
- *
- * @ant.type type="token-set" name="token"
- */
-public class SingletonTokenSet
- implements TokenSet
-{
- /**
- * Token which will be replaced in the filter operation
- */
- private String m_token;
-
- /**
- * The value which will replace the token in the filtering operation
- */
- private String m_value;
-
- /**
- * Constructor for the Filter object
- *
- * @param token The token which will be replaced when filtering
- * @param value The value which will replace the token when filtering
- */
- public SingletonTokenSet( final String token, final String value )
- {
- m_token = token;
- m_value = value;
- }
-
- /**
- * No argument conmstructor
- */
- public SingletonTokenSet()
- {
- }
-
- /**
- * Sets the Token attribute of the Filter object
- */
- public void setToken( final String token )
- {
- m_token = token;
- }
-
- /**
- * Sets the Value attribute of the Filter object
- */
- public void setValue( final String value )
- {
- m_value = value;
- }
-
- /**
- * Evaluates the value for a token.
- */
- public String getValue( final String token, final TaskContext context )
- throws TaskException
- {
- if( token.equals( m_token ) )
- {
- return m_value;
- }
- return null;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToEnumConverter.java b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToEnumConverter.java
deleted file mode 100644
index 5f7e9b71d..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToEnumConverter.java
+++ /dev/null
@@ -1,101 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import org.apache.aut.converter.Converter;
-import org.apache.aut.converter.ConverterException;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-
-/**
- * String to Enum converter
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @ant.converter source="java.lang.String" destination="org.apache.avalon.framework.Enum"
- */
-public class StringToEnumConverter
- implements Converter
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( StringToEnumConverter.class );
-
- public Object convert( final Class destination,
- final Object original,
- final Object context )
- throws ConverterException
- {
- final Object object = getEnum( destination, original );
- if( null == object )
- {
- final String[] names = getValidNames( destination );
- final String message =
- REZ.getString( "invalid.enum.error", original, Arrays.asList( names ) );
- throw new ConverterException( message );
- }
- else
- {
- return object;
- }
- }
-
- private Object getEnum( final Class destination, final Object original )
- throws ConverterException
- {
- try
- {
- final Class[] types = new Class[]{String.class};
- final Object[] args = new Object[]{original.toString()};
-
- final Method method = destination.getMethod( "getByName", types );
- return method.invoke( null, args );
- }
- catch( final InvocationTargetException ite )
- {
- final Throwable target = ite.getTargetException();
- if( target instanceof IllegalArgumentException )
- {
- return null;
- }
- else
- {
- final String message =
- REZ.getString( "getByName.error", destination.getName(), target );
- throw new ConverterException( message, target );
- }
- }
- catch( final Exception e )
- {
- final String message =
- REZ.getString( "enum.missing.getByName.error", destination.getName() );
- throw new ConverterException( message, e );
- }
- }
-
- private String[] getValidNames( final Class clazz )
- throws ConverterException
- {
- try
- {
- final Class[] types = new Class[ 0 ];
- final Object[] args = new Object[ 0 ];
-
- final Method method = clazz.getMethod( "getNames", types );
- return (String[])method.invoke( null, args );
- }
- catch( final Exception e )
- {
- final String message =
- REZ.getString( "enum.missing.getNames.error", clazz.getName() );
- throw new ConverterException( message, e );
- }
- }
-}
-
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToFileConverter.java b/proposal/myrmidon/src/java/org/apache/antlib/core/StringToFileConverter.java
deleted file mode 100644
index 89cd1ab40..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/StringToFileConverter.java
+++ /dev/null
@@ -1,50 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import java.io.File;
-import org.apache.aut.converter.AbstractConverter;
-import org.apache.aut.converter.ConverterException;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * String to file converter
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @ant.converter source="java.lang.String" destination="java.io.File"
- */
-public class StringToFileConverter
- extends AbstractConverter
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( StringToFileConverter.class );
-
- public StringToFileConverter()
- {
- super( String.class, File.class );
- }
-
- public Object convert( final Object object, final Object context )
- throws ConverterException
- {
- try
- {
- final TaskContext taskContext = (TaskContext)context;
- return taskContext.resolveFile( (String)object );
- }
- catch( final TaskException te )
- {
- final String message = REZ.getString( "convert.bad-file.error", object );
- throw new ConverterException( message, te );
- }
- }
-}
-
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/TryCatchTask.java b/proposal/myrmidon/src/java/org/apache/antlib/core/TryCatchTask.java
deleted file mode 100644
index 7e29d2592..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/TryCatchTask.java
+++ /dev/null
@@ -1,129 +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.txt file.
- */
-package org.apache.antlib.core;
-
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.AbstractContainerTask;
-import org.apache.myrmidon.framework.TaskList;
-
-/**
- * A task that emulates the try-catch-finally construct in a number
- * of languages.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @version $Revision$ $Date$
- * @ant.task name="try-catch"
- */
-public final class TryCatchTask
- extends AbstractContainerTask
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( TryCatchTask.class );
-
- private TaskList m_try;
- private TaskList m_catch;
- private TaskList m_finally;
-
- public void addTry( final TaskList taskList )
- throws TaskException
- {
- if( null != m_try )
- {
- final String message = REZ.getString( "trycatch.multiple-trys.error" );
- throw new TaskException( message );
- }
- m_try = taskList;
- }
-
- public void addCatch( final TaskList taskList )
- throws TaskException
- {
- if( null == m_try )
- {
- final String message = REZ.getString( "trycatch.missing-try-before-catch.error" );
- throw new TaskException( message );
- }
- else if( null != m_catch )
- {
- final String message = REZ.getString( "trycatch.multiple-catches.error" );
- throw new TaskException( message );
- }
- m_catch = taskList;
- }
-
- public void addFinally( final TaskList taskList )
- throws TaskException
- {
- if( null == m_try )
- {
- final String message = REZ.getString( "trycatch.missing-try-before-finally.error" );
- throw new TaskException( message );
- }
- else if( null != m_finally )
- {
- final String message = REZ.getString( "trycatch.multiple-finallys.error" );
- throw new TaskException( message );
- }
- m_finally = taskList;
- }
-
- public void execute()
- throws TaskException
- {
- validate();
-
- try
- {
- final Configuration[] tasks = m_try.getTasks();
- executeTasks( tasks );
- }
- catch( final TaskException te )
- {
- if( null != m_catch )
- {
- final Configuration[] tasks = m_catch.getTasks();
- executeTasks( tasks );
- }
- else
- {
- throw te;
- }
- }
- finally
- {
- if( null != m_finally )
- {
- final Configuration[] tasks = m_finally.getTasks();
- executeTasks( tasks );
- }
- }
- }
-
- private void validate()
- throws TaskException
- {
- if( null == m_try )
- {
- final String message = REZ.getString( "trycatch.no-try.error" );
- throw new TaskException( message );
- }
- else if( null == m_catch && null == m_finally )
- {
- final String message = REZ.getString( "trycatch.missing-second.error" );
- throw new TaskException( message );
- }
- }
-
- public String toString()
- {
- return "Try-Catch-Finally";
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/dotnet/CSharp.java b/proposal/myrmidon/src/java/org/apache/antlib/dotnet/CSharp.java
deleted file mode 100644
index aaae2afac..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/dotnet/CSharp.java
+++ /dev/null
@@ -1,827 +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.txt file.
- */
-package org.apache.antlib.dotnet;
-
-import java.io.File;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.nativelib.Execute;
-import org.apache.tools.todo.taskdefs.MatchingTask;
-import org.apache.tools.todo.types.DirectoryScanner;
-import org.apache.myrmidon.framework.nativelib.ArgumentList;
-import org.apache.myrmidon.framework.file.Path;
-
-/**
- * This task compiles CSharp source into executables or modules. The task will
- * only work on win2K until other platforms support csc.exe or an equivalent.
- * CSC.exe must be on the execute path too. <p>
- *
- * All parameters are optional: &lt;csc/&gt; should suffice to produce a debug
- * build of all *.cs files. References to external files do require explicit
- * enumeration, so are one of the first attributes to consider adding. <p>
- *
- * The task is a directory based task, so attributes like <b>includes="*.cs"</b>
- * and <b>excludes="broken.cs"</b> can be used to control the files pulled in.
- * By default, all *.cs files from the project folder down are included in the
- * command. When this happens the output file -if not specified- is taken as the
- * first file in the list, which may be somewhat hard to control. Specifying the
- * output file with <b>'outfile'</b> seems prudent. <p>
- *
- * <p>
- *
- * TODO
- * <ol>
- * <li> is incremental build still broken in beta-1?
- * <li> is Win32Icon broken?
- * <li> all the missing options
- * </ol>
- * <p>
- *
- * History
- * <Table>
- *
- * <tr>
- *
- * <td>
- * 0.3
- * </td>
- *
- * <td>
- * Beta 1 edition
- * </td>
- *
- * <td>
- * To avoid having to remember which assemblies to include, the task
- * automatically refers to the main dotnet libraries in Beta1.
- * </tr>
- *
- * <tr>
- *
- * <td>
- * 0.2
- * </td>
- *
- * <td>
- * Slightly different
- * </td>
- *
- * <td>
- * Split command execution to a separate class;
- * </tr>
- *
- * <tr>
- *
- * <td>
- * 0.1
- * </td>
- *
- * <td>
- * "I can't believe it's so rudimentary"
- * </td>
- *
- * <td>
- * First pass; minimal builds only support;
- * </tr>
- *
- * </table>
- *
- *
- * @author Steve Loughran steve_l@iseran.com
- * @version 0.3
- */
-public class CSharp
- extends MatchingTask
-{
- /**
- * name of the executable. the .exe suffix is deliberately not included in
- * anticipation of the unix version
- */
- private static final String EXE_NAME = "csc";
-
- /**
- * what is the file extension we search on?
- */
- private static final String FILE_EXT = "cs";
-
- /**
- * derive the search pattern from the extension
- */
- private static final String FILE_PATTERN = "**/*." + FILE_EXT;
-
- /**
- * Fix C# reference inclusion. C# is really dumb in how it handles
- * inclusion. You have to list every 'assembly' -read DLL that is imported.
- * So already you are making a platform assumption -shared libraries have a
- * .dll;"+ extension and the poor developer has to know every library which
- * is included why the compiler cant find classes on the path or in a
- * directory, is a mystery. To reduce the need to be explicit, here is a
- * long list of the core libraries used in Beta-1 of .NET ommitting the
- * blatantly non portable (MS.win32.interop) and the .designer libraries.
- * (ripping out Com was tempting) Casing is chosen to match that of the file
- * system <i>exactly</i> so may work on a unix box too.
- */
-
- private static final String DEFAULT_REFERENCE_LIST =
- "Accessibility.dll;" +
- "cscompmgd.dll;" +
- "CustomMarshalers.dll;" +
- "IEExecRemote.dll;" +
- "IEHost.dll;" +
- "IIEHost.dll;" +
- "ISymWrapper.dll;" +
- "Microsoft.JScript.dll;" +
- "Microsoft.VisualBasic.dll;" +
- "Microsoft.VisualC.dll;" +
- "Microsoft.Vsa.dll;" +
- "Mscorcfg.dll;" +
- "RegCode.dll;" +
- "System.Configuration.Install.dll;" +
- "System.Data.dll;" +
- "System.Design.dll;" +
- "System.DirectoryServices.dll;" +
- "System.EnterpriseServices.dll;" +
- "System.dll;" +
- "System.Drawing.Design.dll;" +
- "System.Drawing.dll;" +
- "System.Management.dll;" +
- "System.Messaging.dll;" +
- "System.Runtime.Remoting.dll;" +
- "System.Runtime.Serialization.Formatters.Soap.dll;" +
- "System.Security.dll;" +
- "System.ServiceProcess.dll;" +
- "System.Web.dll;" +
- "System.Web.RegularExpressions.dll;" +
- "System.Web.Services.dll;" +
- "System.Windows.Forms.dll;" +
- "System.XML.dll;";
-
- /**
- * utf out flag
- */
- private boolean m_utf8output;
-
- private boolean m_fullpaths = true;
-
- /**
- * debug flag. Controls generation of debug information.
- */
- private boolean m_debug = true;
-
- /**
- * output XML documentation flag
- */
- private File m_docFile;
-
- /**
- * any extra command options?
- */
- private String m_extraOptions;
-
- /**
- * flag to enable automatic reference inclusion
- */
- private boolean m_includeDefaultReferences = true;
-
- /**
- * incremental build flag
- */
- private boolean m_incremental;
-
- /**
- * main class (or null for automatic choice)
- */
- private String m_mainClass;
-
- /**
- * optimise flag
- */
- private boolean m_optimize;
-
- /**
- * output file. If not supplied this is derived from the source file
- */
- private File m_outputFile;
-
- /**
- * using the path approach didnt work as it could not handle the implicit
- * execution path. Perhaps that could be extracted from the runtime and then
- * the path approach would be viable
- */
- private Path m_referenceFiles;
-
- /**
- * list of reference classes. (pretty much a classpath equivalent)
- */
- private String m_references;
-
- /**
- * type of target. Should be one of exe|library|module|winexe|(null) default
- * is exe; the actual value (if not null) is fed to the command line. <br>
- * See /target
- */
- private String m_targetType;
-
- /**
- * enable unsafe code flag. Clearly set to false by default
- */
- private boolean m_unsafe;
-
- /**
- * icon for incorporation into apps
- */
- private File m_win32icon;
- /**
- * icon for incorporation into apps
- */
- private File m_win32res;
-
- /**
- * list of extra modules to refer to
- */
- private String m_additionalModules;
-
- /**
- * defines list something like 'RELEASE;WIN32;NO_SANITY_CHECKS;;SOMETHING_ELSE'
- */
- private String m_definitions;
-
- /**
- * destination directory (null means use the source directory) NB: this is
- * currently not used
- */
- private File m_destDir;
-
- /**
- * source directory upon which the search pattern is applied
- */
- private File m_srcDir;
-
- /**
- * warning level: 0-4, with 4 being most verbose
- */
- private int m_warnLevel = 3;
-
- /**
- * constructor inits everything and set up the search pattern
- */
-
- public CSharp()
- throws TaskException
- {
- setIncludes( FILE_PATTERN );
- }
-
- /**
- * Set the definitions
- */
- public void setAdditionalModules( final String additionalModules )
- {
- m_additionalModules = additionalModules;
- }
-
- /**
- * set the debug flag on or off
- *
- * @param debug on/off flag
- */
- public void setDebug( final boolean debug )
- {
- m_debug = debug;
- }
-
- /**
- * Set the definitions
- */
- public void setDefinitions( final String definitions )
- {
- m_definitions = definitions;
- }
-
- /**
- * Set the destination dir to find the files to be compiled
- *
- * @param destDir The new DestDir value
- */
- public void setDestDir( final File destDir )
- {
- m_destDir = destDir;
- }
-
- /**
- * file for generated XML documentation
- *
- * @param docFile output file
- */
- public void setDocFile( final File docFile )
- {
- m_docFile = docFile;
- }
-
- /**
- * Sets the ExtraOptions attribute
- */
- public void setExtraOptions( final String extraOptions )
- {
- m_extraOptions = extraOptions;
- }
-
- public void setFullPaths( final boolean fullpaths )
- {
- m_fullpaths = fullpaths;
- }
-
- /**
- * set the automatic reference inclusion flag on or off this flag controls
- * the string of references and the /nostdlib option in CSC
- *
- * @param includeDefaultReferences on/off flag
- */
- public void setIncludeDefaultReferences( final boolean includeDefaultReferences )
- {
- m_includeDefaultReferences = includeDefaultReferences;
- }
-
- /**
- * set the incremental compilation flag on or off
- *
- * @param incremental on/off flag
- */
- public void setIncremental( final boolean incremental )
- {
- m_incremental = incremental;
- }
-
- /**
- * Sets the MainClass attribute
- *
- * @param mainClass The new MainClass value
- */
- public void setMainClass( final String mainClass )
- {
- m_mainClass = mainClass;
- }
-
- /**
- * set the optimise flag on or off
- *
- * @param optimize on/off flag
- */
- public void setOptimize( final boolean optimize )
- {
- m_optimize = optimize;
- }
-
- /**
- * Set the definitions
- */
- public void setOutputFile( final File outputFile )
- {
- m_outputFile = outputFile;
- }
-
- /**
- * add another path to the reference file path list
- *
- * @param path another path to append
- */
- public void setReferenceFiles( final Path path )
- throws TaskException
- {
- //demand create pathlist
- if( null == m_referenceFiles )
- {
- m_referenceFiles = new Path();
- }
- m_referenceFiles.add( path );
- }
-
- /**
- * Set the reference list to be used for this compilation.
- *
- * @param references The new References value
- */
- public void setReferences( final String references )
- {
- m_references = references;
- }
-
- /**
- * Set the source dir to find the files to be compiled
- *
- * @param srcDir The new SrcDir value
- */
- public void setSrcDir( final File srcDir )
- {
- m_srcDir = srcDir;
- }
-
- /**
- * define the target
- *
- * @param targetType The new TargetType value
- * @exception TaskException if target is not one of
- * exe|library|module|winexe
- */
- public void setTargetType( final String targetType )
- throws TaskException
- {
- final String type = targetType.toLowerCase();
- if( type.equals( "exe" ) || type.equals( "library" ) ||
- type.equals( "module" ) || type.equals( "winexe" ) )
- {
- m_targetType = type;
- }
- else
- {
- final String message = "targetType " + type + " is not a valid type";
- throw new TaskException( message );
- }
- }
-
- /**
- * Sets the Unsafe attribute
- *
- * @param unsafe The new Unsafe value
- */
- public void setUnsafe( final boolean unsafe )
- {
- m_unsafe = unsafe;
- }
-
- /**
- * enable generation of utf8 output from the compiler.
- *
- * @param enabled The new Utf8Output value
- */
- public void setUtf8Output( final boolean enabled )
- {
- m_utf8output = enabled;
- }
-
- /**
- * set warn level (no range checking)
- *
- * @param warnLevel warn level -see .net docs for valid range (probably 0-4)
- */
- public void setWarnLevel( final int warnLevel )
- {
- m_warnLevel = warnLevel;
- }
-
- /**
- * Set the win32 icon
- *
- * @param fileName path to the file. Can be relative, absolute, whatever.
- */
- public void setWin32Icon( final File fileName )
- {
- m_win32icon = fileName;
- }
-
- /**
- * Set the win32 icon
- *
- * @param win32res path to the file. Can be relative, absolute, whatever.
- */
- public void setWin32Res( final File win32res )
- {
- m_win32res = win32res;
- }
-
- /**
- * do the work by building the command line and then calling it
- */
- public void execute()
- throws TaskException
- {
- if( null == m_srcDir )
- {
- m_srcDir = getBaseDirectory();
- }
-
- final Execute exe = new Execute();
- exe.setExecutable( EXE_NAME );
-
- addArgument( exe, "/nologo" );
- addArgument( exe, getAdditionalModulesParameter() );
- addArgument( exe, getDefinitionsParameter() );
- addArgument( exe, getDebugParameter() );
- addArgument( exe, getDocFileParameter() );
- addArgument( exe, getIncrementalParameter() );
- addArgument( exe, getMainClassParameter() );
- addArgument( exe, getOptimizeParameter() );
- addArgument( exe, getReferencesParameter() );
- addArgument( exe, getTargetTypeParameter() );
- addArgument( exe, getUnsafeParameter() );
- addArgument( exe, getWarnLevelParameter() );
- addArgument( exe, getWin32IconParameter() );
- addArgument( exe, getOutputFileParameter() );
- addArgument( exe, getIncludeDefaultReferencesParameter() );
- addArgument( exe, getDefaultReferenceParameter() );
- addArgument( exe, getWin32ResParameter() );
- addArgument( exe, getUtf8OutpuParameter() );
- addArgument( exe, getFullPathsParameter() );
- addArgument( exe, getExtraOptionsParameter() );
-
- //get dependencies list.
- final DirectoryScanner scanner = super.getDirectoryScanner( m_srcDir );
- final String[] dependencies = scanner.getIncludedFiles();
- final String message = "compiling " + dependencies.length + " file" +
- ( ( dependencies.length == 1 ) ? "" : "s" );
- getContext().info( message );
- final String baseDir = scanner.getBasedir().toString();
- //add to the command
- for( int i = 0; i < dependencies.length; i++ )
- {
- final String targetFile = baseDir + File.separator + dependencies[ i ];
- addArgument( exe, targetFile );
- }
-
- //now run the command of exe + settings + files
- exe.execute( getContext() );
- }
-
- private void addArgument( final ArgumentList cmd, final String argument )
- {
- if( null != argument && 0 != argument.length() )
- {
- cmd.addArgument( argument );
- }
- }
-
- /**
- * get the argument or null for no argument needed
- *
- * @return The AdditionalModules Parameter to CSC
- */
- private String getAdditionalModulesParameter()
- {
- if( notEmpty( m_additionalModules ) )
- {
- return "/addmodule:" + m_additionalModules;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * get the debug switch argument
- *
- * @return The Debug Parameter to CSC
- */
- private String getDebugParameter()
- {
- return "/debug" + ( m_debug ? "+" : "-" );
- }
-
- /**
- * get default reference list
- *
- * @return null or a string of references.
- */
- private String getDefaultReferenceParameter()
- {
- if( m_includeDefaultReferences )
- {
- StringBuffer s = new StringBuffer( "/reference:" );
- s.append( DEFAULT_REFERENCE_LIST );
- return new String( s );
- }
- else
- {
- return null;
- }
- }
-
- /**
- * get the argument or null for no argument needed
- *
- * @return The Definitions Parameter to CSC
- */
- private String getDefinitionsParameter()
- {
- if( notEmpty( m_definitions ) )
- {
- return "/define:" + m_definitions;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * get the argument or null for no argument needed
- *
- * @return The DocFile Parameter to CSC
- */
- private String getDocFileParameter()
- {
- if( m_docFile != null )
- {
- return "/doc:" + m_docFile.toString();
- }
- else
- {
- return null;
- }
- }
-
- /**
- * get any extra options or null for no argument needed
- *
- * @return The ExtraOptions Parameter to CSC
- */
- private String getExtraOptionsParameter()
- {
- if( m_extraOptions != null && m_extraOptions.length() != 0 )
- {
- return m_extraOptions;
- }
- else
- {
- return null;
- }
- }
-
- private String getFullPathsParameter()
- {
- return m_fullpaths ? "/fullpaths" : null;
- }
-
- /**
- * get the include default references flag or null for no argument needed
- *
- * @return The Parameter to CSC
- */
- private String getIncludeDefaultReferencesParameter()
- {
- return "/nostdlib" + ( m_includeDefaultReferences ? "-" : "+" );
- }
-
- /**
- * get the incremental build argument
- *
- * @return The Incremental Parameter to CSC
- */
- private String getIncrementalParameter()
- {
- return "/incremental" + ( m_incremental ? "+" : "-" );
- }
-
- /**
- * get the /main argument or null for no argument needed
- *
- * @return The MainClass Parameter to CSC
- */
- private String getMainClassParameter()
- {
- if( m_mainClass != null && m_mainClass.length() != 0 )
- {
- return "/main:" + m_mainClass;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * get the optimise flag or null for no argument needed
- *
- * @return The Optimize Parameter to CSC
- */
- private String getOptimizeParameter()
- {
- return "/optimize" + ( m_optimize ? "+" : "-" );
- }
-
- /**
- * get the argument or null for no argument needed
- *
- * @return The OutputFile Parameter to CSC
- */
- private String getOutputFileParameter()
- {
- if( m_outputFile != null )
- {
- File f = m_outputFile;
- return "/out:" + f.toString();
- }
- else
- {
- return null;
- }
- }
-
- /**
- * get the reference string or null for no argument needed
- *
- * @return The References Parameter to CSC
- */
- private String getReferencesParameter()
- {
- //bail on no references
- if( notEmpty( m_references ) )
- {
- return "/reference:" + m_references;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * get the argument or null for no argument needed
- *
- * @return The TargetType Parameter to CSC
- */
- private String getTargetTypeParameter()
- {
- if( notEmpty( m_targetType ) )
- {
- return "/target:" + m_targetType;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * get the argument or null for no argument needed
- *
- * @return The Unsafe Parameter to CSC
- */
- private String getUnsafeParameter()
- {
- return m_unsafe ? "/unsafe" : null;
- }
-
- private String getUtf8OutpuParameter()
- {
- return m_utf8output ? "/utf8output" : null;
- }
-
- /**
- * get the warn level switch
- *
- * @return The WarnLevel Parameter to CSC
- */
- private String getWarnLevelParameter()
- {
- return "/warn:" + m_warnLevel;
- }
-
- /**
- * get the argument or null for no argument needed
- *
- * @return The Win32Icon Parameter to CSC
- */
- private String getWin32IconParameter()
- {
- if( m_win32icon != null )
- {
- return "/win32icon:" + m_win32icon.toString();
- }
- else
- {
- return null;
- }
- }
-
- /**
- * get the argument or null for no argument needed
- *
- * @return The Win32Icon Parameter to CSC
- */
- private String getWin32ResParameter()
- {
- if( m_win32res != null )
- {
- return "/win32res:" + m_win32res.toString();
- }
- else
- {
- return null;
- }
- }
-
- /**
- * test for a string containing something useful
- *
- * @param string string in
- * @return true if the argument is not null or empty
- */
- private boolean notEmpty( final String string )
- {
- return string != null && string.length() != 0;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/dotnet/Ilasm.java b/proposal/myrmidon/src/java/org/apache/antlib/dotnet/Ilasm.java
deleted file mode 100644
index 7c1442e62..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/dotnet/Ilasm.java
+++ /dev/null
@@ -1,395 +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.txt file.
- */
-package org.apache.antlib.dotnet;
-
-import java.io.File;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.nativelib.Execute;
-import org.apache.tools.todo.taskdefs.MatchingTask;
-import org.apache.myrmidon.framework.nativelib.ArgumentList;
-import org.apache.tools.todo.types.DirectoryScanner;
-
-/**
- * Task to assemble .net 'Intermediate Language' files. The task will only work
- * on win2K until other platforms support csc.exe or an equivalent. ilasm.exe
- * must be on the execute path too. <p>
- *
- * <p>
- *
- * All parameters are optional: &lt;il/&gt; should suffice to produce a debug
- * build of all *.il files. The option set is roughly compatible with the CSharp
- * class; even though the command line options are only vaguely equivalent. [The
- * low level commands take things like /OUT=file, csc wants /out:file ...
- * /verbose is used some places; /quiet here in ildasm... etc.] It would be nice
- * if someone made all the command line tools consistent (and not as brittle as
- * the java cmdline tools) <p>
- *
- * The task is a directory based task, so attributes like <b>includes="*.il"</b>
- * and <b>excludes="broken.il"</b> can be used to control the files pulled in.
- * Each file is built on its own, producing an appropriately named output file
- * unless manually specified with <b>outfile</b>
- *
- * @author Steve Loughran steve_l@iseran.com
- * @version 0.2
- */
-public class Ilasm
- extends MatchingTask
-{
- /**
- * name of the executable. the .exe suffix is deliberately not included in
- * anticipation of the unix version
- */
- private static final String EXE_NAME = "ilasm";
-
- /**
- * what is the file extension we search on?
- */
- private static final String FILE_EXT = "il";
-
- /**
- * and now derive the search pattern from the extension
- */
- private static final String FILE_PATTERN = "**/*." + FILE_EXT;
-
- /**
- * debug flag. Controls generation of debug information.
- */
- private boolean m_debug;
-
- /**
- * any extra command options?
- */
- private String m_extraOptions;
-
- /**
- * listing flag
- */
- private boolean m_listing;
-
- /**
- * output file. If not supplied this is derived from the source file
- */
- private File m_outputFile;
-
- /**
- * resource file (.res format) to include in the app.
- */
- private File m_resourceFile;
-
- /**
- * type of target. Should be one of exe|library|module|winexe|(null) default
- * is exe; the actual value (if not null) is fed to the command line. <br>
- * See /target
- */
- private String m_targetType;
-
- /**
- * verbose flag
- */
- private boolean m_verbose;
-
- /**
- * file containing private key
- */
- private File m_keyfile;
-
- /**
- * source directory upon which the search pattern is applied
- */
- private File m_srcDir;
-
- /**
- * constructor inits everything and set up the search pattern
- */
- public Ilasm()
- throws TaskException
- {
- setIncludes( FILE_PATTERN );
- m_debug = true;
- }
-
- /**
- * set the debug flag on or off
- *
- * @param debug on/off flag
- */
- public void setDebug( final boolean debug )
- {
- m_debug = debug;
- }
-
- /**
- * Sets the ExtraOptions attribute
- *
- * @param extraOptions The new ExtraOptions value
- */
- public void setExtraOptions( final String extraOptions )
- {
- m_extraOptions = extraOptions;
- }
-
- public void setKeyfile( final File keyfile )
- {
- m_keyfile = keyfile;
- }
-
- /**
- * enable/disable listing
- *
- * @param listing flag set to true for listing on
- */
- public void setListing( final boolean listing )
- {
- m_listing = listing;
- }
-
- /**
- * Set the definitions
- */
- public void setOutputFile( final File outputFile )
- {
- m_outputFile = outputFile;
- }
-
- /**
- * Set the resource file
- *
- * @param resourceFile path to the file. Can be relative, absolute, whatever.
- */
- public void setResourceFile( final File resourceFile )
- {
- m_resourceFile = resourceFile;
- }
-
- /**
- * Set the source dir to find the files to be compiled
- */
- public void setSrcDir( final File srcDir )
- {
- m_srcDir = srcDir;
- }
-
- /**
- * define the target
- *
- * @param targetType one of exe|library|
- * @exception TaskException if target is not one of
- * exe|library|module|winexe
- */
-
- public void setTargetType( final String targetType )
- throws TaskException
- {
- final String type = targetType.toLowerCase();
- if( type.equals( "exe" ) || type.equals( "library" ) )
- {
- m_targetType = type;
- }
- else
- {
- final String message = "targetType " + targetType + " is not a valid type";
- throw new TaskException( message );
- }
- }
-
- /**
- * enable/disable verbose ILASM output
- *
- * @param verbose flag set to true for verbose on
- */
- public void setVerbose( final boolean verbose )
- {
- m_verbose = verbose;
- }
-
- /**
- * This is the execution entry point. Build a list of files and call ilasm
- * on each of them.
- *
- * @throws TaskException if the assembly failed
- */
- public void execute()
- throws TaskException
- {
- if( null == m_srcDir )
- {
- m_srcDir = getBaseDirectory();
- }
-
- //get dependencies list.
- final DirectoryScanner scanner = super.getDirectoryScanner( m_srcDir );
- final String[] dependencies = scanner.getIncludedFiles();
- final String baseDir = scanner.getBasedir().toString();
-
- final String message = "assembling " + dependencies.length + " file" +
- ( ( dependencies.length == 1 ) ? "" : "s" );
- getContext().info( message );
-
- //add to the command
- for( int i = 0; i < dependencies.length; i++ )
- {
- final String targetFile = baseDir + File.separator + dependencies[ i ];
- executeOneFile( targetFile );
- }
- }
-
- /**
- * do the work for one file by building the command line then calling it
- *
- * @param targetFile name of the the file to assemble
- * @throws TaskException if the assembly failed and FailOnError is true
- */
- public void executeOneFile( final String targetFile )
- throws TaskException
- {
- final Execute exe = new Execute();
- exe.setExecutable( EXE_NAME );
- addArgument( exe, getDebugParameter() );
- addArgument( exe, getTargetTypeParameter() );
- addArgument( exe, getListingParameter() );
- addArgument( exe, getOutputFileParameter() );
- addArgument( exe, getResourceFileParameter() );
- addArgument( exe, getVerboseParameter() );
- addArgument( exe, getKeyfileParameter() );
- addArgument( exe, getExtraOptionsParameter() );
- addArgument( exe, targetFile );
- exe.execute( getContext() );
- }
-
- private void addArgument( final ArgumentList cmd, final String argument )
- {
- if( null != argument && 0 != argument.length() )
- {
- cmd.addArgument( argument );
- }
- }
-
- /**
- * get the argument or null for no argument needed
- *
- * @return The DebugParameter value
- */
- private String getDebugParameter()
- {
- return m_debug ? "/debug" : null;
- }
-
- /**
- * get any extra options or null for no argument needed
- *
- * @return The ExtraOptions Parameter to CSC
- */
- private String getExtraOptionsParameter()
- {
- if( m_extraOptions != null && m_extraOptions.length() != 0 )
- {
- return m_extraOptions;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * get the argument or null for no argument needed
- */
- private String getKeyfileParameter()
- {
- if( m_keyfile != null )
- {
- return "/keyfile:" + m_keyfile.toString();
- }
- else
- {
- return null;
- }
- }
-
- /**
- * turn the listing flag into a parameter for ILASM
- *
- * @return the appropriate string from the state of the listing flag
- */
- private String getListingParameter()
- {
- return m_listing ? "/listing" : "/nolisting";
- }
-
- /**
- * get the output file
- *
- * @return the argument string or null for no argument
- */
- private String getOutputFileParameter()
- {
- if( null == m_outputFile || 0 == m_outputFile.length() )
- {
- return null;
- }
- return "/output=" + m_outputFile.toString();
- }
-
- private String getResourceFileParameter()
- {
- if( null != m_resourceFile )
- {
- return "/resource=" + m_resourceFile.toString();
- }
- else
- {
- return null;
- }
- }
-
- /**
- * g get the target type or null for no argument needed
- *
- * @return The TargetTypeParameter value
- */
-
- private String getTargetTypeParameter()
- {
- if( !notEmpty( m_targetType ) )
- {
- return null;
- }
- if( m_targetType.equals( "exe" ) )
- {
- return "/exe";
- }
- else if( m_targetType.equals( "library" ) )
- {
- return "/dll";
- }
- else
- {
- return null;
- }
- }
-
- /**
- * turn the verbose flag into a parameter for ILASM
- *
- * @return null or the appropriate command line string
- */
- private String getVerboseParameter()
- {
- return m_verbose ? null : "/quiet";
- }
-
- /**
- * test for a string containing something useful
- *
- * @returns true if the argument is not null or empty
- */
- private boolean notEmpty( final String string )
- {
- return string != null && string.length() != 0;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/file/CopyTask.java b/proposal/myrmidon/src/java/org/apache/antlib/file/CopyTask.java
deleted file mode 100644
index ae8ae12bd..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/file/CopyTask.java
+++ /dev/null
@@ -1,450 +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.txt file.
- */
-package org.apache.antlib.file;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.avalon.excalibur.io.FileUtil;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.FileNameMapper;
-import org.apache.myrmidon.framework.FileSet;
-import org.apache.tools.todo.types.DirectoryScanner;
-import org.apache.tools.todo.types.ScannerUtil;
-import org.apache.tools.todo.types.SourceFileScanner;
-import org.apache.tools.todo.util.mappers.IdentityMapper;
-
-/**
- * This is a task used to copy files.
- *
- * @ant.task name="copy"
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @author <a href="mailto:glennm@ca.ibm.com">Glenn McAllister</a>
- * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
- * @author <A href="gholam@xtra.co.nz">Michael McCallum</A>
- * @author <a href="mailto:umagesh@rediffmail.com">Magesh Umasankar</a>
- * @version $Revision$ $Date$
- */
-public class CopyTask
- extends AbstractTask
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( CopyTask.class );
-
- private File m_file;
- private ArrayList m_filesets = new ArrayList();
- private File m_destFile;
- private File m_destDir;
- private boolean m_preserveLastModified;
- private boolean m_overwrite;
- private boolean m_includeEmpty = true;
- private FileNameMapper m_mapper;
-
- private HashMap m_fileMap = new HashMap();
- private HashMap m_dirMap = new HashMap();
-
- /**
- * Sets a single source file to copy.
- */
- public void setFile( final File file )
- {
- m_file = file;
- }
-
- public void addFileset( final FileSet set )
- {
- m_filesets.add( set );
- }
-
- public void setDestFile( final File destFile )
- {
- m_destFile = destFile;
- }
-
- public void setDestDir( final File destDir )
- {
- m_destDir = destDir;
- }
-
- public void setPreserveLastModified( boolean preserveLastModified )
- {
- m_preserveLastModified = preserveLastModified;
- }
-
- /**
- * Overwrite any existing destination file(s).
- */
- public void setOverwrite( boolean overwrite )
- {
- m_overwrite = overwrite;
- }
-
- /**
- * Defines the FileNameMapper to use (nested mapper element).
- */
- public void addMapper( final FileNameMapper mapper )
- throws TaskException
- {
- if( null != m_mapper )
- {
- final String message = "Cannot define more than one mapper";
- throw new TaskException( message );
- }
- m_mapper = mapper;
- }
-
- protected final boolean isPreserveLastModified()
- {
- return m_preserveLastModified;
- }
-
- public void execute()
- throws TaskException
- {
- validate();
-
- // deal with the single file
- if( m_file != null )
- {
- if( null == m_destFile )
- {
- m_destFile = new File( m_destDir, m_file.getName() );
- }
-
- if( m_overwrite ||
- ( m_file.lastModified() > m_destFile.lastModified() ) )
- {
- m_fileMap.put( m_file.getAbsolutePath(), m_destFile.getAbsolutePath() );
- }
- else
- {
- final String message =
- REZ.getString( "copy.omit-uptodate.notice", m_file, m_destFile );
- getContext().debug( message );
- }
- }
-
- // deal with the filesets
- final int size = m_filesets.size();
- for( int i = 0; i < size; i++ )
- {
- final FileSet fileSet = (FileSet)m_filesets.get( i );
- final DirectoryScanner scanner = ScannerUtil.getDirectoryScanner( fileSet );
- final File fromDir = fileSet.getDir();
-
- final String[] srcFiles = scanner.getIncludedFiles();
- final String[] srcDirs = scanner.getIncludedDirectories();
-
- scan( fromDir, m_destDir, srcFiles, srcDirs );
- }
-
- // do all the copy operations now...
- doFileOperations( m_fileMap, m_dirMap );
- }
-
- protected void validate()
- throws TaskException
- {
- final int fileSetSize = m_filesets.size();
-
- if( null == m_file && 0 == fileSetSize )
- {
- final String message = REZ.getString( "copy.missing-src.error" );
- throw new TaskException( message );
- }
-
- if( null != m_destFile && null != m_destDir )
- {
- final String message = REZ.getString( "copy.one-dest-only.error" );
- throw new TaskException( message );
- }
-
- if( null != m_file && m_file.exists() && m_file.isDirectory() )
- {
- final String message = REZ.getString( "copy.fileset-for-dirs.error" );
- throw new TaskException( message );
- }
-
- if( null != m_destFile && fileSetSize > 0 )
- {
- if( fileSetSize > 1 )
- {
- final String message = REZ.getString( "copy.need-destdir.error" );
- throw new TaskException( message );
- }
- else
- {
- final FileSet fileSet = (FileSet)m_filesets.get( 0 );
- final DirectoryScanner scanner = ScannerUtil.getDirectoryScanner( fileSet );
- final String[] srcFiles = scanner.getIncludedFiles();
-
- if( srcFiles.length > 0 )
- {
- if( m_file == null )
- {
- m_file = new File( srcFiles[ 0 ] );
- m_filesets.remove( 0 );
- }
- else
- {
- final String message = REZ.getString( "copy.bad-mapping.error" );
- throw new TaskException( message );
- }
- }
- else
- {
- final String message = REZ.getString( "copy.bad-operation.error" );
- throw new TaskException( message );
- }
- }
- }
-
- if( null != m_file && !m_file.exists() )
- {
- final String message =
- REZ.getString( "copy.missing-file.error", m_file.getAbsolutePath() );
- throw new TaskException( message );
- }
-
- if( null != m_destFile )
- {
- m_destDir = m_destFile.getParentFile();
- }
- }
-
- /**
- * Compares source files to destination files to see if they should be
- * copied.
- */
- private void scan( final File sourceDir,
- final File destDir,
- final String[] files,
- final String[] dirs )
- throws TaskException
- {
- final FileNameMapper mapper = getFilenameMapper();
-
- buildMap( sourceDir, destDir, files, mapper, m_fileMap );
-
- if( m_includeEmpty )
- {
- buildMap( sourceDir, destDir, dirs, mapper, m_dirMap );
- }
- }
-
- private void buildMap( final File sourceDir,
- final File destDir,
- final String[] files,
- final FileNameMapper mapper,
- final Map map )
- throws TaskException
- {
- final String[] toCopy = buildFilenameList( files, mapper, sourceDir, destDir );
- for( int i = 0; i < toCopy.length; i++ )
- {
- final String destFilename = mapper.mapFileName( toCopy[ i ], getContext() )[ 0 ];
- final File source = new File( sourceDir, toCopy[ i ] );
- final File destination = new File( destDir, destFilename );
- map.put( source.getAbsolutePath(), destination.getAbsolutePath() );
- }
- }
-
- /**
- * Utility method to build up a list of files needed between both
- * but only getting the files that need updating (unless overwrite is true).
- */
- private String[] buildFilenameList( final String[] names,
- final FileNameMapper mapper,
- final File fromDir,
- final File toDir )
- throws TaskException
- {
- if( m_overwrite )
- {
- final ArrayList list = new ArrayList( names.length );
- for( int i = 0; i < names.length; i++ )
- {
- final String name = names[ i ];
- if( null != mapper.mapFileName( name, getContext() ) )
- {
- list.add( name );
- }
- }
-
- return (String[])list.toArray( new String[ list.size() ] );
- }
- else
- {
- final SourceFileScanner scanner = new SourceFileScanner();
- return scanner.restrict( names, fromDir, toDir, mapper, getContext() );
- }
- }
-
- /**
- * Perform the oepration on all the files (and possibly empty directorys).
- */
- private void doFileOperations( final Map fileCopyMap, final Map dirCopyMap )
- throws TaskException
- {
- final int fileCount = fileCopyMap.size();
- if( fileCount > 0 )
- {
- doOperationOnFiles( fileCopyMap );
- }
-
- if( m_includeEmpty )
- {
- doOperationOnDirs( dirCopyMap );
- }
- }
-
- /**
- * perform operation on files.
- */
- private void doOperationOnFiles( final Map fileMap )
- throws TaskException
- {
- final int fileCount = fileMap.size();
- displayFilecountNotice( fileCount );
-
- final Iterator names = fileMap.keySet().iterator();
- while( names.hasNext() )
- {
- final String source = (String)names.next();
- final String destination = (String)fileMap.get( source );
-
- if( source.equals( destination ) )
- {
- final String message =
- REZ.getString( "copy.selfcopy-ignored.notice", source );
- getContext().verbose( message );
- continue;
- }
-
- try
- {
- final String message =
- REZ.getString( "copy.filecopy.notice", source, destination );
- getContext().verbose( message );
-
- doOperation( source, destination );
- }
- catch( final IOException ioe )
- {
- final String message =
- REZ.getString( "copy.filecopy.error", source, destination, ioe );
- throw new TaskException( message, ioe );
- }
- }
- }
-
- /**
- * perform operation on directories.
- */
- private void doOperationOnDirs( final Map dirMap )
- {
- final Iterator dirs = dirMap.values().iterator();
- int count = 0;
- while( dirs.hasNext() )
- {
- final String pathname = (String)dirs.next();
- final File dir = new File( pathname );
- if( !dir.exists() )
- {
- if( !dir.mkdirs() )
- {
- final String message =
- REZ.getString( "copy.dircopy.error", dir.getAbsolutePath() );
- getContext().error( message );
- }
- else
- {
- count++;
- }
- }
- }
-
- if( count > 0 )
- {
- displayDirCopyNotice( count );
- }
- }
-
- /**
- * Utility method to determine and retrieve FilenameMapper.
- */
- private FileNameMapper getFilenameMapper()
- throws TaskException
- {
- if( null != m_mapper )
- {
- return m_mapper;
- }
- else
- {
- return new IdentityMapper();
- }
- }
-
- /**
- * Utility method to perform operation to transform a single source file
- * to a destination.
- */
- protected void doOperation( final String sourceFilename,
- final String destinationFilename )
- throws IOException
- {
- final File source = new File( sourceFilename );
- final File destination = new File( destinationFilename );
-
- if( m_overwrite )
- {
- FileUtil.forceDelete( destination );
- }
-
- FileUtil.copyFile( source, destination );
-
- if( m_preserveLastModified )
- {
- destination.setLastModified( source.lastModified() );
- }
- }
-
- /**
- * Utility method to display notice about how many dirs copied.
- */
- private void displayDirCopyNotice( final int count )
- {
- final String message =
- REZ.getString( "copy.dir-count.notice",
- new Integer( count ),
- m_destDir.getAbsolutePath() );
- getContext().info( message );
- }
-
- /**
- * Utility method to display notice about how many files copied.
- */
- private void displayFilecountNotice( final int count )
- {
- if( getContext().isInfoEnabled() )
- {
- final String message =
- REZ.getString( "copy.file-count.notice",
- new Integer( count ),
- m_destDir.getAbsolutePath() );
- getContext().info( message );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/file/Delete.java b/proposal/myrmidon/src/java/org/apache/antlib/file/Delete.java
deleted file mode 100644
index 178c64f52..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/file/Delete.java
+++ /dev/null
@@ -1,240 +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.txt file.
- */
-package org.apache.antlib.file;
-
-import java.io.File;
-import java.util.ArrayList;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.FileSet;
-import org.apache.tools.todo.types.DirectoryScanner;
-import org.apache.tools.todo.types.ScannerUtil;
-
-/**
- * Deletes a file or directory, or set of files defined by a fileset.
- *
- * @ant.task name="delete"
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @author <a href="mailto:tad1@cornell.edu">Tom Dimock</a>
- * @author <a href="mailto:glennm@ca.ibm.com">Glenn McAllister</a>
- * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
- * @version $Revision$ $Date$
- */
-public class Delete
- extends AbstractTask
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( Delete.class );
-
- private final ArrayList filesets = new ArrayList();
- private File m_dir;
- private File m_file;
- private boolean m_includeEmpty;// by default, remove matching empty dirs
-
- /**
- * Set the directory from which files are to be deleted
- *
- * @param dir the directory path.
- */
- public void setDir( final File dir )
- {
- m_dir = dir;
- }
-
- /**
- * Set the name of a single file to be removed.
- *
- * @param file the file to be deleted
- */
- public void setFile( final File file )
- {
- m_file = file;
- }
-
- /**
- * Adds a set of files (nested fileset attribute).
- */
- public void addFileset( FileSet set )
- {
- filesets.add( set );
- }
-
- /**
- * Delete the file(s).
- */
- public void execute()
- throws TaskException
- {
- validate();
-
- // delete the single file
- if( null != m_file && m_file.exists() )
- {
- deleteFile( m_file );
- }
-
- // delete the directory
- if( m_dir != null && m_dir.exists() && m_dir.isDirectory() )
- {
- final String message =
- REZ.getString( "delete.delete-dir.notice", m_dir.getAbsolutePath() );
- getContext().info( message );
- deleteDir( m_dir );
- }
-
- // delete the files in the filesets
- final int size = filesets.size();
- for( int i = 0; i < size; i++ )
- {
- final FileSet fileSet = (FileSet)filesets.get( i );
- final DirectoryScanner scanner =
- ScannerUtil.getDirectoryScanner( fileSet );
- final String[] files = scanner.getIncludedFiles();
- final String[] dirs = scanner.getIncludedDirectories();
- removeFiles( fileSet.getDir(), files, dirs );
- }
- }
-
- private void validate()
- throws TaskException
- {
- if( null == m_file && null == m_dir && 0 == filesets.size() )
- {
- final String message = REZ.getString( "delete.nofiles.error" );
- throw new TaskException( message );
- }
-
- if( null != m_file && m_file.exists() && m_file.isDirectory() )
- {
- final String message =
- REZ.getString( "delete.bad-file.error", m_file.getAbsolutePath() );
- throw new TaskException( message );
- }
-
- if( null != m_file && !m_file.exists() )
- {
- final String message =
- REZ.getString( "delete.missing-file.error", m_file.getAbsolutePath() );
- getContext().debug( message );
- }
- }
-
- private void deleteDir( final File baseDir )
- throws TaskException
- {
- final File[] list = baseDir.listFiles();
- if( list != null )
- {
- deleteFiles( list );
- }
-
- if( getContext().isDebugEnabled() )
- {
- final String message =
- REZ.getString( "delete.delete-dir.notice", m_dir.getAbsolutePath() );
- getContext().debug( message );
- }
-
- if( !baseDir.delete() )
- {
- final String message =
- REZ.getString( "delete.delete-dir.error", m_dir.getAbsolutePath() );
- throw new TaskException( message );
- }
- }
-
- private void deleteFiles( final File[] list )
- throws TaskException
- {
- for( int i = 0; i < list.length; i++ )
- {
- final File file = list[ i ];
- if( file.isDirectory() )
- {
- deleteDir( file );
- }
- else
- {
- deleteFile( file );
- }
- }
- }
-
- private void deleteFile( final File file )
- throws TaskException
- {
- if( getContext().isDebugEnabled() )
- {
- final String message =
- REZ.getString( "delete.delete-file.notice", file.getAbsolutePath() );
- getContext().debug( message );
- }
-
- if( !file.delete() )
- {
- final String message =
- REZ.getString( "delete.delete-file.error", file.getAbsolutePath() );
- throw new TaskException( message );
- }
- }
-
- /**
- * remove an array of files in a directory, and a list of subdirectories
- * which will only be deleted if 'includeEmpty' is true
- *
- * @param d directory to work from
- * @param files array of files to delete; can be of zero length
- * @param dirs array of directories to delete; can of zero length
- */
- protected void removeFiles( final File baseDir,
- final String[] files,
- final String[] dirs )
- throws TaskException
- {
- if( files.length > 0 )
- {
- final String message =
- REZ.getString( "delete.delete-file.error",
- new Integer( files.length ),
- baseDir.getAbsolutePath() );
- getContext().info( message );
- for( int i = 0; i < files.length; i++ )
- {
- final File file = new File( baseDir, files[ i ] );
- deleteFile( file );
- }
- }
-
- if( dirs.length > 0 && m_includeEmpty )
- {
- int dirCount = 0;
- for( int j = dirs.length - 1; j >= 0; j-- )
- {
- final File dir = new File( baseDir, dirs[ j ] );
- final String[] dirFiles = dir.list();
- if( null == dirFiles || 0 == dirFiles.length )
- {
- deleteDir( dir );
- dirCount++;
- }
- }
-
- if( dirCount > 0 )
- {
- final String message =
- REZ.getString( "delete.summary.notice",
- new Integer( dirCount ),
- baseDir.getAbsolutePath() );
- getContext().info( message );
- }
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/file/FilteredCopyTask.java b/proposal/myrmidon/src/java/org/apache/antlib/file/FilteredCopyTask.java
deleted file mode 100644
index 912bc9cda..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/file/FilteredCopyTask.java
+++ /dev/null
@@ -1,132 +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.txt file.
- */
-package org.apache.antlib.file;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import org.apache.avalon.excalibur.io.IOUtil;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.filters.LineFilterSet;
-
-/**
- * A task used to copy files and simultaneously apply a
- * filter on said files.
- *
- * @ant.task name="filtered-copy"
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @version $Revision$ $Date$
- */
-public class FilteredCopyTask
- extends CopyTask
-{
- private LineFilterSet m_filterSetCollection = new LineFilterSet();
- private String m_encoding = "US-ASCII";
-
- public void addFilterset( final LineFilterSet filter )
- {
- m_filterSetCollection.add( filter );
- }
-
- public void setEncoding( final String encoding )
- {
- m_encoding = encoding;
- }
-
- /**
- * Utility method to perform operation to transform a single source file
- * to a destination.
- */
- protected void doOperation( final String sourceFilename,
- final String destinationFilename )
- throws IOException
- {
- final File source = new File( sourceFilename );
- final File destination = new File( destinationFilename );
-
- InputStream inputStream = null;
- OutputStream outputStream = null;
- BufferedReader input = null;
- BufferedWriter output = null;
- try
- {
- inputStream = new FileInputStream( source );
- outputStream = new FileOutputStream( destination );
-
- final Reader fileReader = new InputStreamReader( inputStream, m_encoding );
- final Writer fileWriter = new OutputStreamWriter( outputStream, m_encoding );
- input = new BufferedReader( fileReader );
- output = new BufferedWriter( fileWriter );
-
- process( input, output );
- }
- catch( final UnsupportedEncodingException uee )
- {
- throw new IOException( uee.toString() );
- }
- finally
- {
- IOUtil.shutdownReader( input );
- IOUtil.shutdownStream( inputStream );
- IOUtil.shutdownWriter( output );
- IOUtil.shutdownStream( outputStream );
- }
-
- if( isPreserveLastModified() )
- {
- destination.setLastModified( source.lastModified() );
- }
- }
-
- private void process( final BufferedReader input,
- final BufferedWriter output )
- throws IOException
- {
- String newline = null;
- String line = input.readLine();
- while( null != line )
- {
- if( line.length() == 0 )
- {
- output.newLine();
- }
- else
- {
- newline = replaceTokens( line );
- output.write( newline );
- output.newLine();
- }
- line = input.readLine();
- }
- }
-
- private String replaceTokens( final String line )
- throws IOException
- {
- try
- {
- final StringBuffer buffer = new StringBuffer( line );
- m_filterSetCollection.filterLine( buffer, getContext() );
- return buffer.toString();
- }
- catch( final TaskException te )
- {
- throw new IOException( te.getMessage() );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/file/ListPathTask.java b/proposal/myrmidon/src/java/org/apache/antlib/file/ListPathTask.java
deleted file mode 100644
index b9cdc5170..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/file/ListPathTask.java
+++ /dev/null
@@ -1,49 +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.txt file.
- */
-package org.apache.antlib.file;
-
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.file.FileList;
-import org.apache.myrmidon.framework.file.Path;
-
-/**
- * A diagnostic task that lists the contents of a path.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.task name="list-path"
- */
-public class ListPathTask
- extends AbstractTask
-{
- private final Path m_path = new Path();
-
- /**
- * Adds a nested path.
- */
- public void add( final FileList list )
- {
- m_path.add( list );
- }
-
- /**
- * Executes the task.
- */
- public void execute()
- throws TaskException
- {
- final String[] files = m_path.listFiles( getContext() );
- for( int i = 0; i < files.length; i++ )
- {
- final String file = files[ i ];
- getContext().info( file );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/file/Mkdir.java b/proposal/myrmidon/src/java/org/apache/antlib/file/Mkdir.java
deleted file mode 100644
index 2e9e40452..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/file/Mkdir.java
+++ /dev/null
@@ -1,67 +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.txt file.
- */
-package org.apache.antlib.file;
-
-import java.io.File;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * Creates specified directory.
- *
- * @ant.task name="mkdir"
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @author duncan@x180.com
- * @version $Revision$ $Date$
- */
-public class Mkdir
- extends AbstractTask
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( Mkdir.class );
-
- private File m_dir;
-
- public void setDir( final File dir )
- {
- m_dir = dir;
- }
-
- public void execute()
- throws TaskException
- {
- if( null == m_dir )
- {
- final String message = REZ.getString( "mkdir.missing-dir.error" );
- throw new TaskException( message );
- }
-
- if( m_dir.isFile() )
- {
- final String message =
- REZ.getString( "mkdir.file-exists.error", m_dir.getAbsolutePath() );
- throw new TaskException( message );
- }
-
- if( !m_dir.exists() )
- {
- final boolean result = m_dir.mkdirs();
- if( !result )
- {
- final String message =
- REZ.getString( "mkdir.nocreate.error", m_dir.getAbsolutePath() );
- throw new TaskException( message );
- }
- final String message =
- REZ.getString( "mkdir.create.notice", m_dir.getAbsolutePath() );
- getContext().info( message );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/file/MoveTask.java b/proposal/myrmidon/src/java/org/apache/antlib/file/MoveTask.java
deleted file mode 100644
index 1296fa6a1..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/file/MoveTask.java
+++ /dev/null
@@ -1,48 +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.txt file.
- */
-package org.apache.antlib.file;
-
-import java.io.File;
-import java.io.IOException;
-import org.apache.avalon.excalibur.io.FileUtil;
-
-/**
- * A task used to move files.
- *
- * @ant.task name="move"
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @version $Revision$ $Date$
- */
-public class MoveTask
- extends CopyTask
-{
- /**
- * Utility method to perform operation to transform a single source file
- * to a destination.
- */
- protected void doOperation( final String sourceFilename,
- final String destinationFilename )
- throws IOException
- {
- final File source = new File( sourceFilename );
- final File destination = new File( destinationFilename );
-
- if( destination.exists() )
- {
- FileUtil.forceDelete( destination );
- }
- FileUtil.copyFile( source, destination );
-
- if( isPreserveLastModified() )
- {
- destination.setLastModified( source.lastModified() );
- }
-
- FileUtil.forceDelete( source );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/file/Resources.properties b/proposal/myrmidon/src/java/org/apache/antlib/file/Resources.properties
deleted file mode 100644
index e0910e0e2..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/file/Resources.properties
+++ /dev/null
@@ -1,36 +0,0 @@
-mkdir.missing-dir.error=dir attribute is required.
-mkdir.file-exists.error=Unable to create directory as a file already exists with that name: "{0}".
-mkdir.nocreate.error=Failed to create directory {0} due to an unknown reason.
-mkdir.create.notice=Created dir: {0}
-
-touch.neg-time.error=Date of {0} results in negative milliseconds value relative to epoch (January 1, 1970, 00:00:00 GMT).
-touch.no-files.error=Specify at least one source - a file or a fileset.
-touch.use-fileset.error=Use a fileset to touch directories.
-touch.readonly-file.error=Can not change modification date of read-only file {0}.
-touch.no-touch.error=Could not create file {0} due to {1}.
-touch.create.notice=Creating {0}.
-
-delete.nofiles.error=At least one of the file or dir attributes, or a fileset element, must be set.
-delete.bad-file.error=Directory {0} cannot be removed using the file attribute. Use dir instead.
-delete.missing-file.error=Could not find file {0} to delete.
-delete.delete-dir.notice=Deleting directory {0}.
-delete.delete-dir.error=Unable to delete directory {0}.
-delete.delete-file.notice=Deleting {0}.
-delete.delete-file.error=Unable to delete file {0}.
-delete.delete-file.error=Deleting {0} files from {1}.
-delete.summary.notice=Deleted {0,choice,0#zero directories|1#1 directory|2<{0} directories} from {1}.
-
-copy.omit-uptodate.notice={0} omitted as {1} is up to date.
-copy.missing-src.error=No source file or fileset specified.
-copy.one-dest-only.error=Only one of destFile or destDir may be set.
-copy.fileset-for-dirs.error=Use a fileset to copy directories.
-copy.need-destdir.error=Cannot copy multiple files into a single file.
-copy.bad-mapping.error=Cannot concatenate multiple files into a single file.
-copy.bad-operation.error=Cannot perform operation from directory to file.
-copy.missing-file.error=Could not find file {0} to copy.
-copy.dir-count.notice=Copied {0} empty director{0,choice,1#y|2<ies} to {1}.
-copy.file-count.notice=Copying {0} file{0,choice,1#|2<s} to {1}.
-copy.dircopy.error=Unable to create directory {0}.
-copy.filecopy.error=Failed to copy {0} to {1} due to {3}.
-copy.filecopy.notice=Copying {0} to {1}.
-copy.selfcopy-ignored.notice=Skipping self-copy of {0}. \ No newline at end of file
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/file/Touch.java b/proposal/myrmidon/src/java/org/apache/antlib/file/Touch.java
deleted file mode 100644
index 615531914..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/file/Touch.java
+++ /dev/null
@@ -1,203 +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.txt file.
- */
-package org.apache.antlib.file;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Locale;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.FileSet;
-import org.apache.tools.todo.types.DirectoryScanner;
-import org.apache.tools.todo.types.ScannerUtil;
-
-/**
- * Touch a file and/or fileset(s) -- corresponds to the Unix touch command.
- *
- * If the file to touch doesn't exist, an empty one is created. </p>
- *
- * @ant.task name="touch"
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
- * @author <a href="mailto:mj@servidium.com">Michael J. Sikorsky</a>
- * @author <a href="mailto:shaw@servidium.com">Robert Shaw</a>
- * @version $Revision$ $Date$
- */
-public class Touch
- extends AbstractTask
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( Touch.class );
-
- private long m_millis = -1;
- private String m_datetime;
- private ArrayList m_filesets = new ArrayList();
- private File m_file;
-
- /**
- * Date in the format MM/DD/YYYY HH:MM AM_PM.
- */
- public void setDatetime( final String datetime )
- {
- m_datetime = datetime;
- }
-
- /**
- * Sets a single source file to touch. If the file does not exist an empty
- * file will be created.
- */
- public void setFile( final File file )
- {
- m_file = file;
- }
-
- /**
- * Milliseconds since 01/01/1970 00:00 am.
- */
- public void setMillis( final long millis )
- {
- m_millis = millis;
- }
-
- /**
- * Adds a set of files (nested fileset attribute).
- */
- public void addFileset( final FileSet set )
- {
- m_filesets.add( set );
- }
-
- /**
- * Execute the touch operation.
- *
- * @exception TaskException Description of Exception
- */
- public void execute()
- throws TaskException
- {
- validate();
-
- if( m_datetime != null )
- {
- final DateFormat format =
- DateFormat.getDateTimeInstance( DateFormat.SHORT,
- DateFormat.SHORT,
- Locale.US );
- try
- {
- final long millis = format.parse( m_datetime ).getTime();
- if( 0 > millis )
- {
- final String message = REZ.getString( "touch.neg-time.error", m_datetime );
- throw new TaskException( message );
- }
- setMillis( millis );
- }
- catch( final ParseException pe )
- {
- throw new TaskException( pe.getMessage(), pe );
- }
- }
-
- touch();
- }
-
- private void validate()
- throws TaskException
- {
- if( null == m_file && 0 == m_filesets.size() )
- {
- final String message = REZ.getString( "touch.no-files.error" );
- throw new TaskException( message );
- }
-
- if( null != m_file && m_file.exists() && m_file.isDirectory() )
- {
- final String message = REZ.getString( "touch.use-fileset.error" );
- throw new TaskException( message );
- }
- }
-
- private void touch()
- throws TaskException
- {
- if( m_millis < 0 )
- {
- m_millis = System.currentTimeMillis();
- }
-
- if( null != m_file )
- {
- if( !m_file.exists() )
- {
- if( getContext().isInfoEnabled() )
- {
- final String message = REZ.getString( "touch.create.notice", m_file );
- getContext().info( message );
- }
-
- try
- {
- FileOutputStream fos = new FileOutputStream( m_file );
- fos.write( new byte[ 0 ] );
- fos.close();
- }
- catch( final IOException ioe )
- {
- final String message = REZ.getString( "touch.no-touch.error", m_file, ioe );
- throw new TaskException( message, ioe );
- }
- }
-
- touch( m_file );
- }
-
- // deal with the filesets
- final int size = m_filesets.size();
- for( int i = 0; i < size; i++ )
- {
- final FileSet fileSet = (FileSet)m_filesets.get( i );
- final DirectoryScanner scanner = ScannerUtil.getDirectoryScanner( fileSet );
- final File fromDir = fileSet.getDir();
-
- final String[] srcFiles = scanner.getIncludedFiles();
- final String[] srcDirs = scanner.getIncludedDirectories();
-
- for( int j = 0; j < srcFiles.length; j++ )
- {
- final File file = new File( fromDir, srcFiles[ j ] );
- touch( file );
- }
-
- for( int j = 0; j < srcDirs.length; j++ )
- {
- final File file = new File( fromDir, srcDirs[ j ] );
- touch( file );
- }
- }
- }
-
- private void touch( final File file )
- throws TaskException
- {
- if( !file.canWrite() )
- {
- final String message = REZ.getString( "touch.readonly-file.error", file );
- throw new TaskException( message );
- }
-
- final long time = ( m_millis < 0 ) ? System.currentTimeMillis() : m_millis;
- file.setLastModified( time );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/java/ExternalCompilerAdaptor.java b/proposal/myrmidon/src/java/org/apache/antlib/java/ExternalCompilerAdaptor.java
deleted file mode 100644
index 5d1c1680f..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/java/ExternalCompilerAdaptor.java
+++ /dev/null
@@ -1,92 +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.txt file.
- */
-package org.apache.antlib.java;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.io.IOException;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.nativelib.Execute;
-
-/**
- * An abstract compiler adaptor, that forks an external compiler.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- */
-public abstract class ExternalCompilerAdaptor
- extends JavaCompilerAdaptor
-{
- /**
- * Compiles a set of files.
- */
- protected void compile( final File[] files )
- throws TaskException
- {
- // Write the file names to a temp file
- final File tempFile = createTempFile( files );
- try
- {
- final Execute exe = new Execute();
-
- // Build the command line
- buildCommandLine( exe, tempFile );
-
- // Execute
- exe.execute( getContext() );
- }
- finally
- {
- tempFile.delete();
- }
- }
-
- /**
- * Builds the command-line to execute the compiler.
- */
- protected abstract void buildCommandLine( final Execute exe, final File tempFile )
- throws TaskException;
-
- /**
- * Writes the temporary file containing the names of the files to compile.
- */
- private File createTempFile( final File[] files )
- throws TaskException
- {
- try
- {
- // Build the temp file name
- final File tmpFile = File.createTempFile( "javac", "", getContext().getBaseDirectory() );
-
- // Write file names to the temp file
- final FileWriter writer = new FileWriter( tmpFile );
- try
- {
- final PrintWriter pwriter = new PrintWriter( writer, false );
- for( int i = 0; i < files.length; i++ )
- {
- File file = files[ i ];
- pwriter.println( file.getAbsolutePath() );
- }
- pwriter.close();
- }
- finally
- {
- writer.close();
- }
-
- return tmpFile;
- }
- catch( final IOException e )
- {
- throw new TaskException( "Cannot write file list", e );
- }
- }
-
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/java/JavaCompilerAdaptor.java b/proposal/myrmidon/src/java/org/apache/antlib/java/JavaCompilerAdaptor.java
deleted file mode 100644
index 7a2a17370..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/java/JavaCompilerAdaptor.java
+++ /dev/null
@@ -1,247 +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.txt file.
- */
-package org.apache.antlib.java;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.FileSet;
-import org.apache.myrmidon.framework.file.FileList;
-import org.apache.myrmidon.framework.file.Path;
-import org.apache.tools.todo.types.DirectoryScanner;
-import org.apache.tools.todo.types.ScannerUtil;
-import org.apache.tools.todo.types.SourceFileScanner;
-import org.apache.tools.todo.util.mappers.GlobPatternMapper;
-
-/**
- * An abstract Java compiler.
- *
- * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a>
- * @author Robin Green <a href="mailto:greenrd@hotmail.com">greenrd@hotmail.com
- * </a>
- * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
- * @author <a href="mailto:jayglanville@home.com">J D Glanville</a>
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.role shorthand="java-compiler"
- */
-public abstract class JavaCompilerAdaptor
-{
- private TaskContext m_context;
- private Path m_classPath = new Path();
- private ArrayList m_sourceFilesets = new ArrayList();
- private boolean m_debug;
- private boolean m_deprecation;
- private File m_destDir;
-
- /**
- * Sets the context for this adaptor.
- */
- public void setContext( final TaskContext context )
- {
- m_context = context;
- }
-
- /**
- * Returns the context for this adaptor.
- */
- protected TaskContext getContext()
- {
- return m_context;
- }
-
- /**
- * Enables debug in the compiled classes.
- */
- public void setDebug( final boolean debug )
- {
- m_debug = debug;
- }
-
- /**
- * Returns the 'debug' flag.
- */
- protected boolean isDebug()
- {
- return m_debug;
- }
-
- /**
- * Sets the destination directory.
- */
- public void setDestDir( final File destDir )
- {
- m_destDir = destDir;
- }
-
- /**
- * Returns the destination directory.
- */
- protected File getDestDir()
- {
- return m_destDir;
- }
-
- /**
- * Enables deprecation info.
- */
- public void setDeprecation( final boolean deprecation )
- {
- m_deprecation = deprecation;
- }
-
- /**
- * Returns the 'deprecation' flag.
- */
- protected boolean isDeprecation()
- {
- return m_deprecation;
- }
-
- /**
- * Adds a source fileset.
- */
- public void addSrc( final FileSet fileset )
- {
- m_sourceFilesets.add( fileset );
- }
-
- /**
- * Adds a class-path element.
- */
- public void addClasspath( final Path path )
- {
- m_classPath.add( path );
- }
-
- /**
- * Returns the classpath
- */
- protected FileList getClassPath()
- {
- return m_classPath;
- }
-
- /**
- * Invokes the compiler.
- */
- public void execute()
- throws TaskException
- {
- validate();
-
- // Build the list of files to compile
- final File[] compileList = getCompileList();
- logFiles( compileList );
-
- if( compileList.length == 0 )
- {
- return;
- }
-
- // Compile
- compile( compileList );
- }
-
- /**
- * Compiles a set of files.
- */
- protected abstract void compile( final File[] files )
- throws TaskException;
-
- /**
- * Logs the details of what is going to be compiled.
- */
- private void logFiles( final File[] compileList )
- {
- // Log
- final String message = "Compiling " + compileList.length + " source files to " + m_destDir;
- getContext().info( message );
- if( getContext().isVerboseEnabled() )
- {
- getContext().verbose( "Compiling the following files:" );
- for( int i = 0; i < compileList.length; i++ )
- {
- final File file = compileList[ i ];
- getContext().verbose( file.getAbsolutePath() );
- }
- }
- }
-
- /**
- * Builds the set of file to compile.
- */
- private File[] getCompileList()
- throws TaskException
- {
- final ArrayList allFiles = new ArrayList();
- for( int i = 0; i < m_sourceFilesets.size(); i++ )
- {
- final FileSet fileSet = (FileSet)m_sourceFilesets.get( i );
- final DirectoryScanner scanner = ScannerUtil.getDirectoryScanner( fileSet );
- final String[] files = scanner.getIncludedFiles();
- restrictFiles( fileSet.getDir(), files, allFiles );
- }
- return (File[])allFiles.toArray( new File[ allFiles.size() ] );
- }
-
- /**
- * Restricts a set of source files to those that are out-of-date WRT
- * their class file.
- */
- private void restrictFiles( final File srcDir,
- final String files[],
- final List acceptedFiles )
- throws TaskException
- {
- final GlobPatternMapper mapper = new GlobPatternMapper();
- mapper.setFrom( "*.java" );
- mapper.setTo( "*.class" );
- final SourceFileScanner sfs = new SourceFileScanner();
- final File[] newFiles = sfs.restrictAsFiles( files,
- srcDir,
- m_destDir,
- mapper,
- getContext() );
-
- for( int i = 0; i < newFiles.length; i++ )
- {
- final File file = newFiles[i ];
- acceptedFiles.add( file );
- }
- }
-
- /**
- * Validates the compiler settings.
- */
- private void validate() throws TaskException
- {
- // Validate the destination directory
- if( m_destDir == null )
- {
- throw new TaskException( "No destination directory specified." );
- }
- if( m_destDir.exists() )
- {
- if( !m_destDir.isDirectory() )
- {
- throw new TaskException( "Destination " + m_destDir + " is not a directory." );
- }
- }
- else
- {
- if( !m_destDir.mkdirs() )
- {
- throw new TaskException( "Cannot create destination directory " + m_destDir );
- }
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/java/JavaTask.java b/proposal/myrmidon/src/java/org/apache/antlib/java/JavaTask.java
deleted file mode 100644
index 701ae9de6..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/java/JavaTask.java
+++ /dev/null
@@ -1,121 +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.txt file.
- */
-package org.apache.antlib.java;
-
-import java.io.File;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.java.ExecuteJava;
-import org.apache.myrmidon.framework.nativelib.Argument;
-import org.apache.myrmidon.framework.nativelib.EnvironmentVariable;
-import org.apache.myrmidon.framework.file.Path;
-
-/**
- * This task acts as a loader for java applications but allows to use the same
- * JVM for the called application thus resulting in much faster operation.
- *
- * @author Stefano Mazzocchi <a href="mailto:stefano@apache.org">
- * stefano@apache.org</a>
- * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
- *
- * @ant.task name="java"
- */
-public class JavaTask
- extends AbstractTask
-{
- private final ExecuteJava m_exec = new ExecuteJava();
-
- /**
- * Set the class name.
- */
- public void setClassname( final String className )
- {
- m_exec.setClassName( className );
- }
-
- /**
- * Add a classpath element.
- */
- public void addClasspath( final Path classpath )
- throws TaskException
- {
- m_exec.getClassPath().add( classpath );
- }
-
- /**
- * The working directory of the process
- *
- * @param dir The new Dir value
- */
- public void setDir( final File dir )
- {
- m_exec.setWorkingDirectory( dir );
- }
-
- /**
- * Set the forking flag.
- */
- public void setFork( final boolean fork )
- {
- m_exec.setFork( fork );
- }
-
- /**
- * Set the jar name.
- */
- public void setJar( final File jar )
- {
- m_exec.setJar( jar );
- }
-
- /**
- * Set the command used to start the VM (only if fork==true).
- */
- public void setJvm( final String jvm )
- {
- m_exec.setJvm( jvm );
- }
-
- /**
- * -mx or -Xmx depending on VM version
- */
- public void setMaxmemory( final String max )
- {
- m_exec.setMaxMemory( max );
- }
-
- /**
- * Add a nested sysproperty element.
- */
- public void addSysproperty( final EnvironmentVariable sysp )
- {
- m_exec.getSysProperties().addVariable( sysp );
- }
-
- /**
- * Creates a nested arg element.
- */
- public void addArg( final Argument argument )
- {
- m_exec.getArguments().addArgument( argument );
- }
-
- /**
- * Creates a nested jvmarg element.
- */
- public void addJvmarg( final Argument argument )
- {
- m_exec.getVmArguments().addArgument( argument );
- }
-
- public void execute()
- throws TaskException
- {
- m_exec.execute( getContext() );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/java/JavacAdaptor.java b/proposal/myrmidon/src/java/org/apache/antlib/java/JavacAdaptor.java
deleted file mode 100644
index 890de55b5..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/java/JavacAdaptor.java
+++ /dev/null
@@ -1,114 +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.txt file.
- */
-package org.apache.antlib.java;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.file.FileListUtil;
-import org.apache.myrmidon.framework.file.Path;
-import org.apache.myrmidon.framework.nativelib.ArgumentList;
-
-/**
- * An adaptor for the in-process Javac compiler.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="java-compiler" name="javac"
- */
-public class JavacAdaptor
- extends JavaCompilerAdaptor
-{
-
- /**
- * Compiles as set of files.
- */
- protected void compile( final File[] compileList )
- throws TaskException
- {
- final ArgumentList cmd = new ArgumentList();
- setupModernJavacCommand( cmd, compileList );
-
- final String[] args = cmd.getArguments();
-
- // Use reflection to be able to build on all JDKs >= 1.2:
- final Class compilerClass;
- try
- {
- compilerClass = Class.forName( "com.sun.tools.javac.Main" );
- }
- catch( ClassNotFoundException exc )
- {
- throw new TaskException( "Could not find the javac compiler.", exc );
- }
-
- try
- {
- final Object compiler = compilerClass.newInstance();
- final Class[] paramTypes = new Class[] { args.getClass() };
- final Method compile = compilerClass.getMethod( "compile", paramTypes );
- final Object[] params = new Object[]{ args };
- final Integer result = (Integer)compile.invoke( compiler, params );
- if( result.intValue() != 0 )
- {
- throw new TaskException( "Javac finished with non-zero return code." );
- }
- }
- catch( final TaskException exc )
- {
- throw exc;
- }
- catch( final Exception exc )
- {
- throw new TaskException( "Could not start javac compiler", exc );
- }
- }
-
- /**
- * Builds the command-line to invoke the compiler with.
- */
- private void setupModernJavacCommand( final ArgumentList cmd,
- final File[] files )
- throws TaskException
- {
- // Build the classpath
- Path classpath = new Path();
-
- classpath.addLocation( getDestDir() );
- classpath.add( getClassPath() );
-
- cmd.addArgument( "-classpath" );
- cmd.addArgument( FileListUtil.formatPath( classpath, getContext() ) );
-
- if( isDeprecation() )
- {
- cmd.addArgument( "-deprecation" );
- }
-
- cmd.addArgument( "-d" );
- cmd.addArgument( getDestDir() );
-
-
- if( isDebug() )
- {
- cmd.addArgument( "-g" );
- }
- else
- {
- cmd.addArgument( "-g:none" );
- }
-
- // Add the files to compile
- for( int i = 0; i < files.length; i++ )
- {
- final File file = files[i ];
- cmd.addArgument( file );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/java/JavacTask.java b/proposal/myrmidon/src/java/org/apache/antlib/java/JavacTask.java
deleted file mode 100644
index 7a9fb9e1f..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/java/JavacTask.java
+++ /dev/null
@@ -1,54 +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.txt file.
- */
-package org.apache.antlib.java;
-
-import org.apache.myrmidon.framework.AbstractFacadeTask;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A task that compiles Java source files.
- *
- * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a>
- * @author Robin Green <a href="mailto:greenrd@hotmail.com">greenrd@hotmail.com</a>
- * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
- * @author <a href="mailto:jayglanville@home.com">J D Glanville</a>
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.task name="javac"
- */
-public class JavacTask
- extends AbstractFacadeTask
-{
- public JavacTask()
- {
- super( "compiler", JavaCompilerAdaptor.class, "javac" );
- }
-
- /**
- * Execute this task.
- */
- public void execute()
- throws TaskException
- {
- getContext().verbose( "Using " + getImplementation() + " compiler." );
- final JavaCompilerAdaptor adaptor = (JavaCompilerAdaptor)prepareFacade();
- adaptor.execute();
- }
-
- /**
- * Create the instance of the facade.
- */
- protected Object createFacade()
- throws TaskException
- {
- JavaCompilerAdaptor adaptor = (JavaCompilerAdaptor)super.createFacade();
- adaptor.setContext( getContext() );
- return adaptor;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/java/JikesAdaptor.java b/proposal/myrmidon/src/java/org/apache/antlib/java/JikesAdaptor.java
deleted file mode 100644
index 8d2c5701f..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/java/JikesAdaptor.java
+++ /dev/null
@@ -1,82 +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.txt file.
- */
-package org.apache.antlib.java;
-
-import java.io.File;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.nativelib.Execute;
-import org.apache.myrmidon.framework.java.JavaRuntimeClassPath;
-import org.apache.myrmidon.framework.file.Path;
-import org.apache.myrmidon.framework.file.FileListUtil;
-
-/**
- * An adaptor for the jikes compiler.
- *
- * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a>
- * @author Robin Green <a href="mailto:greenrd@hotmail.com">greenrd@hotmail.com
- * </a>
- * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
- * @author <a href="mailto:jayglanville@home.com">J D Glanville</a>
- * @author skanthak@muehlheim.de
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="java-compiler" name="jikes"
- */
-public class JikesAdaptor
- extends ExternalCompilerAdaptor
-{
- /**
- * Builds the command-line to execute the compiler.
- */
- protected void buildCommandLine( final Execute exe, final File tempFile )
- throws TaskException
- {
- final Path classpath = new Path();
-
- // Add the destination directory
- classpath.addLocation( getDestDir() );
-
- // Add the compile classpath
- classpath.add( getClassPath() );
-
- // If the user has set JIKESPATH we should add the contents as well
- String jikesPath = System.getProperty( "jikes.class.path" );
- if( jikesPath != null )
- {
- classpath.add( jikesPath );
- }
-
- // Add the runtime
- classpath.add( new JavaRuntimeClassPath() );
-
- // Build the command line
- exe.setExecutable( "jikes" );
-
- if( isDeprecation() )
- {
- exe.addArgument( "-deprecation" );
- }
-
- if( isDebug() )
- {
- exe.addArgument( "-g" );
- }
-
- exe.addArgument( "-d" );
- exe.addArgument( getDestDir() );
-
- exe.addArgument( "-classpath" );
- exe.addArgument( FileListUtil.formatPath( classpath, getContext() ) );
-
- // TODO - make this configurable
- exe.addArgument( "+E" );
-
- exe.addArgument( "@" + tempFile.getAbsolutePath() );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/nativelib/Exec.java b/proposal/myrmidon/src/java/org/apache/antlib/nativelib/Exec.java
deleted file mode 100644
index 507e359fc..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/nativelib/Exec.java
+++ /dev/null
@@ -1,112 +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.txt file.
- */
-package org.apache.antlib.nativelib;
-
-import java.io.File;
-import java.util.Properties;
-import org.apache.aut.nativelib.Os;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.nativelib.Execute;
-import org.apache.myrmidon.framework.nativelib.Argument;
-import org.apache.myrmidon.framework.nativelib.EnvironmentData;
-import org.apache.myrmidon.framework.nativelib.EnvironmentVariable;
-
-/**
- * Executes a native command.
- *
- * @author <a href="mailto:duncan@x180.com">JDD</a>
- * @author <a href="mailto:rubys@us.ibm.com">Sam Ruby</a>
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
- * @author <a href="mailto:mariusz@rakiura.org">Mariusz Nowostawski</a>
- * @author <a href="mailto:thomas.haas@softwired-inc.com">Thomas Haas</a>
- * @ant.task name="exec"
- */
-public class Exec
- extends AbstractTask
-{
- private final Execute m_exe = new Execute();
- private final EnvironmentData m_env = new EnvironmentData();
- private String m_os;
-
- /**
- * The working directory of the process
- */
- public void setDir( final File dir )
- throws TaskException
- {
- m_exe.setWorkingDirectory( dir );
- }
-
- /**
- * The command to execute.
- */
- public void setExecutable( final String value )
- throws TaskException
- {
- m_exe.setExecutable( value );
- }
-
- /**
- * Use a completely new environment
- */
- public void setNewenvironment( final boolean newEnvironment )
- {
- m_exe.setNewenvironment( newEnvironment );
- }
-
- /**
- * Only execute the process if running on the specified OS family.
- */
- public void setOs( final String os )
- {
- m_os = os;
- }
-
- /**
- * Timeout in milliseconds after which the process will be killed.
- */
- public void setTimeout( final long timeout )
- {
- m_exe.setTimeout( timeout );
- }
-
- /**
- * Add a nested env element - an environment variable.
- */
- public void addEnv( final EnvironmentVariable var )
- {
- m_env.addVariable( var );
- }
-
- /**
- * Add a nested arg element - a command line argument.
- */
- public void addArg( final Argument argument )
- {
- m_exe.addArgument( argument );
- }
-
- public void execute()
- throws TaskException
- {
- if( null != m_os && Os.isFamily( m_os ) )
- {
- return;
- }
-
- // Setup environment vars
- final Properties environment = m_env.getVariables();
- m_exe.setEnvironment( environment );
-
- // execute the command
- m_exe.execute( getContext() );
- }
-
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/nativelib/LoadEnvironment.java b/proposal/myrmidon/src/java/org/apache/antlib/nativelib/LoadEnvironment.java
deleted file mode 100644
index 177137609..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/nativelib/LoadEnvironment.java
+++ /dev/null
@@ -1,99 +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.txt file.
- */
-package org.apache.antlib.nativelib;
-
-import java.util.Iterator;
-import java.util.Properties;
-import org.apache.aut.nativelib.ExecException;
-import org.apache.aut.nativelib.ExecManager;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * This task is responsible for loading that OS-specific environment
- * variables and adding them as propertys to the context with a specified
- * prefix.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @ant.task name="load-environment"
- */
-public class LoadEnvironment
- extends AbstractTask
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( LoadEnvironment.class );
-
- private String m_prefix;
-
- public void setPrefix( final String prefix )
- {
- m_prefix = prefix;
- }
-
- public void execute()
- throws TaskException
- {
- if( null == m_prefix )
- {
- final String message = REZ.getString( "loadenv.no-prefix.error" );
- throw new TaskException( message );
- }
-
- //Make sure prefix ends with a '.'
- if( !m_prefix.endsWith( "." ) )
- {
- m_prefix += ".";
- }
-
- if( getContext().isDebugEnabled() )
- {
- final String displayPrefix =
- m_prefix.substring( 0, m_prefix.length() - 1 );
- final String message =
- REZ.getString( "loadenv.prefix.notice", displayPrefix );
- getContext().debug( message );
- }
-
- final Properties environment = loadNativeEnvironment();
- final Iterator keys = environment.keySet().iterator();
- while( keys.hasNext() )
- {
- final String key = (String)keys.next();
- final String value = environment.getProperty( key );
-
- if( value.equals( "" ) )
- {
- final String message = REZ.getString( "loadenv.ignoring-empty.warn", key );
- getContext().warn( message );
- }
- else
- {
- getContext().setProperty( m_prefix + key, value );
- }
- }
- }
-
- /**
- * Utility method to load the native environment variables.
- */
- private Properties loadNativeEnvironment()
- throws TaskException
- {
- try
- {
- final ExecManager manager = (ExecManager)getService( ExecManager.class );
- return manager.getNativeEnvironment();
- }
- catch( final ExecException ee )
- {
- throw new TaskException( ee.getMessage(), ee );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/nativelib/OsCondition.java b/proposal/myrmidon/src/java/org/apache/antlib/nativelib/OsCondition.java
deleted file mode 100644
index bfcd56766..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/nativelib/OsCondition.java
+++ /dev/null
@@ -1,79 +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.txt file.
- */
-package org.apache.antlib.nativelib;
-
-import org.apache.aut.nativelib.Os;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.conditions.Condition;
-
-/**
- * Condition to check the current OS.</p>
- *
- * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
- * @version $Revision$
- *
- * @ant.type type="condition" name="os"
- */
-public class OsCondition
- implements Condition
-{
- private String m_family;
- private String m_name;
- private String m_version;
- private String m_arch;
-
- /**
- * Sets the desired OS family type
- *
- * @param family The OS family type desired.
- */
- public void setFamily( final String family )
- {
- m_family = family;
- }
-
- /**
- * Sets the desired OS name
- *
- * @param name The OS name
- */
- public void setName( final String name )
- {
- m_name = name;
- }
-
- /**
- * Sets the desired OS architecture
- *
- * @param arch The OS architecture
- */
- public void setArch( final String arch )
- {
- m_arch = arch;
- }
-
- /**
- * Sets the desired OS version
- *
- * @param version The OS version
- */
- public void setVersion( final String version )
- {
- m_version = version;
- }
-
- /**
- * Evaluates this condition.
- */
- public boolean evaluate( final TaskContext context )
- throws TaskException
- {
- return Os.isOs( m_family, m_name, m_arch, m_version );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/nativelib/Resources.properties b/proposal/myrmidon/src/java/org/apache/antlib/nativelib/Resources.properties
deleted file mode 100644
index 86749caaa..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/nativelib/Resources.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-loadenv.no-prefix.error=No prefix specified for environment data.
-loadenv.prefix.notice=Loading Environment with prefix {0}.
-loadenv.ignoring-empty.warn=Key {0} in native OS environment is empty - ignoring key.
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/runtime/ConverterDef.java b/proposal/myrmidon/src/java/org/apache/antlib/runtime/ConverterDef.java
deleted file mode 100644
index f3a95422c..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/runtime/ConverterDef.java
+++ /dev/null
@@ -1,46 +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.txt file.
- */
-package org.apache.antlib.runtime;
-
-import org.apache.myrmidon.framework.AbstractTypeDef;
-import org.apache.myrmidon.interfaces.deployer.ConverterDefinition;
-import org.apache.myrmidon.interfaces.deployer.TypeDefinition;
-
-/**
- * Task to define a converter.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @ant.task name="converter-def"
- */
-public class ConverterDef
- extends AbstractTypeDef
-{
- private String m_sourceType;
- private String m_destinationType;
-
- /**
- * Sets the converter's source type.
- */
- public void setSourceType( final String sourceType )
- {
- m_sourceType = sourceType;
- }
-
- /**
- * Sets the converter's destination type.
- */
- public void setDestinationType( final String destinationType )
- {
- m_destinationType = destinationType;
- }
-
- protected TypeDefinition createTypeDefinition()
- {
- return new ConverterDefinition( getClassname(), m_sourceType, m_destinationType );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/runtime/Facility.java b/proposal/myrmidon/src/java/org/apache/antlib/runtime/Facility.java
deleted file mode 100644
index fbb1dc124..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/runtime/Facility.java
+++ /dev/null
@@ -1,89 +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.txt file.
- */
-package org.apache.antlib.runtime;
-
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.aspects.AspectHandler;
-import org.apache.myrmidon.framework.AbstractContainerTask;
-import org.apache.myrmidon.interfaces.aspect.AspectManager;
-
-/**
- * Task that definesMethod to register a single converter.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @ant.task name="facility"
- */
-public class Facility
- extends AbstractContainerTask
- implements Configurable
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( Facility.class );
-
- private String m_namespace;
- private AspectHandler m_aspectHandler;
-
- public void configure( final Configuration configuration )
- throws ConfigurationException
- {
- final String[] attributes = configuration.getAttributeNames();
- for( int i = 0; i < attributes.length; i++ )
- {
- final String name = attributes[ i ];
- final String value = configuration.getAttribute( name );
- configureAttribute( this, name, value );
- }
-
- final Configuration[] children = configuration.getChildren();
-
- if( 1 == children.length )
- {
- final String typeName = children[ 0 ].getName();
- try
- {
- m_aspectHandler = (AspectHandler)newInstance( AspectHandler.ROLE, typeName );
- }
- catch( final Exception e )
- {
- final String message =
- REZ.getString( "facility.no-create.error", typeName );
- throw new ConfigurationException( message, e );
- }
-
- configureElement( m_aspectHandler, children[ 0 ] );
- }
- else
- {
- final String message = REZ.getString( "facility.multi-element.error" );
- throw new ConfigurationException( message );
- }
- }
-
- public void setNamespace( final String namespace )
- {
- m_namespace = namespace;
- }
-
- public void execute()
- throws TaskException
- {
- if( null == m_namespace )
- {
- final String message = REZ.getString( "facility.no-namespace.error" );
- throw new TaskException( message );
- }
-
- final AspectManager aspectManager = (AspectManager)getService( AspectManager.class );
- aspectManager.addAspectHandler( m_namespace, m_aspectHandler );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/runtime/Import.java b/proposal/myrmidon/src/java/org/apache/antlib/runtime/Import.java
deleted file mode 100644
index 0bd382916..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/runtime/Import.java
+++ /dev/null
@@ -1,59 +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.txt file.
- */
-package org.apache.antlib.runtime;
-
-import java.io.File;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.interfaces.deployer.Deployer;
-import org.apache.myrmidon.interfaces.deployer.DeploymentException;
-import org.apache.myrmidon.interfaces.deployer.TypeDeployer;
-
-/**
- * Task to import a tasklib.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @ant.task name="import"
- */
-public class Import
- extends AbstractTask
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( Import.class );
-
- private File m_lib;
-
- public void setLib( final File lib )
- {
- m_lib = lib;
- }
-
- public void execute()
- throws TaskException
- {
- if( null == m_lib )
- {
- final String message = REZ.getString( "import.no-lib.error" );
- throw new TaskException( message );
- }
-
- try
- {
- final Deployer deployer = (Deployer)getService( Deployer.class );
- final TypeDeployer typeDeployer = deployer.createDeployer( m_lib );
- typeDeployer.deployAll();
- }
- catch( final DeploymentException de )
- {
- final String message = REZ.getString( "import.no-deploy.error" );
- throw new TaskException( message, de );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/runtime/Resources.properties b/proposal/myrmidon/src/java/org/apache/antlib/runtime/Resources.properties
deleted file mode 100644
index b32f44b68..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/runtime/Resources.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-facility.no-create.error=Failed to create aspect handler of type {0}.
-facility.multi-element.error=Expected one sub-element to configure facility.
-facility.no-namespace.error=Must specify namespace parameter.
-
-import.no-lib.error=Must specify lib parameter.
-import.no-deploy.error=Error importing tasklib.
-
-typeavailable.no-type-name.error=No type name was specified.
-typeavailable.unknown-role.error=Unknown role "{0}".
-typeavailable.evaluate.error=Could not determine if type "{0}" is available.
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeAvailableCondition.java b/proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeAvailableCondition.java
deleted file mode 100644
index ee3ab6677..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeAvailableCondition.java
+++ /dev/null
@@ -1,102 +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.txt file.
- */
-package org.apache.antlib.runtime;
-
-import org.apache.myrmidon.framework.conditions.Condition;
-import org.apache.myrmidon.framework.DataType;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.interfaces.role.RoleManager;
-import org.apache.myrmidon.interfaces.role.RoleInfo;
-import org.apache.myrmidon.interfaces.type.TypeManager;
-import org.apache.myrmidon.interfaces.type.TypeFactory;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-
-/**
- * A condition that evaluates to true if a particular type is available.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="condition" name="type-available"
- */
-public class TypeAvailableCondition
- implements Condition
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( TypeAvailableCondition.class );
-
- private String m_roleShorthand;
- private String m_name;
-
- /**
- * Sets the role to search for.
- */
- public void setType( final String type )
- {
- m_roleShorthand = type;
- }
-
- /**
- * Sets the type to search for.
- */
- public void setName( final String name )
- {
- m_name = name;
- }
-
- /**
- * Evaluates this condition.
- *
- * @param context
- * The context to evaluate the condition in.
- */
- public boolean evaluate( final TaskContext context )
- throws TaskException
- {
- if( m_name == null )
- {
- final String message = REZ.getString( "typeavailable.no-type-name.error" );
- throw new TaskException( message );
- }
-
- try
- {
- // Map the shorthand name to a role
- final String roleName;
- if( m_roleShorthand != null )
- {
- final RoleManager roleManager = (RoleManager)context.getService( RoleManager.class );
- final RoleInfo roleInfo = roleManager.getRoleByShorthandName( m_roleShorthand );
- if( roleInfo == null )
- {
- final String message = REZ.getString( "typeavailable.unknown-role.error", m_roleShorthand );
- throw new TaskException( message );
- }
- roleName = roleInfo.getName();
- }
- else
- {
- roleName = DataType.ROLE;
- }
-
- // Lookup the type
- final TypeManager typeManager = (TypeManager)context.getService( TypeManager.class );
- final TypeFactory typeFactory = typeManager.getFactory( roleName );
-
- // Check if the type is available
- return typeFactory.canCreate( m_name );
- }
- catch( final Exception e )
- {
- final String message = REZ.getString( "typeavailable.evaluate.error", m_name );
- throw new TaskException( message, e );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeDef.java b/proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeDef.java
deleted file mode 100644
index e06a79af3..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeDef.java
+++ /dev/null
@@ -1,41 +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.txt file.
- */
-package org.apache.antlib.runtime;
-
-import org.apache.myrmidon.framework.AbstractTypeDef;
-import org.apache.myrmidon.interfaces.deployer.TypeDefinition;
-
-/**
- * Task to define a type.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @ant.task name="type-def"
- */
-public class TypeDef
- extends AbstractTypeDef
-{
- private String m_role;
-
- public void setName( final String name )
- {
- super.setName( name );
- }
-
- /**
- * Sets the type's role.
- */
- public void setRole( final String role )
- {
- m_role = role;
- }
-
- protected TypeDefinition createTypeDefinition()
- {
- return new TypeDefinition( getName(), m_role, getClassname() );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/security/DistinguishedName.java b/proposal/myrmidon/src/java/org/apache/antlib/security/DistinguishedName.java
deleted file mode 100644
index f521ae6ae..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/security/DistinguishedName.java
+++ /dev/null
@@ -1,75 +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.txt file.
- */
-package org.apache.antlib.security;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-public class DistinguishedName
-{
- private ArrayList m_params = new ArrayList();
-
- public Iterator getParams()
- {
- return m_params.iterator();
- }
-
- public Object createParam()
- {
- final DnameParam param = new DnameParam();
- m_params.add( param );
- return param;
- }
-
- private String encode( final String string )
- {
- int end = string.indexOf( ',' );
- if( -1 == end )
- {
- return string;
- }
-
- final StringBuffer sb = new StringBuffer();
-
- int start = 0;
- while( -1 != end )
- {
- sb.append( string.substring( start, end ) );
- sb.append( "\\," );
- start = end + 1;
- end = string.indexOf( ',', start );
- }
-
- sb.append( string.substring( start ) );
-
- return sb.toString();
- }
-
- public String toString()
- {
- final int size = m_params.size();
- final StringBuffer sb = new StringBuffer();
- boolean firstPass = true;
-
- for( int i = 0; i < size; i++ )
- {
- if( !firstPass )
- {
- sb.append( " ," );
- }
- firstPass = false;
-
- final DnameParam param = (DnameParam)m_params.get( i );
- sb.append( encode( param.getName() ) );
- sb.append( '=' );
- sb.append( encode( param.getValue() ) );
- }
-
- return sb.toString();
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/security/DnameParam.java b/proposal/myrmidon/src/java/org/apache/antlib/security/DnameParam.java
deleted file mode 100644
index a6567f767..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/security/DnameParam.java
+++ /dev/null
@@ -1,34 +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.txt file.
- */
-package org.apache.antlib.security;
-
-public final class DnameParam
-{
- private String m_name;
- private String m_value;
-
- public void setName( final String name )
- {
- m_name = name;
- }
-
- public void setValue( final String value )
- {
- m_value = value;
- }
-
- protected String getName()
- {
- return m_name;
- }
-
- protected String getValue()
- {
- return m_value;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/security/GenerateKey.java b/proposal/myrmidon/src/java/org/apache/antlib/security/GenerateKey.java
deleted file mode 100644
index ec64c1072..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/security/GenerateKey.java
+++ /dev/null
@@ -1,236 +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.txt file.
- */
-package org.apache.antlib.security;
-
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.nativelib.Execute;
-import org.apache.myrmidon.framework.nativelib.Commandline;
-
-/**
- * Generates a key.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @ant.task name="generate-key"
- */
-public class GenerateKey
- extends AbstractTask
-{
- /**
- * The alias of signer.
- */
- private String m_alias;
- private String m_dname;
- private DistinguishedName m_expandedDname;
- private String m_keyalg;
- private String m_keypass;
- private int m_keysize;
-
- /**
- * The name of keystore file.
- */
- private String m_keystore;
-
- private String m_sigalg;
- private String m_storepass;
- private String m_storetype;
- private int m_validity;
- private boolean m_verbose;
-
- public void setAlias( final String alias )
- {
- m_alias = alias;
- }
-
- public void setDname( final String dname )
- throws TaskException
- {
- m_dname = dname;
- }
-
- public void setKeyalg( final String keyalg )
- {
- m_keyalg = keyalg;
- }
-
- public void setKeypass( final String keypass )
- {
- m_keypass = keypass;
- }
-
- public void setKeysize( final int keysize )
- {
- m_keysize = keysize;
- }
-
- public void setKeystore( final String keystore )
- {
- m_keystore = keystore;
- }
-
- public void setSigalg( final String sigalg )
- {
- m_sigalg = sigalg;
- }
-
- public void setStorepass( final String storepass )
- {
- m_storepass = storepass;
- }
-
- public void setStoretype( final String storetype )
- {
- m_storetype = storetype;
- }
-
- public void setValidity( final int validity )
- throws TaskException
- {
- m_validity = validity;
- }
-
- public void setVerbose( final boolean verbose )
- {
- m_verbose = verbose;
- }
-
- public void addDname( final DistinguishedName distinguishedName )
- throws TaskException
- {
- if( null != m_expandedDname )
- {
- final String message = "DName sub-element can only be specified once.";
- throw new TaskException( message );
- }
- m_expandedDname = distinguishedName;
- }
-
- public void execute()
- throws TaskException
- {
- validate();
-
- final String message = "Generating Key for " + m_alias;
- getContext().info( message );
-
- final Execute exe = createCommand();
- exe.execute( getContext() );
- }
-
- private Execute createCommand()
- {
- final Execute cmd = new Execute();
- cmd.setExecutable( "keytool" );
-
- cmd.addArgument( "-genkey " );
-
- if( m_verbose )
- {
- cmd.addArgument( "-v " );
- }
-
- cmd.addArgument( "-alias" );
- cmd.addArgument( m_alias );
-
- if( null != m_dname )
- {
- cmd.addArgument( "-dname" );
- cmd.addArgument( m_dname );
- }
-
- if( null != m_expandedDname )
- {
- cmd.addArgument( "-dname" );
- cmd.addArgument( m_expandedDname.toString() );
- }
-
- if( null != m_keystore )
- {
- cmd.addArgument( "-keystore" );
- cmd.addArgument( m_keystore );
- }
-
- if( null != m_storepass )
- {
- cmd.addArgument( "-storepass" );
- cmd.addArgument( m_storepass );
- }
-
- if( null != m_storetype )
- {
- cmd.addArgument( "-storetype" );
- cmd.addArgument( m_storetype );
- }
-
- cmd.addArgument( "-keypass" );
- if( null != m_keypass )
- {
- cmd.addArgument( m_keypass );
- }
- else
- {
- cmd.addArgument( m_storepass );
- }
-
- if( null != m_sigalg )
- {
- cmd.addArgument( "-sigalg" );
- cmd.addArgument( m_sigalg );
- }
-
- if( null != m_keyalg )
- {
- cmd.addArgument( "-keyalg" );
- cmd.addArgument( m_keyalg );
- }
-
- if( 0 < m_keysize )
- {
- cmd.addArgument( "-keysize" );
- cmd.addArgument( "" + m_keysize );
- }
-
- if( 0 < m_validity )
- {
- cmd.addArgument( "-validity" );
- cmd.addArgument( "" + m_validity );
- }
-
- return cmd;
- }
-
- private void validate()
- throws TaskException
- {
- if( null == m_alias )
- {
- final String message = "alias attribute must be set";
- throw new TaskException( message );
- }
-
- if( null == m_storepass )
- {
- final String message = "storepass attribute must be set";
- throw new TaskException( message );
- }
-
- if( null == m_dname && null == m_expandedDname )
- {
- final String message = "dname must be set";
- throw new TaskException( message );
- }
- else if( null != m_expandedDname && null != m_dname )
- {
- final String message = "It is not possible to specify dname both " +
- "as attribute and element.";
- throw new TaskException( message );
- }
-
- }
-}
-
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/security/SignJar.java b/proposal/myrmidon/src/java/org/apache/antlib/security/SignJar.java
deleted file mode 100644
index 61fa01057..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/security/SignJar.java
+++ /dev/null
@@ -1,363 +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.txt file.
- */
-package org.apache.antlib.security;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.nativelib.Execute;
-import org.apache.myrmidon.framework.FileSet;
-import org.apache.tools.todo.types.DirectoryScanner;
-import org.apache.tools.todo.types.ScannerUtil;
-
-/**
- * Sign a archive.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @author <a href="mailto:nick@ox.compsoc.net">Nick Fortescue</a>
- * @ant.task name="sign-jar"
- */
-public class SignJar
- extends AbstractTask
-{
- /**
- * the filesets of the jars to sign
- */
- private ArrayList m_filesets = new ArrayList();
-
- /**
- * The alias of signer.
- */
- private String m_alias;
- private boolean m_internalsf;
-
- /**
- * The name of the jar file.
- */
- private File m_jar;
- private String m_keypass;
-
- /**
- * The name of keystore file.
- */
- private File m_keystore;
-
- /**
- * Whether to assume a jar which has an appropriate .SF file in is already
- * signed.
- */
- private boolean m_lazy;
-
- private boolean m_sectionsonly;
- private File m_sigfile;
- private File m_signedjar;
-
- private String m_storepass;
- private String m_storetype;
- private boolean m_verbose;
-
- public void setAlias( final String alias )
- {
- m_alias = alias;
- }
-
- public void setInternalsf( final boolean internalsf )
- {
- m_internalsf = internalsf;
- }
-
- public void setJar( final File jar )
- {
- m_jar = jar;
- }
-
- public void setKeypass( final String keypass )
- {
- m_keypass = keypass;
- }
-
- public void setKeystore( final File keystore )
- {
- m_keystore = keystore;
- }
-
- public void setLazy( final boolean lazy )
- {
- m_lazy = lazy;
- }
-
- public void setSectionsonly( final boolean sectionsonly )
- {
- m_sectionsonly = sectionsonly;
- }
-
- public void setSigfile( final File sigfile )
- {
- m_sigfile = sigfile;
- }
-
- public void setSignedjar( final File signedjar )
- {
- m_signedjar = signedjar;
- }
-
- public void setStorepass( final String storepass )
- {
- m_storepass = storepass;
- }
-
- public void setStoretype( final String storetype )
- {
- m_storetype = storetype;
- }
-
- public void setVerbose( final boolean verbose )
- {
- m_verbose = verbose;
- }
-
- /**
- * Adds a set of files (nested fileset attribute).
- *
- * @param set The feature to be added to the Fileset attribute
- */
- public void addFileset( final FileSet set )
- {
- m_filesets.add( set );
- }
-
- public void execute()
- throws TaskException
- {
- validate();
-
- if( null != m_jar )
- {
- doOneJar( m_jar, m_signedjar );
- }
- else
- {
- //Assume null != filesets
-
- // deal with the filesets
- final int size = m_filesets.size();
- for( int i = 0; i < size; i++ )
- {
- final FileSet fileSet = (FileSet)m_filesets.get( i );
- final DirectoryScanner scanner = ScannerUtil.getDirectoryScanner( fileSet );
- final String[] jarFiles = scanner.getIncludedFiles();
- for( int j = 0; j < jarFiles.length; j++ )
- {
- final File file =
- new File( fileSet.getDir(), jarFiles[ j ] );
- doOneJar( file, null );
- }
- }
- }
- }
-
- private void validate() throws TaskException
- {
- if( null == m_jar && null == m_filesets )
- {
- final String message = "jar must be set through jar attribute or nested filesets";
- throw new TaskException( message );
- }
- else if( null != m_jar )
- {
- if( null == m_alias )
- {
- final String message = "alias attribute must be set";
- throw new TaskException( message );
- }
-
- if( null == m_storepass )
- {
- final String message = "storepass attribute must be set";
- throw new TaskException( message );
- }
- }
- }
-
- private boolean isSigned( final File file )
- {
- final String SIG_START = "META-INF/";
- final String SIG_END = ".SF";
-
- if( !file.exists() )
- {
- return false;
- }
- ZipFile jarFile = null;
- try
- {
- jarFile = new ZipFile( file );
- if( null == m_alias )
- {
- final Enumeration entries = jarFile.entries();
- while( entries.hasMoreElements() )
- {
- final ZipEntry entry = (ZipEntry)entries.nextElement();
- final String name = entry.getName();
- if( name.startsWith( SIG_START ) && name.endsWith( SIG_END ) )
- {
- return true;
- }
- }
- return false;
- }
- else
- {
- final String name = SIG_START + m_alias.toUpperCase() + SIG_END;
- final ZipEntry entry = jarFile.getEntry( name );
- return ( entry != null );
- }
- }
- catch( final IOException ioe )
- {
- return false;
- }
- finally
- {
- if( null != jarFile )
- {
- try
- {
- jarFile.close();
- }
- catch( final IOException ioe )
- {
- }
- }
- }
- }
-
- private boolean isUpToDate( final File jarFile, final File signedjarFile )
- {
- if( null == jarFile )
- {
- return false;
- }
- else if( null != signedjarFile )
- {
- if( !jarFile.exists() )
- {
- return false;
- }
- else if( !signedjarFile.exists() )
- {
- return false;
- }
- else if( jarFile.equals( signedjarFile ) )
- {
- return false;
- }
- else if( signedjarFile.lastModified() > jarFile.lastModified() )
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- else if( m_lazy )
- {
- return isSigned( jarFile );
- }
- else
- {
- return false;
- }
- }
-
- private void doOneJar( final File jarSource, final File jarTarget )
- throws TaskException
- {
- if( isUpToDate( jarSource, jarTarget ) )
- {
- return;
- }
-
- final String message = "Signing Jar : " + jarSource.getAbsolutePath();
- getContext().info( message );
-
- final Execute exe = buildCommand( jarTarget, jarSource );
- exe.execute( getContext() );
- }
-
- private Execute buildCommand( final File jarTarget,
- final File jarSource )
- {
- final Execute cmd = new Execute();
- cmd.setExecutable( "jarsigner" );
-
- if( null != m_keystore )
- {
- cmd.addArgument( "-keystore" );
- cmd.addArgument( m_keystore );
- }
-
- if( null != m_storepass )
- {
- cmd.addArgument( "-storepass" );
- cmd.addArgument( m_storepass );
- }
-
- if( null != m_storetype )
- {
- cmd.addArgument( "-storetype" );
- cmd.addArgument( m_storetype );
- }
-
- if( null != m_keypass )
- {
- cmd.addArgument( "-keypass" );
- cmd.addArgument( m_keypass );
- }
-
- if( null != m_sigfile )
- {
- cmd.addArgument( "-sigfile" );
- cmd.addArgument( m_sigfile );
- }
-
- if( null != jarTarget )
- {
- cmd.addArgument( "-signedjar" );
- cmd.addArgument( jarTarget );
- }
-
- if( m_verbose )
- {
- cmd.addArgument( "-verbose" );
- }
-
- if( m_internalsf )
- {
- cmd.addArgument( "-internalsf" );
- }
-
- if( m_sectionsonly )
- {
- cmd.addArgument( "-sectionsonly" );
- }
-
- cmd.addArgument( jarSource );
-
- cmd.addArgument( m_alias );
-
- return cmd;
- }
-}
-
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/selftest/ExtensionsTest.java b/proposal/myrmidon/src/java/org/apache/antlib/selftest/ExtensionsTest.java
deleted file mode 100644
index b3738f31d..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/selftest/ExtensionsTest.java
+++ /dev/null
@@ -1,47 +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.txt file.
- */
-package org.apache.antlib.selftest;
-
-import org.apache.antlib.selftest.extension1.ExtensionsLoadedClass;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * This is to test whether extension is loaded.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @ant.task name="extensions-test"
- */
-public class ExtensionsTest
- extends AbstractTask
-{
- public void execute()
- throws TaskException
- {
- ExtensionsLoadedClass.doSomething();
-
- Class clazz = null;
- try
- {
- clazz = Class.forName( "sun.tools.javac.Main" );
- }
- catch( ClassNotFoundException e )
- {
- try
- {
- clazz = Class.forName( "com.sun.tools.javac.Main" );
- }
- catch( ClassNotFoundException e1 )
- {
- throw new TaskException( "Unable to locate compilers from tools.jar" );
- }
- }
-
- System.out.println( "Compiler loaded from tools.jar = " + clazz );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/selftest/PrimitiveTypesTest.java b/proposal/myrmidon/src/java/org/apache/antlib/selftest/PrimitiveTypesTest.java
deleted file mode 100644
index 0484fe8ff..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/selftest/PrimitiveTypesTest.java
+++ /dev/null
@@ -1,91 +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.txt file.
- */
-package org.apache.antlib.selftest;
-
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * Test conversion of all the primitive types.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @ant.task name="prim-test"
- */
-public class PrimitiveTypesTest
- extends AbstractTask
-{
- public void setInteger( final Integer value )
- {
- getContext().info( "setInteger( " + value + " );" );
- }
-
- public void setInteger2( final int value )
- {
- getContext().info( "setInteger2( " + value + " );" );
- }
-
- public void setShort( final Short value )
- {
- getContext().info( "setShort( " + value + " );" );
- }
-
- public void setShort2( final short value )
- {
- getContext().info( "setShort2( " + value + " );" );
- }
-
- public void setByte( final Byte value )
- {
- getContext().info( "setByte( " + value + " );" );
- }
-
- public void setByte2( final byte value )
- {
- getContext().info( "setByte2( " + value + " );" );
- }
-
- public void setLong( final Long value )
- {
- getContext().info( "setLong( " + value + " );" );
- }
-
- public void setLong2( final long value )
- {
- getContext().info( "setLong2( " + value + " );" );
- }
-
- public void setFloat( final Float value )
- {
- getContext().info( "setFloat( " + value + " );" );
- }
-
- public void setFloat2( final float value )
- {
- getContext().info( "setFloat2( " + value + " );" );
- }
-
- public void setDouble( final Double value )
- {
- getContext().info( "setDouble( " + value + " );" );
- }
-
- public void setDouble2( final double value )
- {
- getContext().info( "setDouble2( " + value + " );" );
- }
-
- public void setString( final String value )
- {
- getContext().info( "setString( " + value + " );" );
- }
-
- public void execute()
- throws TaskException
- {
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/selftest/extension1/ExtensionsLoadedClass.java b/proposal/myrmidon/src/java/org/apache/antlib/selftest/extension1/ExtensionsLoadedClass.java
deleted file mode 100644
index e8f231b5f..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/selftest/extension1/ExtensionsLoadedClass.java
+++ /dev/null
@@ -1,21 +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.txt file.
- */
-package org.apache.antlib.selftest.extension1;
-
-/**
- * This is to test whether extension is loaded.
- *
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- */
-public class ExtensionsLoadedClass
-{
- public static void doSomething()
- {
- System.out.println( "This was loaded via an extension - yea!" );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/sound/AntSoundPlayer.java b/proposal/myrmidon/src/java/org/apache/antlib/sound/AntSoundPlayer.java
deleted file mode 100644
index ccbd371c5..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/sound/AntSoundPlayer.java
+++ /dev/null
@@ -1,237 +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.txt file.
- */
-package org.apache.antlib.sound;
-
-import java.io.File;
-import java.io.IOException;
-import javax.sound.sampled.AudioFormat;
-import javax.sound.sampled.AudioInputStream;
-import javax.sound.sampled.AudioSystem;
-import javax.sound.sampled.Clip;
-import javax.sound.sampled.DataLine;
-import javax.sound.sampled.Line;
-import javax.sound.sampled.LineEvent;
-import javax.sound.sampled.LineListener;
-import javax.sound.sampled.LineUnavailableException;
-import javax.sound.sampled.UnsupportedAudioFileException;
-import org.apache.avalon.framework.logger.LogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.myrmidon.listeners.AbstractProjectListener;
-import org.apache.myrmidon.listeners.LogEvent;
-import org.apache.myrmidon.listeners.ProjectEvent;
-
-/**
- * This class is designed to be used by any AntTask that requires audio output.
- * It implements the BuildListener interface to listen for BuildEvents and could
- * be easily extended to provide audio output upon any specific build events
- * occuring. I have only tested this with .WAV and .AIFF sound file formats.
- * Both seem to work fine.
- *
- * @author Nick Pellow
- * @version $Revision$, $Date$
- */
-public class AntSoundPlayer
- extends AbstractProjectListener
- implements LineListener, LogEnabled
-{
- private File m_fileSuccess;
- private int m_loopsSuccess;
- private Long m_durationSuccess;
-
- private File m_fileFail;
- private int m_loopsFail;
- private Long m_durationFail;
-
- private Logger m_logger;
-
- /**
- * Provide component with a logger.
- *
- * @param logger the logger
- */
- public void enableLogging( final Logger logger )
- {
- m_logger = logger;
- }
-
- protected final Logger getLogger()
- {
- return m_logger;
- }
-
- /**
- * Notify listener of projectFinished event.
- */
- public void projectFinished( final ProjectEvent event )
- {
- success();
- }
-
- /**
- * Notify listener of log message event.
- */
- public void log( final LogEvent event )
- {
- if( event.getThrowable() != null )
- {
- failure();
- }
- }
-
- /**
- * @param fileFail The feature to be added to the BuildFailedSound attribute
- * @param loopsFail The feature to be added to the BuildFailedSound
- * attribute
- * @param durationFail The feature to be added to the BuildFailedSound
- * attribute
- */
- public void addBuildFailedSound( File fileFail, int loopsFail, Long durationFail )
- {
- m_fileFail = fileFail;
- m_loopsFail = loopsFail;
- m_durationFail = durationFail;
- }
-
- /**
- * @param loops the number of times the file should be played when the build
- * is successful
- * @param duration the number of milliseconds the file should be played when
- * the build is successful
- * @param file The feature to be added to the BuildSuccessfulSound attribute
- */
- public void addBuildSuccessfulSound( File file, int loops, Long duration )
- {
- m_fileSuccess = file;
- m_loopsSuccess = loops;
- m_durationSuccess = duration;
- }
-
- /**
- * This is implemented to listen for any line events and closes the clip if
- * required.
- */
- public void update( LineEvent event )
- {
- if( event.getType().equals( LineEvent.Type.STOP ) )
- {
- Line line = event.getLine();
- line.close();
- }
- else if( event.getType().equals( LineEvent.Type.CLOSE ) )
- {
- /*
- * There is a bug in JavaSound 0.90 (jdk1.3beta).
- * It prevents correct termination of the VM.
- * So we have to exit ourselves.
- */
- //System.exit(0);
- }
- }
-
- protected void success()
- {
- if( null != m_fileSuccess )
- {
- // build successfull!
- play( m_fileSuccess, m_loopsSuccess, m_durationSuccess );
- }
- }
-
- protected void failure()
- {
- if( null != m_fileFail )
- {
- play( m_fileFail, m_loopsFail, m_durationFail );
- }
- }
-
- /**
- * Plays the file for duration milliseconds or loops.
- */
- private void play( File file, int loops, Long duration )
- {
- Clip audioClip = null;
-
- AudioInputStream audioInputStream = null;
-
- try
- {
- audioInputStream = AudioSystem.getAudioInputStream( file );
- }
- catch( UnsupportedAudioFileException uafe )
- {
- final String message = "Audio format is not yet supported: " + uafe.getMessage();
- getLogger().info( message );
- }
- catch( IOException ioe )
- {
- ioe.printStackTrace();
- }
-
- if( audioInputStream != null )
- {
- AudioFormat format = audioInputStream.getFormat();
- DataLine.Info info = new DataLine.Info( Clip.class, format,
- AudioSystem.NOT_SPECIFIED );
- try
- {
- audioClip = (Clip)AudioSystem.getLine( info );
- audioClip.addLineListener( this );
- audioClip.open( audioInputStream );
- }
- catch( LineUnavailableException e )
- {
- final String message = "The sound device is currently unavailable";
- getLogger().info( message );
- return;
- }
- catch( IOException e )
- {
- e.printStackTrace();
- }
-
- if( duration != null )
- {
- playClip( audioClip, duration.longValue() );
- }
- else
- {
- playClip( audioClip, loops );
- }
- audioClip.drain();
- audioClip.close();
- }
- else
- {
- final String message = "Can't get data from file " + file.getName();
- getLogger().info( message );
- }
- }
-
- private void playClip( Clip clip, int loops )
- {
-
- clip.loop( loops );
- while( clip.isRunning() )
- {
- }
- }
-
- private void playClip( Clip clip, long duration )
- {
- clip.loop( Clip.LOOP_CONTINUOUSLY );
- try
- {
- Thread.sleep( duration );
- }
- catch( InterruptedException e )
- {
- }
- }
-}
-
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/sound/BuildAlert.java b/proposal/myrmidon/src/java/org/apache/antlib/sound/BuildAlert.java
deleted file mode 100644
index 4a11eae86..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/sound/BuildAlert.java
+++ /dev/null
@@ -1,81 +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.txt file.
- */
-package org.apache.antlib.sound;
-
-import java.io.File;
-
-/**
- * A class to be extended by any BuildAlert's that require the output of
- * sound.
- */
-public class BuildAlert
-{
- private File m_source;
- private int m_loops;
- private Long m_duration;
-
- /**
- * Sets the duration in milliseconds the file should be played.
- *
- * @param duration The new Duration value
- */
- public void setDuration( Long duration )
- {
- m_duration = duration;
- }
-
- /**
- * Sets the number of times the source file should be played.
- *
- * @param loops the number of loops to play the source file
- */
- public void setLoops( int loops )
- {
- m_loops = loops;
- }
-
- /**
- * Sets the location of the file to get the audio.
- *
- * @param source the name of a sound-file directory or of the audio file
- */
- public void setSource( final File source )
- {
- m_source = source;
- }
-
- /**
- * Gets the duration in milliseconds the file should be played.
- *
- * @return The Duration value
- */
- public Long getDuration()
- {
- return m_duration;
- }
-
- /**
- * Sets the number of times the source file should be played.
- *
- * @return the number of loops to play the source file
- */
- public int getLoops()
- {
- return m_loops;
- }
-
- /**
- * Gets the location of the file to get the audio.
- *
- * @return The Source value
- */
- public File getSource()
- {
- return m_source;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/sound/Resources.properties b/proposal/myrmidon/src/java/org/apache/antlib/sound/Resources.properties
deleted file mode 100644
index d01821c59..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/sound/Resources.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-sound.missing-success.error=No nested success element found.
-sound.missing-failure.error=No nested failure element found.
-sound.empty.dir.error=No files found in directory {0}.
-sound.invalid-path.error={0}: invalid path. \ No newline at end of file
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/sound/SoundTask.java b/proposal/myrmidon/src/java/org/apache/antlib/sound/SoundTask.java
deleted file mode 100644
index 4492a1352..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/sound/SoundTask.java
+++ /dev/null
@@ -1,134 +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.txt file.
- */
-package org.apache.antlib.sound;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Random;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.interfaces.workspace.Workspace;
-
-/**
- * This is an example of an AntTask that makes of use of the AntSoundPlayer.
- * There are three attributes to be set: <code>source</code>: the location of
- * the audio file to be played <code>duration</code>: play the sound file
- * continuously until "duration" milliseconds has expired <code>loops</code>:
- * the number of times the sound file should be played until stopped I have only
- * tested this with .WAV and .AIFF sound file formats. Both seem to work fine.
- * plans for the future: - use the midi api to define sounds (or drum beat etc)
- * in xml and have Ant play them back
- *
- * @ant.task name="sound-listener"
- * @author Nick Pellow
- * @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @version $Revision$, $Date$
- */
-public class SoundTask
- extends AbstractTask
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( SoundTask.class );
-
- private BuildAlert m_success;
- private BuildAlert m_fail;
-
- public void addFail( final BuildAlert fail )
- {
- m_fail = fail;
- }
-
- public void addSuccess( final BuildAlert success )
- {
- m_success = success;
- }
-
- public void execute()
- throws TaskException
- {
- final AntSoundPlayer soundPlayer = new AntSoundPlayer();
- if( null == m_success )
- {
- final String message = REZ.getString( "sound.missing-success.error" );
- getContext().warn( message );
- }
- else
- {
- final File source = getRandomSource( m_success );
- soundPlayer.addBuildSuccessfulSound( source,
- m_success.getLoops(),
- m_success.getDuration() );
- }
-
- if( null == m_fail )
- {
- final String message = REZ.getString( "sound.missing-failure.error" );
- getContext().warn( message );
- }
- else
- {
- final File source = getRandomSource( m_fail );
- soundPlayer.addBuildFailedSound( source,
- m_fail.getLoops(),
- m_fail.getDuration() );
- }
-
- final Workspace workspace = (Workspace)getContext().getService( Workspace.class );
- workspace.addProjectListener( soundPlayer );
- }
-
- /**
- * Gets the location of the file to get the audio.
- */
- private File getRandomSource( final BuildAlert alert )
- throws TaskException
- {
- final File source = alert.getSource();
- // Check if source is a directory
- if( source.exists() )
- {
- if( source.isDirectory() )
- {
- // get the list of files in the dir
- final String[] entries = source.list();
- final ArrayList files = new ArrayList();
- for( int i = 0; i < entries.length; i++ )
- {
- final File file = new File( source, entries[ i ] );
- if( file.isFile() )
- {
- files.add( file );
- }
- }
- if( files.size() < 1 )
- {
- final String message = REZ.getString( "sound.empty.dir.error", source );
- throw new TaskException( message );
- }
- final int numfiles = files.size();
- // get a random number between 0 and the number of files
- final Random random = new Random();
- final int x = random.nextInt( numfiles );
- // set the source to the file at that location
- return (File)files.get( x );
- }
- else
- {
- return null;
- }
- }
- else
- {
- final String message = REZ.getString( "sound.invalid-path.error", source );
- getContext().warn( message );
- return null;
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/CopyFilesTask.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/CopyFilesTask.java
deleted file mode 100644
index 5bcb2fd0b..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/CopyFilesTask.java
+++ /dev/null
@@ -1,156 +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.txt file.
- */
-package org.apache.antlib.vfile;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import org.apache.aut.vfs.FileObject;
-import org.apache.aut.vfs.FileSystemException;
-import org.apache.aut.vfs.FileType;
-import org.apache.aut.vfs.NameScope;
-import org.apache.aut.vfs.FileConstants;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A task that copies files.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- *
- * @ant.task name="v-copy"
- */
-public class CopyFilesTask
- extends AbstractTask
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( CopyFilesTask.class );
-
- private FileObject m_srcFile;
- private FileObject m_destFile;
- private FileObject m_destDir;
- private ArrayList m_fileSets = new ArrayList();
-
- /**
- * Sets the source file.
- */
- public void setSrcfile( final FileObject file )
- {
- m_srcFile = file;
- }
-
- /**
- * Sets the destination file.
- */
- public void setDestfile( final FileObject file )
- {
- m_destFile = file;
- }
-
- /**
- * Sets the destination directory.
- */
- public void setDestdir( final FileObject file )
- {
- m_destDir = file;
- }
-
- /**
- * Sets the source directory.
- */
- public void setSrcdir( final FileObject dir )
- {
- add( new DefaultFileSet( dir ) );
- }
-
- /**
- * Adds a source file set.
- */
- public void add( final FileSet fileset )
- {
- m_fileSets.add( fileset );
- }
-
- /**
- * Execute task.
- * This method is called to perform actual work associated with task.
- * It is called after Task has been Configured and Initialized and before
- * beig Disposed (If task implements appropriate interfaces).
- *
- * @exception TaskException if an error occurs
- */
- public void execute()
- throws TaskException
- {
- if( m_srcFile == null && m_fileSets.size() == 0 )
- {
- final String message = REZ.getString( "copyfilestask.no-source.error", getContext().getName() );
- throw new TaskException( message );
- }
- if( m_destFile == null && m_destDir == null )
- {
- final String message = REZ.getString( "copyfilestask.no-destination.error", getContext().getName() );
- throw new TaskException( message );
- }
- if( m_fileSets.size() > 0 && m_destDir == null )
- {
- final String message = REZ.getString( "copyfilestask.no-destination-dir.error", getContext().getName() );
- throw new TaskException( message );
- }
-
- try
- {
- // Copy the source file across
- if( m_srcFile != null )
- {
- if( m_destFile == null )
- {
- m_destFile = m_destDir.resolveFile( m_srcFile.getName().getBaseName() );
- }
-
- getContext().verbose( "copy " + m_srcFile + " to " + m_destFile );
- m_destFile.copyFrom( m_srcFile, FileConstants.SELECT_SELF );
- }
-
- // Copy the contents of the filesets across
- for( Iterator iterator = m_fileSets.iterator(); iterator.hasNext(); )
- {
- FileSet fileset = (FileSet)iterator.next();
- FileSetResult result = fileset.getResult( getContext() );
- final FileObject[] files = result.getFiles();
- final String[] paths = result.getPaths();
- for( int i = 0; i < files.length; i++ )
- {
- final FileObject srcFile = files[ i ];
- final String path = paths[ i ];
-
- // TODO - map destination name
-
- // TODO - maybe include empty dirs
- if( srcFile.getType() != FileType.FILE )
- {
- continue;
- }
-
- // Locate the destination file
- final FileObject destFile = m_destDir.resolveFile( path, NameScope.DESCENDENT );
-
- // Copy the file across
- getContext().verbose( "copy " + srcFile + " to " + destFile );
- destFile.copyFrom( srcFile, FileConstants.SELECT_SELF );
- }
- }
- }
- catch( FileSystemException e )
- {
- throw new TaskException( e.getMessage(), e );
- }
- }
-
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/DefaultFileList.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/DefaultFileList.java
deleted file mode 100644
index 731c7cbd2..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/DefaultFileList.java
+++ /dev/null
@@ -1,78 +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.txt file.
- */
-package org.apache.antlib.vfile;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.apache.aut.vfs.FileObject;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A compound file list, which is made up of several other file lists.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- *
- * @ant.data-type name="v-path"
- * @ant.type type="v-path" name="v-path"
- */
-public class DefaultFileList implements FileList
-{
- private final List m_elements = new ArrayList();
-
- /**
- * Adds a single file to this list.
- */
- public void addLocation( final FileObject file )
- {
- final SingletonFileList element = new SingletonFileList();
- element.setFile( file );
- m_elements.add( element );
- }
-
- /**
- * Adds a path to this list.
- */
- public void addPath( final String pathStr )
- {
- final PathFileList path = new PathFileList();
- path.setPath( pathStr );
- m_elements.add( path );
- }
-
- /**
- * Adds a file list to this list.
- */
- public void add( final FileList list )
- {
- m_elements.add( list );
- }
-
- /**
- * Returns the list of files.
- */
- public FileObject[] listFiles( TaskContext context ) throws TaskException
- {
- // Collect the files from all elements
- final ArrayList allFiles = new ArrayList();
- for( Iterator iterator = m_elements.iterator(); iterator.hasNext(); )
- {
- FileList fileList = (FileList)iterator.next();
- FileObject[] files = fileList.listFiles( context );
- for( int i = 0; i < files.length; i++ )
- {
- FileObject file = files[ i ];
- allFiles.add( file );
- }
- }
-
- // Convert to array
- return (FileObject[])allFiles.toArray( new FileObject[ allFiles.size() ] );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/DefaultFileSet.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/DefaultFileSet.java
deleted file mode 100644
index 12bdbbe65..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/DefaultFileSet.java
+++ /dev/null
@@ -1,120 +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.txt file.
- */
-package org.apache.antlib.vfile;
-
-import java.util.ArrayList;
-import org.apache.antlib.vfile.selectors.AndFileSelector;
-import org.apache.antlib.vfile.selectors.FileSelector;
-import org.apache.aut.vfs.FileObject;
-import org.apache.aut.vfs.FileSystemException;
-import org.apache.aut.vfs.FileType;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A file set, that contains those files under a directory that match
- * a set of selectors.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- *
- * @ant.data-type name="v-fileset"
- * @ant.type type="v-fileset" name="v-fileset"
- */
-public class DefaultFileSet
- implements FileSet
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( DefaultFileSet.class );
-
- private FileObject m_dir;
- private final AndFileSelector m_selector = new AndFileSelector();
-
- public DefaultFileSet()
- {
- }
-
- public DefaultFileSet( final FileObject dir )
- {
- m_dir = dir;
- }
-
- /**
- * Sets the root directory.
- */
- public void setDir( final FileObject dir )
- {
- m_dir = dir;
- }
-
- /**
- * Adds a selector.
- */
- public void add( final FileSelector selector )
- {
- m_selector.add( selector );
- }
-
- /**
- * Returns the contents of the set.
- */
- public FileSetResult getResult( final TaskContext context )
- throws TaskException
- {
- if( m_dir == null )
- {
- final String message = REZ.getString( "fileset.dir-not-set.error" );
- throw new TaskException( message );
- }
-
- try
- {
- final DefaultFileSetResult result = new DefaultFileSetResult();
- final ArrayList stack = new ArrayList();
- final ArrayList pathStack = new ArrayList();
- stack.add( m_dir );
- pathStack.add( "" );
-
- while( stack.size() > 0 )
- {
- // Pop next folder off the stack
- FileObject folder = (FileObject)stack.remove( 0 );
- String path = (String)pathStack.remove( 0 );
-
- // Queue the children of the folder
- FileObject[] children = folder.getChildren();
- for( int i = 0; i < children.length; i++ )
- {
- FileObject child = children[ i ];
- String childPath = path + child.getName().getBaseName();
-
- // Check whether to include the file in the result
- if( m_selector.accept( child, childPath, context ) )
- {
- result.addElement( child, childPath );
- }
-
- if( child.getType() == FileType.FOLDER )
- {
- // A folder - push it on to the stack
- stack.add( 0, child );
- pathStack.add( 0, childPath + '/' );
- }
- }
- }
-
- return result;
- }
- catch( FileSystemException e )
- {
- final String message = REZ.getString( "fileset.list-files.error", m_dir );
- throw new TaskException( message, e );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/DefaultFileSetResult.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/DefaultFileSetResult.java
deleted file mode 100644
index 9e350a4aa..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/DefaultFileSetResult.java
+++ /dev/null
@@ -1,50 +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.txt file.
- */
-package org.apache.antlib.vfile;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.aut.vfs.FileObject;
-
-/**
- * An implementation of a file set result.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- */
-public class DefaultFileSetResult
- implements FileSetResult
-{
- private List m_files = new ArrayList();
- private List m_paths = new ArrayList();
-
- /**
- * Adds an element to the result.
- */
- public void addElement( final FileObject file,
- final String path )
- {
- m_files.add( file );
- m_paths.add( path );
- }
-
- /**
- * Returns the files in the result.
- */
- public FileObject[] getFiles()
- {
- return (FileObject[])m_files.toArray( new FileObject[ m_files.size() ] );
- }
-
- /**
- * Returns the virtual paths of the files.
- */
- public String[] getPaths()
- {
- return (String[])m_paths.toArray( new String[ m_paths.size() ] );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/FileList.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/FileList.java
deleted file mode 100644
index 2ee4d7e78..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/FileList.java
+++ /dev/null
@@ -1,35 +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.txt file.
- */
-package org.apache.antlib.vfile;
-
-import org.apache.aut.vfs.FileObject;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.DataType;
-
-/**
- * An ordered list of files.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- *
- * @ant:role shorthand="v-path"
- */
-public interface FileList
- extends DataType
-{
- /**
- * Returns the files in the list.
- *
- * @param context
- * The context to use to build the list of files.
- *
- * @throws TaskException
- * On error building the list of files.
- */
- FileObject[] listFiles( TaskContext context ) throws TaskException;
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/FileSet.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/FileSet.java
deleted file mode 100644
index 8bf9ec40b..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/FileSet.java
+++ /dev/null
@@ -1,36 +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.txt file.
- */
-package org.apache.antlib.vfile;
-
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.DataType;
-
-/**
- * A set of files, where each file in the list has a virtual path associated
- * with it.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- *
- * @ant:role shorthand="v-fileset"
- */
-public interface FileSet
- extends DataType
-{
- /**
- * Returns the contents of the set.
- *
- * @param context
- * The context to use to build the set.
- *
- * @throws TaskException
- * On error building the set.
- */
- FileSetResult getResult( TaskContext context )
- throws TaskException;
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/FileSetAdaptor.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/FileSetAdaptor.java
deleted file mode 100644
index 755e241a3..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/FileSetAdaptor.java
+++ /dev/null
@@ -1,39 +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.txt file.
- */
-package org.apache.antlib.vfile;
-
-import org.apache.aut.vfs.FileObject;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * An adaptor from a {@link FileSet} to a {@link FileList}.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- */
-public class FileSetAdaptor
- implements FileList
-{
- private final FileSet m_fileset;
-
- public FileSetAdaptor( final FileSet fileset )
- {
- m_fileset = fileset;
- }
-
- /**
- * Returns the files in the list.
- */
- public FileObject[] listFiles( TaskContext context )
- throws TaskException
- {
- final FileSetResult result = m_fileset.getResult( context );
- return result.getFiles();
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/FileSetResult.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/FileSetResult.java
deleted file mode 100644
index 6aa66de40..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/FileSetResult.java
+++ /dev/null
@@ -1,28 +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.txt file.
- */
-package org.apache.antlib.vfile;
-
-import org.apache.aut.vfs.FileObject;
-
-/**
- * The contents of a {@link FileSet}.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- */
-public interface FileSetResult
-{
- /**
- * Returns the files in the result.
- */
- FileObject[] getFiles();
-
- /**
- * Returns the virtual paths of the files.
- */
- String[] getPaths();
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/FileSetToFileListConverter.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/FileSetToFileListConverter.java
deleted file mode 100644
index ed753fba5..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/FileSetToFileListConverter.java
+++ /dev/null
@@ -1,39 +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.txt file.
- */
-package org.apache.antlib.vfile;
-
-import org.apache.aut.converter.AbstractConverter;
-import org.apache.aut.converter.ConverterException;
-
-/**
- * A converter from {@link FileSet} to {@link FileList}.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.converter source="org.apache.antlib.vfile.FileSet"
- * destination="org.apache.antlib.vfile.FileList"
- */
-public class FileSetToFileListConverter
- extends AbstractConverter
-{
- public FileSetToFileListConverter()
- {
- super( FileSet.class, FileList.class );
- }
-
- /**
- * Do the conversion.
- */
- protected Object convert( final Object original, final Object context )
- throws ConverterException
- {
- final FileSet src = (FileSet)original;
- return new FileSetAdaptor( src );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/FilteredFileList.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/FilteredFileList.java
deleted file mode 100644
index 9f002c1ff..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/FilteredFileList.java
+++ /dev/null
@@ -1,73 +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.txt file.
- */
-package org.apache.antlib.vfile;
-
-import java.util.ArrayList;
-import org.apache.antlib.vfile.selectors.AndFileSelector;
-import org.apache.antlib.vfile.selectors.FileSelector;
-import org.apache.aut.vfs.FileObject;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A file-list which filters another.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.data-type name="filtered-path"
- * @ant.type type="v-path" name="filtered-path"
- */
-public class FilteredFileList
- implements FileList
-{
- private DefaultFileList m_fileList = new DefaultFileList();
- private FileSelector m_selector;
-
- /**
- * Sets the selector to use to filter with.
- */
- public void setFilter( final AndFileSelector selector )
- {
- m_selector = selector;
- }
-
- /**
- * Sets the filelist to filter.
- */
- public void add( final FileList fileList )
- {
- m_fileList.add( fileList );
- }
-
- /**
- * Returns the files in the list.
- */
- public FileObject[] listFiles( final TaskContext context )
- throws TaskException
- {
- if( m_selector == null )
- {
- throw new TaskException( "filteredfilelist.no-selector.error" );
- }
-
- // Build the set of files
- final ArrayList acceptedFiles = new ArrayList();
- final FileObject[] files = m_fileList.listFiles( context );
- for( int i = 0; i < files.length; i++ )
- {
- final FileObject file = files[ i ];
- if( m_selector.accept( file, null, context ) )
- {
- acceptedFiles.add( file );
- }
- }
-
- return (FileObject[])acceptedFiles.toArray( new FileObject[ acceptedFiles.size() ] );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/FlatFileSet.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/FlatFileSet.java
deleted file mode 100644
index bd9f03911..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/FlatFileSet.java
+++ /dev/null
@@ -1,54 +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.txt file.
- */
-package org.apache.antlib.vfile;
-
-import org.apache.aut.vfs.FileObject;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A file set that flattens its contents into a single directory.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.data-type name="flat-fileset"
- * @ant.type type="v-fileset" name="flat-fileset"
- */
-public class FlatFileSet
- implements FileSet
-{
- private DefaultFileList m_files = new DefaultFileList();
-
- /**
- * Adds a file list to this set.
- */
- public void add( final FileList files )
- {
- m_files.add( files );
- }
-
- /**
- * Returns the contents of the set.
- */
- public FileSetResult getResult( final TaskContext context )
- throws TaskException
- {
- DefaultFileSetResult result = new DefaultFileSetResult();
- FileObject[] files = m_files.listFiles( context );
- for( int i = 0; i < files.length; i++ )
- {
- final FileObject file = files[ i ];
-
- // TODO - detect collisions
- result.addElement( file, file.getName().getBaseName() );
- }
-
- return result;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/ListFileSetTask.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/ListFileSetTask.java
deleted file mode 100644
index cb607e085..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/ListFileSetTask.java
+++ /dev/null
@@ -1,54 +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.txt file.
- */
-package org.apache.antlib.vfile;
-
-import java.util.ArrayList;
-import org.apache.aut.vfs.FileObject;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A debug task, that lists the contents of a {@link FileSet}.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.task name="v-list-fileset"
- */
-public class ListFileSetTask
- extends AbstractTask
-{
- private final ArrayList m_fileSets = new ArrayList();
-
- public void add( final FileSet fileSet )
- {
- m_fileSets.add( fileSet );
- }
-
- /**
- * Execute task.
- */
- public void execute()
- throws TaskException
- {
- final int count = m_fileSets.size();
- for( int i = 0; i < count; i++ )
- {
- final FileSet fileSet = (FileSet)m_fileSets.get(i );
- FileSetResult result = fileSet.getResult( getContext() );
- final FileObject[] files = result.getFiles();
- final String[] paths = result.getPaths();
- for( int j = 0; j < files.length; j++ )
- {
- final FileObject file = files[ j ];
- final String path = paths[ j ];
- getContext().info( path + " = " + file );
- }
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/ListFilesTask.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/ListFilesTask.java
deleted file mode 100644
index 229a9220f..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/ListFilesTask.java
+++ /dev/null
@@ -1,47 +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.txt file.
- */
-package org.apache.antlib.vfile;
-
-import org.apache.aut.vfs.FileObject;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A debug task, which prints out the files in a file list.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.task name="v-list-path"
- */
-public class ListFilesTask
- extends AbstractTask
-{
- private final DefaultFileList m_files = new DefaultFileList();
-
- public void add( final FileList files )
- {
- m_files.add( files );
- }
-
- /**
- * Execute task.
- *
- * @exception TaskException if an error occurs
- */
- public void execute()
- throws TaskException
- {
- final FileObject[] files = m_files.listFiles( getContext() );
- for( int i = 0; i < files.length; i++ )
- {
- FileObject file = files[ i ];
- getContext().info( file.toString() );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/MappedFileSet.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/MappedFileSet.java
deleted file mode 100644
index 138d3b38d..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/MappedFileSet.java
+++ /dev/null
@@ -1,95 +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.txt file.
- */
-package org.apache.antlib.vfile;
-
-import java.util.ArrayList;
-import org.apache.aut.vfs.FileObject;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.ChainFileNameMapper;
-
-/**
- * A fileset that maps another fileset.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.data-type name="mapped-fileset"
- */
-public class MappedFileSet
- implements FileSet
-{
- private final ArrayList m_filesets = new ArrayList();
- private ChainFileNameMapper m_mapper = new ChainFileNameMapper();
-
- /**
- * Sets the mapper to use.
- */
- public void setMapper( final ChainFileNameMapper mapper )
- {
- m_mapper.add( mapper );
- }
-
- /**
- * Sets the fileset to map.
- */
- public void add( final FileSet fileset )
- {
- m_filesets.add( fileset );
- }
-
- /**
- * Returns the contents of the set.
- */
- public FileSetResult getResult( final TaskContext context )
- throws TaskException
- {
- final DefaultFileSetResult result = new DefaultFileSetResult();
-
- // Map each source fileset.
- final int count = m_filesets.size();
- for( int i = 0; i < count; i++ )
- {
- final FileSet fileSet = (FileSet)m_filesets.get(i );
- mapFileSet( fileSet, result, context );
- }
-
- return result;
- }
-
- /**
- * Maps the contents of a fileset.
- */
- private void mapFileSet( final FileSet fileset,
- final DefaultFileSetResult result,
- final TaskContext context )
- throws TaskException
- {
- // Build the result from the nested fileset
- FileSetResult origResult = fileset.getResult( context );
- final FileObject[] files = origResult.getFiles();
- final String[] paths = origResult.getPaths();
-
- // Map each element of the result
- for( int i = 0; i < files.length; i++ )
- {
- final FileObject file = files[ i ];
- final String path = paths[ i ];
- String[] newPaths = m_mapper.mapFileName( path, context );
- if( newPaths == null )
- {
- continue;
- }
- for( int j = 0; j < newPaths.length; j++ )
- {
- String newPath = newPaths[j ];
- result.addElement( file, newPath );
- }
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/PathFileList.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/PathFileList.java
deleted file mode 100644
index 526350b63..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/PathFileList.java
+++ /dev/null
@@ -1,61 +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.txt file.
- */
-package org.apache.antlib.vfile;
-
-import org.apache.aut.vfs.FileObject;
-import org.apache.aut.vfs.FileSystemException;
-import org.apache.aut.vfs.FileSystemManager;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.tools.todo.util.FileUtils;
-
-/**
- * A path made up of file names separated by ; and : characters. Similar to
- * a CLASSPATH or PATH environment variable.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- */
-public class PathFileList implements FileList
-{
- private String m_path;
-
- /**
- * Sets the path to use for this file list.
- */
- public void setPath( final String path )
- {
- m_path = path;
- }
-
- /**
- * Returns the list of files.
- */
- public FileObject[] listFiles( final TaskContext context )
- throws TaskException
- {
- FileSystemManager fileSystemManager = (FileSystemManager)context.getService( FileSystemManager.class );
-
- // TODO - move parsing to the VFS
- final String[] elements = FileUtils.parsePath( m_path );
- final FileObject[] result = new FileObject[ elements.length ];
- for( int i = 0; i < elements.length; i++ )
- {
- String element = elements[ i ];
- try
- {
- result[ i ] = fileSystemManager.resolveFile( context.getBaseDirectory(), element );
- }
- catch( FileSystemException e )
- {
- throw new TaskException( e.getMessage(), e );
- }
- }
-
- return result;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/Resources.properties b/proposal/myrmidon/src/java/org/apache/antlib/vfile/Resources.properties
deleted file mode 100644
index b0eb4863c..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/Resources.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-bad-convert-string-to-file.error=Could not convert URI "{0}" into a file object.
-
-fileset.dir-not-set.error=Fileset root directory is not set.
-fileset.list-files.error=Could not list the files in folder "{0}".
-
-copyfilestask.no-source.error=No source files specified for {0} task.
-copyfilestask.no-destination.error=No destination file or directory specified for {0} task.
-copyfilestask.no-destination.error=No destination directory specified for {0} task.
-
-filteredfilelist.no-selector.error=No filter criteria specified.
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/SingletonFileList.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/SingletonFileList.java
deleted file mode 100644
index 472c6a5e3..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/SingletonFileList.java
+++ /dev/null
@@ -1,40 +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.txt file.
- */
-package org.apache.antlib.vfile;
-
-import org.apache.aut.vfs.FileObject;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A file list that contains a single file.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- *
- */
-public class SingletonFileList
- implements FileList
-{
- private FileObject m_file;
-
- /**
- * Sets the file to use for tils file list.
- */
- public void setFile( final FileObject file )
- {
- m_file = file;
- }
-
- /**
- * Returns the list of files.
- */
- public FileObject[] listFiles( TaskContext context ) throws TaskException
- {
- return new FileObject[]{m_file};
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/StringToFileObjectConverter.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/StringToFileObjectConverter.java
deleted file mode 100644
index 481da5574..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/StringToFileObjectConverter.java
+++ /dev/null
@@ -1,58 +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.txt file.
- */
-package org.apache.antlib.vfile;
-
-import org.apache.aut.converter.AbstractConverter;
-import org.apache.aut.converter.ConverterException;
-import org.apache.aut.vfs.FileObject;
-import org.apache.aut.vfs.FileSystemManager;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.TaskContext;
-
-/**
- * Converts a String to a {@link FileObject}
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @ant.converter source="java.lang.String" destination="org.apache.aut.vfs.FileObject"
- */
-public class StringToFileObjectConverter
- extends AbstractConverter
-{
- private static final Resources REZ =
- ResourceManager.getPackageResources( StringToFileObjectConverter.class );
-
- public StringToFileObjectConverter()
- {
- super( String.class, FileObject.class );
- }
-
- /**
- * Converts a String into a FileObject.
- */
- protected Object convert( final Object original, final Object context )
- throws ConverterException
- {
- final String uri = (String)original;
- final TaskContext taskContext = (TaskContext)context;
-
- try
- {
- final FileSystemManager manager =
- (FileSystemManager)taskContext.getService( FileSystemManager.class );
-
- // TODO - change TaskContext.getBaseDirectory() to return a FileObject
- return manager.resolveFile( taskContext.getBaseDirectory(), uri );
- }
- catch( Exception e )
- {
- final String message = REZ.getString( "bad-convert-string-to-file.error", uri );
- throw new ConverterException( message, e );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/AbstractNameFileSelector.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/AbstractNameFileSelector.java
deleted file mode 100644
index dc241cf17..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/AbstractNameFileSelector.java
+++ /dev/null
@@ -1,137 +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.txt file.
- */
-package org.apache.antlib.vfile.selectors;
-
-import org.apache.aut.vfs.FileObject;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.oro.text.GlobCompiler;
-import org.apache.oro.text.regex.MalformedPatternException;
-import org.apache.oro.text.regex.Pattern;
-import org.apache.oro.text.regex.Perl5Compiler;
-import org.apache.oro.text.regex.Perl5Matcher;
-
-/**
- * An abstract file selector that selects files based on name.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- */
-public abstract class AbstractNameFileSelector
- implements FileSelector
-{
- private static final Resources REZ
- = ResourceManager.getPackageResources( AbstractNameFileSelector.class );
-
- private Object m_type;
- private String m_pattern;
-
- private static final Object TYPE_GLOB = "glob";
- private static final Object TYPE_REGEXP = "regexp";
-
- /**
- * Sets the GLOB pattern to match the name against.
- */
- public void setPattern( final String pattern )
- throws TaskException
- {
- setPattern( TYPE_GLOB, pattern );
- }
-
- /**
- * Sets the Regexp pattern to match the file basename against.
- */
- public void setRegexp( final String pattern )
- throws TaskException
- {
- setPattern( TYPE_REGEXP, pattern );
- }
-
- /**
- * Sets the pattern and type to match
- */
- private void setPattern( final Object type, final String pattern )
- throws TaskException
- {
- if( m_type != null )
- {
- final String message = REZ.getString( "nameselector.too-many-patterns.error" );
- throw new TaskException( message );
- }
- m_type = type;
- m_pattern = pattern;
- }
-
- /**
- * Accepts the file.
- */
- public boolean accept( final FileObject file,
- final String path,
- final TaskContext context )
- throws TaskException
- {
- if( m_type == null )
- {
- final String message = REZ.getString( "nameselector.no-pattern.error" );
- throw new TaskException( message );
- }
-
- // Create the pattern to match against
- final Pattern pattern;
- try
- {
- if( m_type == TYPE_GLOB )
- {
- pattern = createGlobPattern( m_pattern );
- }
- else
- {
- pattern = createRegexpPattern( m_pattern );
- }
- }
- catch( MalformedPatternException e )
- {
- final String message = REZ.getString( "nameselector.bad-pattern.error", m_pattern );
- throw new TaskException( message );
- }
-
- // Get the name to match against
- final String name = getNameForMatch( path, file );
-
- // Compare the name against the pattern
- return new Perl5Matcher().matches( name, pattern );
- }
-
- /**
- * Creates a GLOB pattern for matching the name against.
- */
- protected Pattern createGlobPattern( final String pattern )
- throws MalformedPatternException
- {
- // TODO - need to implement Ant-style patterns
- return new GlobCompiler().compile( pattern );
- }
-
- /**
- * Creates a Regexp pattern for matching the name against.
- */
- protected Pattern createRegexpPattern( final String pattern )
- throws MalformedPatternException
- {
- return new Perl5Compiler().compile( pattern );
- }
-
- /**
- * Returns the name to match against.
- */
- protected abstract String getNameForMatch( final String path,
- final FileObject file )
- throws TaskException;
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/AndFileSelector.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/AndFileSelector.java
deleted file mode 100644
index 0e67b9c1e..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/AndFileSelector.java
+++ /dev/null
@@ -1,56 +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.txt file.
- */
-package org.apache.antlib.vfile.selectors;
-
-import java.util.ArrayList;
-import org.apache.aut.vfs.FileObject;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A file selector that performs an AND of nested selectors. Performs
- * lazy evaluation. Returns true when no nested elements are supplied.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="v-file-selector" name="and"
- */
-public class AndFileSelector
- implements FileSelector
-{
- private final ArrayList m_selectors = new ArrayList();
-
- /**
- * Adds a nested selector.
- */
- public void add( final FileSelector selector )
- {
- m_selectors.add( selector );
- }
-
- /**
- * Accepts a file.
- */
- public boolean accept( final FileObject file,
- final String path,
- final TaskContext context )
- throws TaskException
- {
- for( int i = 0; i < m_selectors.size(); i++ )
- {
- final FileSelector fileSelector = (FileSelector)m_selectors.get( i );
- if( !fileSelector.accept( file, path, context ) )
- {
- return false;
- }
- }
-
- return true;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/BaseNameFileSelector.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/BaseNameFileSelector.java
deleted file mode 100644
index f656433b1..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/BaseNameFileSelector.java
+++ /dev/null
@@ -1,31 +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.txt file.
- */
-package org.apache.antlib.vfile.selectors;
-
-import org.apache.aut.vfs.FileObject;
-
-/**
- * A file selector that selects files based on their base-name.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="v-file-selector" name="basename"
- */
-public class BaseNameFileSelector
- extends AbstractNameFileSelector
-{
- /**
- * Returns the name to match against.
- */
- protected String getNameForMatch( final String path,
- final FileObject file )
- {
- return file.getName().getBaseName();
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/ConditionSelector.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/ConditionSelector.java
deleted file mode 100644
index 31007c51f..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/ConditionSelector.java
+++ /dev/null
@@ -1,47 +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.txt file.
- */
-package org.apache.antlib.vfile.selectors;
-
-import org.apache.aut.vfs.FileObject;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.conditions.AndCondition;
-import org.apache.myrmidon.framework.conditions.Condition;
-
-/**
- * A file selector that evaluates a set of nested {@link Condition} elements.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="v-file-selector" name="condition"
- */
-public class ConditionSelector
- implements FileSelector
-{
- private AndCondition m_condition = new AndCondition();
-
- /**
- * Adds a condition.
- */
- public void add( final Condition condition )
- {
- m_condition.add( condition );
- }
-
- /**
- * Accepts a file.
- */
- public boolean accept( final FileObject file,
- final String path,
- final TaskContext context )
- throws TaskException
- {
- return m_condition.evaluate( context );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/ExistenceFileSelector.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/ExistenceFileSelector.java
deleted file mode 100644
index ef7d0a15e..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/ExistenceFileSelector.java
+++ /dev/null
@@ -1,43 +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.txt file.
- */
-package org.apache.antlib.vfile.selectors;
-
-import org.apache.aut.vfs.FileObject;
-import org.apache.aut.vfs.FileSystemException;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A file selector that only selects files that exist.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="v-file-selector" name="exists"
- */
-public class ExistenceFileSelector
- implements FileSelector
-{
- /**
- * Accepts a file.
- */
- public boolean accept( final FileObject file,
- final String path,
- final TaskContext context )
- throws TaskException
- {
- try
- {
- return file.exists();
- }
- catch( FileSystemException e )
- {
- throw new TaskException( e.getMessage(), e );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/FileSelector.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/FileSelector.java
deleted file mode 100644
index f3ce41757..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/FileSelector.java
+++ /dev/null
@@ -1,34 +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.txt file.
- */
-package org.apache.antlib.vfile.selectors;
-
-import org.apache.aut.vfs.FileObject;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * Accepts files as part of a set.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant:role shorthand="v-file-selector"
- */
-public interface FileSelector
-{
- /**
- * Accepts a file.
- *
- * @param path The virtual path associated with the file. May be null
- * if such a path is not available.
- * @param file The file to select.
- * @param context The context to perform the selection in.
- */
- boolean accept( FileObject file, String path, TaskContext context )
- throws TaskException;
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/FileTestCondition.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/FileTestCondition.java
deleted file mode 100644
index f7efe586c..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/FileTestCondition.java
+++ /dev/null
@@ -1,63 +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.txt file.
- */
-package org.apache.antlib.vfile.selectors;
-
-import org.apache.aut.vfs.FileObject;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.conditions.Condition;
-
-/**
- * A condition that applies a set of file selectors to a file.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="condition" name="file-test"
- */
-public class FileTestCondition
- implements Condition
-{
- private static final Resources REZ
- = ResourceManager.getPackageResources( FileTestCondition.class );
-
- private FileObject m_file;
- private AndFileSelector m_selector = new AndFileSelector();
-
- /**
- * Sets the file to test.
- */
- public void setFile( final FileObject file )
- {
- m_file = file;
- }
-
- /**
- * Adds a selector.
- */
- public void add( final FileSelector selector )
- {
- m_selector.add( selector );
- }
-
- /**
- * Evaluates this condition.
- */
- public boolean evaluate( final TaskContext context )
- throws TaskException
- {
- if( m_file == null )
- {
- final String message = REZ.getString( "filetestcondition.no-file.error" );
- throw new TaskException( message );
- }
- return m_selector.accept( m_file, null, context );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/IsEmptyFolderSelector.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/IsEmptyFolderSelector.java
deleted file mode 100644
index da96a721b..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/IsEmptyFolderSelector.java
+++ /dev/null
@@ -1,46 +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.txt file.
- */
-package org.apache.antlib.vfile.selectors;
-
-import org.apache.aut.vfs.FileObject;
-import org.apache.aut.vfs.FileSystemException;
-import org.apache.aut.vfs.FileType;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A file selector that selects empty directories.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="v-file-selector" name="is-empty-folder"
- */
-public class IsEmptyFolderSelector
- implements FileSelector
-{
- /**
- * Accepts a file.
- */
- public boolean accept( final FileObject file,
- final String path,
- final TaskContext context )
- throws TaskException
- {
- try
- {
- return ( file.exists()
- && file.getType() == FileType.FOLDER
- && file.getChildren().length == 0 );
- }
- catch( FileSystemException e )
- {
- throw new TaskException( e.getMessage(), e );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/IsFileSelector.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/IsFileSelector.java
deleted file mode 100644
index 6f19a51b8..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/IsFileSelector.java
+++ /dev/null
@@ -1,44 +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.txt file.
- */
-package org.apache.antlib.vfile.selectors;
-
-import org.apache.aut.vfs.FileObject;
-import org.apache.aut.vfs.FileSystemException;
-import org.apache.aut.vfs.FileType;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A file selector which only selects files, not folders.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="v-file-selector" name="is-file"
- */
-public class IsFileSelector
- implements FileSelector
-{
- /**
- * Accepts a file.
- */
- public boolean accept( final FileObject file,
- final String path,
- final TaskContext context )
- throws TaskException
- {
- try
- {
- return ( file.exists() && file.getType() == FileType.FILE );
- }
- catch( FileSystemException e )
- {
- throw new TaskException( e.getMessage(), e );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/IsFolderSelector.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/IsFolderSelector.java
deleted file mode 100644
index 419ed4b61..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/IsFolderSelector.java
+++ /dev/null
@@ -1,44 +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.txt file.
- */
-package org.apache.antlib.vfile.selectors;
-
-import org.apache.aut.vfs.FileObject;
-import org.apache.aut.vfs.FileSystemException;
-import org.apache.aut.vfs.FileType;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A file selector which only selects folders, not files.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="v-file-selector" name="is-folder"
- */
-public class IsFolderSelector
- implements FileSelector
-{
- /**
- * Accepts a file.
- */
- public boolean accept( final FileObject file,
- final String path,
- final TaskContext context )
- throws TaskException
- {
- try
- {
- return ( file.exists() && file.getType() == FileType.FOLDER );
- }
- catch( FileSystemException e )
- {
- throw new TaskException( e.getMessage(), e );
- }
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/NameFileSelector.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/NameFileSelector.java
deleted file mode 100644
index aabed0d5f..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/NameFileSelector.java
+++ /dev/null
@@ -1,43 +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.txt file.
- */
-package org.apache.antlib.vfile.selectors;
-
-import org.apache.aut.vfs.FileObject;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A file selector that selects files based on their name.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="v-file-selector" name="name"
- */
-public class NameFileSelector
- extends AbstractNameFileSelector
-{
- private static final Resources REZ
- = ResourceManager.getPackageResources( NameFileSelector.class );
-
- /**
- * Returns the name to match against.
- */
- protected String getNameForMatch( final String path,
- final FileObject file )
- throws TaskException
- {
- if( path == null )
- {
- final String message = REZ.getString( "namefileselector.no-path.error" );
- throw new TaskException( message );
- }
- return path;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/NotFileSelector.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/NotFileSelector.java
deleted file mode 100644
index e4019f35c..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/NotFileSelector.java
+++ /dev/null
@@ -1,55 +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.txt file.
- */
-package org.apache.antlib.vfile.selectors;
-
-import org.apache.aut.vfs.FileObject;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A file selector that negates a nested file selector.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="v-file-selector" name="not"
- */
-public class NotFileSelector
- implements FileSelector
-{
- private static final Resources REZ
- = ResourceManager.getPackageResources( NotFileSelector.class );
-
- private FileSelector m_selector;
-
- /**
- * Sets the nested selector.
- */
- public void set( final FileSelector selector )
- {
- m_selector = selector;
- }
-
- /**
- * Accepts a file.
- */
- public boolean accept( final FileObject file,
- final String path,
- final TaskContext context )
- throws TaskException
- {
- if( m_selector == null )
- {
- final String message = REZ.getString( "notfileselector.no-selector.error" );
- throw new TaskException( message );
- }
- return !m_selector.accept( file, path, context );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/OrFileSelector.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/OrFileSelector.java
deleted file mode 100644
index 7517196d3..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/OrFileSelector.java
+++ /dev/null
@@ -1,57 +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.txt file.
- */
-package org.apache.antlib.vfile.selectors;
-
-import java.util.ArrayList;
-import org.apache.aut.vfs.FileObject;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-
-/**
- * A file selector that performs an OR of nested selectors. Performs
- * lazy evaluation. Returns true when no nested elements are supplied.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="v-file-selector" name="or"
- */
-public class OrFileSelector
- implements FileSelector
-{
- private final ArrayList m_selectors = new ArrayList();
-
- /**
- * Adds a nested selector.
- */
- public void add( final FileSelector selector )
- {
- m_selectors.add( selector );
- }
-
- /**
- * Accepts a file.
- */
- public boolean accept( final FileObject file,
- final String path,
- final TaskContext context )
- throws TaskException
- {
- for( int i = 0; i < m_selectors.size(); i++ )
- {
- final FileSelector fileSelector = (FileSelector)m_selectors.get( i );
- if( fileSelector.accept( file, path, context ) )
- {
- return true;
- }
- }
-
- // Return true if there are no selectors, false if there are
- return ( m_selectors.size() == 0 );
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/Resources.properties b/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/Resources.properties
deleted file mode 100644
index 55e91a60f..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/Resources.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-nameselector.too-many-patterns.error=Too many name patterns specified.
-nameselector.no-pattern.error=No name pattern specified.
-nameselector.bad-pattern.error=Invalid name pattern "{0}".
-
-notfileselector.no-selector.error=No selector specified.
-
-namefileselector.no-path.error=Cannot use the <name> file selector here.
-
-filetestcondition.no-file.error=No file specified.
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/UrlFileSelector.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/UrlFileSelector.java
deleted file mode 100644
index 95338fb4f..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/selectors/UrlFileSelector.java
+++ /dev/null
@@ -1,31 +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.txt file.
- */
-package org.apache.antlib.vfile.selectors;
-
-import org.apache.aut.vfs.FileObject;
-
-/**
- * A file selector that selects files based on their URL.
- *
- * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
- *
- * @ant.type type="v-file-selector" name="url"
- */
-public class UrlFileSelector
- extends AbstractNameFileSelector
-{
- /**
- * Returns the name to match against.
- */
- protected String getNameForMatch( final String path,
- final FileObject file )
- {
- return file.getName().getURI();
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/xml/DTDLocation.java b/proposal/myrmidon/src/java/org/apache/antlib/xml/DTDLocation.java
deleted file mode 100644
index 1af165b12..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/xml/DTDLocation.java
+++ /dev/null
@@ -1,34 +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.txt file.
- */
-package org.apache.antlib.xml;
-
-public class DTDLocation
-{
- private String m_publicId;
- private String m_location;
-
- public void setLocation( final String location )
- {
- m_location = location;
- }
-
- public void setPublicId( final String publicId )
- {
- m_publicId = publicId;
- }
-
- public String getLocation()
- {
- return m_location;
- }
-
- public String getPublicId()
- {
- return m_publicId;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/xml/LocalResolver.java b/proposal/myrmidon/src/java/org/apache/antlib/xml/LocalResolver.java
deleted file mode 100644
index 81f90bfc5..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/xml/LocalResolver.java
+++ /dev/null
@@ -1,136 +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.txt file.
- */
-package org.apache.antlib.xml;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Hashtable;
-import org.apache.myrmidon.api.TaskContext;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-class LocalResolver
- implements EntityResolver
-{
- private final Hashtable m_fileDTDs = new Hashtable();
- private final Hashtable m_resourceDTDs = new Hashtable();
- private final Hashtable m_urlDTDs = new Hashtable();
- private final TaskContext m_context;
-
- public LocalResolver( final TaskContext context )
- {
- m_context = context;
- }
-
- public void registerDTD( String publicId, String location )
- {
- if( location == null )
- {
- return;
- }
-
- File fileDTD = new File( location );
- if( fileDTD.exists() )
- {
- if( publicId != null )
- {
- m_fileDTDs.put( publicId, fileDTD );
- final String message = "Mapped publicId " + publicId + " to file " + fileDTD;
- m_context.debug( message );
- }
- return;
- }
-
- if( getClass().getResource( location ) != null )
- {
- if( publicId != null )
- {
- m_resourceDTDs.put( publicId, location );
- final String message = "Mapped publicId " + publicId +
- " to resource " + location;
- m_context.debug( message );
- }
- }
-
- try
- {
- if( publicId != null )
- {
- URL urldtd = new URL( location );
- m_urlDTDs.put( publicId, urldtd );
- }
- }
- catch( MalformedURLException e )
- {
- //ignored
- }
- }
-
- public void registerDTD( DTDLocation location )
- {
- registerDTD( location.getPublicId(), location.getLocation() );
- }
-
- public InputSource resolveEntity( String publicId, String systemId )
- throws SAXException
- {
- File dtdFile = (File)m_fileDTDs.get( publicId );
- if( dtdFile != null )
- {
- try
- {
- final String message = "Resolved " + publicId + " to local file " + dtdFile;
- m_context.debug( message );
- return new InputSource( new FileInputStream( dtdFile ) );
- }
- catch( FileNotFoundException ex )
- {
- // ignore
- }
- }
-
- String dtdResourceName = (String)m_resourceDTDs.get( publicId );
- if( dtdResourceName != null )
- {
- InputStream is = getClass().getResourceAsStream( dtdResourceName );
- if( is != null )
- {
- m_context.debug( "Resolved " + publicId + " to local resource " + dtdResourceName );
- return new InputSource( is );
- }
- }
-
- URL dtdUrl = (URL)m_urlDTDs.get( publicId );
- if( dtdUrl != null )
- {
- try
- {
- InputStream is = dtdUrl.openStream();
- final String message = "Resolved " + publicId + " to url " + dtdUrl;
- m_context.debug( message );
- return new InputSource( is );
- }
- catch( IOException ioe )
- {
- //ignore
- }
- }
-
- final String message = "Could not resolve ( publicId: " + publicId +
- ", systemId: " + systemId + ") to a local entity";
- m_context.info( message );
-
- return null;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/xml/TraxErrorListener.java b/proposal/myrmidon/src/java/org/apache/antlib/xml/TraxErrorListener.java
deleted file mode 100644
index a6058fb0a..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/xml/TraxErrorListener.java
+++ /dev/null
@@ -1,86 +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.txt file.
- */
-package org.apache.antlib.xml;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import javax.xml.transform.ErrorListener;
-import javax.xml.transform.SourceLocator;
-import javax.xml.transform.TransformerException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-
-final class TraxErrorListener
- extends AbstractLogEnabled
- implements ErrorListener
-{
- private final boolean m_warn;
- private boolean m_failed;
-
- protected TraxErrorListener( final boolean warn )
- {
- m_warn = warn;
- }
-
- public void error( final TransformerException te )
- {
- m_failed = true;
- getLogger().error( getMessage( te ), te );
- }
-
- public void fatalError( final TransformerException te )
- {
- m_failed = true;
- getLogger().error( getMessage( te ), te );
- }
-
- public void warning( final TransformerException te )
- {
- // depending on implementation, XMLReader can yield hips of warning,
- // only output then if user explicitely asked for it
- if( m_warn )
- {
- getLogger().warn( getMessage( te ), te );
- }
- }
-
- protected void reset()
- {
- m_failed = false;
- }
-
- // did an error happen during last parsing ?
- protected boolean getFailure()
- {
- return m_failed;
- }
-
- private String getMessage( final TransformerException te )
- {
- final SourceLocator locator = te.getLocator();
- final String systemID = locator.getSystemId();
- if( null != systemID )
- {
- final int line = locator.getLineNumber();
- final int column = locator.getColumnNumber();
-
- try
- {
- //Build a message using standard compiler
- //error format
- return new URL( systemID ).getFile() +
- ( line == -1 ? "" : ( ":" + line +
- ( column == -1 ? "" : ( ":" + column ) ) ) ) +
- ": " + te.getMessage();
- }
- catch( final MalformedURLException mue )
- {
- }
- }
- return te.getMessage();
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/xml/ValidatorErrorHandler.java b/proposal/myrmidon/src/java/org/apache/antlib/xml/ValidatorErrorHandler.java
deleted file mode 100644
index 08e07e891..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/xml/ValidatorErrorHandler.java
+++ /dev/null
@@ -1,92 +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.txt file.
- */
-package org.apache.antlib.xml;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import org.apache.myrmidon.api.TaskContext;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXParseException;
-
-/*
- * ValidatorErrorHandler role :
- * <ul>
- * <li> log SAX parse exceptions,
- * <li> remember if an error occured
- * </ul>
- */
-final class ValidatorErrorHandler
- implements ErrorHandler
-{
- private final boolean m_warn;
- private final TaskContext m_context;
- private boolean m_failed;
-
- protected ValidatorErrorHandler( final boolean warn, final TaskContext context )
- {
- m_warn = warn;
- m_context = context;
- }
-
- public void error( final SAXParseException spe )
- {
- m_failed = true;
- m_context.error( getMessage( spe ), spe );
- }
-
- public void fatalError( final SAXParseException spe )
- {
- m_failed = true;
- m_context.error( getMessage( spe ), spe );
- }
-
- public void warning( final SAXParseException spe )
- {
- // depending on implementation, XMLReader can yield hips of warning,
- // only output then if user explicitely asked for it
- if( m_warn )
- {
- m_context.warn( getMessage( spe ), spe );
- }
- }
-
- protected void reset()
- {
- m_failed = false;
- }
-
- // did an error happen during last parsing ?
- protected boolean getFailure()
- {
- return m_failed;
- }
-
- private String getMessage( final SAXParseException spe )
- {
- final String systemID = spe.getSystemId();
- if( null != systemID )
- {
- final int line = spe.getLineNumber();
- final int col = spe.getColumnNumber();
-
- try
- {
- //Build a message using standard compiler
- //error format
- return new URL( systemID ).getFile() +
- ( line == -1 ? "" : ( ":" + line +
- ( col == -1 ? "" : ( ":" + col ) ) ) ) +
- ": " + spe.getMessage();
- }
- catch( final MalformedURLException mue )
- {
- }
- }
- return spe.getMessage();
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/xml/XMLValidateTask.java b/proposal/myrmidon/src/java/org/apache/antlib/xml/XMLValidateTask.java
deleted file mode 100644
index 5b83b969c..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/xml/XMLValidateTask.java
+++ /dev/null
@@ -1,383 +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.txt file.
- */
-package org.apache.antlib.xml;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.file.Path;
-import org.apache.myrmidon.framework.file.FileListUtil;
-import org.apache.myrmidon.framework.FileSet;
-import org.apache.tools.todo.types.DirectoryScanner;
-import org.apache.tools.todo.types.ScannerUtil;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.Parser;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.ParserAdapter;
-
-/**
- * The <code>XMLValidateTask</code> checks that an XML document is valid, with a
- * SAX validating parser.
- *
- * @author Raphael Pierquin <a href="mailto:raphael.pierquin@agisphere.com">
- * raphael.pierquin@agisphere.com</a>
- */
-public class XMLValidateTask
- extends AbstractTask
-{
- /**
- * The default implementation parser classname used by the task to process
- * validation.
- */
- // The crimson implementation is shipped with ant.
- public static String DEFAULT_XML_READER_CLASSNAME = "org.apache.crimson.parser.XMLReaderImpl";
-
- private static String INIT_FAILED_MSG = "Could not start xml validation: ";
-
- // ant task properties
- // defaults
- private boolean m_warn = true;
- private boolean m_lenient;
- private String m_readerClassName = DEFAULT_XML_READER_CLASSNAME;
- private File m_file;// file to be validated
- private ArrayList m_filesets = new ArrayList();
-
- /**
- * the parser is viewed as a SAX2 XMLReader. If a SAX1 parser is specified,
- * it's wrapped in an adapter that make it behave as a XMLReader. a more
- * 'standard' way of doing this would be to use the JAXP1.1 SAXParser
- * interface.
- */
- private XMLReader m_xmlReader;// XMLReader used to validation process
-
- /**
- * to report sax parsing errors
- */
- private ValidatorErrorHandler m_errorHandler;
- private Hashtable m_features = new Hashtable();
-
- /**
- * The list of configured DTD locations
- */
- private ArrayList m_dtdLocations = new ArrayList();// sets of file to be validated
- private Path m_classpath = new Path();
-
- /**
- * Specify the class name of the SAX parser to be used. (optional)
- *
- * @param className should be an implementation of SAX2 <code>org.xml.sax.XMLReader</code>
- * or SAX2 <code>org.xml.sax.Parser</code>. <p>
- *
- * if className is an implementation of <code>org.xml.sax.Parser</code>
- * , {@link #setLenient(boolean)}, will be ignored. <p>
- *
- * if not set, the default {@link #DEFAULT_XML_READER_CLASSNAME} will
- * be used.
- * @see org.xml.sax.XMLReader
- * @see org.xml.sax.Parser
- */
- public void setClassName( final String className )
- {
- m_readerClassName = className;
- }
-
- /**
- * Specify the classpath to be searched to load the parser (optional)
- */
- public void setClasspath( final String classpath )
- throws TaskException
- {
- m_classpath.add( classpath );
- }
-
- /**
- * specifify the file to be checked
- *
- * @param file The new File value
- */
- public void setFile( File file )
- {
- m_file = file;
- }
-
- /**
- * Specify whether the parser should be validating. Default is <code>true</code>
- * . <p>
- *
- * If set to false, the validation will fail only if the parsed document is
- * not well formed XML. <p>
- *
- * this option is ignored if the specified class with {@link
- * #setClassName(String)} is not a SAX2 XMLReader.
- */
- public void setLenient( final boolean bool )
- {
- m_lenient = bool;
- }
-
- /**
- * Specify how parser error are to be handled. <p>
- *
- * If set to <code>true
- *</true>
- *(default), log a warn message for each SAX warn event.
- */
- public void setWarn( final boolean warn )
- {
- m_warn = warn;
- }
-
- /**
- * specifify a set of file to be checked
- */
- public void addFileset( final FileSet fileSet )
- {
- m_filesets.add( fileSet );
- }
-
- /**
- * @see #setClasspath
- */
- public void addClasspath( final Path path )
- throws TaskException
- {
- m_classpath.add( path );
- }
-
- /**
- * Create a DTD location record. This stores the location of a DTD. The DTD
- * is identified by its public Id. The location may either be a file
- * location or a resource location.
- *
- * @return Description of the Returned Value
- */
- public DTDLocation createDTD()
- {
- final DTDLocation dtdLocation = new DTDLocation();
- m_dtdLocations.add( dtdLocation );
- return dtdLocation;
- }
-
- public void execute()
- throws TaskException
- {
- int fileProcessed = 0;
- final int size = m_filesets.size();
- if( m_file == null && ( size == 0 ) )
- {
- final String message = "Specify at least one source - a file or a fileset.";
- throw new TaskException( message );
- }
-
- initValidator();
-
- if( m_file != null )
- {
- if( m_file.exists() && m_file.canRead() && m_file.isFile() )
- {
- doValidate( m_file );
- fileProcessed++;
- }
- else
- {
- final String message = "File " + m_file + " cannot be read";
- throw new TaskException( message );
- }
- }
-
- for( int i = 0; i < size; i++ )
- {
- final FileSet fileSet = (FileSet)m_filesets.get( i );
- final DirectoryScanner scanner = ScannerUtil.getDirectoryScanner( fileSet );
- final String[] files = scanner.getIncludedFiles();
-
- for( int j = 0; j < files.length; j++ )
- {
- final File srcFile = new File( fileSet.getDir(), files[ j ] );
- doValidate( srcFile );
- fileProcessed++;
- }
- }
- final String message = fileProcessed + " file(s) have been successfully validated.";
- getContext().info( message );
- }
-
- private EntityResolver buildEntityResolver()
- {
- final LocalResolver resolver = new LocalResolver( getContext() );
-
- final int size = m_dtdLocations.size();
- for( int i = 0; i < size; i++ )
- {
- final DTDLocation location = (DTDLocation)m_dtdLocations.get( i );
- resolver.registerDTD( location );
- }
-
- return resolver;
- }
-
- /*
- * set a feature on the parser.
- * TODO: find a way to set any feature from build.xml
- */
- private boolean setFeature( final String feature,
- final boolean value,
- final boolean warn )
- {
- boolean toReturn = false;
- try
- {
- m_xmlReader.setFeature( feature, value );
- toReturn = true;
- }
- catch( SAXNotRecognizedException e )
- {
- final String message = "Could not set feature '" + feature + "' because the parser doesn't recognize it";
- if( warn )
- {
- getContext().warn( message );
- }
- }
- catch( SAXNotSupportedException e )
- {
- final String message = "Could not set feature '" + feature + "' because the parser doesn't support it";
- if( warn )
- {
- getContext().warn( message );
- }
- }
- return toReturn;
- }
-
- /*
- * parse the file
- */
- private void doValidate( File afile )
- throws TaskException
- {
- try
- {
- getContext().debug( "Validating " + afile.getName() + "... " );
- m_errorHandler.reset();
- InputSource is = new InputSource( new FileReader( afile ) );
- String uri = "file:" + afile.getAbsolutePath().replace( '\\', '/' );
- for( int index = uri.indexOf( '#' ); index != -1;
- index = uri.indexOf( '#' ) )
- {
- uri = uri.substring( 0, index ) + "%23" + uri.substring( index + 1 );
- }
- is.setSystemId( uri );
- m_xmlReader.parse( is );
- }
- catch( SAXException ex )
- {
- final String message = "Could not validate document " + afile;
- throw new TaskException( message );
- }
- catch( IOException ex )
- {
- final String message = "Could not validate document " + afile;
- throw new TaskException( message, ex );
- }
-
- if( m_errorHandler.getFailure() )
- {
- final String message = afile + " is not a valid XML document.";
- throw new TaskException( message );
- }
- }
-
- /**
- * init the parser : load the parser class, and set features if necessary
- */
- private void initValidator()
- throws TaskException
- {
- try
- {
- // load the parser class
- // with JAXP, we would use a SAXParser factory
- final ClassLoader classLoader = FileListUtil.createClassLoader( m_classpath, getContext() );
- final Class readerClass = classLoader.loadClass( m_readerClassName );
-
- // then check it implements XMLReader
- if( XMLReader.class.isAssignableFrom( readerClass ) )
- {
-
- m_xmlReader = (XMLReader)readerClass.newInstance();
- getContext().debug( "Using SAX2 reader " + m_readerClassName );
- }
- else
- {
-
- // see if it is a SAX1 Parser
- if( Parser.class.isAssignableFrom( readerClass ) )
- {
- Parser parser = (Parser)readerClass.newInstance();
- m_xmlReader = new ParserAdapter( parser );
- getContext().debug( "Using SAX1 parser " + m_readerClassName );
- }
- else
- {
- throw new TaskException( INIT_FAILED_MSG
- + m_readerClassName
- + " implements nor SAX1 Parser nor SAX2 XMLReader." );
- }
- }
- }
- catch( ClassNotFoundException e )
- {
- throw new TaskException( INIT_FAILED_MSG + m_readerClassName, e );
- }
- catch( InstantiationException e )
- {
- throw new TaskException( INIT_FAILED_MSG + m_readerClassName, e );
- }
- catch( IllegalAccessException e )
- {
- throw new TaskException( INIT_FAILED_MSG + m_readerClassName, e );
- }
-
- m_xmlReader.setEntityResolver( buildEntityResolver() );
-
- m_errorHandler = new ValidatorErrorHandler( m_warn, getContext() );
- m_xmlReader.setErrorHandler( m_errorHandler );
-
- if( !( m_xmlReader instanceof ParserAdapter ) )
- {
- // turn validation on
- if( !m_lenient )
- {
- boolean ok = setFeature( "http://xml.org/sax/features/validation", true, true );
- if( !ok )
- {
- throw new TaskException( INIT_FAILED_MSG
- + m_readerClassName
- + " doesn't provide validation" );
- }
- }
- // set other features
- Enumeration enum = m_features.keys();
- while( enum.hasMoreElements() )
- {
- String featureId = (String)enum.nextElement();
- setFeature( featureId, ( (Boolean)m_features.get( featureId ) ).booleanValue(), true );
- }
- }
- }
-
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTParam.java b/proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTParam.java
deleted file mode 100644
index 0adf87a58..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTParam.java
+++ /dev/null
@@ -1,34 +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.txt file.
- */
-package org.apache.antlib.xml;
-
-public final class XSLTParam
-{
- private String m_name;
- private String m_expression;
-
- public void setExpression( String expression )
- {
- m_expression = expression;
- }
-
- public void setName( String name )
- {
- m_name = name;
- }
-
- protected String getExpression()
- {
- return m_expression;
- }
-
- protected String getName()
- {
- return m_name;
- }
-}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTProcess.java b/proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTProcess.java
deleted file mode 100644
index cab3af969..000000000
--- a/proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTProcess.java
+++ /dev/null
@@ -1,399 +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.txt file.
- */
-package org.apache.antlib.xml;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import javax.xml.transform.Templates;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import org.apache.avalon.excalibur.io.FileUtil;
-import org.apache.avalon.excalibur.io.IOUtil;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.AbstractMatchingTask;
-import org.apache.myrmidon.framework.FileSet;
-import org.apache.tools.todo.types.DirectoryScanner;
-import org.apache.myrmidon.framework.file.Path;
-import org.apache.tools.todo.types.ScannerUtil;
-
-/**
- * A Task to process via XSLT a set of XML documents. This is useful for
- * building views of XML based documentation. arguments:
- * <ul>
- * <li> basedir
- * <li> destdir
- * <li> style
- * <li> includes
- * <li> excludes
- * </ul>
- * Of these arguments, the <b>sourcedir</b> and <b>destdir</b> are required. <p>
- *
- * This task will recursively scan the sourcedir and destdir looking for XML
- * documents to process via XSLT. Any other files, such as images, or html files
- * in the source directory will be copied into the destination directory.
- *
- * @author <a href="mailto:kvisco@exoffice.com">Keith Visco</a>
- * @author <a href="mailto:rubys@us.ibm.com">Sam Ruby</a>
- * @author <a href="mailto:russgold@acm.org">Russell Gold</a>
- * @author <a href="stefan.bodewig@epost.de">Stefan Bodewig</a>
- */
-public class XSLTProcess
- extends AbstractMatchingTask
-{
- private File m_destdir;
- private File m_basedir;
- private String m_targetExtension = ".html";
- private ArrayList m_params = new ArrayList();
- private File m_in;
- private File m_out;
- private Path m_classpath;
- private boolean m_force;
- private File m_stylesheet;
-
- private boolean m_processorPrepared;
- private TransformerFactory m_transformerFactory;
- private Transformer m_transformer;
-
- /**
- * Set the base directory.
- */
- public void setBasedir( final File basedir )
- {
- m_basedir = basedir;
- }
-
- /**
- * Set the classpath to load the Processor through (attribute).
- */
- public void setClasspath( final Path classpath )
- throws TaskException
- {
- addClasspath( classpath );
- }
-
- /**
- * Set the destination directory into which the XSL result files should be
- * copied to
- */
- public void setDestdir( final File destdir )
- {
- m_destdir = destdir;
- }
-
- /**
- * Set the desired file extension to be used for the target
- */
- public void setExtension( final String targetExtension )
- {
- m_targetExtension = targetExtension;
- }
-
- /**
- * Set whether to check dependencies, or always generate.
- */
- public void setForce( final boolean force )
- {
- m_force = force;
- }
-
- /**
- * Sets an input xml file to be styled
- */
- public void setIn( final File in )
- {
- m_in = in;
- }
-
- /**
- * Sets an out file
- */
- public void setOut( final File out )
- {
- m_out = out;
- }
-
- /**
- * Sets the file to use for styling relative to the base directory of this
- * task.
- */
- public void setStyle( final File stylesheet )
- {
- m_stylesheet = stylesheet;
- }
-
- /**
- * Set the classpath to load the Processor through (nested element).
- */
- public void addClasspath( final Path path )
- throws TaskException
- {
- if( m_classpath == null )
- {
- m_classpath = new Path();
- }
- m_classpath.add( path );
- }
-
- public void addParam( final XSLTParam param )
- {
- m_params.add( param );
- }
-
- public void execute()
- throws TaskException
- {
- validate();
-
- final FileSet fileSet = getFileSet();
- fileSet.setDir( m_basedir );
- final DirectoryScanner scanner = ScannerUtil.getDirectoryScanner( fileSet );
-
- prepareProcessor();
-
- // if we have an in file and out then process them
- if( m_in != null && m_out != null )
- {
- processSingleFile( m_in, m_out );
- return;
- }
-
- final String message = "Transforming into " + m_destdir;
- getContext().info( message );
-
- // Process all the files marked for styling
- processFiles( scanner );
-
- // Process all the directoried marked for styling
- processDirs( scanner );
- }
-
- private void validate()
- throws TaskException
- {
- if( null == m_stylesheet )
- {
- final String message = "no stylesheet specified";
- throw new TaskException( message );
- }
-
- if( null == m_basedir )
- {
- m_basedir = getBaseDirectory();
- }
-
- //-- make sure Source directory exists...
- if( null == m_destdir )
- {
- final String message = "destdir attributes must be set!";
- throw new TaskException( message );
- }
- }
-
- private void processDirs( final DirectoryScanner scanner )
- throws TaskException
- {
- final String[] dirs = scanner.getIncludedDirectories();
- for( int i = 0; i < dirs.length; i++ )
- {
- final String[] list = new File( m_basedir, dirs[ i ] ).list();
- for( int j = 0; j < list.length; j++ )
- {
- process( m_basedir, list[ j ], m_destdir );
- }
- }
- }
-
- private void processFiles( final DirectoryScanner scanner )
- throws TaskException
- {
- final String[] list = scanner.getIncludedFiles();
- for( int i = 0; i < list.length; ++i )
- {
- process( m_basedir, list[ i ], m_destdir );
- }
- }
-
- /**
- * Create transformer factory, loads the stylesheet and set xsl:param parameters.
- */
- protected void prepareProcessor()
- throws TaskException
- {
- if( m_processorPrepared )
- {
- return;
- }
- m_processorPrepared = true;
-
- //Note the next line should use the specified Classpath
- //and load the class dynaically
- m_transformerFactory = TransformerFactory.newInstance();
- m_transformerFactory.setErrorListener( new TraxErrorListener( true ) );
- //m_transformer.setOutputProperty( OutputKeys.METHOD, m_type );
-
- try
- {
- getContext().info( "Loading stylesheet " + m_stylesheet );
- specifyStylesheet();
- specifyParams();
- }
- catch( final Exception e )
- {
- final String message = "Failed to read stylesheet " + m_stylesheet;
- throw new TaskException( e.getMessage(), e );
- }
- }
-
- private void specifyStylesheet()
- throws Exception
- {
- final FileInputStream xslStream = new FileInputStream( m_stylesheet );
- try
- {
- final StreamSource source = new StreamSource( xslStream );
- source.setSystemId( getSystemId( m_stylesheet ) );
- final Templates template = m_transformerFactory.newTemplates( source );
- m_transformer = template.newTransformer();
- m_transformer.setErrorListener( new TraxErrorListener( true ) );
- }
- finally
- {
- IOUtil.shutdownStream( xslStream );
- }
- }
-
- private void specifyParams() throws TaskException
- {
- final Iterator params = m_params.iterator();
- while( params.hasNext() )
- {
- final XSLTParam param = (XSLTParam)params.next();
-
- final String expression = param.getExpression();
- if( expression == null )
- {
- throw new TaskException( "Expression attribute is missing." );
- }
-
- final String name = param.getName();
- if( name == null )
- {
- throw new TaskException( "Name attribute is missing." );
- }
-
- m_transformer.setParameter( name, expression );
- }
- }
-
- /**
- * Processes the given input XML file and stores the result in the given
- * resultFile.
- */
- private void process( final File baseDir, final String xmlFile, final File destDir )
- throws TaskException
- {
- final String filename = FileUtil.removeExtension( xmlFile );
-
- final File in = new File( baseDir, xmlFile );
- final File out = new File( destDir, filename + m_targetExtension );
-
- processFile( in, out );
- }
-
- private void processFile( final File in, final File out )
- throws TaskException
- {
- final long styleSheetLastModified = m_stylesheet.lastModified();
- try
- {
- if( m_force ||
- in.lastModified() > out.lastModified() ||
- styleSheetLastModified > out.lastModified() )
- {
- ensureDirectoryFor( out );
-
- final String notice = "Processing " + in + " to " + out;
- getContext().info( notice );
- transform( in, out );
- }
- }
- catch( final Exception e )
- {
- // If failed to process document, must delete target document,
- // or it will not attempt to process it the second time
- final String message = "Failed to process " + in;
- getContext().info( message );
- if( out != null )
- {
- out.delete();
- }
-
- throw new TaskException( e.getMessage(), e );
- }
- }
-
- private void processSingleFile( final File in, final File out )
- throws TaskException
- {
- final long styleSheetLastModified = m_stylesheet.lastModified();
- getContext().debug( "In file " + in + " time: " + in.lastModified() );
- getContext().debug( "Out file " + out + " time: " + out.lastModified() );
- getContext().debug( "Style file " + m_stylesheet + " time: " + styleSheetLastModified );
-
- processFile( in, out );
- }
-
- private void transform( final File in, final File out )
- throws Exception
- {
- FileInputStream fis = null;
- FileOutputStream fos = null;
- try
- {
- fis = new FileInputStream( in );
- fos = new FileOutputStream( out );
- final StreamSource source = new StreamSource( fis, getSystemId( in ) );
- final StreamResult result = new StreamResult( fos );
-
- m_transformer.transform( source, result );
- }
- finally
- {
- IOUtil.shutdownStream( fis );
- IOUtil.shutdownStream( fos );
- }
- }
-
- private String getSystemId( final File file )
- throws IOException
- {
- return file.getCanonicalFile().toURL().toExternalForm();
- }
-
- private void ensureDirectoryFor( final File targetFile )
- throws TaskException
- {
- //In future replace me with
- //FileUtil.forceMkdir( targetFile.getParent() );
- File directory = new File( targetFile.getParent() );
- if( !directory.exists() )
- {
- if( !directory.mkdirs() )
- {
- throw new TaskException( "Unable to create directory: " +
- directory.getAbsolutePath() );
- }
- }
- }
-}