diff --git a/proposal/myrmidon/src/java/org/apache/antlib/archive/Pack.java b/proposal/myrmidon/src/java/org/apache/antlib/archive/Pack.java
index 60529f184..92f508c13 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/archive/Pack.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/archive/Pack.java
@@ -15,6 +15,7 @@ import java.io.OutputStream;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
/**
* Abstract Base class for pack tasks.
@@ -43,7 +44,7 @@ public abstract class Pack
{
validate();
final String message = "Building: " + m_zipFile.getAbsolutePath();
- getLogger().info( message );
+ getContext().info( message );
pack();
}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/archive/Unpack.java b/proposal/myrmidon/src/java/org/apache/antlib/archive/Unpack.java
index 012b86935..63cbfcd6c 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/archive/Unpack.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/archive/Unpack.java
@@ -16,6 +16,7 @@ import java.io.OutputStream;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
/**
* Abstract Base class for unpack tasks.
@@ -52,7 +53,7 @@ public abstract class Unpack
{
final String message = "Expanding " + src.getAbsolutePath() +
" to " + dest.getAbsolutePath();
- getLogger().info( message );
+ getContext().info( message );
extract();
}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/build/Checksum.java b/proposal/myrmidon/src/java/org/apache/antlib/build/Checksum.java
index 500c8371f..ba895d7af 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/build/Checksum.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/build/Checksum.java
@@ -21,6 +21,8 @@ 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.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.AbstractMatchingTask;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
@@ -195,7 +197,7 @@ public class Checksum
{
final String message = file + " omitted as " + dest +
" is up to date.";
- getLogger().debug( message );
+ getContext().debug( message );
}
}
else
@@ -207,7 +209,7 @@ public class Checksum
{
final String message = "Could not find file " + file.getAbsolutePath() +
" to generate checksum for.";
- getLogger().info( message );
+ getContext().info( message );
throw new TaskException( message );
}
}
@@ -225,7 +227,7 @@ public class Checksum
{
final File src = (File)includes.nextElement();
final String message = "Calculating " + m_algorithm + " checksum for " + src;
- getLogger().info( message );
+ getContext().info( message );
checksumMatches = z( src, checksumMatches );
}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/build/SleepTask.java b/proposal/myrmidon/src/java/org/apache/antlib/build/SleepTask.java
index 49b096377..989b51b8b 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/build/SleepTask.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/build/SleepTask.java
@@ -11,6 +11,7 @@ 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.api.TaskContext;
/**
* A task to sleep for a period of time
@@ -91,7 +92,7 @@ public class SleepTask
final long sleepTime = getSleepTime();
final String message = REZ.getString( "sleep.duration.notice", new Long( sleepTime ) );
- getLogger().debug( message );
+ getContext().debug( message );
doSleep( sleepTime );
}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/core/LoadProperties.java b/proposal/myrmidon/src/java/org/apache/antlib/core/LoadProperties.java
index f2a1bdf69..272ef6f58 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/LoadProperties.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/core/LoadProperties.java
@@ -16,6 +16,7 @@ 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;
+import org.apache.myrmidon.api.TaskContext;
/**
* This task loads properties from a property file and places them in the context.
@@ -73,18 +74,18 @@ public class LoadProperties
private void loadFile( final File file )
throws TaskException
{
- if( getLogger().isDebugEnabled() )
+ if( getContext().isDebugEnabled() )
{
final String message =
REZ.getString( "loadprop.file.notice", file.getAbsolutePath() );
- getLogger().debug( message );
+ getContext().debug( message );
}
if( !file.exists() )
{
final String message =
REZ.getString( "loadprop.missing-file.notice", file.getAbsolutePath() );
- getLogger().debug( message );
+ getContext().debug( message );
}
else
{
@@ -120,7 +121,7 @@ public class LoadProperties
catch( final TaskException te )
{
final String message = REZ.getString( "loadprop.bad-resolve.error", name, value );
- getLogger().info( message, te );
+ 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
index 56430ead2..8b55511ad 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/core/Log.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/core/Log.java
@@ -9,7 +9,8 @@ package org.apache.antlib.core;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.LogLevel;
+import org.apache.myrmidon.api.TaskContext;
+import org.apache.myrmidon.api.LogLevel;
/**
* This is a task used to log messages in the build file.
@@ -33,7 +34,7 @@ public class Log
/**
* Set the level at which the message will be logged.
*
- * @param the level at which message will be logged
+ * @param level the level at which message will be logged
*/
public void setLevel( final LogLevel level )
{
@@ -64,7 +65,7 @@ public class Log
public void execute()
throws TaskException
{
- LogLevel.log( getLogger(), m_message, m_level );
+ getContext().log( m_level, m_message );
}
/**
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/cvslib/CVSPass.java b/proposal/myrmidon/src/java/org/apache/antlib/cvslib/CVSPass.java
index 16fafaf4d..fd7e6a5ea 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/cvslib/CVSPass.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/cvslib/CVSPass.java
@@ -16,6 +16,7 @@ import java.io.PrintWriter;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
/**
* CVSLogin Adds an new entry to a CVS password file
@@ -112,9 +113,9 @@ public class CVSPass
throw new TaskException( "password is required" );
}
- getLogger().debug( "cvsRoot: " + m_cvsRoot );
- getLogger().debug( "password: " + m_password );
- getLogger().debug( "passFile: " + m_passwordFile );
+ getContext().debug( "cvsRoot: " + m_cvsRoot );
+ getContext().debug( "password: " + m_password );
+ getContext().debug( "passFile: " + m_passwordFile );
//FIXME: Should not be writing the whole file - Just append to the file
//Also should have EOL configurable
@@ -142,7 +143,7 @@ public class CVSPass
final String pwdfile =
sb.toString() + m_cvsRoot + " A" + mangle( m_password );
- getLogger().debug( "Writing -> " + pwdfile );
+ getContext().debug( "Writing -> " + pwdfile );
final PrintWriter writer =
new PrintWriter( new FileWriter( m_passwordFile ) );
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/dotnet/CSharp.java b/proposal/myrmidon/src/java/org/apache/antlib/dotnet/CSharp.java
index eed575cfa..873955384 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/dotnet/CSharp.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/dotnet/CSharp.java
@@ -10,6 +10,8 @@ package org.apache.antlib.dotnet;
import java.io.File;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.Commandline;
@@ -537,7 +539,7 @@ public class CSharp
final String[] dependencies = scanner.getIncludedFiles();
final String message = "compiling " + dependencies.length + " file" +
( ( dependencies.length == 1 ) ? "" : "s" );
- getLogger().info( message );
+ getContext().info( message );
final String baseDir = scanner.getBasedir().toString();
//add to the command
for( int i = 0; i < dependencies.length; i++ )
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/dotnet/Ilasm.java b/proposal/myrmidon/src/java/org/apache/antlib/dotnet/Ilasm.java
index 9548c02b9..377046ded 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/dotnet/Ilasm.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/dotnet/Ilasm.java
@@ -10,6 +10,8 @@ package org.apache.antlib.dotnet;
import java.io.File;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.Commandline;
@@ -229,7 +231,7 @@ public class Ilasm
final String message = "assembling " + dependencies.length + " file" +
( ( dependencies.length == 1 ) ? "" : "s" );
- getLogger().info( message );
+ getContext().info( message );
//add to the command
for( int i = 0; i < dependencies.length; i++ )
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/file/CopyTask.java b/proposal/myrmidon/src/java/org/apache/antlib/file/CopyTask.java
index 9dfe36bd3..1be1ce2e3 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/file/CopyTask.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/file/CopyTask.java
@@ -18,6 +18,7 @@ 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.api.TaskContext;
import org.apache.myrmidon.framework.FileNameMapper;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
@@ -131,7 +132,7 @@ public class CopyTask
{
final String message =
REZ.getString( "copy.omit-uptodate.notice", m_file, m_destFile );
- getLogger().debug( message );
+ getContext().debug( message );
}
}
@@ -287,7 +288,6 @@ public class CopyTask
else
{
final SourceFileScanner scanner = new SourceFileScanner();
- setupLogger( scanner );
return scanner.restrict( names, fromDir, toDir, mapper, getContext() );
}
}
@@ -329,7 +329,7 @@ public class CopyTask
{
final String message =
REZ.getString( "copy.selfcopy-ignored.notice", source );
- getLogger().info( message );
+ getContext().info( message );
continue;
}
@@ -337,7 +337,7 @@ public class CopyTask
{
final String message =
REZ.getString( "copy.filecopy.notice", source, destination );
- getLogger().info( message );
+ getContext().info( message );
doOperation( source, destination );
}
@@ -367,7 +367,7 @@ public class CopyTask
{
final String message =
REZ.getString( "copy.dircopy.error", dir.getAbsolutePath() );
- getLogger().error( message );
+ getContext().error( message );
}
else
{
@@ -431,7 +431,7 @@ public class CopyTask
REZ.getString( "copy.dir-count.notice",
new Integer( count ),
m_destDir.getAbsolutePath() );
- getLogger().info( message );
+ getContext().info( message );
}
/**
@@ -439,13 +439,13 @@ public class CopyTask
*/
private void displayFilecountNotice( final int count )
{
- if( getLogger().isInfoEnabled() )
+ if( getContext().isInfoEnabled() )
{
final String message =
REZ.getString( "copy.file-count.notice",
new Integer( count ),
m_destDir.getAbsolutePath() );
- getLogger().info( message );
+ 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
index 23baba5b4..a2a61e6a5 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/file/Delete.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/file/Delete.java
@@ -13,6 +13,7 @@ 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.api.TaskContext;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.ScannerUtil;
@@ -86,7 +87,7 @@ public class Delete
{
final String message =
REZ.getString( "delete.delete-dir.notice", m_dir.getAbsolutePath() );
- getLogger().info( message );
+ getContext().info( message );
deleteDir( m_dir );
}
@@ -123,7 +124,7 @@ public class Delete
{
final String message =
REZ.getString( "delete.missing-file.error", m_file.getAbsolutePath() );
- getLogger().debug( message );
+ getContext().debug( message );
}
}
@@ -136,11 +137,11 @@ public class Delete
deleteFiles( list );
}
- if( getLogger().isDebugEnabled() )
+ if( getContext().isDebugEnabled() )
{
final String message =
REZ.getString( "delete.delete-dir.notice", m_dir.getAbsolutePath() );
- getLogger().debug( message );
+ getContext().debug( message );
}
if( !baseDir.delete() )
@@ -171,11 +172,11 @@ public class Delete
private void deleteFile( final File file )
throws TaskException
{
- if( getLogger().isDebugEnabled() )
+ if( getContext().isDebugEnabled() )
{
final String message =
REZ.getString( "delete.delete-file.notice", file.getAbsolutePath() );
- getLogger().debug( message );
+ getContext().debug( message );
}
if( !file.delete() )
@@ -205,7 +206,7 @@ public class Delete
REZ.getString( "delete.delete-file.error",
new Integer( files.length ),
baseDir.getAbsolutePath() );
- getLogger().info( message );
+ getContext().info( message );
for( int i = 0; i < files.length; i++ )
{
final File file = new File( baseDir, files[ i ] );
@@ -233,7 +234,7 @@ public class Delete
REZ.getString( "delete.summary.notice",
new Integer( dirCount ),
baseDir.getAbsolutePath() );
- getLogger().info( message );
+ 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
index 6c87f23c5..a42a8e030 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/file/FilteredCopyTask.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/file/FilteredCopyTask.java
@@ -142,7 +142,6 @@ public class FilteredCopyTask
for( int i = 0; i < size; i++ )
{
final FilterSet filterSet = (FilterSet)m_filterSets.get( i );
- setupLogger( filterSet );
m_filterSetCollection.addFilterSet( filterSet );
}
}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/file/Mkdir.java b/proposal/myrmidon/src/java/org/apache/antlib/file/Mkdir.java
index f280a865f..a1a2f47c5 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/file/Mkdir.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/file/Mkdir.java
@@ -12,6 +12,7 @@ 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.api.TaskContext;
/**
* Creates specified directory.
@@ -61,7 +62,7 @@ public class Mkdir
}
final String message =
REZ.getString( "mkdir.create.notice", m_dir.getAbsolutePath() );
- getLogger().info( message );
+ getContext().info( message );
}
}
}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/file/Touch.java b/proposal/myrmidon/src/java/org/apache/antlib/file/Touch.java
index c1ab070d8..d8e217956 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/file/Touch.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/file/Touch.java
@@ -18,6 +18,7 @@ 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.api.TaskContext;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.ScannerUtil;
@@ -141,10 +142,10 @@ public class Touch
{
if( !m_file.exists() )
{
- if( getLogger().isInfoEnabled() )
+ if( getContext().isInfoEnabled() )
{
final String message = REZ.getString( "touch.create.notice", m_file );
- getLogger().info( message );
+ getContext().info( message );
}
try
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/nativelib/Exec.java b/proposal/myrmidon/src/java/org/apache/antlib/nativelib/Exec.java
index 166b4f0f3..0a786e046 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/nativelib/Exec.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/nativelib/Exec.java
@@ -15,6 +15,7 @@ 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.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Commandline;
@@ -170,8 +171,8 @@ public class Exec
private void logExecDetails( final Properties environment )
{
// show the command
- getLogger().debug( m_command.toString() );
+ getContext().debug( m_command.toString() );
final String message = REZ.getString( "exec.env-vars.notice", environment );
- getLogger().debug( message );
+ getContext().debug( message );
}
}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/nativelib/LoadEnvironment.java b/proposal/myrmidon/src/java/org/apache/antlib/nativelib/LoadEnvironment.java
index 88220ec81..ee5045d60 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/nativelib/LoadEnvironment.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/nativelib/LoadEnvironment.java
@@ -15,6 +15,7 @@ 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.api.TaskContext;
/**
* This task is responsible for loading that OS-specific environment
@@ -52,13 +53,13 @@ public class LoadEnvironment
m_prefix += ".";
}
- if( getLogger().isDebugEnabled() )
+ if( getContext().isDebugEnabled() )
{
final String displayPrefix =
m_prefix.substring( 0, m_prefix.length() - 1 );
final String message =
REZ.getString( "loadenv.prefix.notice", displayPrefix );
- getLogger().debug( message );
+ getContext().debug( message );
}
final Properties environment = loadNativeEnvironment();
@@ -71,7 +72,7 @@ public class LoadEnvironment
if( value.equals( "" ) )
{
final String message = REZ.getString( "loadenv.ignoring-empty.warn", key );
- getLogger().warn( message );
+ getContext().warn( message );
}
else
{
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/security/GenerateKey.java b/proposal/myrmidon/src/java/org/apache/antlib/security/GenerateKey.java
index f20831575..3f316a10b 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/security/GenerateKey.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/security/GenerateKey.java
@@ -10,6 +10,7 @@ package org.apache.antlib.security;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline;
@@ -117,7 +118,7 @@ public class GenerateKey
validate();
final String message = "Generating Key for " + m_alias;
- getLogger().info( message );
+ getContext().info( message );
final Commandline cmd = createCommand();
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/security/SignJar.java b/proposal/myrmidon/src/java/org/apache/antlib/security/SignJar.java
index 2c6f9d8b2..29b6cef0e 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/security/SignJar.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/security/SignJar.java
@@ -16,6 +16,7 @@ import java.util.zip.ZipFile;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.DirectoryScanner;
@@ -292,7 +293,7 @@ public class SignJar
}
final String message = "Signing Jar : " + jarSource.getAbsolutePath();
- getLogger().info( message );
+ getContext().info( message );
final Commandline cmd = buildCommand( jarTarget, jarSource );
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/selftest/PrimitiveTypesTest.java b/proposal/myrmidon/src/java/org/apache/antlib/selftest/PrimitiveTypesTest.java
index d1ddac770..a02bf72d7 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/selftest/PrimitiveTypesTest.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/selftest/PrimitiveTypesTest.java
@@ -9,6 +9,7 @@ package org.apache.antlib.selftest;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
/**
* Test conversion of all the primitive types.
@@ -21,67 +22,67 @@ public class PrimitiveTypesTest
{
public void setInteger( final Integer value )
{
- getLogger().warn( "setInteger( " + value + " );" );
+ getContext().warn( "setInteger( " + value + " );" );
}
public void setInteger2( final int value )
{
- getLogger().warn( "setInteger2( " + value + " );" );
+ getContext().warn( "setInteger2( " + value + " );" );
}
public void setShort( final Short value )
{
- getLogger().warn( "setShort( " + value + " );" );
+ getContext().warn( "setShort( " + value + " );" );
}
public void setShort2( final short value )
{
- getLogger().warn( "setShort2( " + value + " );" );
+ getContext().warn( "setShort2( " + value + " );" );
}
public void setByte( final Byte value )
{
- getLogger().warn( "setByte( " + value + " );" );
+ getContext().warn( "setByte( " + value + " );" );
}
public void setByte2( final byte value )
{
- getLogger().warn( "setByte2( " + value + " );" );
+ getContext().warn( "setByte2( " + value + " );" );
}
public void setLong( final Long value )
{
- getLogger().warn( "setLong( " + value + " );" );
+ getContext().warn( "setLong( " + value + " );" );
}
public void setLong2( final long value )
{
- getLogger().warn( "setLong2( " + value + " );" );
+ getContext().warn( "setLong2( " + value + " );" );
}
public void setFloat( final Float value )
{
- getLogger().warn( "setFloat( " + value + " );" );
+ getContext().warn( "setFloat( " + value + " );" );
}
public void setFloat2( final float value )
{
- getLogger().warn( "setFloat2( " + value + " );" );
+ getContext().warn( "setFloat2( " + value + " );" );
}
public void setDouble( final Double value )
{
- getLogger().warn( "setDouble( " + value + " );" );
+ getContext().warn( "setDouble( " + value + " );" );
}
public void setDouble2( final double value )
{
- getLogger().warn( "setDouble2( " + value + " );" );
+ getContext().warn( "setDouble2( " + value + " );" );
}
public void setString( final String value )
{
- getLogger().warn( "setString( " + value + " );" );
+ getContext().warn( "setString( " + value + " );" );
}
public void execute()
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/sound/SoundTask.java b/proposal/myrmidon/src/java/org/apache/antlib/sound/SoundTask.java
index e4c165262..e599242a3 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/sound/SoundTask.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/sound/SoundTask.java
@@ -14,6 +14,7 @@ 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.api.TaskContext;
import org.apache.myrmidon.interfaces.workspace.Workspace;
/**
@@ -57,7 +58,7 @@ public class SoundTask
if( null == m_success )
{
final String message = REZ.getString( "sound.missing-success.error" );
- getLogger().warn( message );
+ getContext().warn( message );
}
else
{
@@ -70,7 +71,7 @@ public class SoundTask
if( null == m_fail )
{
final String message = REZ.getString( "sound.missing-failure.error" );
- getLogger().warn( message );
+ getContext().warn( message );
}
else
{
@@ -127,7 +128,7 @@ public class SoundTask
else
{
final String message = REZ.getString( "sound.invalid-path.error", source );
- getLogger().warn( message );
+ 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
index 5ebcb253e..4502a3131 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/CopyFilesTask.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/vfile/CopyFilesTask.java
@@ -17,6 +17,7 @@ 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.api.TaskContext;
/**
* A task that copies files.
@@ -113,7 +114,7 @@ public class CopyFilesTask
m_destFile = m_destDir.resolveFile( m_srcFile.getName().getBaseName() );
}
- getLogger().info( "copy " + m_srcFile + " to " + m_destFile );
+ getContext().info( "copy " + m_srcFile + " to " + m_destFile );
m_destFile.copy( m_srcFile );
}
@@ -141,7 +142,7 @@ public class CopyFilesTask
final FileObject destFile = m_destDir.resolveFile( path, NameScope.DESCENDENT );
// Copy the file across
- getLogger().info( "copy " + srcFile + " to " + destFile );
+ getContext().info( "copy " + srcFile + " to " + destFile );
destFile.copy( srcFile );
}
}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/vfile/ListFileSetTask.java b/proposal/myrmidon/src/java/org/apache/antlib/vfile/ListFileSetTask.java
index bd2ff212c..f3f35c2ab 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/ListFileSetTask.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/vfile/ListFileSetTask.java
@@ -11,6 +11,7 @@ import java.util.ArrayList;
import org.apache.aut.vfs.FileObject;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
/**
* A debug task, that lists the contents of a {@link FileSet}.
@@ -47,7 +48,7 @@ public class ListFileSetTask
{
final FileObject file = files[ j ];
final String path = paths[ j ];
- getLogger().info( path + " = " + file );
+ 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
index 8c99dcb54..684fa7dcd 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/vfile/ListFilesTask.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/vfile/ListFilesTask.java
@@ -10,6 +10,7 @@ package org.apache.antlib.vfile;
import org.apache.aut.vfs.FileObject;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
/**
* A debug task, which prints out the files in a file list.
@@ -41,7 +42,7 @@ public class ListFilesTask
for( int i = 0; i < files.length; i++ )
{
FileObject file = files[ i ];
- getLogger().info( file.toString() );
+ getContext().info( file.toString() );
}
}
}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/xml/LocalResolver.java b/proposal/myrmidon/src/java/org/apache/antlib/xml/LocalResolver.java
index ba531262a..6659217dd 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/xml/LocalResolver.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/xml/LocalResolver.java
@@ -15,18 +15,23 @@ import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Hashtable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
+import org.apache.myrmidon.api.TaskContext;
class LocalResolver
- extends AbstractLogEnabled
implements EntityResolver
{
- private Hashtable m_fileDTDs = new Hashtable();
- private Hashtable m_resourceDTDs = new Hashtable();
- private Hashtable m_urlDTDs = new Hashtable();
+ 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 )
{
@@ -42,19 +47,19 @@ class LocalResolver
{
m_fileDTDs.put( publicId, fileDTD );
final String message = "Mapped publicId " + publicId + " to file " + fileDTD;
- getLogger().debug( message );
+ m_context.debug( message );
}
return;
}
- if( LocalResolver.this.getClass().getResource( location ) != null )
+ if( getClass().getResource( location ) != null )
{
if( publicId != null )
{
m_resourceDTDs.put( publicId, location );
final String message = "Mapped publicId " + publicId +
" to resource " + location;
- getLogger().debug( message );
+ m_context.debug( message );
}
}
@@ -86,7 +91,7 @@ class LocalResolver
try
{
final String message = "Resolved " + publicId + " to local file " + dtdFile;
- getLogger().debug( message );
+ m_context.debug( message );
return new InputSource( new FileInputStream( dtdFile ) );
}
catch( FileNotFoundException ex )
@@ -101,7 +106,7 @@ class LocalResolver
InputStream is = getClass().getResourceAsStream( dtdResourceName );
if( is != null )
{
- getLogger().debug( "Resolved " + publicId + " to local resource " + dtdResourceName );
+ m_context.debug( "Resolved " + publicId + " to local resource " + dtdResourceName );
return new InputSource( is );
}
}
@@ -113,7 +118,7 @@ class LocalResolver
{
InputStream is = dtdUrl.openStream();
final String message = "Resolved " + publicId + " to url " + dtdUrl;
- getLogger().debug( message );
+ m_context.debug( message );
return new InputSource( is );
}
catch( IOException ioe )
@@ -124,7 +129,7 @@ class LocalResolver
final String message = "Could not resolve ( publicId: " + publicId +
", systemId: " + systemId + ") to a local entity";
- getLogger().info( message );
+ m_context.info( message );
return null;
}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/xml/ValidatorErrorHandler.java b/proposal/myrmidon/src/java/org/apache/antlib/xml/ValidatorErrorHandler.java
index 75f0d8692..95fc589d2 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/xml/ValidatorErrorHandler.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/xml/ValidatorErrorHandler.java
@@ -9,9 +9,9 @@ package org.apache.antlib.xml;
import java.net.MalformedURLException;
import java.net.URL;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXParseException;
+import org.apache.myrmidon.api.TaskContext;
/*
* ValidatorErrorHandler role :
@@ -21,27 +21,28 @@ import org.xml.sax.SAXParseException;
*
*/
final class ValidatorErrorHandler
- extends AbstractLogEnabled
implements ErrorHandler
{
private final boolean m_warn;
+ private final TaskContext m_context;
private boolean m_failed;
- protected ValidatorErrorHandler( final boolean warn )
+ protected ValidatorErrorHandler( final boolean warn, final TaskContext context )
{
m_warn = warn;
+ m_context = context;
}
public void error( final SAXParseException spe )
{
m_failed = true;
- getLogger().error( getMessage( spe ), spe );
+ m_context.error( getMessage( spe ), spe );
}
public void fatalError( final SAXParseException spe )
{
m_failed = true;
- getLogger().error( getMessage( spe ), spe );
+ m_context.error( getMessage( spe ), spe );
}
public void warning( final SAXParseException spe )
@@ -50,7 +51,7 @@ final class ValidatorErrorHandler
// only output then if user explicitely asked for it
if( m_warn )
{
- getLogger().warn( getMessage( spe ), spe );
+ m_context.warn( getMessage( spe ), spe );
}
}
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/xml/XMLValidateTask.java b/proposal/myrmidon/src/java/org/apache/antlib/xml/XMLValidateTask.java
index c85a467c4..27fe59cad 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/xml/XMLValidateTask.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/xml/XMLValidateTask.java
@@ -229,13 +229,12 @@ public class XMLValidateTask
}
}
final String message = fileProcessed + " file(s) have been successfully validated.";
- getLogger().info( message );
+ getContext().info( message );
}
private EntityResolver buildEntityResolver()
{
- final LocalResolver resolver = new LocalResolver();
- setupLogger( resolver );
+ final LocalResolver resolver = new LocalResolver( getContext() );
final int size = m_dtdLocations.size();
for( int i = 0; i < size; i++ )
@@ -266,7 +265,7 @@ public class XMLValidateTask
final String message = "Could not set feature '" + feature + "' because the parser doesn't recognize it";
if( warn )
{
- getLogger().warn( message );
+ getContext().warn( message );
}
}
catch( SAXNotSupportedException e )
@@ -274,7 +273,7 @@ public class XMLValidateTask
final String message = "Could not set feature '" + feature + "' because the parser doesn't support it";
if( warn )
{
- getLogger().warn( message );
+ getContext().warn( message );
}
}
return toReturn;
@@ -288,7 +287,7 @@ public class XMLValidateTask
{
try
{
- getLogger().debug( "Validating " + afile.getName() + "... " );
+ getContext().debug( "Validating " + afile.getName() + "... " );
m_errorHandler.reset();
InputSource is = new InputSource( new FileReader( afile ) );
String uri = "file:" + afile.getAbsolutePath().replace( '\\', '/' );
@@ -345,7 +344,7 @@ public class XMLValidateTask
{
m_xmlReader = (XMLReader)readerClass.newInstance();
- getLogger().debug( "Using SAX2 reader " + m_readerClassName );
+ getContext().debug( "Using SAX2 reader " + m_readerClassName );
}
else
{
@@ -355,7 +354,7 @@ public class XMLValidateTask
{
Parser parser = (Parser)readerClass.newInstance();
m_xmlReader = new ParserAdapter( parser );
- getLogger().debug( "Using SAX1 parser " + m_readerClassName );
+ getContext().debug( "Using SAX1 parser " + m_readerClassName );
}
else
{
@@ -380,8 +379,7 @@ public class XMLValidateTask
m_xmlReader.setEntityResolver( buildEntityResolver() );
- m_errorHandler = new ValidatorErrorHandler( m_warn );
- setupLogger( m_errorHandler );
+ m_errorHandler = new ValidatorErrorHandler( m_warn, getContext() );
m_xmlReader.setErrorHandler( m_errorHandler );
if( !( m_xmlReader instanceof ParserAdapter ) )
diff --git a/proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTProcess.java b/proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTProcess.java
index ff3f0cf07..918a88e97 100644
--- a/proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTProcess.java
+++ b/proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTProcess.java
@@ -21,6 +21,8 @@ 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.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.AbstractMatchingTask;
import org.apache.myrmidon.framework.FileSet;
import org.apache.tools.ant.types.DirectoryScanner;
@@ -169,7 +171,7 @@ public class XSLTProcess
}
final String message = "Transforming into " + m_destdir;
- getLogger().info( message );
+ getContext().info( message );
// Process all the files marked for styling
processFiles( scanner );
@@ -244,14 +246,14 @@ public class XSLTProcess
try
{
- getLogger().info( "Loading stylesheet " + m_stylesheet );
+ getContext().info( "Loading stylesheet " + m_stylesheet );
specifyStylesheet();
specifyParams();
}
catch( final Exception e )
{
final String message = "Failed to read stylesheet " + m_stylesheet;
- getLogger().info( message );
+ getContext().info( message );
throw new TaskException( e.getMessage(), e );
}
}
@@ -325,7 +327,7 @@ public class XSLTProcess
ensureDirectoryFor( out );
final String notice = "Processing " + in + " to " + out;
- getLogger().info( notice );
+ getContext().info( notice );
transform( in, out );
}
}
@@ -334,7 +336,7 @@ public class XSLTProcess
// 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;
- getLogger().info( message );
+ getContext().info( message );
if( out != null )
{
out.delete();
@@ -348,9 +350,9 @@ public class XSLTProcess
throws TaskException
{
final long styleSheetLastModified = m_stylesheet.lastModified();
- getLogger().debug( "In file " + in + " time: " + in.lastModified() );
- getLogger().debug( "Out file " + out + " time: " + out.lastModified() );
- getLogger().debug( "Style file " + m_stylesheet + " time: " + styleSheetLastModified );
+ 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 );
}
diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/api/AbstractTask.java b/proposal/myrmidon/src/java/org/apache/myrmidon/api/AbstractTask.java
index 7d700e39e..3b00b31be 100644
--- a/proposal/myrmidon/src/java/org/apache/myrmidon/api/AbstractTask.java
+++ b/proposal/myrmidon/src/java/org/apache/myrmidon/api/AbstractTask.java
@@ -8,7 +8,6 @@
package org.apache.myrmidon.api;
import java.io.File;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
/**
* This is the class that Task writers should extend to provide custom tasks.
@@ -17,7 +16,6 @@ import org.apache.avalon.framework.logger.AbstractLogEnabled;
* @version $Revision$ $Date$
*/
public abstract class AbstractTask
- extends AbstractLogEnabled
implements Task
{
///Variable to hold context for use by sub-classes
diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/LogLevel.java b/proposal/myrmidon/src/java/org/apache/myrmidon/api/LogLevel.java
similarity index 53%
rename from proposal/myrmidon/src/java/org/apache/myrmidon/framework/LogLevel.java
rename to proposal/myrmidon/src/java/org/apache/myrmidon/api/LogLevel.java
index 39459fc6d..eb45c842f 100644
--- a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/LogLevel.java
+++ b/proposal/myrmidon/src/java/org/apache/myrmidon/api/LogLevel.java
@@ -5,12 +5,11 @@
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
-package org.apache.myrmidon.framework;
+package org.apache.myrmidon.api;
import java.util.HashMap;
import java.util.Set;
import org.apache.avalon.framework.Enum;
-import org.apache.avalon.framework.logger.Logger;
/**
* Type safe Enum for Log Levels and utility method
@@ -54,65 +53,6 @@ public final class LogLevel
return (String[])keys.toArray( new String[ keys.size() ] );
}
- /**
- * Log a message to the Logger at the specified level.
- */
- public static void log( final Logger logger,
- final String message,
- final LogLevel level )
- {
- if( LogLevel.FATAL_ERROR == level )
- {
- logger.fatalError( message );
- }
- else if( LogLevel.ERROR == level )
- {
- logger.error( message );
- }
- else if( LogLevel.WARN == level )
- {
- logger.warn( message );
- }
- else if( LogLevel.INFO == level )
- {
- logger.info( message );
- }
- else
- {
- logger.debug( message );
- }
- }
-
- /**
- * Log a message to the Logger at the specified level.
- */
- public static void log( final Logger logger,
- final String message,
- final Throwable throwable,
- final LogLevel level )
- {
- if( LogLevel.FATAL_ERROR == level )
- {
- logger.fatalError( message, throwable );
- }
- else if( LogLevel.ERROR == level )
- {
- logger.error( message, throwable );
- }
- else if( LogLevel.WARN == level )
- {
- logger.warn( message, throwable );
- }
- else if( LogLevel.INFO == level )
- {
- logger.info( message, throwable );
- }
- else
- {
- logger.debug( message, throwable );
- }
- }
-
/**
* Private constructor so no instance except here can be defined.
*
diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/api/TaskContext.java b/proposal/myrmidon/src/java/org/apache/myrmidon/api/TaskContext.java
index 4bb1296b7..77230a276 100644
--- a/proposal/myrmidon/src/java/org/apache/myrmidon/api/TaskContext.java
+++ b/proposal/myrmidon/src/java/org/apache/myrmidon/api/TaskContext.java
@@ -100,6 +100,23 @@ public interface TaskContext
void setProperty( String name, Object value )
throws TaskException;
+ /**
+ * Log a message.
+ *
+ * @param level the level to write the log message at.
+ * @param message the message to write.
+ */
+ void log( LogLevel level, String message );
+
+ /**
+ * Log a message.
+ *
+ * @param level the level to write the log message at.
+ * @param message the message to write.
+ * @param throwable the throwable
+ */
+ void log( LogLevel level, String message, Throwable throwable );
+
/**
* Log a debug message.
*
diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/AspectAwareExecutor.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/AspectAwareExecutor.java
index 5ba45dffb..4c1484981 100644
--- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/AspectAwareExecutor.java
+++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/AspectAwareExecutor.java
@@ -88,7 +88,6 @@ public class AspectAwareExecutor
debug( "logger.notice", taskName );
final Logger logger = frame.getLogger();
getAspectManager().preLogEnabled( logger );
- doLogEnabled( task, taskModel, logger );
debug( "contextualizing.notice", taskName );
doContextualize( task, taskModel, frame.getContext() );
diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java
index e2f5bcb73..b7d61bdfd 100644
--- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java
+++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java
@@ -12,8 +12,6 @@ import org.apache.avalon.excalibur.i18n.Resources;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.LogEnabled;
-import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
@@ -65,9 +63,6 @@ public class DefaultExecutor
debug( "creating.notice", taskName );
final Task task = doCreateTask( taskName, frame );
- debug( "logger.notice", taskName );
- doLogEnabled( task, taskModel, frame.getLogger() );
-
debug( "contextualizing.notice", taskName );
doContextualize( task, taskModel, frame.getContext() );
@@ -142,27 +137,4 @@ public class DefaultExecutor
throw new TaskException( message, throwable );
}
}
-
- /**
- * Sets the logger for a task.
- */
- protected final void doLogEnabled( final Task task,
- final Configuration taskModel,
- final Logger logger )
- throws TaskException
- {
- if( task instanceof LogEnabled )
- {
- try
- {
- ( (LogEnabled)task ).enableLogging( logger );
- }
- catch( final Throwable throwable )
- {
- final String message =
- REZ.getString( "logger.error", taskModel.getName() );
- throw new TaskException( message, throwable );
- }
- }
- }
}
diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/Resources.properties b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/Resources.properties
index b038221f6..2705dbeb3 100644
--- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/Resources.properties
+++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/Resources.properties
@@ -1,12 +1,10 @@
creating.notice=Creating {0}.
-logger.notice=Setting Logger {0}.
contextualizing.notice=Contextualizing {0}.
configuring.notice=Configuring {0}.
executing.notice=Executing {0}.
create.error=Could not create task <{0}>.
contextualize.error=Could not set the context for task <{0}>.
-logger.error=Could not set the logger for task <{0}>.
execute.error={1}: Could not execute task <{0}>.
unused-settings.error=Unused aspect settings for namespace {0} (parameterCount={1} elementCount={2}).
diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java
index 4c153fa12..163111d38 100644
--- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java
+++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java
@@ -22,6 +22,7 @@ import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.interfaces.model.DefaultNameValidator;
import org.apache.myrmidon.interfaces.workspace.PropertyResolver;
+import org.apache.myrmidon.api.LogLevel;
/**
* Default implementation of TaskContext.
@@ -211,6 +212,67 @@ public class DefaultTaskContext
m_contextData.put( name, value );
}
+ /**
+ * Log a message.
+ *
+ * @param level the level to write the log message at.
+ * @param message the message to write.
+ */
+ public void log( LogLevel level, String message )
+ {
+ if( LogLevel.FATAL_ERROR == level )
+ {
+ m_logger.fatalError( message );
+ }
+ else if( LogLevel.ERROR == level )
+ {
+ m_logger.error( message );
+ }
+ else if( LogLevel.WARN == level )
+ {
+ m_logger.warn( message );
+ }
+ else if( LogLevel.INFO == level )
+ {
+ m_logger.info( message );
+ }
+ else
+ {
+ m_logger.debug( message );
+ }
+ }
+
+ /**
+ * Log a message.
+ *
+ * @param level the level to write the log message at.
+ * @param message the message to write.
+ * @param throwable the throwable.
+ */
+ public void log( LogLevel level, String message, Throwable throwable )
+ {
+ if( LogLevel.FATAL_ERROR == level )
+ {
+ m_logger.fatalError( message, throwable );
+ }
+ else if( LogLevel.ERROR == level )
+ {
+ m_logger.error( message, throwable );
+ }
+ else if( LogLevel.WARN == level )
+ {
+ m_logger.warn( message, throwable );
+ }
+ else if( LogLevel.INFO == level )
+ {
+ m_logger.info( message, throwable );
+ }
+ else
+ {
+ m_logger.debug( message, throwable );
+ }
+ }
+
/**
* Log a debug message.
*
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java
index f1e1e526a..f2ea9985f 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java
@@ -13,6 +13,8 @@ import java.util.Date;
import java.util.Iterator;
import org.apache.aut.nativelib.Os;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileList;
import org.apache.tools.ant.types.FileSet;
@@ -166,7 +168,7 @@ public class DependSet extends MatchingTask
if( dest.lastModified() > now )
{
- getLogger().warn( "Warning: " + targetFiles[ i ] + " modified in the future." );
+ getContext().warn( "Warning: " + targetFiles[ i ] + " modified in the future." );
}
}
}
@@ -188,7 +190,7 @@ public class DependSet extends MatchingTask
File dest = new File( targetFL.getDir(), targetFiles[ i ] );
if( !dest.exists() )
{
- getLogger().debug( targetFiles[ i ] + " does not exist." );
+ getContext().debug( targetFiles[ i ] + " does not exist." );
upToDate = false;
continue;
}
@@ -198,7 +200,7 @@ public class DependSet extends MatchingTask
}
if( dest.lastModified() > now )
{
- getLogger().warn( "Warning: " + targetFiles[ i ] + " modified in the future." );
+ getContext().warn( "Warning: " + targetFiles[ i ] + " modified in the future." );
}
}
}
@@ -222,7 +224,7 @@ public class DependSet extends MatchingTask
if( src.lastModified() > now )
{
- getLogger().warn( "Warning: " + sourceFiles[ i ] + " modified in the future." );
+ getContext().warn( "Warning: " + sourceFiles[ i ] + " modified in the future." );
}
Iterator enumTargets = allTargets.iterator();
@@ -232,7 +234,7 @@ public class DependSet extends MatchingTask
File dest = (File)enumTargets.next();
if( src.lastModified() > dest.lastModified() )
{
- getLogger().debug( dest.getPath() + " is out of date with respect to " + sourceFiles[ i ] );
+ getContext().debug( dest.getPath() + " is out of date with respect to " + sourceFiles[ i ] );
upToDate = false;
}
@@ -260,12 +262,12 @@ public class DependSet extends MatchingTask
if( src.lastModified() > now )
{
- getLogger().warn( "Warning: " + sourceFiles[ i ] + " modified in the future." );
+ getContext().warn( "Warning: " + sourceFiles[ i ] + " modified in the future." );
}
if( !src.exists() )
{
- getLogger().debug( sourceFiles[ i ] + " does not exist." );
+ getContext().debug( sourceFiles[ i ] + " does not exist." );
upToDate = false;
break;
}
@@ -278,7 +280,7 @@ public class DependSet extends MatchingTask
if( src.lastModified() > dest.lastModified() )
{
- getLogger().debug( dest.getPath() + " is out of date with respect to " + sourceFiles[ i ] );
+ getContext().debug( dest.getPath() + " is out of date with respect to " + sourceFiles[ i ] );
upToDate = false;
}
@@ -289,11 +291,11 @@ public class DependSet extends MatchingTask
if( !upToDate )
{
- getLogger().debug( "Deleting all target files. " );
+ getContext().debug( "Deleting all target files. " );
for( Iterator e = allTargets.iterator(); e.hasNext(); )
{
File fileToRemove = (File)e.next();
- getLogger().debug( "Deleting file " + fileToRemove.getAbsolutePath() );
+ getContext().debug( "Deleting file " + fileToRemove.getAbsolutePath() );
fileToRemove.delete();
}
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Filter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Filter.java
index a8d628011..add696a5e 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Filter.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Filter.java
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs;
import java.io.File;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.FilterSet;
/**
@@ -70,7 +71,7 @@ public class Filter
protected void readFilters()
throws TaskException
{
- getLogger().debug( "Reading filters from " + filtersFile );
+ getContext().debug( "Reading filters from " + filtersFile );
getGlobalFilterSet().readFiltersFromFile( filtersFile );
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Get.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Get.java
index f792ee4e0..64454302d 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Get.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Get.java
@@ -17,6 +17,7 @@ import java.net.URLConnection;
import java.util.Date;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
/**
* Get a particular file from a URL source. Options include verbose reporting,
@@ -147,7 +148,7 @@ public class Get extends AbstractTask
try
{
- getLogger().info( "Getting: " + source );
+ getContext().info( "Getting: " + source );
//set the timestamp to the file date.
long timestamp = 0;
@@ -159,7 +160,7 @@ public class Get extends AbstractTask
if( verbose )
{
Date t = new Date( timestamp );
- getLogger().info( "local file date : " + t.toString() );
+ getContext().info( "local file date : " + t.toString() );
}
hasTimestamp = true;
@@ -205,13 +206,13 @@ public class Get extends AbstractTask
//not modified so no file download. just return instead
//and trace out something so the user doesn't think that the
//download happened when it didnt
- getLogger().info( "Not modified - so not downloaded" );
+ getContext().info( "Not modified - so not downloaded" );
return;
}
// test for 401 result (HTTP only)
if( httpConnection.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED )
{
- getLogger().info( "Not authorized - check " + dest + " for details" );
+ getContext().info( "Not authorized - check " + dest + " for details" );
return;
}
@@ -233,12 +234,12 @@ public class Get extends AbstractTask
}
catch( IOException ex )
{
- getLogger().info( "Error opening connection " + ex );
+ getContext().info( "Error opening connection " + ex );
}
}
if( is == null )
{
- getLogger().info( "Can't get " + source + " to " + dest );
+ getContext().info( "Can't get " + source + " to " + dest );
if( ignoreErrors )
{
return;
@@ -272,7 +273,7 @@ public class Get extends AbstractTask
if( verbose )
{
Date t = new Date( remoteTimestamp );
- getLogger().info( "last modified = " + t.toString()
+ getContext().info( "last modified = " + t.toString()
+ ( ( remoteTimestamp == 0 ) ? " - using current time instead" : "" ) );
}
@@ -284,7 +285,7 @@ public class Get extends AbstractTask
}
catch( IOException ioe )
{
- getLogger().info( "Error getting " + source + " to " + dest );
+ getContext().info( "Error getting " + source + " to " + dest );
if( ignoreErrors )
{
return;
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java
index 6c7124d66..d7408b199 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java
@@ -13,6 +13,7 @@ import java.util.ArrayList;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Commandline;
@@ -157,7 +158,7 @@ public class Java
if( m_fork )
{
- getLogger().debug( "Forking " + m_cmdl.toString() );
+ getContext().debug( "Forking " + m_cmdl.toString() );
return run( new Commandline( m_cmdl.getCommandline() ) );
}
@@ -165,14 +166,14 @@ public class Java
{
if( m_cmdl.getVmCommand().size() > 1 )
{
- getLogger().warn( "JVM args ignored when same JVM is used." );
+ getContext().warn( "JVM args ignored when same JVM is used." );
}
if( m_dir != null )
{
- getLogger().warn( "Working directory ignored when same JVM is used." );
+ getContext().warn( "Working directory ignored when same JVM is used." );
}
- getLogger().debug( "Running in same VM " + m_cmdl.getJavaCommand().toString() );
+ getContext().debug( "Running in same VM " + m_cmdl.getJavaCommand().toString() );
run( m_cmdl );
return 0;
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
index 4d16c8f85..e47e4e1fe 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
@@ -12,6 +12,7 @@ import java.util.ArrayList;
import org.apache.aut.nativelib.Os;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.Path;
/**
@@ -157,7 +158,7 @@ public class PathConvert extends AbstractTask
// Place the result into the specified property
final String value = rslt.toString();
- getLogger().debug( "Set property " + m_property + " = " + value );
+ getContext().debug( "Set property " + m_property + " = " + value );
final String name = m_property;
getContext().setProperty( name, value );
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java
index d8ef8136d..6d9f9e1ef 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java
@@ -16,6 +16,7 @@ import java.util.Iterator;
import java.util.Properties;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.PathUtil;
@@ -126,7 +127,7 @@ public class Property
throws TaskException
{
Properties props = new Properties();
- getLogger().debug( "Resource Loading " + name );
+ getContext().debug( "Resource Loading " + name );
try
{
ClassLoader classLoader = null;
@@ -149,7 +150,7 @@ public class Property
}
else
{
- getLogger().warn( "Unable to find resource " + name );
+ getContext().warn( "Unable to find resource " + name );
}
}
catch( IOException ex )
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
index 30628c702..c478568a4 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
@@ -34,6 +34,7 @@ import java.util.Properties;
import java.util.StringTokenizer;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.FileSet;
@@ -429,7 +430,7 @@ public class SQLExec
Class dc;
if( classpath != null )
{
- getLogger().debug( "Loading " + driver + " using AntClassLoader with classpath " + classpath );
+ getContext().debug( "Loading " + driver + " using AntClassLoader with classpath " + classpath );
final URL[] urls = PathUtil.toURLs( classpath );
final ClassLoader classLoader = new URLClassLoader( urls );
@@ -437,7 +438,7 @@ public class SQLExec
}
else
{
- getLogger().debug( "Loading " + driver + " using system loader." );
+ getContext().debug( "Loading " + driver + " using system loader." );
dc = Class.forName( driver );
}
driverInstance = (Driver)dc.newInstance();
@@ -457,7 +458,7 @@ public class SQLExec
try
{
- getLogger().debug( "connecting to " + url );
+ getContext().debug( "connecting to " + url );
Properties info = new Properties();
info.put( "user", userId );
info.put( "password", password );
@@ -483,7 +484,7 @@ public class SQLExec
{
if( output != null )
{
- getLogger().debug( "Opening PrintStream to output file " + output );
+ getContext().debug( "Opening PrintStream to output file " + output );
out = new PrintStream( new BufferedOutputStream( new FileOutputStream( output ) ) );
}
@@ -495,7 +496,7 @@ public class SQLExec
( (Transaction)e.next() ).runTransaction( out );
if( !autocommit )
{
- getLogger().debug( "Commiting transaction" );
+ getContext().debug( "Commiting transaction" );
conn.commit();
}
}
@@ -554,7 +555,7 @@ public class SQLExec
}
}
- getLogger().info( goodSql + " of " + totalSql +
+ getContext().info( goodSql + " of " + totalSql +
" SQL statements executed successfully" );
}
@@ -579,10 +580,10 @@ public class SQLExec
{
String theVendor = dmd.getDatabaseProductName().toLowerCase();
- getLogger().debug( "RDBMS = " + theVendor );
+ getContext().debug( "RDBMS = " + theVendor );
if( theVendor == null || theVendor.indexOf( rdbms ) < 0 )
{
- getLogger().debug( "Not the required RDBMS: " + rdbms );
+ getContext().debug( "Not the required RDBMS: " + rdbms );
return false;
}
}
@@ -591,12 +592,12 @@ public class SQLExec
{
String theVersion = dmd.getDatabaseProductVersion().toLowerCase();
- getLogger().debug( "Version = " + theVersion );
+ getContext().debug( "Version = " + theVersion );
if( theVersion == null ||
!( theVersion.startsWith( version ) ||
theVersion.indexOf( " " + version ) >= 0 ) )
{
- getLogger().debug( "Not the required version: \"" + version + "\"" );
+ getContext().debug( "Not the required version: \"" + version + "\"" );
return false;
}
}
@@ -604,7 +605,7 @@ public class SQLExec
catch( SQLException e )
{
// Could not get the required information
- getLogger().error( "Failed to obtain required RDBMS information" );
+ getContext().error( "Failed to obtain required RDBMS information" );
return false;
}
@@ -632,7 +633,7 @@ public class SQLExec
totalSql++;
if( !statement.execute( sql ) )
{
- getLogger().debug( statement.getUpdateCount() + " rows affected" );
+ getContext().debug( statement.getUpdateCount() + " rows affected" );
}
else
{
@@ -645,7 +646,7 @@ public class SQLExec
SQLWarning warning = conn.getWarnings();
while( warning != null )
{
- getLogger().debug( warning + " sql warning" );
+ getContext().debug( warning + " sql warning" );
warning = warning.getNextWarning();
}
conn.clearWarnings();
@@ -653,12 +654,12 @@ public class SQLExec
}
catch( SQLException e )
{
- getLogger().error( "Failed to execute: " + sql );
+ getContext().error( "Failed to execute: " + sql );
if( !onError.equals( "continue" ) )
{
throw e;
}
- getLogger().error( e.toString() );
+ getContext().error( e.toString() );
}
}
@@ -677,7 +678,7 @@ public class SQLExec
rs = statement.getResultSet();
if( rs != null )
{
- getLogger().debug( "Processing new result set." );
+ getContext().debug( "Processing new result set." );
ResultSetMetaData md = rs.getMetaData();
int columnCount = md.getColumnCount();
StringBuffer line = new StringBuffer();
@@ -768,7 +769,7 @@ public class SQLExec
if( delimiterType.equals( DelimiterType.NORMAL ) && sql.endsWith( delimiter ) ||
delimiterType.equals( DelimiterType.ROW ) && line.equals( delimiter ) )
{
- getLogger().debug( "SQL: " + sql );
+ getContext().debug( "SQL: " + sql );
execSQL( sql.substring( 0, sql.length() - delimiter.length() ), out );
sql = "";
}
@@ -839,13 +840,13 @@ public class SQLExec
{
if( tSqlCommand.length() != 0 )
{
- getLogger().info( "Executing commands" );
+ getContext().info( "Executing commands" );
runStatements( new StringReader( tSqlCommand ), out );
}
if( tSrcFile != null )
{
- getLogger().info( "Executing file: " + tSrcFile.getAbsolutePath() );
+ getContext().info( "Executing file: " + tSrcFile.getAbsolutePath() );
Reader reader = ( encoding == null ) ? new FileReader( tSrcFile )
: new InputStreamReader( new FileInputStream( tSrcFile ), encoding );
runStatements( reader, out );
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/UpToDate.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/UpToDate.java
index 902e6ad02..53443f39c 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/UpToDate.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/UpToDate.java
@@ -12,6 +12,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.FileNameMapper;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
@@ -148,11 +149,11 @@ public class UpToDate
getContext().setProperty( name, value );
if( m_mapper == null )
{
- getLogger().debug( "File \"" + m_targetFile.getAbsolutePath() + "\" is up to date." );
+ getContext().debug( "File \"" + m_targetFile.getAbsolutePath() + "\" is up to date." );
}
else
{
- getLogger().debug( "All target files have been up to date." );
+ getContext().debug( "All target files have been up to date." );
}
}
}
@@ -161,7 +162,6 @@ public class UpToDate
throws TaskException
{
SourceFileScanner scanner = new SourceFileScanner();
- setupLogger( scanner );
FileNameMapper mapper = null;
File dir = srcDir;
if( m_mapper == null )
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Ear.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Ear.java
index dfeb35551..b8ba52f05 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Ear.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Ear.java
@@ -11,6 +11,8 @@ import java.io.File;
import java.io.IOException;
import org.apache.aut.zip.ZipOutputStream;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
/**
* Creates a EAR archive. Based on WAR task
@@ -48,7 +50,7 @@ public class Ear
{
// We just set the prefix for this fileset, and pass it up.
// Do we need to do this? LH
- getLogger().debug( "addArchives called" );
+ getContext().debug( "addArchives called" );
fs.setPrefix( "/" );
super.addFileset( fs );
}
@@ -81,7 +83,7 @@ public class Ear
final String message = "Warning: selected " + m_archiveType +
" files include a META-INF/application.xml which will be ignored " +
"(please use appxml attribute to " + m_archiveType + " task)";
- getLogger().warn( message );
+ getContext().warn( message );
}
else
{
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Expand.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Expand.java
index 93c29bbe8..bbc06b597 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Expand.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Expand.java
@@ -18,6 +18,7 @@ import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.framework.PatternSet;
import org.apache.myrmidon.framework.PatternUtil;
import org.apache.tools.ant.taskdefs.MatchingTask;
@@ -162,10 +163,10 @@ public abstract class Expand
protected void expandFile( final File src, final File dir )
throws TaskException
{
- if( getLogger().isInfoEnabled() )
+ if( getContext().isInfoEnabled() )
{
final String message = "Expanding: " + src + " into " + dir;
- getLogger().info( message );
+ getContext().info( message );
}
try
@@ -178,10 +179,10 @@ public abstract class Expand
throw new TaskException( message, ioe );
}
- if( getLogger().isDebugEnabled() )
+ if( getContext().isDebugEnabled() )
{
final String message = "expand complete";
- getLogger().debug( message );
+ getContext().debug( message );
}
}
@@ -247,11 +248,11 @@ public abstract class Expand
file.lastModified() >= date.getTime() )
{
final String message = "Skipping " + file + " as it is up-to-date";
- getLogger().debug( message );
+ getContext().debug( message );
return;
}
- getLogger().debug( "expanding " + entryName + " to " + file );
+ getContext().debug( "expanding " + entryName + " to " + file );
// create intermediary directories - sometimes zip don't add them
final File parent = file.getParentFile();
@@ -280,7 +281,7 @@ public abstract class Expand
catch( final FileNotFoundException fnfe )
{
final String message = "Unable to expand to file " + file.getPath();
- getLogger().warn( message );
+ getContext().warn( message );
}
}
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Jar.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Jar.java
index 14cde3ac2..1dfa651e2 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Jar.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Jar.java
@@ -21,6 +21,8 @@ import java.util.Enumeration;
import java.util.zip.ZipFile;
import org.apache.aut.zip.ZipOutputStream;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.manifest.Manifest;
import org.apache.tools.ant.taskdefs.manifest.ManifestException;
import org.apache.tools.ant.taskdefs.manifest.ManifestUtil;
@@ -99,7 +101,7 @@ public class Jar
catch( ManifestException e )
{
final String message = "Manifest " + manifestFile + " is invalid: " + e.getMessage();
- getLogger().error( message );
+ getContext().error( message );
throw new TaskException( message, e );
}
catch( IOException e )
@@ -126,7 +128,7 @@ public class Jar
public void setWhenempty( WhenEmpty we )
{
final String message = "JARs are never empty, they contain at least a manifest file";
- getLogger().warn( message );
+ getContext().warn( message );
}
public void addManifest( Manifest newManifest )
@@ -169,7 +171,7 @@ public class Jar
java.util.zip.ZipEntry entry = theZipFile.getEntry( "META-INF/MANIFEST.MF" );
if( entry == null )
{
- getLogger().debug( "Updating jar since the current jar has no manifest" );
+ getContext().debug( "Updating jar since the current jar has no manifest" );
return false;
}
Manifest currentManifest = ManifestUtil.buildManifest( new InputStreamReader( theZipFile.getInputStream( entry ) ) );
@@ -179,14 +181,14 @@ public class Jar
}
if( !currentManifest.equals( m_manifest ) )
{
- getLogger().debug( "Updating jar since jar manifest has changed" );
+ getContext().debug( "Updating jar since jar manifest has changed" );
return false;
}
}
catch( Exception e )
{
// any problems and we will rebuild
- getLogger().debug( "Updating jar since cannot read current jar manifest: " + e.getClass().getName() + e.getMessage() );
+ getContext().debug( "Updating jar since cannot read current jar manifest: " + e.getClass().getName() + e.getMessage() );
return false;
}
finally
@@ -258,7 +260,7 @@ public class Jar
}
catch( ManifestException e )
{
- getLogger().error( "Manifest is invalid: " + e.getMessage() );
+ getContext().error( "Manifest is invalid: " + e.getMessage() );
throw new TaskException( "Invalid Manifest", e );
}
}
@@ -275,7 +277,7 @@ public class Jar
final String message = "Warning: selected " + m_archiveType +
" files include a META-INF/MANIFEST.MF which will be ignored " +
"(please use manifest attribute to " + m_archiveType + " task)";
- getLogger().warn( message );
+ getContext().warn( message );
}
else
{
@@ -388,7 +390,7 @@ public class Jar
}
catch( ManifestException e )
{
- getLogger().error( "Manifest is invalid: " + e.getMessage() );
+ getContext().error( "Manifest is invalid: " + e.getMessage() );
throw new TaskException( "Invalid Manifest", e );
}
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Tar.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Tar.java
index 85ad3426f..ad078fc64 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Tar.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Tar.java
@@ -17,6 +17,8 @@ import org.apache.aut.tar.TarEntry;
import org.apache.aut.tar.TarOutputStream;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.ScannerUtil;
import org.apache.tools.ant.types.SourceFileScanner;
@@ -160,11 +162,11 @@ public class Tar
if( upToDate )
{
- getLogger().info( "Nothing to do: " + tarFile.getAbsolutePath() + " is up to date." );
+ getContext().info( "Nothing to do: " + tarFile.getAbsolutePath() + " is up to date." );
return;
}
- getLogger().info( "Building tar: " + tarFile.getAbsolutePath() );
+ getContext().info( "Building tar: " + tarFile.getAbsolutePath() );
TarOutputStream tOut = null;
try
@@ -224,7 +226,6 @@ public class Tar
throws TaskException
{
final SourceFileScanner scanner = new SourceFileScanner();
- setupLogger( scanner );
final MergingMapper mapper = new MergingMapper();
mapper.setTo( tarFile.getAbsolutePath() );
return scanner.restrict( files, baseDir, null, mapper, getContext() ).length == 0;
@@ -253,19 +254,19 @@ public class Tar
if( longFileMode.isOmitMode() )
{
final String message = "Omitting: " + storedPath;
- getLogger().info( message );
+ getContext().info( message );
return;
}
else if( longFileMode.isWarnMode() )
{
final String message = "Entry: " + storedPath + " longer than " +
TarEntry.NAMELEN + " characters.";
- getLogger().warn( message );
+ getContext().warn( message );
if( !longWarningGiven )
{
final String message2 = "Resulting tar file can only be processed successfully"
+ " by GNU compatible tar commands";
- getLogger().warn( message2 );
+ getContext().warn( message2 );
longWarningGiven = true;
}
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/War.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/War.java
index 2b906c3da..9881b7372 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/War.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/War.java
@@ -11,6 +11,8 @@ import java.io.File;
import java.io.IOException;
import org.apache.aut.zip.ZipOutputStream;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
/**
* Creates a WAR archive.
@@ -93,7 +95,7 @@ public class War
final String message = "Warning: selected " + m_archiveType +
" files include a WEB-INF/web.xml which will be ignored " +
"(please use webxml attribute to " + m_archiveType + " task)";
- getLogger().warn( message );
+ getContext().warn( message );
}
else
{
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Zip.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Zip.java
index df52cd528..9f609b5e7 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Zip.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Zip.java
@@ -24,6 +24,8 @@ import org.apache.aut.zip.ZipEntry;
import org.apache.aut.zip.ZipOutputStream;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileScanner;
@@ -280,7 +282,7 @@ public class Zip
String action = m_update ? "Updating " : "Building ";
- getLogger().info( action + m_archiveType + ": " + m_file.getAbsolutePath() );
+ getContext().info( action + m_archiveType + ": " + m_file.getAbsolutePath() );
boolean success = false;
try
@@ -385,7 +387,7 @@ public class Zip
{
final String message = "Warning: unable to delete temporary file " +
renamedFile.getName();
- getLogger().warn( message );
+ getContext().warn( message );
}
}
}
@@ -447,7 +449,7 @@ public class Zip
{
final String message = "Warning: skipping " + m_archiveType + " archive " + zipFile +
" because no files were included.";
- getLogger().warn( message );
+ getContext().warn( message );
return true;
}
else if( m_emptyBehavior.equals( "fail" ) )
@@ -477,7 +479,6 @@ public class Zip
}
final SourceFileScanner scanner = new SourceFileScanner();
- setupLogger( scanner );
MergingMapper mm = new MergingMapper();
mm.setTo( zipFile.getAbsolutePath() );
for( int i = 0; i < scanners.length; i++ )
@@ -739,7 +740,7 @@ public class Zip
// In this case using java.util.zip will not work
// because it does not permit a zero-entry archive.
// Must create it manually.
- getLogger().info( "Note: creating empty " + m_archiveType + " archive " + zipFile );
+ getContext().info( "Note: creating empty " + m_archiveType + " archive " + zipFile );
try
{
OutputStream os = new FileOutputStream( zipFile );
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac.java
index ba63a5d86..8dd8b9055 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac.java
@@ -12,6 +12,8 @@ import java.util.ArrayList;
import java.util.Iterator;
import org.apache.aut.nativelib.Os;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.JavaVersion;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.DirectoryScanner;
@@ -639,7 +641,7 @@ public class Javac
final String message = "Compiling " + m_compileList.length + " source file" +
( m_compileList.length == 1 ? "" : "s" ) +
( m_destDir != null ? " to " + m_destDir : "" );
- getLogger().info( message );
+ getContext().info( message );
// now we need to populate the compiler adapter
adapter.setJavac( this );
@@ -709,7 +711,6 @@ public class Javac
m.setFrom( "*.java" );
m.setTo( "*.class" );
SourceFileScanner sfs = new SourceFileScanner();
- setupLogger( sfs );
File[] newFiles = sfs.restrictAsFiles( files, srcDir, destDir, m, getContext() );
if( newFiles.length > 0 )
@@ -732,12 +733,12 @@ public class Javac
if( isJdkCompiler( compiler.toString() ) )
{
final String message = "Since fork is true, ignoring build.compiler setting.";
- getLogger().warn( message );
+ getContext().warn( message );
compiler = "extJavac";
}
else
{
- getLogger().warn( "Since build.compiler setting isn't classic or modern, ignoring fork setting." );
+ getContext().warn( "Since build.compiler setting isn't classic or modern, ignoring fork setting." );
}
}
else
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Http.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Http.java
index a4bb1ef25..6d80f47b6 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Http.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Http.java
@@ -11,7 +11,6 @@ import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.framework.conditions.Condition;
@@ -25,7 +24,6 @@ import org.apache.myrmidon.framework.conditions.Condition;
* @ant:type type="condition" name="http"
*/
public class Http
- extends AbstractLogEnabled
implements Condition
{
String spec = null;
@@ -45,7 +43,7 @@ public class Http
{
throw new TaskException( "No url specified in HTTP task" );
}
- getLogger().debug( "Checking for " + spec );
+ context.debug( "Checking for " + spec );
try
{
URL url = new URL( spec );
@@ -56,7 +54,7 @@ public class Http
{
HttpURLConnection http = (HttpURLConnection)conn;
int code = http.getResponseCode();
- getLogger().debug( "Result code for " + spec + " was " + code );
+ context.debug( "Result code for " + spec + " was " + code );
if( code > 0 && code < 500 )
{
return true;
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java
index 0d3b3b399..40a055342 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java
@@ -8,7 +8,6 @@
package org.apache.tools.ant.taskdefs.condition;
import java.io.IOException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.framework.conditions.Condition;
@@ -22,7 +21,6 @@ import org.apache.myrmidon.framework.conditions.Condition;
* @ant:type type="condition" name="socket"
*/
public class Socket
- extends AbstractLogEnabled
implements Condition
{
String server = null;
@@ -52,7 +50,7 @@ public class Socket
{
throw new TaskException( "No port specified in Socket task" );
}
- getLogger().debug( "Checking for listener at " + server + ":" + port );
+ context.debug( "Checking for listener at " + server + ":" + port );
try
{
java.net.Socket socket = new java.net.Socket( server, port );
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java
index e572de2fe..a93dd0e9e 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java
@@ -20,6 +20,7 @@ import org.apache.aut.nativelib.ExecOutputHandler;
import org.apache.aut.nativelib.Os;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.myrmidon.framework.Pattern;
import org.apache.tools.ant.types.Commandline;
@@ -536,7 +537,7 @@ public class Javadoc
throw new TaskException( msg );
}
- getLogger().info( "Generating Javadoc" );
+ getContext().info( "Generating Javadoc" );
if( m_doctitle != null )
{
@@ -662,7 +663,7 @@ public class Javadoc
}
else
{
- getLogger().debug( "Warning: No package list was found at " + packageListLocation );
+ getContext().debug( "Warning: No package list was found at " + packageListLocation );
}
}
else
@@ -810,9 +811,9 @@ public class Javadoc
{
cmd.addArgument( "@" + m_packageList );
}
- getLogger().debug( "Javadoc args: " + cmd );
+ getContext().debug( "Javadoc args: " + cmd );
- getLogger().info( "Javadoc execution" );
+ getContext().info( "Javadoc execution" );
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
@@ -873,7 +874,7 @@ public class Javadoc
}
else
{
- getLogger().warn( "Warning: Leaving out empty argument '" + key + "'" );
+ getContext().warn( "Warning: Leaving out empty argument '" + key + "'" );
}
}
@@ -899,7 +900,7 @@ public class Javadoc
ArrayList packages, ArrayList excludePackages )
throws TaskException
{
- getLogger().debug( "Source path = " + sourcePath.toString() );
+ getContext().debug( "Source path = " + sourcePath.toString() );
StringBuffer msg = new StringBuffer( "Packages = " );
for( int i = 0; i < packages.size(); i++ )
{
@@ -909,7 +910,7 @@ public class Javadoc
}
msg.append( packages.get( i ) );
}
- getLogger().debug( msg.toString() );
+ getContext().debug( msg.toString() );
msg.setLength( 0 );
msg.append( "Exclude Packages = " );
@@ -921,7 +922,7 @@ public class Javadoc
}
msg.append( excludePackages.get( i ) );
}
- getLogger().debug( msg.toString() );
+ getContext().debug( msg.toString() );
ArrayList addedPackages = new ArrayList();
@@ -1036,11 +1037,11 @@ public class Javadoc
{
if( line.startsWith( "Generating " ) || line.startsWith( "Building " ) )
{
- getLogger().debug( line );
+ getContext().debug( line );
}
else
{
- getLogger().info( line );
+ getContext().info( line );
}
}
@@ -1050,6 +1051,6 @@ public class Javadoc
*/
public void stderr( final String line )
{
- getLogger().warn( line );
+ getContext().warn( line );
}
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
index b4932b856..b0d26eac7 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
@@ -15,6 +15,7 @@ import java.net.URL;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.taskdefs.ExecuteJava;
import org.apache.tools.ant.types.Argument;
@@ -76,13 +77,13 @@ public class ANTLR extends AbstractTask
public void setOutputdirectory( File outputDirectory )
{
- getLogger().debug( "Setting output directory to: " + outputDirectory.toString() );
+ getContext().debug( "Setting output directory to: " + outputDirectory.toString() );
this.outputDirectory = outputDirectory;
}
public void setTarget( File target )
{
- getLogger().debug( "Setting target to: " + target.toString() );
+ getContext().debug( "Setting target to: " + target.toString() );
this.target = target;
}
@@ -130,7 +131,7 @@ public class ANTLR extends AbstractTask
if( fork )
{
- getLogger().debug( "Forking " + commandline.toString() );
+ getContext().debug( "Forking " + commandline.toString() );
int err = run( commandline );
if( err == 1 )
{
@@ -166,24 +167,24 @@ public class ANTLR extends AbstractTask
{
int pling = u.indexOf( "!" );
String jarName = u.substring( 9, pling );
- getLogger().debug( "Implicitly adding " + jarName + " to classpath" );
+ getContext().debug( "Implicitly adding " + jarName + " to classpath" );
createClasspath().setLocation( new File( ( new File( jarName ) ).getAbsolutePath() ) );
}
else if( u.startsWith( "file:" ) )
{
int tail = u.indexOf( resource );
String dirName = u.substring( 5, tail );
- getLogger().debug( "Implicitly adding " + dirName + " to classpath" );
+ getContext().debug( "Implicitly adding " + dirName + " to classpath" );
createClasspath().setLocation( new File( ( new File( dirName ) ).getAbsolutePath() ) );
}
else
{
- getLogger().debug( "Don\'t know how to handle resource URL " + u );
+ getContext().debug( "Don\'t know how to handle resource URL " + u );
}
}
else
{
- getLogger().debug( "Couldn\'t find " + resource );
+ getContext().debug( "Couldn\'t find " + resource );
}
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
index 4ba03072e..b84d42d83 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
@@ -17,6 +17,8 @@ import java.util.Iterator;
import org.apache.aut.nativelib.ExecManager;
import org.apache.aut.nativelib.Os;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.Commandline;
@@ -101,11 +103,11 @@ public class Cab
return;
}
- getLogger().info( "Building cab: " + m_cabFile.getAbsolutePath() );
+ getContext().info( "Building cab: " + m_cabFile.getAbsolutePath() );
if( !Os.isFamily( Os.OS_FAMILY_WINDOWS ) )
{
- getLogger().debug( "Using listcab/libcabinet" );
+ getContext().debug( "Using listcab/libcabinet" );
final StringBuffer sb = new StringBuffer();
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ClassArgument.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ClassArgument.java
index 018e8687a..636228dc0 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ClassArgument.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ClassArgument.java
@@ -7,17 +7,13 @@
*/
package org.apache.tools.ant.taskdefs.optional;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-
public class ClassArgument
- extends AbstractLogEnabled
{
private String m_name;
public void setName( String name )
{
m_name = name;
- getLogger().info( "ClassArgument.name=" + name );
}
public String getName()
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java
index 4db72b61f..e7425df71 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java
@@ -16,6 +16,7 @@ import java.util.Date;
import java.util.Properties;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.listeners.AbstractProjectListener;
import org.apache.myrmidon.listeners.LogEvent;
import org.apache.tools.ant.taskdefs.Java;
@@ -515,7 +516,7 @@ public class IContract extends MatchingTask
{
if( !controlFile.exists() )
{
- getLogger().info( "WARNING: Control file " + controlFile.getAbsolutePath() + " doesn't exist. iContract will be run without control file." );
+ getContext().info( "WARNING: Control file " + controlFile.getAbsolutePath() + " doesn't exist. iContract will be run without control file." );
}
this.controlFile = controlFile;
}
@@ -698,7 +699,7 @@ public class IContract extends MatchingTask
// issue warning if pre,post or invariant is used together with controlfile
if( ( pre || post || invariant ) && controlFile != null )
{
- getLogger().info( "WARNING: specifying pre,post or invariant will override control file settings" );
+ getContext().info( "WARNING: specifying pre,post or invariant will override control file settings" );
}
@@ -781,7 +782,7 @@ public class IContract extends MatchingTask
}
catch( IOException e )
{
- getLogger().info( "File icontrol.properties not found. That's ok. Writing a default one." );
+ getContext().info( "File icontrol.properties not found. That's ok. Writing a default one." );
}
iControlProps.setProperty( "sourceRoot", srcDir.getAbsolutePath() );
iControlProps.setProperty( "classRoot", classDir.getAbsolutePath() );
@@ -792,11 +793,11 @@ public class IContract extends MatchingTask
try
{// to read existing propertiesfile
iControlProps.store( new FileOutputStream( "icontrol.properties" ), ICONTROL_PROPERTIES_HEADER );
- getLogger().info( "Updated icontrol.properties" );
+ getContext().info( "Updated icontrol.properties" );
}
catch( IOException e )
{
- getLogger().info( "Couldn't write icontrol.properties." );
+ getContext().info( "Couldn't write icontrol.properties." );
}
}
@@ -806,9 +807,9 @@ public class IContract extends MatchingTask
{
if( iContractMissing )
{
- getLogger().info( "iContract can't be found on your classpath. Your classpath is:" );
- getLogger().info( classpath.toString() );
- getLogger().info( "If you don't have the iContract jar, go get it at http://www.reliable-systems.com/tools/" );
+ getContext().info( "iContract can't be found on your classpath. Your classpath is:" );
+ getContext().info( classpath.toString() );
+ getContext().info( "If you don't have the iContract jar, go get it at http://www.reliable-systems.com/tools/" );
}
throw new TaskException( "iContract instrumentation failed. Code=" + result );
}
@@ -933,17 +934,17 @@ public class IContract extends MatchingTask
if( targets == null )
{
targets = new File( "targets" );
- getLogger().info( "Warning: targets file not specified. generating file: " + targets.getName() );
+ getContext().info( "Warning: targets file not specified. generating file: " + targets.getName() );
writeTargets = true;
}
else if( !targets.exists() )
{
- getLogger().info( "Specified targets file doesn't exist. generating file: " + targets.getName() );
+ getContext().info( "Specified targets file doesn't exist. generating file: " + targets.getName() );
writeTargets = true;
}
if( writeTargets )
{
- getLogger().info( "You should consider using iControl to create a target file." );
+ getContext().info( "You should consider using iControl to create a target file." );
targetOutputStream = new FileOutputStream( targets );
targetPrinter = new PrintStream( targetOutputStream );
}
@@ -962,7 +963,7 @@ public class IContract extends MatchingTask
if( srcFile.lastModified() > now )
{
final String message = "Warning: file modified in the future: " + files[ i ];
- getLogger().warn( message );
+ getContext().warn( message );
}
if( !classFile.exists() || srcFile.lastModified() > classFile.lastModified() )
@@ -1003,7 +1004,7 @@ public class IContract extends MatchingTask
{
if( !dirty )
{
- getLogger().info( "Control file " + controlFile.getAbsolutePath() + " has been updated. Instrumenting all files..." );
+ getContext().info( "Control file " + controlFile.getAbsolutePath() + " has been updated. Instrumenting all files..." );
}
dirty = true;
instrumentall = true;
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
index c0a151f01..bae47511f 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
@@ -14,6 +14,7 @@ import java.util.StringTokenizer;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.util.FileUtils;
@@ -158,7 +159,6 @@ public class Javah
public ClassArgument createClass()
{
final ClassArgument ga = new ClassArgument();
- setupLogger( ga );
m_classes.add( ga );
return ga;
}
@@ -210,7 +210,7 @@ public class Javah
private void logAndAddFilesToCompile( final Commandline cmd )
{
int n = 0;
- getLogger().debug( "Compilation args: " + cmd.toString() );
+ getContext().debug( "Compilation args: " + cmd.toString() );
StringBuffer niceClassList = new StringBuffer();
if( m_cls != null )
@@ -243,7 +243,7 @@ public class Javah
prefix.append( " to be compiled:" );
prefix.append( StringUtil.LINE_SEPARATOR );
- getLogger().debug( prefix.toString() + niceClassList.toString() );
+ getContext().debug( prefix.toString() + niceClassList.toString() );
}
/**
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
index bc2b28d62..321afd462 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
@@ -21,6 +21,7 @@ import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.DirectoryScanner;
@@ -503,7 +504,7 @@ public class NetRexxC extends MatchingTask
// compile the source files
if( compileList.size() > 0 )
{
- getLogger().info( "Compiling " + compileList.size() + " source file"
+ getContext().info( "Compiling " + compileList.size() + " source file"
+ ( compileList.size() == 1 ? "" : "s" )
+ " to " + destDir );
doNetRexxCompile();
@@ -599,7 +600,7 @@ public class NetRexxC extends MatchingTask
}
else
{
- getLogger().debug( "Dropping from classpath: " + f.getAbsolutePath() );
+ getContext().debug( "Dropping from classpath: " + f.getAbsolutePath() );
}
}
@@ -613,7 +614,7 @@ public class NetRexxC extends MatchingTask
//FIXME: This should be zapped no ?
if( filecopyList.size() > 0 )
{
- getLogger().info( "Copying " + filecopyList.size() + " file"
+ getContext().info( "Copying " + filecopyList.size() + " file"
+ ( filecopyList.size() == 1 ? "" : "s" )
+ " to " + destDir.getAbsolutePath() );
Iterator enum = filecopyList.keySet().iterator();
@@ -643,7 +644,7 @@ public class NetRexxC extends MatchingTask
private void doNetRexxCompile()
throws TaskException
{
- getLogger().debug( "Using NetRexx compiler" );
+ getContext().debug( "Using NetRexx compiler" );
String classpath = getCompileClasspath();
StringBuffer compileOptions = new StringBuffer();
StringBuffer fileList = new StringBuffer();
@@ -677,7 +678,7 @@ public class NetRexxC extends MatchingTask
compileOptions.append( compileOptionsArray[ i ] );
compileOptions.append( " " );
}
- getLogger().debug( compileOptions.toString() );
+ getContext().debug( compileOptions.toString() );
StringBuffer niceSourceList = new StringBuffer( "Files to be compiled:" + StringUtil.LINE_SEPARATOR );
@@ -688,7 +689,7 @@ public class NetRexxC extends MatchingTask
niceSourceList.append( StringUtil.LINE_SEPARATOR );
}
- getLogger().debug( niceSourceList.toString() );
+ getContext().debug( niceSourceList.toString() );
// need to set java.class.path property and restore it later
// since the NetRexx compiler has no option for the classpath
@@ -704,17 +705,17 @@ public class NetRexxC extends MatchingTask
if( rc > 1 )
{// 1 is warnings from real NetRexxC
- getLogger().error( out.toString() );
+ getContext().error( out.toString() );
String msg = "Compile failed, messages should have been provided.";
throw new TaskException( msg );
}
else if( rc == 1 )
{
- getLogger().warn( out.toString() );
+ getContext().warn( out.toString() );
}
else
{
- getLogger().info( out.toString() );
+ getContext().info( out.toString() );
}
}
finally
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java
index 76eb81c33..a938551ae 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java
@@ -9,6 +9,8 @@ package org.apache.tools.ant.taskdefs.optional.ccm;
import org.apache.aut.nativelib.ExecOutputHandler;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.Commandline;
/**
@@ -146,7 +148,7 @@ public class CCMCreateTask
cmd.addArgument( COMMAND_DEFAULT_TASK );
cmd.addArgument( m_task );
- getLogger().debug( commandLine.toString() );
+ getContext().debug( commandLine.toString() );
final int result2 = run( cmd, null );
if( result2 != 0 )
@@ -219,11 +221,11 @@ public class CCMCreateTask
*/
public void stdout( final String line )
{
- getLogger().debug( "buffer:" + line );
+ getContext().debug( "buffer:" + line );
final String task = getTask( line );
setTask( task );
- getLogger().debug( "task is " + m_task );
+ getContext().debug( "task is " + m_task );
}
private String getTask( final String line )
@@ -236,7 +238,7 @@ public class CCMCreateTask
catch( final Exception e )
{
final String message = "error procession stream " + e.getMessage();
- getLogger().error( message, e );
+ getContext().error( message, e );
}
return null;
@@ -248,7 +250,7 @@ public class CCMCreateTask
*/
public void stderr( final String line )
{
- getLogger().debug( "err " + line );
+ getContext().debug( "err " + line );
}
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
index 46e58243d..0d7d2d82b 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
@@ -20,6 +20,8 @@ import java.util.Hashtable;
import java.util.Locale;
import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
@@ -480,12 +482,12 @@ public class Translate
ins = new FileInputStream( bundleFile );
loaded = true;
bundleLastModified[ i ] = new File( bundleFile ).lastModified();
- getLogger().debug( "Using " + bundleFile );
+ getContext().debug( "Using " + bundleFile );
loadResourceMap( ins );
}
catch( IOException ioe )
{
- getLogger().debug( bundleFile + " not found." );
+ getContext().debug( bundleFile + " not found." );
//if all resource files associated with this bundle
//have been scanned for and still not able to
//find a single resrouce file, throw exception
@@ -532,7 +534,7 @@ public class Translate
}
catch( Exception e )
{
- getLogger().debug( "Exception occured while trying to check/create " + " parent directory. " + e.getMessage() );
+ getContext().debug( "Exception occured while trying to check/create " + " parent directory. " + e.getMessage() );
}
destLastModified = dest.lastModified();
srcLastModified = new File( srcFiles[ i ] ).lastModified();
@@ -547,7 +549,7 @@ public class Translate
|| destLastModified < bundleLastModified[ 5 ]
|| destLastModified < bundleLastModified[ 6 ] )
{
- getLogger().debug( "Processing " + srcFiles[ j ] );
+ getContext().debug( "Processing " + srcFiles[ j ] );
FileOutputStream fos = new FileOutputStream( dest );
BufferedWriter out = new BufferedWriter(
new OutputStreamWriter( fos,
@@ -596,7 +598,7 @@ public class Translate
//use the key itself as the value also.
if( replace == null )
{
- getLogger().debug( "Warning: The key: " + matches + " hasn't been defined." );
+ getContext().debug( "Warning: The key: " + matches + " hasn't been defined." );
replace = matches;
}
line = line.substring( 0, startIndex )
@@ -622,7 +624,7 @@ public class Translate
}
else
{
- getLogger().debug( "Skipping " + srcFiles[ j ] + " as destination file is up to date" );
+ getContext().debug( "Skipping " + srcFiles[ j ] + " as destination file is up to date" );
}
}
catch( IOException ioe )
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
index ede583b38..ec4ac16c8 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
@@ -13,6 +13,7 @@ import java.util.Hashtable;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
@@ -164,7 +165,7 @@ public class JJTree
targetName.substring( 0, targetName.indexOf( ".jjt" ) ) + ".jj" );
if( javaFile.exists() && target.lastModified() < javaFile.lastModified() )
{
- getLogger().info( "Target is already built - skipping (" + target + ")" );
+ getContext().info( "Target is already built - skipping (" + target + ")" );
return;
}
cmdl.addArgument( target.getAbsolutePath() );
@@ -182,7 +183,7 @@ public class JJTree
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
- getLogger().debug( cmdl.toString() );
+ getContext().debug( cmdl.toString() );
exe.setCommandline( new Commandline( cmdl.getCommandline() ) );
exe.setReturnCode( 0 );
exe.execute();
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java
index e6f628548..cf42e88ac 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java
@@ -13,6 +13,7 @@ import java.util.Hashtable;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
@@ -217,7 +218,7 @@ public class JavaCC
final File javaFile = getOutputJavaFile( outputDirectory, target );
if( javaFile.exists() && target.lastModified() < javaFile.lastModified() )
{
- getLogger().debug( "Target is already built - skipping (" + target + ")" );
+ getContext().debug( "Target is already built - skipping (" + target + ")" );
return;
}
cmdl.addArgument( target.getAbsolutePath() );
@@ -239,7 +240,7 @@ public class JavaCC
private void runCommand( final CommandlineJava cmdline )
throws TaskException
{
- getLogger().debug( cmdline.toString() );
+ getContext().debug( cmdline.toString() );
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
final String[] commandline = cmdline.getCommandline();
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
index 601b79129..c12c6c22a 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
@@ -14,6 +14,7 @@ import java.io.PrintWriter;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
@@ -252,9 +253,9 @@ public class JDependTask
if( m_outputFile != null )
{
- getLogger().info( "Output to be stored in " + m_outputFile.getPath() );
+ getContext().info( "Output to be stored in " + m_outputFile.getPath() );
}
- getLogger().debug( "Executing: " + commandline.toString() );
+ getContext().debug( "Executing: " + commandline.toString() );
return exe.execute();
}
@@ -295,11 +296,11 @@ public class JDependTask
catch( IOException e )
{
String msg = "JDepend Failed when creating the output file: " + e.getMessage();
- getLogger().info( msg );
+ getContext().info( msg );
throw new TaskException( msg );
}
jdepend.setWriter( new PrintWriter( fw ) );
- getLogger().info( "Output to be stored in " + m_outputFile.getPath() );
+ getContext().info( "Output to be stored in " + m_outputFile.getPath() );
}
final String[] elements = FileUtils.parsePath( m_sourcesPath.toString() );
@@ -311,7 +312,7 @@ public class JDependTask
if( !f.exists() || !f.isDirectory() )
{
String msg = "\"" + f.getPath() + "\" does not represent a valid directory. JDepend would fail.";
- getLogger().info( msg );
+ getContext().info( msg );
throw new TaskException( msg );
}
try
@@ -321,7 +322,7 @@ public class JDependTask
catch( IOException e )
{
String msg = "JDepend Failed when adding a source directory: " + e.getMessage();
- getLogger().info( msg );
+ getContext().info( msg );
throw new TaskException( msg );
}
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java
index c2e02d180..7f26c95ff 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java
@@ -12,6 +12,7 @@ import java.util.ArrayList;
import java.util.Date;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapter;
import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapterFactory;
@@ -378,13 +379,13 @@ public class JspC extends MatchingTask
{
compiler = "jasper";
}
- getLogger().debug( "compiling " + compileList.size() + " files" );
+ getContext().debug( "compiling " + compileList.size() + " files" );
if( compileList.size() > 0 )
{
CompilerAdapter adapter =
CompilerAdapterFactory.getCompiler( compiler.toString(), getContext() );
- getLogger().info( "Compiling " + compileList.size() +
+ getContext().info( "Compiling " + compileList.size() +
" source file"
+ ( compileList.size() == 1 ? "" : "s" )
+ ( destDir != null ? " to " + destDir : "" ) );
@@ -401,7 +402,7 @@ public class JspC extends MatchingTask
}
else
{
- getLogger().error( FAIL_MSG );
+ getContext().error( FAIL_MSG );
}
}
}
@@ -409,11 +410,11 @@ public class JspC extends MatchingTask
{
if( filecount == 0 )
{
- getLogger().info( "there were no files to compile" );
+ getContext().info( "there were no files to compile" );
}
else
{
- getLogger().debug( "all files are up to date" );
+ getContext().debug( "all files are up to date" );
}
}
}
@@ -460,7 +461,7 @@ public class JspC extends MatchingTask
{
final String message =
"Warning: file modified in the future: " + files[ i ];
- getLogger().warn( message );
+ getContext().warn( message );
}
if( !javaFile.exists() ||
@@ -468,11 +469,11 @@ public class JspC extends MatchingTask
{
if( !javaFile.exists() )
{
- getLogger().debug( "Compiling " + srcFile.getPath() + " because java file " + javaFile.getPath() + " does not exist" );
+ getContext().debug( "Compiling " + srcFile.getPath() + " because java file " + javaFile.getPath() + " does not exist" );
}
else
{
- getLogger().debug( "Compiling " + srcFile.getPath() + " because it is out of date with respect to " + javaFile.getPath() );
+ getContext().debug( "Compiling " + srcFile.getPath() + " because it is out of date with respect to " + javaFile.getPath() );
}
compileList.add( srcFile.getAbsolutePath() );
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
index b2d7529af..a1ad8068f 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
@@ -12,6 +12,8 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.StringTokenizer;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.Java;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.Argument;
@@ -199,7 +201,7 @@ public class WLJspc extends MatchingTask
args[ j++ ] = compileClasspath.toString();
this.scanDir( files );
- getLogger().info( "Compiling " + filesToDo.size() + " JSP files" );
+ getContext().info( "Compiling " + filesToDo.size() + " JSP files" );
for( int i = 0; i < filesToDo.size(); i++ )
{
@@ -235,7 +237,7 @@ public class WLJspc extends MatchingTask
helperTask.addClasspath( compileClasspath );
if( helperTask.executeJava() != 0 )
{
- getLogger().warn( files[ i ] + " failed to compile" );
+ getContext().warn( files[ i ] + " failed to compile" );
}
}
}
@@ -298,13 +300,13 @@ public class WLJspc extends MatchingTask
if( srcFile.lastModified() > now )
{
final String message = "Warning: file modified in the future: " + files[ i ];
- getLogger().warn( message );
+ getContext().warn( message );
}
if( srcFile.lastModified() > classFile.lastModified() )
{
//log("Files are" + srcFile.getAbsolutePath()+" " +classFile.getAbsolutePath());
filesToDo.add( files[ i ] );
- getLogger().debug( "Recompiling File " + files[ i ] );
+ getContext().debug( "Recompiling File " + files[ i ] );
}
}
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
index a8425d085..fca57dce7 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
@@ -454,24 +454,24 @@ public class JUnitTask extends AbstractTask
{
int pling = u.indexOf( "!" );
String jarName = u.substring( 9, pling );
- getLogger().debug( "Implicitly adding " + jarName + " to classpath" );
+ getContext().debug( "Implicitly adding " + jarName + " to classpath" );
createClasspath().addLocation( new File( jarName ) );
}
else if( u.startsWith( "file:" ) )
{
int tail = u.indexOf( resource );
String dirName = u.substring( 5, tail );
- getLogger().debug( "Implicitly adding " + dirName + " to classpath" );
+ getContext().debug( "Implicitly adding " + dirName + " to classpath" );
createClasspath().addLocation( new File( dirName ) );
}
else
{
- getLogger().debug( "Don\'t know how to handle resource URL " + u );
+ getContext().debug( "Don\'t know how to handle resource URL " + u );
}
}
else
{
- getLogger().debug( "Couldn\'t find " + resource );
+ getContext().debug( "Couldn\'t find " + resource );
}
}
@@ -530,7 +530,7 @@ public class JUnitTask extends AbstractTask
{
final String message = "TEST " + test.getName() + " FAILED" +
( wasKilled ? " (timeout)" : "" );
- getLogger().error( message );
+ getContext().error( message );
if( errorOccurredHere && test.getErrorProperty() != null )
{
final String name = test.getErrorProperty();
@@ -593,7 +593,7 @@ public class JUnitTask extends AbstractTask
cmd.addArgument( "haltOnFailure=" + test.getHaltonfailure() );
if( summary )
{
- getLogger().info( "Running " + test.getName() );
+ getContext().info( "Running " + test.getName() );
cmd.addArgument( "formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter" );
}
@@ -643,7 +643,7 @@ public class JUnitTask extends AbstractTask
exe.setWorkingDirectory( dir );
}
- getLogger().debug( "Executing: " + cmd.toString() );
+ getContext().debug( "Executing: " + cmd.toString() );
try
{
return exe.execute();
@@ -666,7 +666,7 @@ public class JUnitTask extends AbstractTask
test.setProperties( getContext().getProperties() );
if( dir != null )
{
- getLogger().warn( "dir attribute ignored if running in the same VM" );
+ getContext().warn( "dir attribute ignored if running in the same VM" );
}
SysProperties sysProperties = commandline.getSystemProperties();
@@ -676,12 +676,12 @@ public class JUnitTask extends AbstractTask
}
try
{
- getLogger().debug( "Using System properties " + System.getProperties() );
+ getContext().debug( "Using System properties " + System.getProperties() );
ClassLoader classLoader = null;
Path classpath = commandline.getClasspath();
if( classpath != null )
{
- getLogger().debug( "Using CLASSPATH " + classpath );
+ getContext().debug( "Using CLASSPATH " + classpath );
final URL[] urls = PathUtil.toURLs( classpath );
classLoader = new URLClassLoader( urls );
}
@@ -692,7 +692,7 @@ public class JUnitTask extends AbstractTask
classLoader );
if( summary )
{
- getLogger().info( "Running " + test.getName() );
+ getContext().info( "Running " + test.getName() );
SummaryJUnitResultFormatter f =
new SummaryJUnitResultFormatter();
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java
index 1b3313ff7..113afafa4 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java
@@ -20,6 +20,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.avalon.framework.ExceptionUtil;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.ScannerUtil;
@@ -273,7 +274,7 @@ public class XMLResultAggregator
{
try
{
- getLogger().debug( "Parsing file: '" + files[ i ] + "'" );
+ getContext().debug( "Parsing file: '" + files[ i ] + "'" );
//XXX there seems to be a bug in xerces 1.3.0 that doesn't like file object
// will investigate later. It does not use the given directory but
// the vm dir instead ? Works fine with crimson.
@@ -287,19 +288,19 @@ public class XMLResultAggregator
else
{
// issue a warning.
- getLogger().warn( "the file " + files[ i ] + " is not a valid testsuite XML document" );
+ getContext().warn( "the file " + files[ i ] + " is not a valid testsuite XML document" );
}
}
catch( SAXException e )
{
// a testcase might have failed and write a zero-length document,
// It has already failed, but hey.... mm. just put a warning
- getLogger().warn( "The file " + files[ i ] + " is not a valid XML document. It is possibly corrupted." );
- getLogger().debug( ExceptionUtil.printStackTrace( e ) );
+ getContext().warn( "The file " + files[ i ] + " is not a valid XML document. It is possibly corrupted." );
+ getContext().debug( ExceptionUtil.printStackTrace( e ) );
}
catch( IOException e )
{
- getLogger().error( "Error while accessing file " + files[ i ] + ": " + e.getMessage() );
+ getContext().error( "Error while accessing file " + files[ i ] + ": " + e.getMessage() );
}
}
return rootElement;
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
index 1965ab18b..0548ecec9 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
@@ -18,6 +18,7 @@ import java.util.Random;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Commandline;
@@ -207,7 +208,7 @@ public abstract class AbstractMetamataTask
// retrieve all the files we want to scan
m_includedFiles = scanFileSets();
- getLogger().debug( m_includedFiles.size() + " files added for audit" );
+ getContext().debug( m_includedFiles.size() + " files added for audit" );
// write all the options to a temp file and use it ro run the process
ArrayList options = getOptions();
@@ -281,7 +282,7 @@ public abstract class AbstractMetamataTask
{
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
- getLogger().debug( m_cmdl.toString() );
+ getContext().debug( m_cmdl.toString() );
final String[] commandline = m_cmdl.getCommandline();
exe.setCommandline( new Commandline( commandline ) );
exe.setReturnCode( 0 );
@@ -336,7 +337,7 @@ public abstract class AbstractMetamataTask
DirectoryScanner ds = ScannerUtil.getDirectoryScanner( fs );
ds.scan();
String[] f = ds.getIncludedFiles();
- getLogger().debug( i + ") Adding " + f.length + " files from directory " + ds.getBasedir() );
+ getContext().debug( i + ") Adding " + f.length + " files from directory " + ds.getBasedir() );
for( int j = 0; j < f.length; j++ )
{
String pathname = f[ j ];
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java
index 7f8384c8b..578629740 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java
@@ -10,6 +10,8 @@ package org.apache.tools.ant.taskdefs.optional.metamata;
import java.io.File;
import java.util.ArrayList;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.Path;
/**
@@ -174,7 +176,7 @@ public class MAudit
}
if( !m_unused && m_searchPath != null )
{
- getLogger().warn( "'searchpath' element ignored. 'unused' attribute is disabled." );
+ getContext().warn( "'searchpath' element ignored. 'unused' attribute is disabled." );
}
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java
index ef8d4bc4a..9e08d81b9 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java
@@ -247,7 +247,6 @@ public class MMetrics extends AbstractMetamataTask
{
xmlStream = new FileOutputStream( outFile );
ExecuteStreamHandler xmlHandler = new MMetricsStreamHandler( xmlStream );
- setupLogger( xmlHandler );
xmlHandler.setProcessOutputStream( tmpStream );
xmlHandler.start();
xmlHandler.stop();
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java
index 1aa97b47a..3c9d28d12 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java
@@ -26,7 +26,6 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -43,7 +42,6 @@ import org.xml.sax.helpers.AttributesImpl;
* @author Stephane Bailliez
*/
public class MMetricsStreamHandler
- extends AbstractLogEnabled
implements ExecuteStreamHandler
{
/**
@@ -162,7 +160,6 @@ public class MMetricsStreamHandler
}
catch( Exception e )
{
- e.printStackTrace();
throw new IOException( e.getMessage() );
}
}
@@ -278,7 +275,7 @@ public class MMetricsStreamHandler
* @exception SAXException Description of Exception
*/
protected void parseOutput()
- throws IOException, SAXException
+ throws IOException, SAXException, ParseException
{
BufferedReader br = new BufferedReader( new InputStreamReader( metricsOutput ) );
String line = null;
@@ -296,23 +293,14 @@ public class MMetricsStreamHandler
* @exception SAXException Description of Exception
*/
protected void processLine( String line )
- throws SAXException
+ throws SAXException, ParseException
{
if( line.startsWith( "Construct\tV(G)\tLOC\tDIT\tNOA\tNRM\tNLM\tWMC\tRFC\tDAC\tFANOUT\tCBO\tLCOM\tNOCL" ) )
{
return;
}
- try
- {
- MetricsElement elem = MetricsElement.parse( line );
- startElement( elem );
- }
- catch( ParseException e )
- {
- e.printStackTrace();
- // invalid lines are sent to the output as information, it might be anything,
- getLogger().info( line );
- }
+ MetricsElement elem = MetricsElement.parse( line );
+ startElement( elem );
}
/**
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
index f657dc4f0..e5d4f273b 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
@@ -17,6 +17,7 @@ import org.apache.aut.nativelib.ExecManager;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Commandline;
@@ -283,13 +284,13 @@ public class MParse
File javaFile = new File( pathname );
if( javaFile.exists() && m_target.lastModified() < javaFile.lastModified() )
{
- getLogger().info( "Target is already build - skipping (" + m_target + ")" );
+ getContext().info( "Target is already build - skipping (" + m_target + ")" );
return;
}
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
- getLogger().debug( m_cmdl.toString() );
+ getContext().debug( m_cmdl.toString() );
final String[] commandline = m_cmdl.getCommandline();
exe.setCommandline( new Commandline( commandline ) );
exe.setReturnCode( 0 );
@@ -347,7 +348,7 @@ public class MParse
final File sunjj = new File( m_target.getParent(), name );
if( sunjj.exists() )
{
- getLogger().info( "Removing stale file: " + sunjj.getName() );
+ getContext().info( "Removing stale file: " + sunjj.getName() );
sunjj.delete();
}
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
index cafbeef40..e44954bdd 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
@@ -288,7 +288,7 @@ public class FTP
try
{
- getLogger().debug( "Opening FTP connection to " + m_server );
+ getContext().debug( "Opening FTP connection to " + m_server );
ftp = new FTPClient();
@@ -298,15 +298,15 @@ public class FTP
throw new TaskException( "FTP connection failed: " + ftp.getReplyString() );
}
- getLogger().debug( "connected" );
- getLogger().debug( "logging in to FTP server" );
+ getContext().debug( "connected" );
+ getContext().debug( "logging in to FTP server" );
if( !ftp.login( m_userid, m_password ) )
{
throw new TaskException( "Could not login to FTP server" );
}
- getLogger().debug( "login succeeded" );
+ getContext().debug( "login succeeded" );
if( m_binary )
{
@@ -321,7 +321,7 @@ public class FTP
if( m_passive )
{
- getLogger().debug( "entering passive mode" );
+ getContext().debug( "entering passive mode" );
ftp.enterLocalPassiveMode();
if( !FTPReply.isPositiveCompletion( ftp.getReplyCode() ) )
{
@@ -344,7 +344,7 @@ public class FTP
{
if( m_remotedir != null )
{
- getLogger().debug( "changing the remote directory" );
+ getContext().debug( "changing the remote directory" );
ftp.changeWorkingDirectory( m_remotedir );
if( !FTPReply.isPositiveCompletion( ftp.getReplyCode() ) )
{
@@ -353,7 +353,7 @@ public class FTP
ftp.getReplyString() );
}
}
- getLogger().info( ACTION_STRS[ m_action ] + " files" );
+ getContext().info( ACTION_STRS[ m_action ] + " files" );
transferFiles( ftp );
}
@@ -368,7 +368,7 @@ public class FTP
{
try
{
- getLogger().debug( "disconnecting" );
+ getContext().debug( "disconnecting" );
ftp.logout();
ftp.disconnect();
}
@@ -411,7 +411,7 @@ public class FTP
if( m_verbose )
{
- getLogger().info( "transferring " + filename + " to " + file.getAbsolutePath() );
+ getContext().info( "transferring " + filename + " to " + file.getAbsolutePath() );
}
final File parent = file.getParentFile();
@@ -427,7 +427,7 @@ public class FTP
String s = "could not get file: " + ftp.getReplyString();
if( m_skipFailedTransfers == true )
{
- getLogger().warn( s );
+ getContext().warn( s );
m_skipped++;
}
else
@@ -438,7 +438,7 @@ public class FTP
}
else
{
- getLogger().debug( "File " + file.getAbsolutePath() + " copied from " + m_server );
+ getContext().debug( "File " + file.getAbsolutePath() + " copied from " + m_server );
m_transferred++;
}
}
@@ -465,7 +465,7 @@ public class FTP
protected boolean isUpToDate( FTPClient ftp, File localFile, String remoteFile )
throws IOException, TaskException
{
- getLogger().debug( "checking date for " + remoteFile );
+ getContext().debug( "checking date for " + remoteFile );
FTPFile[] files = ftp.listFiles( remoteFile );
@@ -478,7 +478,7 @@ public class FTP
if( m_action == SEND_FILES )
{
- getLogger().debug( "Could not date test remote file: " + remoteFile + "assuming out of date." );
+ getContext().debug( "Could not date test remote file: " + remoteFile + "assuming out of date." );
return false;
}
else
@@ -554,7 +554,7 @@ public class FTP
dir = (File)parents.get( i );
if( !m_dirCache.contains( dir ) )
{
- getLogger().debug( "creating remote directory " + remoteResolveFile( dir.getPath() ) );
+ getContext().debug( "creating remote directory " + remoteResolveFile( dir.getPath() ) );
ftp.makeDirectory( remoteResolveFile( dir.getPath() ) );
// Both codes 550 and 553 can be produced by FTP Servers
// to indicate that an attempt to create a directory has
@@ -581,7 +581,7 @@ public class FTP
{
if( m_verbose )
{
- getLogger().info( "deleting " + filename );
+ getContext().info( "deleting " + filename );
}
if( !ftp.deleteFile( remoteResolveFile( filename ) ) )
@@ -589,7 +589,7 @@ public class FTP
String s = "could not delete file: " + ftp.getReplyString();
if( m_skipFailedTransfers == true )
{
- getLogger().warn( s );
+ getContext().warn( s );
m_skipped++;
}
else
@@ -599,7 +599,7 @@ public class FTP
}
else
{
- getLogger().debug( "File " + filename + " deleted from " + m_server );
+ getContext().debug( "File " + filename + " deleted from " + m_server );
m_transferred++;
}
}
@@ -616,7 +616,7 @@ public class FTP
{
if( m_verbose )
{
- getLogger().info( "listing " + filename );
+ getContext().info( "listing " + filename );
}
FTPFile ftpfile = ftp.listFiles( remoteResolveFile( filename ) )[ 0 ];
@@ -639,7 +639,7 @@ public class FTP
{
if( m_verbose )
{
- getLogger().info( "creating directory: " + dir );
+ getContext().info( "creating directory: " + dir );
}
if( !ftp.makeDirectory( dir ) )
@@ -657,14 +657,14 @@ public class FTP
if( m_verbose )
{
- getLogger().info( "directory already exists" );
+ getContext().info( "directory already exists" );
}
}
else
{
if( m_verbose )
{
- getLogger().info( "directory created OK" );
+ getContext().info( "directory created OK" );
}
}
}
@@ -715,7 +715,7 @@ public class FTP
if( m_verbose )
{
- getLogger().info( "transferring " + file.getAbsolutePath() );
+ getContext().info( "transferring " + file.getAbsolutePath() );
}
instream = new BufferedInputStream( new FileInputStream( file ) );
@@ -729,7 +729,7 @@ public class FTP
String s = "could not put file: " + ftp.getReplyString();
if( m_skipFailedTransfers == true )
{
- getLogger().warn( s );
+ getContext().warn( s );
m_skipped++;
}
else
@@ -741,7 +741,7 @@ public class FTP
else
{
- getLogger().debug( "File " + file.getAbsolutePath() + " copied to " + m_server );
+ getContext().debug( "File " + file.getAbsolutePath() + " copied to " + m_server );
m_transferred++;
}
}
@@ -889,10 +889,10 @@ public class FTP
}
}
- getLogger().info( m_transferred + " files " + COMPLETED_ACTION_STRS[ m_action ] );
+ getContext().info( m_transferred + " files " + COMPLETED_ACTION_STRS[ m_action ] );
if( m_skipped != 0 )
{
- getLogger().info( m_skipped + " files were not successfully " + COMPLETED_ACTION_STRS[ m_action ] );
+ getContext().info( m_skipped + " files were not successfully " + COMPLETED_ACTION_STRS[ m_action ] );
}
}
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java
index 0c901da34..d3c1bcfce 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java
@@ -25,6 +25,7 @@ import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.ScannerUtil;
@@ -263,7 +264,7 @@ public class MimeMail extends AbstractTask
MimeMessage msg = new MimeMessage( sesh );
//set the sender
- getLogger().debug( "message sender: " + from );
+ getContext().debug( "message sender: " + from );
msg.setFrom( new InternetAddress( from ) );
// add recipient lists
@@ -273,7 +274,7 @@ public class MimeMail extends AbstractTask
if( subject != null )
{
- getLogger().debug( "subject: " + subject );
+ getContext().debug( "subject: " + subject );
msg.setSubject( subject );
}
@@ -326,7 +327,7 @@ public class MimeMail extends AbstractTask
throw new TaskException( "File \"" + file.getAbsolutePath()
+ "\" does not exist or is not readable." );
}
- getLogger().debug( "Attaching " + file.toString() + " - " + file.length() + " bytes" );
+ getContext().debug( "Attaching " + file.toString() + " - " + file.length() + " bytes" );
FileDataSource fileData = new FileDataSource( file );
DataHandler fileDataHandler = new DataHandler( fileData );
body.setDataHandler( fileDataHandler );
@@ -337,7 +338,7 @@ public class MimeMail extends AbstractTask
}// for i
msg.setContent( attachments );
- getLogger().info( "sending email " );
+ getContext().info( "sending email " );
Transport.send( msg );
}
@@ -364,7 +365,7 @@ public class MimeMail extends AbstractTask
else
{
String text = e.toString();
- getLogger().error( text );
+ getContext().error( text );
}
}
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java
index 9108c20c0..a1d08b43c 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java
@@ -15,6 +15,7 @@ import java.util.Calendar;
import java.util.Iterator;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
/**
* Class to provide automated telnet protocol support for the Ant build tool
@@ -226,7 +227,7 @@ public class TelnetTask
output.write( ( string + "\n" ).getBytes() );
if( echoString )
{
- getLogger().info( string );
+ getContext().info( string );
}
output.flush();
}
@@ -269,7 +270,7 @@ public class TelnetTask
sb.append( (char)input.read() );
}
}
- getLogger().info( sb.toString() );
+ getContext().info( sb.toString() );
}
catch( final TaskException te )
{
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java
index f392bcc31..b88bd60d3 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java
@@ -10,6 +10,8 @@ package org.apache.tools.ant.taskdefs.optional.perforce;
import java.io.File;
import java.util.ArrayList;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.ScannerUtil;
@@ -151,7 +153,7 @@ public class P4Add extends P4Base
}
else
{
- getLogger().warn( "No files specified to add!" );
+ getContext().warn( "No files specified to add!" );
}
}
@@ -160,10 +162,10 @@ public class P4Add extends P4Base
private void execP4Add( final StringBuffer list )
throws TaskException
{
- if( getLogger().isInfoEnabled() )
+ if( getContext().isInfoEnabled() )
{
final String message = "Execing add " + m_p4CmdOpts + " " + addCmd + list;
- getLogger().info( message );
+ getContext().info( message );
}
final String command = "-s add " + m_p4CmdOpts + " " + addCmd + list;
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java
index af428cde4..f1cc5af46 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java
@@ -11,6 +11,7 @@ import org.apache.aut.nativelib.ExecManager;
import org.apache.aut.nativelib.ExecOutputHandler;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.oro.text.perl.Perl5Util;
import org.apache.tools.ant.types.Commandline;
@@ -158,7 +159,7 @@ public abstract class P4Base
cmdl += cmdline[ i ] + " ";
}
- getLogger().debug( "Execing " + cmdl );
+ getContext().debug( "Execing " + cmdl );
if( handler == null )
{
handler = this;
@@ -217,7 +218,7 @@ public abstract class P4Base
registerError( new TaskException( line ) );
}
- getLogger().info( util.substitute( "s/^.*: //", line ) );
+ getContext().info( util.substitute( "s/^.*: //", line ) );
}
public void stderr( final String line )
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java
index f28e13da0..b58800ad3 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java
@@ -8,6 +8,8 @@
package org.apache.tools.ant.taskdefs.optional.perforce;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
/**
* P4Change - grab a new changelist from Perforce. P4Change creates a new
@@ -105,7 +107,7 @@ public class P4Change
{
if( util.match( "/error/", line ) )
{
- getLogger().debug( "Client Error" );
+ getContext().debug( "Client Error" );
registerError( new TaskException( "Perforce Error, check client settings and/or server" ) );
}
else if( util.match( "//", line ) )
@@ -135,7 +137,7 @@ public class P4Change
line = util.substitute( "s/[^0-9]//g", line );
final int changenumber = Integer.parseInt( line );
- getLogger().info( "Change Number is " + changenumber );
+ getContext().info( "Change Number is " + changenumber );
try
{
getContext().setProperty( "p4.change", "" + changenumber );
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java
index f9c284925..72a5cbea1 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java
@@ -8,6 +8,8 @@
package org.apache.tools.ant.taskdefs.optional.perforce;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
/**
* P4Counter - Obtain or set the value of a counter. P4Counter can be used to
@@ -73,7 +75,7 @@ public class P4Counter
}
else
{
- getLogger().debug( "P4Counter retrieved line \"" + line + "\"" );
+ getContext().debug( "P4Counter retrieved line \"" + line + "\"" );
try
{
m_value = Integer.parseInt( line );
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java
index e1475c4af..09d93fa13 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java
@@ -10,6 +10,8 @@ package org.apache.tools.ant.taskdefs.optional.perforce;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
/**
* P4Label - create a Perforce Label. P4Label inserts a label into perforce
@@ -46,7 +48,7 @@ public class P4Label
public void stdout( String line )
{
- getLogger().debug( line );
+ getContext().debug( line );
if( null != m_labelSpec )
{
@@ -62,7 +64,7 @@ public class P4Label
public void execute()
throws TaskException
{
- getLogger().info( "P4Label exec:" );
+ getContext().info( "P4Label exec:" );
validate();
@@ -77,13 +79,13 @@ public class P4Label
execP4Command( "label -i", null );
execP4Command( "labelsync -l " + m_name, null );
- getLogger().info( "Created Label " + m_name + " (" + m_description + ")" );
+ getContext().info( "Created Label " + m_name + " (" + m_description + ")" );
//Now lock if required
if( m_lock != null && m_lock.equalsIgnoreCase( "locked" ) )
{
- getLogger().info( "Modifying lock status to 'locked'" );
+ getContext().info( "Modifying lock status to 'locked'" );
//Read back the label spec from perforce,
//Replace Options
@@ -92,12 +94,12 @@ public class P4Label
m_labelSpec = new StringBuffer();
execP4Command( "label -o " + m_name, null );
final String labelSpec = m_labelSpec.toString();
- getLogger().debug( labelSpec );
+ getContext().debug( labelSpec );
//reset labelSpec to null so output is not written to it anymore
m_labelSpec = null;
- getLogger().debug( "Now locking label..." );
+ getContext().debug( "Now locking label..." );
//handler.setOutput( labelSpec );
execP4Command( "label -i", null );
}
@@ -107,19 +109,19 @@ public class P4Label
{
if( m_p4View == null || m_p4View.length() < 1 )
{
- getLogger().warn( "View not set, assuming //depot/..." );
+ getContext().warn( "View not set, assuming //depot/..." );
m_p4View = "//depot/...";
}
if( m_description == null || m_description.length() < 1 )
{
- getLogger().warn( "Label Description not set, assuming 'AntLabel'" );
+ getContext().warn( "Label Description not set, assuming 'AntLabel'" );
m_description = "AntLabel";
}
if( m_lock != null && !m_lock.equalsIgnoreCase( "locked" ) )
{
- getLogger().warn( "lock attribute invalid - ignoring" );
+ getContext().warn( "lock attribute invalid - ignoring" );
}
if( m_name == null || m_name.length() < 1 )
@@ -127,7 +129,7 @@ public class P4Label
SimpleDateFormat formatter = new SimpleDateFormat( "yyyy.MM.dd-hh:mm" );
Date now = new Date();
m_name = "AntLabel-" + formatter.format( now );
- getLogger().warn( "name not set, assuming '" + m_name + "'" );
+ getContext().warn( "name not set, assuming '" + m_name + "'" );
}
}
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java
index 13f803dc3..cbd4fc9cf 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java
@@ -8,6 +8,8 @@
package org.apache.tools.ant.taskdefs.optional.perforce;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
/**
* P4Submit - submit a numbered changelist to Perforce. Note: P4Submit
@@ -35,7 +37,7 @@ public class P4Submit
*/
public void stdout( final String line )
{
- getLogger().debug( line );
+ getContext().debug( line );
}
public void execute()
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java
index f5da854a3..8b189c267 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java
@@ -8,6 +8,8 @@
package org.apache.tools.ant.taskdefs.optional.perforce;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
/**
* P4Sync - synchronise client space to a perforce depot view. The API allows
@@ -122,7 +124,7 @@ public class P4Sync
}
final String message = "Execing sync " + m_p4CmdOpts + " " + m_syncCmd;
- getLogger().debug( message );
+ getContext().debug( message );
final String command = "-s sync " + m_p4CmdOpts + " " + m_syncCmd;
execP4Command( command, null );
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
index 460252c99..7571e435d 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
@@ -24,6 +24,7 @@ import org.apache.aut.nativelib.ExecOutputHandler;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline;
@@ -187,8 +188,8 @@ public class Pvcs
final File filelist = getFileList();
final Commandline cmd = buildGetCommand( filelist );
- getLogger().info( "Getting files" );
- getLogger().debug( "Executing " + cmd.toString() );
+ getContext().info( "Getting files" );
+ getContext().debug( "Executing " + cmd.toString() );
try
{
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
@@ -258,7 +259,7 @@ public class Pvcs
// Capture output
// build the command line from what we got the format is
final Commandline cmd = buildPCLICommand();
- getLogger().debug( "Executing " + cmd.toString() );
+ getContext().debug( "Executing " + cmd.toString() );
File tmp = null;
@@ -284,7 +285,7 @@ public class Pvcs
}
// Create folders in workspace
- getLogger().info( "Creating folders" );
+ getContext().info( "Creating folders" );
createFolders( tmp );
// Massage PCLI lvf output transforming '\' to '/' so get command works appropriately
@@ -326,7 +327,7 @@ public class Pvcs
catch( final IOException ioe )
{
final String message = "Failed to write to output stream";
- getLogger().error( message );
+ getContext().error( message );
}
}
@@ -336,7 +337,7 @@ public class Pvcs
*/
public void stderr( final String line )
{
- getLogger().warn( line );
+ getContext().warn( line );
}
private Commandline buildPCLICommand()
@@ -420,7 +421,7 @@ public class Pvcs
String line = in.readLine();
while( line != null )
{
- getLogger().debug( "Considering \"" + line + "\"" );
+ getContext().debug( "Considering \"" + line + "\"" );
if( line.startsWith( "\"\\" ) ||
line.startsWith( "\"/" ) ||
line.startsWith( m_lineStart ) )
@@ -434,30 +435,30 @@ public class Pvcs
File dir = new File( f.substring( 0, index ) );
if( !dir.exists() )
{
- getLogger().debug( "Creating " + dir.getAbsolutePath() );
+ getContext().debug( "Creating " + dir.getAbsolutePath() );
if( dir.mkdirs() )
{
- getLogger().info( "Created " + dir.getAbsolutePath() );
+ getContext().info( "Created " + dir.getAbsolutePath() );
}
else
{
- getLogger().info( "Failed to create " + dir.getAbsolutePath() );
+ getContext().info( "Failed to create " + dir.getAbsolutePath() );
}
}
else
{
- getLogger().debug( dir.getAbsolutePath() + " exists. Skipping" );
+ getContext().debug( dir.getAbsolutePath() + " exists. Skipping" );
}
}
else
{
final String message = "File separator problem with " + line;
- getLogger().warn( message );
+ getContext().warn( message );
}
}
else
{
- getLogger().debug( "Skipped \"" + line + "\"" );
+ getContext().debug( "Skipped \"" + line + "\"" );
}
line = in.readLine();
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java
index 6a54fc186..f728d7b80 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java
@@ -18,6 +18,7 @@ import com.starbase.util.Platform;
import java.util.StringTokenizer;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.ScannerUtil;
/**
@@ -622,7 +623,7 @@ public class AntStarTeamCheckOut
// send the message to the project log.
// Tell how many files were checked out.
- getLogger().info( checkedOut + " files checked out." );
+ getContext().info( checkedOut + " files checked out." );
}
/**
@@ -857,7 +858,7 @@ public class AntStarTeamCheckOut
{
strFolder = strFolder.substring( i + 1 );
}
- getLogger().info( " Folder: \"" + strFolder + "\"" );
+ getContext().info( " Folder: \"" + strFolder + "\"" );
prevFolder = f;
// If we displayed the project, view, item type, or folder,
@@ -868,7 +869,7 @@ public class AntStarTeamCheckOut
{
header.append( ",\t" ).append( p2.getDisplayName() );
}
- getLogger().info( header.toString() );
+ getContext().info( header.toString() );
}
// Finally, show the Item properties ...
@@ -897,7 +898,7 @@ public class AntStarTeamCheckOut
{
itemLine.append( ",\tNot locked" );
}
- getLogger().info( itemLine.toString() );
+ getContext().info( itemLine.toString() );
}
// END VERBOSE ONLY
@@ -937,7 +938,7 @@ public class AntStarTeamCheckOut
{
if( getVerbose() )
{
- getLogger().info( "Found " + getProjectName() + delim + getViewName() + delim );
+ getContext().info( "Found " + getProjectName() + delim + getViewName() + delim );
}
runType( s, p, v, s.typeForName( (String)s.getTypeNames().FILE ) );
break;
@@ -961,7 +962,7 @@ public class AntStarTeamCheckOut
{
if( getVerbose() )
{
- getLogger().info( "Found " + getProjectName() + delim );
+ getContext().info( "Found " + getProjectName() + delim );
}
runProject( s, p );
break;
@@ -998,7 +999,7 @@ public class AntStarTeamCheckOut
if( getVerbose() && getFolderName() != null )
{
- getLogger().info( "Found " + getProjectName() + delim + getViewName() +
+ getContext().info( "Found " + getProjectName() + delim + getViewName() +
delim + getFolderName() + delim + "\n" );
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java
index 94b81e4b6..548bb1090 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java
@@ -16,6 +16,7 @@ import java.util.Random;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.DirectoryScanner;
@@ -117,7 +118,7 @@ public class CovMerge
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
- getLogger().debug( cmdl.toString() );
+ getContext().debug( cmdl.toString() );
exe.setCommandline( cmdl );
// JProbe process always return 0 so we will not be
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java
index 32e5000c3..41e94e80e 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java
@@ -20,6 +20,7 @@ import javax.xml.transform.stream.StreamResult;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.EnumeratedAttribute;
@@ -250,15 +251,15 @@ public class CovReport
// use the custom handler for stdin issues
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
- getLogger().debug( cmdl.toString() );
+ getContext().debug( cmdl.toString() );
exe.setCommandline( cmdl );
int exitValue = exe.execute();
if( exitValue != 0 )
{
throw new TaskException( "JProbe Coverage Report failed (" + exitValue + ")" );
}
- getLogger().debug( "coveragePath: " + coveragePath );
- getLogger().debug( "format: " + format );
+ getContext().debug( "coveragePath: " + coveragePath );
+ getContext().debug( "format: " + format );
if( reference != null && "xml".equals( format ) )
{
reference.createEnhancedXMLReport();
@@ -340,7 +341,7 @@ public class CovReport
}
if( reference != null && !"xml".equals( format ) )
{
- getLogger().info( "Ignored reference. It cannot be used in non XML report." );
+ getContext().info( "Ignored reference. It cannot be used in non XML report." );
reference = null;// nullify it so that there is no ambiguity
}
@@ -406,13 +407,13 @@ public class CovReport
if( filters == null || filters.size() == 0 )
{
createFilters();
- getLogger().debug( "Adding default include filter to *.*()" );
+ getContext().debug( "Adding default include filter to *.*()" );
Include include = new Include();
filters.addInclude( include );
}
try
{
- getLogger().debug( "Creating enhanced XML report" );
+ getContext().debug( "Creating enhanced XML report" );
XMLReport report = new XMLReport( CovReport.this, tofile );
report.setReportFilters( filters );
report.setJProbehome( new File( home.getParent() ) );
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java
index de68a26d8..027909a8a 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java
@@ -16,6 +16,7 @@ import java.util.ArrayList;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Commandline;
@@ -251,7 +252,7 @@ public class Coverage
// use the custom handler for stdin issues
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
- getLogger().debug( cmdl.toString() );
+ getContext().debug( cmdl.toString() );
exe.setCommandline( cmdl );
int exitValue = exe.execute();
if( exitValue != 0 )
@@ -412,7 +413,7 @@ public class Coverage
{
//@todo change this when switching to JDK 1.2 and use File.createTmpFile()
File file = File.createTempFile( "jpcoverage", "tmp" );
- getLogger().debug( "Creating parameter file: " + file );
+ getContext().debug( "Creating parameter file: " + file );
// options need to be one per line in the parameter file
// so write them all in a single string
@@ -424,7 +425,7 @@ public class Coverage
pw.println( params[ i ] );
}
pw.flush();
- getLogger().debug( "JProbe Coverage parameters:\n" + sw.toString() );
+ getContext().debug( "JProbe Coverage parameters:\n" + sw.toString() );
// now write them to the file
FileWriter fw = null;
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java
index 3af54a71a..4df5cba0f 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java
@@ -16,6 +16,7 @@ import java.util.NoSuchElementException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.optional.sitraka.bytecode.ClassFile;
import org.apache.tools.ant.taskdefs.optional.sitraka.bytecode.ClassPathLoader;
import org.apache.tools.ant.taskdefs.optional.sitraka.bytecode.MethodInfo;
@@ -194,7 +195,7 @@ public class XMLReport
}
else
{
- task.getLogger().debug( message );
+ task.getContext().debug( message );
}
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java
index 6561fadcb..a0f86a8a3 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java
@@ -9,6 +9,8 @@ package org.apache.tools.ant.taskdefs.optional.vss;
import java.io.File;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
@@ -133,7 +135,7 @@ public class MSVSSCHECKIN
}
final String message = "Created dir: " + dir.getAbsolutePath();
- getLogger().info( message );
+ getContext().info( message );
}
cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_localPath );
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java
index 03f406819..5a85b9b32 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.optional.vss;
import java.io.File;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
@@ -169,7 +170,7 @@ public class MSVSSCHECKOUT
else
{
final String message = "Created dir: " + dir.getAbsolutePath();
- getLogger().info( message );
+ getContext().info( message );
}
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java
index df977722a..2df2b34bf 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.optional.vss;
import java.io.File;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
@@ -390,7 +391,7 @@ public class MSVSSGET extends MSVSS
"successful for an unknown reason";
throw new TaskException( msg );
}
- getLogger().info( "Created dir: " + dir.getAbsolutePath() );
+ getContext().info( "Created dir: " + dir.getAbsolutePath() );
}
cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath );
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/Rmic.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/Rmic.java
index 9bbfd80a2..0afc764ca 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/Rmic.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/Rmic.java
@@ -15,6 +15,8 @@ import java.rmi.Remote;
import java.util.ArrayList;
import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.FileNameMapper;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.DirectoryScanner;
@@ -442,20 +444,20 @@ public class Rmic extends MatchingTask
{
final String message = "Unable to verify class " + classname +
". It could not be found.";
- getLogger().warn( message );
+ getContext().warn( message );
}
catch( NoClassDefFoundError e )
{
final String message = "Unable to verify class " + classname +
". It is not defined.";
- getLogger().warn( message );
+ getContext().warn( message );
}
catch( Throwable t )
{
final String message = "Unable to verify class " + classname +
". Loading caused Exception: " +
t.getMessage();
- getLogger().warn( message );
+ getContext().warn( message );
}
// we only get here if an exception has been thrown
return false;
@@ -475,7 +477,7 @@ public class Rmic extends MatchingTask
if( verify )
{
- getLogger().info( "Verify has been turned on." );
+ getContext().info( "Verify has been turned on." );
}
String compiler = getContext().getProperty( "build.rmic" ).toString();
@@ -507,7 +509,7 @@ public class Rmic extends MatchingTask
int fileCount = compileList.size();
if( fileCount > 0 )
{
- getLogger().info( "RMI Compiling " + fileCount + " class" + ( fileCount > 1 ? "es" : "" ) + " to " + baseDir );
+ getContext().info( "RMI Compiling " + fileCount + " class" + ( fileCount > 1 ? "es" : "" ) + " to " + baseDir );
// finally, lets execute the compiler!!
if( !adapter.execute() )
@@ -525,8 +527,8 @@ public class Rmic extends MatchingTask
{
if( idl )
{
- getLogger().warn( "Cannot determine sourcefiles in idl mode, " );
- getLogger().warn( "sourcebase attribute will be ignored." );
+ getContext().warn( "Cannot determine sourcefiles in idl mode, " );
+ getContext().warn( "sourcebase attribute will be ignored." );
}
else
{
@@ -557,17 +559,16 @@ public class Rmic extends MatchingTask
String[] newFiles = files;
if( idl )
{
- getLogger().debug( "will leave uptodate test to rmic implementation in idl mode." );
+ getContext().debug( "will leave uptodate test to rmic implementation in idl mode." );
}
else if( iiop
&& iiopopts != null && iiopopts.indexOf( "-always" ) > -1 )
{
- getLogger().debug( "no uptodate test as -always option has been specified" );
+ getContext().debug( "no uptodate test as -always option has been specified" );
}
else
{
final SourceFileScanner scanner = new SourceFileScanner();
- setupLogger( scanner );
newFiles = scanner.restrict( files, baseDir, baseDir, mapper, getContext() );
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/FixCRLF.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/FixCRLF.java
index 1964d521a..9a6962e4c 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/FixCRLF.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/FixCRLF.java
@@ -24,6 +24,8 @@ import java.util.NoSuchElementException;
import org.apache.aut.nativelib.Os;
import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.DirectoryScanner;
@@ -318,7 +320,7 @@ public class FixCRLF
}
// log options used
- getLogger().debug( "options:" +
+ getContext().debug( "options:" +
" eol=" +
( eol == ASIS ? "asis" : eol == CR ? "cr" : eol == LF ? "lf" : "crlf" ) +
" tab=" + ( tabs == TABS ? "add" : tabs == ASIS ? "asis" : "remove" ) +
@@ -752,11 +754,11 @@ public class FixCRLF
if( destFile.exists() )
{
// Compare the destination with the temp file
- getLogger().debug( "destFile exists" );
+ getContext().debug( "destFile exists" );
boolean result = FileUtil.contentEquals( destFile, tmpFile );
if( !result )
{
- getLogger().debug( destFile + " is being written" );
+ getContext().debug( destFile + " is being written" );
if( !destFile.delete() )
{
throw new TaskException( "Unable to delete "
@@ -774,7 +776,7 @@ public class FixCRLF
}
else
{// destination is equal to temp file
- getLogger().debug( destFile + " is not written, as the contents are identical" );
+ getContext().debug( destFile + " is not written, as the contents are identical" );
if( !tmpFile.delete() )
{
throw new TaskException( "Unable to delete "
@@ -785,7 +787,7 @@ public class FixCRLF
else
{// destFile does not exist - write the temp file
///XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- getLogger().debug( "destFile does not exist" );
+ getContext().debug( "destFile does not exist" );
if( !tmpFile.renameTo( destFile ) )
{
throw new TaskException(
@@ -814,7 +816,7 @@ public class FixCRLF
}
catch( IOException io )
{
- getLogger().error( "Error closing " + srcFile );
+ getContext().error( "Error closing " + srcFile );
}// end of catch
if( tmpFile != null )
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/Native2Ascii.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/Native2Ascii.java
index 566ac9129..50569ab4b 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/Native2Ascii.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/Native2Ascii.java
@@ -9,6 +9,8 @@ package org.apache.tools.ant.taskdefs.text;
import java.io.File;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.FileNameMapper;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.Commandline;
@@ -96,7 +98,6 @@ public class Native2Ascii
String[] files = scanner.getIncludedFiles();
final SourceFileScanner sfs = new SourceFileScanner();
- setupLogger( sfs );
final FileNameMapper mapper = buildMapper();
files = sfs.restrict( files, m_srcDir, m_destDir, mapper, getContext() );
int count = files.length;
@@ -108,7 +109,7 @@ public class Native2Ascii
final String message = "Converting " + count + " file" +
( count != 1 ? "s" : "" ) + " from " + m_srcDir + " to " +
m_destDir;
- getLogger().info( message );
+ getContext().info( message );
for( int i = 0; i < files.length; i++ )
{
@@ -192,7 +193,7 @@ public class Native2Ascii
}
}
- getLogger().debug( "converting " + srcName );
+ getContext().debug( "converting " + srcName );
sun.tools.native2ascii.Main n2a = new sun.tools.native2ascii.Main();
if( !n2a.convert( cmd.getArguments() ) )
{
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/Replace.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/Replace.java
index 2aa68d2d7..2003aa1b5 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/Replace.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/Replace.java
@@ -25,6 +25,8 @@ import java.util.Properties;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.DirectoryScanner;
@@ -227,7 +229,7 @@ public class Replace
if( m_summary )
{
- getLogger().info( "Replaced " + m_replaceCount + " occurrences in " + m_fileCount + " files." );
+ getContext().info( "Replaced " + m_replaceCount + " occurrences in " + m_fileCount + " files." );
}
}
@@ -351,7 +353,7 @@ public class Replace
final String tok = stringReplace( m_token.getText(), "\n", StringUtil.LINE_SEPARATOR );
// for each found token, replace with value
- getLogger().debug( "Replacing in " + src.getPath() + ": " + m_token.getText() + " --> " + m_value.getText() );
+ getContext().debug( "Replacing in " + src.getPath() + ": " + m_token.getText() + " --> " + m_value.getText() );
newString = stringReplace( newString, tok, val );
}
@@ -409,7 +411,7 @@ public class Replace
Replacefilter filter = (Replacefilter)m_replacefilters.get( i );
//for each found token, replace with value
- getLogger().debug( "Replacing in " + filename + ": " + filter.getToken() + " --> " + filter.getReplaceValue() );
+ getContext().debug( "Replacing in " + filename + ": " + filter.getToken() + " --> " + filter.getReplaceValue() );
newString = stringReplace( newString, filter.getToken(), filter.getReplaceValue() );
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/ReplaceRegExp.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/ReplaceRegExp.java
index e4627185f..b568e675b 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/ReplaceRegExp.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/ReplaceRegExp.java
@@ -18,6 +18,7 @@ import java.io.PrintWriter;
import java.util.ArrayList;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.ScannerUtil;
@@ -216,14 +217,14 @@ public class ReplaceRegExp
{
final String message = "An error occurred processing file: '" +
file.getAbsolutePath() + "': " + e.toString();
- getLogger().error( message, e );
+ getContext().error( message, e );
}
}
else if( file != null )
{
final String message =
"The following file is missing: '" + file.getAbsolutePath() + "'";
- getLogger().error( message );
+ getContext().error( message );
}
int sz = filesets.size();
@@ -246,13 +247,13 @@ public class ReplaceRegExp
{
final String message = "An error occurred processing file: '" + f.getAbsolutePath() +
"': " + e.toString();
- getLogger().error( message );
+ getContext().error( message );
}
}
else
{
final String message = "The following file is missing: '" + file.getAbsolutePath() + "'";
- getLogger().error( message );
+ getContext().error( message );
}
}
}
@@ -308,7 +309,7 @@ public class ReplaceRegExp
( byline ? " by line" : "" ) +
( flags.length() > 0 ? " with flags: '" + flags + "'" : "" ) +
".";
- getLogger().warn( message );
+ getContext().warn( message );
if( byline )
{
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Rpm.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Rpm.java
index 235c7b4f7..169b462aa 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Rpm.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Rpm.java
@@ -11,6 +11,7 @@ import java.io.File;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline;
@@ -101,7 +102,7 @@ public class Rpm
exe.setReturnCode( 0 );
final String message = "Building the RPM based on the " + m_specFile + " file";
- getLogger().info( message );
+ getContext().info( message );
exe.execute();
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java
index 57a781776..9523d7423 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java
@@ -15,7 +15,6 @@ import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Properties;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.framework.Filter;
@@ -26,7 +25,7 @@ import org.apache.myrmidon.framework.Filter;
* @author Michael McCallum
*/
public class FilterSet
- extends AbstractLogEnabled
+ //extends AbstractLogEnabled
implements Cloneable
{
/**
@@ -133,7 +132,6 @@ public class FilterSet
{
if( filtersFile.isFile() )
{
- getLogger().debug( "Reading filters from " + filtersFile );
FileInputStream in = null;
try
{
@@ -142,12 +140,11 @@ public class FilterSet
props.load( in );
Enumeration enum = props.propertyNames();
- ArrayList filters = m_filters;
while( enum.hasMoreElements() )
{
String strPropName = (String)enum.nextElement();
String strValue = props.getProperty( strPropName );
- filters.add( new Filter( strPropName, strValue ) );
+ m_filters.add( new Filter( strPropName, strValue ) );
}
}
catch( Exception e )
@@ -210,7 +207,6 @@ public class FilterSet
if( tokens.containsKey( token ) )
{
value = (String)tokens.get( token );
- getLogger().debug( "Replacing: " + DEFAULT_TOKEN_START + token + DEFAULT_TOKEN_END + " -> " + value );
b.append( value );
i = index + DEFAULT_TOKEN_START.length() + token.length() + DEFAULT_TOKEN_END.length();
}
@@ -230,26 +226,6 @@ public class FilterSet
return line;
}
}
-
- /**
- * The filtersfile nested element.
- *
- * @author Michael McCallum
- * @created Thursday, April 19, 2001
- */
- public class FiltersFile
- {
- /**
- * Sets the file from which filters will be read.
- *
- * @param file the file from which filters will be read.
- */
- public void setFile( final File file )
- throws TaskException
- {
- readFiltersFromFile( file );
- }
- }
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/SourceFileScanner.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/SourceFileScanner.java
index 30b794c64..d7751aebe 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/SourceFileScanner.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/SourceFileScanner.java
@@ -12,7 +12,6 @@ import java.util.ArrayList;
import java.util.Date;
import org.apache.aut.nativelib.Os;
import org.apache.avalon.excalibur.io.FileUtil;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.framework.FileNameMapper;
@@ -28,7 +27,6 @@ import org.apache.myrmidon.framework.FileNameMapper;
* @author Stefan Bodewig
*/
public class SourceFileScanner
- extends AbstractLogEnabled
{
/**
* Restrict the given set of files to those that are newer than their
@@ -72,7 +70,7 @@ public class SourceFileScanner
if( targets == null || targets.length == 0 )
{
final String message = files[ i ] + " skipped - don\'t know how to handle it";
- getLogger().debug( message );
+ context.debug( message );
continue;
}
@@ -80,7 +78,7 @@ public class SourceFileScanner
if( src.lastModified() > now )
{
final String message = "Warning: " + files[ i ] + " modified in the future.";
- getLogger().warn( message );
+ context.warn( message );
}
boolean added = false;
@@ -93,7 +91,7 @@ public class SourceFileScanner
{
final String message =
files[ i ] + " added as " + dest.getAbsolutePath() + " doesn\'t exist.";
- getLogger().debug( message );
+ context.debug( message );
v.add( files[ i ] );
added = true;
}
@@ -101,7 +99,7 @@ public class SourceFileScanner
{
final String message =
files[ i ] + " added as " + dest.getAbsolutePath() + " is outdated.";
- getLogger().debug( message );
+ context.debug( message );
v.add( files[ i ] );
added = true;
}
@@ -119,7 +117,7 @@ public class SourceFileScanner
{
final String message = files[ i ] + " omitted as " + targetList.toString() +
( targets.length == 1 ? " is" : " are " ) + " up to date.";
- getLogger().debug( message );
+ context.debug( message );
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/DependSet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/DependSet.java
index f1e1e526a..f2ea9985f 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/DependSet.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/DependSet.java
@@ -13,6 +13,8 @@ import java.util.Date;
import java.util.Iterator;
import org.apache.aut.nativelib.Os;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileList;
import org.apache.tools.ant.types.FileSet;
@@ -166,7 +168,7 @@ public class DependSet extends MatchingTask
if( dest.lastModified() > now )
{
- getLogger().warn( "Warning: " + targetFiles[ i ] + " modified in the future." );
+ getContext().warn( "Warning: " + targetFiles[ i ] + " modified in the future." );
}
}
}
@@ -188,7 +190,7 @@ public class DependSet extends MatchingTask
File dest = new File( targetFL.getDir(), targetFiles[ i ] );
if( !dest.exists() )
{
- getLogger().debug( targetFiles[ i ] + " does not exist." );
+ getContext().debug( targetFiles[ i ] + " does not exist." );
upToDate = false;
continue;
}
@@ -198,7 +200,7 @@ public class DependSet extends MatchingTask
}
if( dest.lastModified() > now )
{
- getLogger().warn( "Warning: " + targetFiles[ i ] + " modified in the future." );
+ getContext().warn( "Warning: " + targetFiles[ i ] + " modified in the future." );
}
}
}
@@ -222,7 +224,7 @@ public class DependSet extends MatchingTask
if( src.lastModified() > now )
{
- getLogger().warn( "Warning: " + sourceFiles[ i ] + " modified in the future." );
+ getContext().warn( "Warning: " + sourceFiles[ i ] + " modified in the future." );
}
Iterator enumTargets = allTargets.iterator();
@@ -232,7 +234,7 @@ public class DependSet extends MatchingTask
File dest = (File)enumTargets.next();
if( src.lastModified() > dest.lastModified() )
{
- getLogger().debug( dest.getPath() + " is out of date with respect to " + sourceFiles[ i ] );
+ getContext().debug( dest.getPath() + " is out of date with respect to " + sourceFiles[ i ] );
upToDate = false;
}
@@ -260,12 +262,12 @@ public class DependSet extends MatchingTask
if( src.lastModified() > now )
{
- getLogger().warn( "Warning: " + sourceFiles[ i ] + " modified in the future." );
+ getContext().warn( "Warning: " + sourceFiles[ i ] + " modified in the future." );
}
if( !src.exists() )
{
- getLogger().debug( sourceFiles[ i ] + " does not exist." );
+ getContext().debug( sourceFiles[ i ] + " does not exist." );
upToDate = false;
break;
}
@@ -278,7 +280,7 @@ public class DependSet extends MatchingTask
if( src.lastModified() > dest.lastModified() )
{
- getLogger().debug( dest.getPath() + " is out of date with respect to " + sourceFiles[ i ] );
+ getContext().debug( dest.getPath() + " is out of date with respect to " + sourceFiles[ i ] );
upToDate = false;
}
@@ -289,11 +291,11 @@ public class DependSet extends MatchingTask
if( !upToDate )
{
- getLogger().debug( "Deleting all target files. " );
+ getContext().debug( "Deleting all target files. " );
for( Iterator e = allTargets.iterator(); e.hasNext(); )
{
File fileToRemove = (File)e.next();
- getLogger().debug( "Deleting file " + fileToRemove.getAbsolutePath() );
+ getContext().debug( "Deleting file " + fileToRemove.getAbsolutePath() );
fileToRemove.delete();
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Filter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Filter.java
index a8d628011..add696a5e 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Filter.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Filter.java
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs;
import java.io.File;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.FilterSet;
/**
@@ -70,7 +71,7 @@ public class Filter
protected void readFilters()
throws TaskException
{
- getLogger().debug( "Reading filters from " + filtersFile );
+ getContext().debug( "Reading filters from " + filtersFile );
getGlobalFilterSet().readFiltersFromFile( filtersFile );
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Get.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Get.java
index f792ee4e0..64454302d 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Get.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Get.java
@@ -17,6 +17,7 @@ import java.net.URLConnection;
import java.util.Date;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
/**
* Get a particular file from a URL source. Options include verbose reporting,
@@ -147,7 +148,7 @@ public class Get extends AbstractTask
try
{
- getLogger().info( "Getting: " + source );
+ getContext().info( "Getting: " + source );
//set the timestamp to the file date.
long timestamp = 0;
@@ -159,7 +160,7 @@ public class Get extends AbstractTask
if( verbose )
{
Date t = new Date( timestamp );
- getLogger().info( "local file date : " + t.toString() );
+ getContext().info( "local file date : " + t.toString() );
}
hasTimestamp = true;
@@ -205,13 +206,13 @@ public class Get extends AbstractTask
//not modified so no file download. just return instead
//and trace out something so the user doesn't think that the
//download happened when it didnt
- getLogger().info( "Not modified - so not downloaded" );
+ getContext().info( "Not modified - so not downloaded" );
return;
}
// test for 401 result (HTTP only)
if( httpConnection.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED )
{
- getLogger().info( "Not authorized - check " + dest + " for details" );
+ getContext().info( "Not authorized - check " + dest + " for details" );
return;
}
@@ -233,12 +234,12 @@ public class Get extends AbstractTask
}
catch( IOException ex )
{
- getLogger().info( "Error opening connection " + ex );
+ getContext().info( "Error opening connection " + ex );
}
}
if( is == null )
{
- getLogger().info( "Can't get " + source + " to " + dest );
+ getContext().info( "Can't get " + source + " to " + dest );
if( ignoreErrors )
{
return;
@@ -272,7 +273,7 @@ public class Get extends AbstractTask
if( verbose )
{
Date t = new Date( remoteTimestamp );
- getLogger().info( "last modified = " + t.toString()
+ getContext().info( "last modified = " + t.toString()
+ ( ( remoteTimestamp == 0 ) ? " - using current time instead" : "" ) );
}
@@ -284,7 +285,7 @@ public class Get extends AbstractTask
}
catch( IOException ioe )
{
- getLogger().info( "Error getting " + source + " to " + dest );
+ getContext().info( "Error getting " + source + " to " + dest );
if( ignoreErrors )
{
return;
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java
index 6c7124d66..d7408b199 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java
@@ -13,6 +13,7 @@ import java.util.ArrayList;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Commandline;
@@ -157,7 +158,7 @@ public class Java
if( m_fork )
{
- getLogger().debug( "Forking " + m_cmdl.toString() );
+ getContext().debug( "Forking " + m_cmdl.toString() );
return run( new Commandline( m_cmdl.getCommandline() ) );
}
@@ -165,14 +166,14 @@ public class Java
{
if( m_cmdl.getVmCommand().size() > 1 )
{
- getLogger().warn( "JVM args ignored when same JVM is used." );
+ getContext().warn( "JVM args ignored when same JVM is used." );
}
if( m_dir != null )
{
- getLogger().warn( "Working directory ignored when same JVM is used." );
+ getContext().warn( "Working directory ignored when same JVM is used." );
}
- getLogger().debug( "Running in same VM " + m_cmdl.getJavaCommand().toString() );
+ getContext().debug( "Running in same VM " + m_cmdl.getJavaCommand().toString() );
run( m_cmdl );
return 0;
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PathConvert.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PathConvert.java
index 4d16c8f85..e47e4e1fe 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PathConvert.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PathConvert.java
@@ -12,6 +12,7 @@ import java.util.ArrayList;
import org.apache.aut.nativelib.Os;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.Path;
/**
@@ -157,7 +158,7 @@ public class PathConvert extends AbstractTask
// Place the result into the specified property
final String value = rslt.toString();
- getLogger().debug( "Set property " + m_property + " = " + value );
+ getContext().debug( "Set property " + m_property + " = " + value );
final String name = m_property;
getContext().setProperty( name, value );
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Property.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Property.java
index d8ef8136d..6d9f9e1ef 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Property.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Property.java
@@ -16,6 +16,7 @@ import java.util.Iterator;
import java.util.Properties;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.PathUtil;
@@ -126,7 +127,7 @@ public class Property
throws TaskException
{
Properties props = new Properties();
- getLogger().debug( "Resource Loading " + name );
+ getContext().debug( "Resource Loading " + name );
try
{
ClassLoader classLoader = null;
@@ -149,7 +150,7 @@ public class Property
}
else
{
- getLogger().warn( "Unable to find resource " + name );
+ getContext().warn( "Unable to find resource " + name );
}
}
catch( IOException ex )
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SQLExec.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SQLExec.java
index 30628c702..c478568a4 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SQLExec.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SQLExec.java
@@ -34,6 +34,7 @@ import java.util.Properties;
import java.util.StringTokenizer;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.FileSet;
@@ -429,7 +430,7 @@ public class SQLExec
Class dc;
if( classpath != null )
{
- getLogger().debug( "Loading " + driver + " using AntClassLoader with classpath " + classpath );
+ getContext().debug( "Loading " + driver + " using AntClassLoader with classpath " + classpath );
final URL[] urls = PathUtil.toURLs( classpath );
final ClassLoader classLoader = new URLClassLoader( urls );
@@ -437,7 +438,7 @@ public class SQLExec
}
else
{
- getLogger().debug( "Loading " + driver + " using system loader." );
+ getContext().debug( "Loading " + driver + " using system loader." );
dc = Class.forName( driver );
}
driverInstance = (Driver)dc.newInstance();
@@ -457,7 +458,7 @@ public class SQLExec
try
{
- getLogger().debug( "connecting to " + url );
+ getContext().debug( "connecting to " + url );
Properties info = new Properties();
info.put( "user", userId );
info.put( "password", password );
@@ -483,7 +484,7 @@ public class SQLExec
{
if( output != null )
{
- getLogger().debug( "Opening PrintStream to output file " + output );
+ getContext().debug( "Opening PrintStream to output file " + output );
out = new PrintStream( new BufferedOutputStream( new FileOutputStream( output ) ) );
}
@@ -495,7 +496,7 @@ public class SQLExec
( (Transaction)e.next() ).runTransaction( out );
if( !autocommit )
{
- getLogger().debug( "Commiting transaction" );
+ getContext().debug( "Commiting transaction" );
conn.commit();
}
}
@@ -554,7 +555,7 @@ public class SQLExec
}
}
- getLogger().info( goodSql + " of " + totalSql +
+ getContext().info( goodSql + " of " + totalSql +
" SQL statements executed successfully" );
}
@@ -579,10 +580,10 @@ public class SQLExec
{
String theVendor = dmd.getDatabaseProductName().toLowerCase();
- getLogger().debug( "RDBMS = " + theVendor );
+ getContext().debug( "RDBMS = " + theVendor );
if( theVendor == null || theVendor.indexOf( rdbms ) < 0 )
{
- getLogger().debug( "Not the required RDBMS: " + rdbms );
+ getContext().debug( "Not the required RDBMS: " + rdbms );
return false;
}
}
@@ -591,12 +592,12 @@ public class SQLExec
{
String theVersion = dmd.getDatabaseProductVersion().toLowerCase();
- getLogger().debug( "Version = " + theVersion );
+ getContext().debug( "Version = " + theVersion );
if( theVersion == null ||
!( theVersion.startsWith( version ) ||
theVersion.indexOf( " " + version ) >= 0 ) )
{
- getLogger().debug( "Not the required version: \"" + version + "\"" );
+ getContext().debug( "Not the required version: \"" + version + "\"" );
return false;
}
}
@@ -604,7 +605,7 @@ public class SQLExec
catch( SQLException e )
{
// Could not get the required information
- getLogger().error( "Failed to obtain required RDBMS information" );
+ getContext().error( "Failed to obtain required RDBMS information" );
return false;
}
@@ -632,7 +633,7 @@ public class SQLExec
totalSql++;
if( !statement.execute( sql ) )
{
- getLogger().debug( statement.getUpdateCount() + " rows affected" );
+ getContext().debug( statement.getUpdateCount() + " rows affected" );
}
else
{
@@ -645,7 +646,7 @@ public class SQLExec
SQLWarning warning = conn.getWarnings();
while( warning != null )
{
- getLogger().debug( warning + " sql warning" );
+ getContext().debug( warning + " sql warning" );
warning = warning.getNextWarning();
}
conn.clearWarnings();
@@ -653,12 +654,12 @@ public class SQLExec
}
catch( SQLException e )
{
- getLogger().error( "Failed to execute: " + sql );
+ getContext().error( "Failed to execute: " + sql );
if( !onError.equals( "continue" ) )
{
throw e;
}
- getLogger().error( e.toString() );
+ getContext().error( e.toString() );
}
}
@@ -677,7 +678,7 @@ public class SQLExec
rs = statement.getResultSet();
if( rs != null )
{
- getLogger().debug( "Processing new result set." );
+ getContext().debug( "Processing new result set." );
ResultSetMetaData md = rs.getMetaData();
int columnCount = md.getColumnCount();
StringBuffer line = new StringBuffer();
@@ -768,7 +769,7 @@ public class SQLExec
if( delimiterType.equals( DelimiterType.NORMAL ) && sql.endsWith( delimiter ) ||
delimiterType.equals( DelimiterType.ROW ) && line.equals( delimiter ) )
{
- getLogger().debug( "SQL: " + sql );
+ getContext().debug( "SQL: " + sql );
execSQL( sql.substring( 0, sql.length() - delimiter.length() ), out );
sql = "";
}
@@ -839,13 +840,13 @@ public class SQLExec
{
if( tSqlCommand.length() != 0 )
{
- getLogger().info( "Executing commands" );
+ getContext().info( "Executing commands" );
runStatements( new StringReader( tSqlCommand ), out );
}
if( tSrcFile != null )
{
- getLogger().info( "Executing file: " + tSrcFile.getAbsolutePath() );
+ getContext().info( "Executing file: " + tSrcFile.getAbsolutePath() );
Reader reader = ( encoding == null ) ? new FileReader( tSrcFile )
: new InputStreamReader( new FileInputStream( tSrcFile ), encoding );
runStatements( reader, out );
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/UpToDate.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/UpToDate.java
index 902e6ad02..53443f39c 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/UpToDate.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/UpToDate.java
@@ -12,6 +12,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.FileNameMapper;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
@@ -148,11 +149,11 @@ public class UpToDate
getContext().setProperty( name, value );
if( m_mapper == null )
{
- getLogger().debug( "File \"" + m_targetFile.getAbsolutePath() + "\" is up to date." );
+ getContext().debug( "File \"" + m_targetFile.getAbsolutePath() + "\" is up to date." );
}
else
{
- getLogger().debug( "All target files have been up to date." );
+ getContext().debug( "All target files have been up to date." );
}
}
}
@@ -161,7 +162,6 @@ public class UpToDate
throws TaskException
{
SourceFileScanner scanner = new SourceFileScanner();
- setupLogger( scanner );
FileNameMapper mapper = null;
File dir = srcDir;
if( m_mapper == null )
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Ear.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Ear.java
index dfeb35551..b8ba52f05 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Ear.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Ear.java
@@ -11,6 +11,8 @@ import java.io.File;
import java.io.IOException;
import org.apache.aut.zip.ZipOutputStream;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
/**
* Creates a EAR archive. Based on WAR task
@@ -48,7 +50,7 @@ public class Ear
{
// We just set the prefix for this fileset, and pass it up.
// Do we need to do this? LH
- getLogger().debug( "addArchives called" );
+ getContext().debug( "addArchives called" );
fs.setPrefix( "/" );
super.addFileset( fs );
}
@@ -81,7 +83,7 @@ public class Ear
final String message = "Warning: selected " + m_archiveType +
" files include a META-INF/application.xml which will be ignored " +
"(please use appxml attribute to " + m_archiveType + " task)";
- getLogger().warn( message );
+ getContext().warn( message );
}
else
{
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Expand.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Expand.java
index 93c29bbe8..bbc06b597 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Expand.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Expand.java
@@ -18,6 +18,7 @@ import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.framework.PatternSet;
import org.apache.myrmidon.framework.PatternUtil;
import org.apache.tools.ant.taskdefs.MatchingTask;
@@ -162,10 +163,10 @@ public abstract class Expand
protected void expandFile( final File src, final File dir )
throws TaskException
{
- if( getLogger().isInfoEnabled() )
+ if( getContext().isInfoEnabled() )
{
final String message = "Expanding: " + src + " into " + dir;
- getLogger().info( message );
+ getContext().info( message );
}
try
@@ -178,10 +179,10 @@ public abstract class Expand
throw new TaskException( message, ioe );
}
- if( getLogger().isDebugEnabled() )
+ if( getContext().isDebugEnabled() )
{
final String message = "expand complete";
- getLogger().debug( message );
+ getContext().debug( message );
}
}
@@ -247,11 +248,11 @@ public abstract class Expand
file.lastModified() >= date.getTime() )
{
final String message = "Skipping " + file + " as it is up-to-date";
- getLogger().debug( message );
+ getContext().debug( message );
return;
}
- getLogger().debug( "expanding " + entryName + " to " + file );
+ getContext().debug( "expanding " + entryName + " to " + file );
// create intermediary directories - sometimes zip don't add them
final File parent = file.getParentFile();
@@ -280,7 +281,7 @@ public abstract class Expand
catch( final FileNotFoundException fnfe )
{
final String message = "Unable to expand to file " + file.getPath();
- getLogger().warn( message );
+ getContext().warn( message );
}
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Jar.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Jar.java
index 14cde3ac2..1dfa651e2 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Jar.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Jar.java
@@ -21,6 +21,8 @@ import java.util.Enumeration;
import java.util.zip.ZipFile;
import org.apache.aut.zip.ZipOutputStream;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.manifest.Manifest;
import org.apache.tools.ant.taskdefs.manifest.ManifestException;
import org.apache.tools.ant.taskdefs.manifest.ManifestUtil;
@@ -99,7 +101,7 @@ public class Jar
catch( ManifestException e )
{
final String message = "Manifest " + manifestFile + " is invalid: " + e.getMessage();
- getLogger().error( message );
+ getContext().error( message );
throw new TaskException( message, e );
}
catch( IOException e )
@@ -126,7 +128,7 @@ public class Jar
public void setWhenempty( WhenEmpty we )
{
final String message = "JARs are never empty, they contain at least a manifest file";
- getLogger().warn( message );
+ getContext().warn( message );
}
public void addManifest( Manifest newManifest )
@@ -169,7 +171,7 @@ public class Jar
java.util.zip.ZipEntry entry = theZipFile.getEntry( "META-INF/MANIFEST.MF" );
if( entry == null )
{
- getLogger().debug( "Updating jar since the current jar has no manifest" );
+ getContext().debug( "Updating jar since the current jar has no manifest" );
return false;
}
Manifest currentManifest = ManifestUtil.buildManifest( new InputStreamReader( theZipFile.getInputStream( entry ) ) );
@@ -179,14 +181,14 @@ public class Jar
}
if( !currentManifest.equals( m_manifest ) )
{
- getLogger().debug( "Updating jar since jar manifest has changed" );
+ getContext().debug( "Updating jar since jar manifest has changed" );
return false;
}
}
catch( Exception e )
{
// any problems and we will rebuild
- getLogger().debug( "Updating jar since cannot read current jar manifest: " + e.getClass().getName() + e.getMessage() );
+ getContext().debug( "Updating jar since cannot read current jar manifest: " + e.getClass().getName() + e.getMessage() );
return false;
}
finally
@@ -258,7 +260,7 @@ public class Jar
}
catch( ManifestException e )
{
- getLogger().error( "Manifest is invalid: " + e.getMessage() );
+ getContext().error( "Manifest is invalid: " + e.getMessage() );
throw new TaskException( "Invalid Manifest", e );
}
}
@@ -275,7 +277,7 @@ public class Jar
final String message = "Warning: selected " + m_archiveType +
" files include a META-INF/MANIFEST.MF which will be ignored " +
"(please use manifest attribute to " + m_archiveType + " task)";
- getLogger().warn( message );
+ getContext().warn( message );
}
else
{
@@ -388,7 +390,7 @@ public class Jar
}
catch( ManifestException e )
{
- getLogger().error( "Manifest is invalid: " + e.getMessage() );
+ getContext().error( "Manifest is invalid: " + e.getMessage() );
throw new TaskException( "Invalid Manifest", e );
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Tar.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Tar.java
index 85ad3426f..ad078fc64 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Tar.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Tar.java
@@ -17,6 +17,8 @@ import org.apache.aut.tar.TarEntry;
import org.apache.aut.tar.TarOutputStream;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.ScannerUtil;
import org.apache.tools.ant.types.SourceFileScanner;
@@ -160,11 +162,11 @@ public class Tar
if( upToDate )
{
- getLogger().info( "Nothing to do: " + tarFile.getAbsolutePath() + " is up to date." );
+ getContext().info( "Nothing to do: " + tarFile.getAbsolutePath() + " is up to date." );
return;
}
- getLogger().info( "Building tar: " + tarFile.getAbsolutePath() );
+ getContext().info( "Building tar: " + tarFile.getAbsolutePath() );
TarOutputStream tOut = null;
try
@@ -224,7 +226,6 @@ public class Tar
throws TaskException
{
final SourceFileScanner scanner = new SourceFileScanner();
- setupLogger( scanner );
final MergingMapper mapper = new MergingMapper();
mapper.setTo( tarFile.getAbsolutePath() );
return scanner.restrict( files, baseDir, null, mapper, getContext() ).length == 0;
@@ -253,19 +254,19 @@ public class Tar
if( longFileMode.isOmitMode() )
{
final String message = "Omitting: " + storedPath;
- getLogger().info( message );
+ getContext().info( message );
return;
}
else if( longFileMode.isWarnMode() )
{
final String message = "Entry: " + storedPath + " longer than " +
TarEntry.NAMELEN + " characters.";
- getLogger().warn( message );
+ getContext().warn( message );
if( !longWarningGiven )
{
final String message2 = "Resulting tar file can only be processed successfully"
+ " by GNU compatible tar commands";
- getLogger().warn( message2 );
+ getContext().warn( message2 );
longWarningGiven = true;
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/War.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/War.java
index 2b906c3da..9881b7372 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/War.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/War.java
@@ -11,6 +11,8 @@ import java.io.File;
import java.io.IOException;
import org.apache.aut.zip.ZipOutputStream;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
/**
* Creates a WAR archive.
@@ -93,7 +95,7 @@ public class War
final String message = "Warning: selected " + m_archiveType +
" files include a WEB-INF/web.xml which will be ignored " +
"(please use webxml attribute to " + m_archiveType + " task)";
- getLogger().warn( message );
+ getContext().warn( message );
}
else
{
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Zip.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Zip.java
index df52cd528..9f609b5e7 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Zip.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/archive/Zip.java
@@ -24,6 +24,8 @@ import org.apache.aut.zip.ZipEntry;
import org.apache.aut.zip.ZipOutputStream;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileScanner;
@@ -280,7 +282,7 @@ public class Zip
String action = m_update ? "Updating " : "Building ";
- getLogger().info( action + m_archiveType + ": " + m_file.getAbsolutePath() );
+ getContext().info( action + m_archiveType + ": " + m_file.getAbsolutePath() );
boolean success = false;
try
@@ -385,7 +387,7 @@ public class Zip
{
final String message = "Warning: unable to delete temporary file " +
renamedFile.getName();
- getLogger().warn( message );
+ getContext().warn( message );
}
}
}
@@ -447,7 +449,7 @@ public class Zip
{
final String message = "Warning: skipping " + m_archiveType + " archive " + zipFile +
" because no files were included.";
- getLogger().warn( message );
+ getContext().warn( message );
return true;
}
else if( m_emptyBehavior.equals( "fail" ) )
@@ -477,7 +479,6 @@ public class Zip
}
final SourceFileScanner scanner = new SourceFileScanner();
- setupLogger( scanner );
MergingMapper mm = new MergingMapper();
mm.setTo( zipFile.getAbsolutePath() );
for( int i = 0; i < scanners.length; i++ )
@@ -739,7 +740,7 @@ public class Zip
// In this case using java.util.zip will not work
// because it does not permit a zero-entry archive.
// Must create it manually.
- getLogger().info( "Note: creating empty " + m_archiveType + " archive " + zipFile );
+ getContext().info( "Note: creating empty " + m_archiveType + " archive " + zipFile );
try
{
OutputStream os = new FileOutputStream( zipFile );
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac.java
index ba63a5d86..8dd8b9055 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac.java
@@ -12,6 +12,8 @@ import java.util.ArrayList;
import java.util.Iterator;
import org.apache.aut.nativelib.Os;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.JavaVersion;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.DirectoryScanner;
@@ -639,7 +641,7 @@ public class Javac
final String message = "Compiling " + m_compileList.length + " source file" +
( m_compileList.length == 1 ? "" : "s" ) +
( m_destDir != null ? " to " + m_destDir : "" );
- getLogger().info( message );
+ getContext().info( message );
// now we need to populate the compiler adapter
adapter.setJavac( this );
@@ -709,7 +711,6 @@ public class Javac
m.setFrom( "*.java" );
m.setTo( "*.class" );
SourceFileScanner sfs = new SourceFileScanner();
- setupLogger( sfs );
File[] newFiles = sfs.restrictAsFiles( files, srcDir, destDir, m, getContext() );
if( newFiles.length > 0 )
@@ -732,12 +733,12 @@ public class Javac
if( isJdkCompiler( compiler.toString() ) )
{
final String message = "Since fork is true, ignoring build.compiler setting.";
- getLogger().warn( message );
+ getContext().warn( message );
compiler = "extJavac";
}
else
{
- getLogger().warn( "Since build.compiler setting isn't classic or modern, ignoring fork setting." );
+ getContext().warn( "Since build.compiler setting isn't classic or modern, ignoring fork setting." );
}
}
else
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Http.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Http.java
index a4bb1ef25..6d80f47b6 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Http.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Http.java
@@ -11,7 +11,6 @@ import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.framework.conditions.Condition;
@@ -25,7 +24,6 @@ import org.apache.myrmidon.framework.conditions.Condition;
* @ant:type type="condition" name="http"
*/
public class Http
- extends AbstractLogEnabled
implements Condition
{
String spec = null;
@@ -45,7 +43,7 @@ public class Http
{
throw new TaskException( "No url specified in HTTP task" );
}
- getLogger().debug( "Checking for " + spec );
+ context.debug( "Checking for " + spec );
try
{
URL url = new URL( spec );
@@ -56,7 +54,7 @@ public class Http
{
HttpURLConnection http = (HttpURLConnection)conn;
int code = http.getResponseCode();
- getLogger().debug( "Result code for " + spec + " was " + code );
+ context.debug( "Result code for " + spec + " was " + code );
if( code > 0 && code < 500 )
{
return true;
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Socket.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Socket.java
index 0d3b3b399..40a055342 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Socket.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Socket.java
@@ -8,7 +8,6 @@
package org.apache.tools.ant.taskdefs.condition;
import java.io.IOException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.framework.conditions.Condition;
@@ -22,7 +21,6 @@ import org.apache.myrmidon.framework.conditions.Condition;
* @ant:type type="condition" name="socket"
*/
public class Socket
- extends AbstractLogEnabled
implements Condition
{
String server = null;
@@ -52,7 +50,7 @@ public class Socket
{
throw new TaskException( "No port specified in Socket task" );
}
- getLogger().debug( "Checking for listener at " + server + ":" + port );
+ context.debug( "Checking for listener at " + server + ":" + port );
try
{
java.net.Socket socket = new java.net.Socket( server, port );
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java
index e572de2fe..a93dd0e9e 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java
@@ -20,6 +20,7 @@ import org.apache.aut.nativelib.ExecOutputHandler;
import org.apache.aut.nativelib.Os;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.myrmidon.framework.Pattern;
import org.apache.tools.ant.types.Commandline;
@@ -536,7 +537,7 @@ public class Javadoc
throw new TaskException( msg );
}
- getLogger().info( "Generating Javadoc" );
+ getContext().info( "Generating Javadoc" );
if( m_doctitle != null )
{
@@ -662,7 +663,7 @@ public class Javadoc
}
else
{
- getLogger().debug( "Warning: No package list was found at " + packageListLocation );
+ getContext().debug( "Warning: No package list was found at " + packageListLocation );
}
}
else
@@ -810,9 +811,9 @@ public class Javadoc
{
cmd.addArgument( "@" + m_packageList );
}
- getLogger().debug( "Javadoc args: " + cmd );
+ getContext().debug( "Javadoc args: " + cmd );
- getLogger().info( "Javadoc execution" );
+ getContext().info( "Javadoc execution" );
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
@@ -873,7 +874,7 @@ public class Javadoc
}
else
{
- getLogger().warn( "Warning: Leaving out empty argument '" + key + "'" );
+ getContext().warn( "Warning: Leaving out empty argument '" + key + "'" );
}
}
@@ -899,7 +900,7 @@ public class Javadoc
ArrayList packages, ArrayList excludePackages )
throws TaskException
{
- getLogger().debug( "Source path = " + sourcePath.toString() );
+ getContext().debug( "Source path = " + sourcePath.toString() );
StringBuffer msg = new StringBuffer( "Packages = " );
for( int i = 0; i < packages.size(); i++ )
{
@@ -909,7 +910,7 @@ public class Javadoc
}
msg.append( packages.get( i ) );
}
- getLogger().debug( msg.toString() );
+ getContext().debug( msg.toString() );
msg.setLength( 0 );
msg.append( "Exclude Packages = " );
@@ -921,7 +922,7 @@ public class Javadoc
}
msg.append( excludePackages.get( i ) );
}
- getLogger().debug( msg.toString() );
+ getContext().debug( msg.toString() );
ArrayList addedPackages = new ArrayList();
@@ -1036,11 +1037,11 @@ public class Javadoc
{
if( line.startsWith( "Generating " ) || line.startsWith( "Building " ) )
{
- getLogger().debug( line );
+ getContext().debug( line );
}
else
{
- getLogger().info( line );
+ getContext().info( line );
}
}
@@ -1050,6 +1051,6 @@ public class Javadoc
*/
public void stderr( final String line )
{
- getLogger().warn( line );
+ getContext().warn( line );
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java
index b4932b856..b0d26eac7 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java
@@ -15,6 +15,7 @@ import java.net.URL;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.taskdefs.ExecuteJava;
import org.apache.tools.ant.types.Argument;
@@ -76,13 +77,13 @@ public class ANTLR extends AbstractTask
public void setOutputdirectory( File outputDirectory )
{
- getLogger().debug( "Setting output directory to: " + outputDirectory.toString() );
+ getContext().debug( "Setting output directory to: " + outputDirectory.toString() );
this.outputDirectory = outputDirectory;
}
public void setTarget( File target )
{
- getLogger().debug( "Setting target to: " + target.toString() );
+ getContext().debug( "Setting target to: " + target.toString() );
this.target = target;
}
@@ -130,7 +131,7 @@ public class ANTLR extends AbstractTask
if( fork )
{
- getLogger().debug( "Forking " + commandline.toString() );
+ getContext().debug( "Forking " + commandline.toString() );
int err = run( commandline );
if( err == 1 )
{
@@ -166,24 +167,24 @@ public class ANTLR extends AbstractTask
{
int pling = u.indexOf( "!" );
String jarName = u.substring( 9, pling );
- getLogger().debug( "Implicitly adding " + jarName + " to classpath" );
+ getContext().debug( "Implicitly adding " + jarName + " to classpath" );
createClasspath().setLocation( new File( ( new File( jarName ) ).getAbsolutePath() ) );
}
else if( u.startsWith( "file:" ) )
{
int tail = u.indexOf( resource );
String dirName = u.substring( 5, tail );
- getLogger().debug( "Implicitly adding " + dirName + " to classpath" );
+ getContext().debug( "Implicitly adding " + dirName + " to classpath" );
createClasspath().setLocation( new File( ( new File( dirName ) ).getAbsolutePath() ) );
}
else
{
- getLogger().debug( "Don\'t know how to handle resource URL " + u );
+ getContext().debug( "Don\'t know how to handle resource URL " + u );
}
}
else
{
- getLogger().debug( "Couldn\'t find " + resource );
+ getContext().debug( "Couldn\'t find " + resource );
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Cab.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Cab.java
index 4ba03072e..b84d42d83 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Cab.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Cab.java
@@ -17,6 +17,8 @@ import java.util.Iterator;
import org.apache.aut.nativelib.ExecManager;
import org.apache.aut.nativelib.Os;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.Commandline;
@@ -101,11 +103,11 @@ public class Cab
return;
}
- getLogger().info( "Building cab: " + m_cabFile.getAbsolutePath() );
+ getContext().info( "Building cab: " + m_cabFile.getAbsolutePath() );
if( !Os.isFamily( Os.OS_FAMILY_WINDOWS ) )
{
- getLogger().debug( "Using listcab/libcabinet" );
+ getContext().debug( "Using listcab/libcabinet" );
final StringBuffer sb = new StringBuffer();
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ClassArgument.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ClassArgument.java
index 018e8687a..636228dc0 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ClassArgument.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ClassArgument.java
@@ -7,17 +7,13 @@
*/
package org.apache.tools.ant.taskdefs.optional;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-
public class ClassArgument
- extends AbstractLogEnabled
{
private String m_name;
public void setName( String name )
{
m_name = name;
- getLogger().info( "ClassArgument.name=" + name );
}
public String getName()
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/IContract.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/IContract.java
index 4db72b61f..e7425df71 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/IContract.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/IContract.java
@@ -16,6 +16,7 @@ import java.util.Date;
import java.util.Properties;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.listeners.AbstractProjectListener;
import org.apache.myrmidon.listeners.LogEvent;
import org.apache.tools.ant.taskdefs.Java;
@@ -515,7 +516,7 @@ public class IContract extends MatchingTask
{
if( !controlFile.exists() )
{
- getLogger().info( "WARNING: Control file " + controlFile.getAbsolutePath() + " doesn't exist. iContract will be run without control file." );
+ getContext().info( "WARNING: Control file " + controlFile.getAbsolutePath() + " doesn't exist. iContract will be run without control file." );
}
this.controlFile = controlFile;
}
@@ -698,7 +699,7 @@ public class IContract extends MatchingTask
// issue warning if pre,post or invariant is used together with controlfile
if( ( pre || post || invariant ) && controlFile != null )
{
- getLogger().info( "WARNING: specifying pre,post or invariant will override control file settings" );
+ getContext().info( "WARNING: specifying pre,post or invariant will override control file settings" );
}
@@ -781,7 +782,7 @@ public class IContract extends MatchingTask
}
catch( IOException e )
{
- getLogger().info( "File icontrol.properties not found. That's ok. Writing a default one." );
+ getContext().info( "File icontrol.properties not found. That's ok. Writing a default one." );
}
iControlProps.setProperty( "sourceRoot", srcDir.getAbsolutePath() );
iControlProps.setProperty( "classRoot", classDir.getAbsolutePath() );
@@ -792,11 +793,11 @@ public class IContract extends MatchingTask
try
{// to read existing propertiesfile
iControlProps.store( new FileOutputStream( "icontrol.properties" ), ICONTROL_PROPERTIES_HEADER );
- getLogger().info( "Updated icontrol.properties" );
+ getContext().info( "Updated icontrol.properties" );
}
catch( IOException e )
{
- getLogger().info( "Couldn't write icontrol.properties." );
+ getContext().info( "Couldn't write icontrol.properties." );
}
}
@@ -806,9 +807,9 @@ public class IContract extends MatchingTask
{
if( iContractMissing )
{
- getLogger().info( "iContract can't be found on your classpath. Your classpath is:" );
- getLogger().info( classpath.toString() );
- getLogger().info( "If you don't have the iContract jar, go get it at http://www.reliable-systems.com/tools/" );
+ getContext().info( "iContract can't be found on your classpath. Your classpath is:" );
+ getContext().info( classpath.toString() );
+ getContext().info( "If you don't have the iContract jar, go get it at http://www.reliable-systems.com/tools/" );
}
throw new TaskException( "iContract instrumentation failed. Code=" + result );
}
@@ -933,17 +934,17 @@ public class IContract extends MatchingTask
if( targets == null )
{
targets = new File( "targets" );
- getLogger().info( "Warning: targets file not specified. generating file: " + targets.getName() );
+ getContext().info( "Warning: targets file not specified. generating file: " + targets.getName() );
writeTargets = true;
}
else if( !targets.exists() )
{
- getLogger().info( "Specified targets file doesn't exist. generating file: " + targets.getName() );
+ getContext().info( "Specified targets file doesn't exist. generating file: " + targets.getName() );
writeTargets = true;
}
if( writeTargets )
{
- getLogger().info( "You should consider using iControl to create a target file." );
+ getContext().info( "You should consider using iControl to create a target file." );
targetOutputStream = new FileOutputStream( targets );
targetPrinter = new PrintStream( targetOutputStream );
}
@@ -962,7 +963,7 @@ public class IContract extends MatchingTask
if( srcFile.lastModified() > now )
{
final String message = "Warning: file modified in the future: " + files[ i ];
- getLogger().warn( message );
+ getContext().warn( message );
}
if( !classFile.exists() || srcFile.lastModified() > classFile.lastModified() )
@@ -1003,7 +1004,7 @@ public class IContract extends MatchingTask
{
if( !dirty )
{
- getLogger().info( "Control file " + controlFile.getAbsolutePath() + " has been updated. Instrumenting all files..." );
+ getContext().info( "Control file " + controlFile.getAbsolutePath() + " has been updated. Instrumenting all files..." );
}
dirty = true;
instrumentall = true;
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Javah.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Javah.java
index c0a151f01..bae47511f 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Javah.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Javah.java
@@ -14,6 +14,7 @@ import java.util.StringTokenizer;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.util.FileUtils;
@@ -158,7 +159,6 @@ public class Javah
public ClassArgument createClass()
{
final ClassArgument ga = new ClassArgument();
- setupLogger( ga );
m_classes.add( ga );
return ga;
}
@@ -210,7 +210,7 @@ public class Javah
private void logAndAddFilesToCompile( final Commandline cmd )
{
int n = 0;
- getLogger().debug( "Compilation args: " + cmd.toString() );
+ getContext().debug( "Compilation args: " + cmd.toString() );
StringBuffer niceClassList = new StringBuffer();
if( m_cls != null )
@@ -243,7 +243,7 @@ public class Javah
prefix.append( " to be compiled:" );
prefix.append( StringUtil.LINE_SEPARATOR );
- getLogger().debug( prefix.toString() + niceClassList.toString() );
+ getContext().debug( prefix.toString() + niceClassList.toString() );
}
/**
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/NetRexxC.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
index bc2b28d62..321afd462 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
@@ -21,6 +21,7 @@ import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.DirectoryScanner;
@@ -503,7 +504,7 @@ public class NetRexxC extends MatchingTask
// compile the source files
if( compileList.size() > 0 )
{
- getLogger().info( "Compiling " + compileList.size() + " source file"
+ getContext().info( "Compiling " + compileList.size() + " source file"
+ ( compileList.size() == 1 ? "" : "s" )
+ " to " + destDir );
doNetRexxCompile();
@@ -599,7 +600,7 @@ public class NetRexxC extends MatchingTask
}
else
{
- getLogger().debug( "Dropping from classpath: " + f.getAbsolutePath() );
+ getContext().debug( "Dropping from classpath: " + f.getAbsolutePath() );
}
}
@@ -613,7 +614,7 @@ public class NetRexxC extends MatchingTask
//FIXME: This should be zapped no ?
if( filecopyList.size() > 0 )
{
- getLogger().info( "Copying " + filecopyList.size() + " file"
+ getContext().info( "Copying " + filecopyList.size() + " file"
+ ( filecopyList.size() == 1 ? "" : "s" )
+ " to " + destDir.getAbsolutePath() );
Iterator enum = filecopyList.keySet().iterator();
@@ -643,7 +644,7 @@ public class NetRexxC extends MatchingTask
private void doNetRexxCompile()
throws TaskException
{
- getLogger().debug( "Using NetRexx compiler" );
+ getContext().debug( "Using NetRexx compiler" );
String classpath = getCompileClasspath();
StringBuffer compileOptions = new StringBuffer();
StringBuffer fileList = new StringBuffer();
@@ -677,7 +678,7 @@ public class NetRexxC extends MatchingTask
compileOptions.append( compileOptionsArray[ i ] );
compileOptions.append( " " );
}
- getLogger().debug( compileOptions.toString() );
+ getContext().debug( compileOptions.toString() );
StringBuffer niceSourceList = new StringBuffer( "Files to be compiled:" + StringUtil.LINE_SEPARATOR );
@@ -688,7 +689,7 @@ public class NetRexxC extends MatchingTask
niceSourceList.append( StringUtil.LINE_SEPARATOR );
}
- getLogger().debug( niceSourceList.toString() );
+ getContext().debug( niceSourceList.toString() );
// need to set java.class.path property and restore it later
// since the NetRexx compiler has no option for the classpath
@@ -704,17 +705,17 @@ public class NetRexxC extends MatchingTask
if( rc > 1 )
{// 1 is warnings from real NetRexxC
- getLogger().error( out.toString() );
+ getContext().error( out.toString() );
String msg = "Compile failed, messages should have been provided.";
throw new TaskException( msg );
}
else if( rc == 1 )
{
- getLogger().warn( out.toString() );
+ getContext().warn( out.toString() );
}
else
{
- getLogger().info( out.toString() );
+ getContext().info( out.toString() );
}
}
finally
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java
index 76eb81c33..a938551ae 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java
@@ -9,6 +9,8 @@ package org.apache.tools.ant.taskdefs.optional.ccm;
import org.apache.aut.nativelib.ExecOutputHandler;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.Commandline;
/**
@@ -146,7 +148,7 @@ public class CCMCreateTask
cmd.addArgument( COMMAND_DEFAULT_TASK );
cmd.addArgument( m_task );
- getLogger().debug( commandLine.toString() );
+ getContext().debug( commandLine.toString() );
final int result2 = run( cmd, null );
if( result2 != 0 )
@@ -219,11 +221,11 @@ public class CCMCreateTask
*/
public void stdout( final String line )
{
- getLogger().debug( "buffer:" + line );
+ getContext().debug( "buffer:" + line );
final String task = getTask( line );
setTask( task );
- getLogger().debug( "task is " + m_task );
+ getContext().debug( "task is " + m_task );
}
private String getTask( final String line )
@@ -236,7 +238,7 @@ public class CCMCreateTask
catch( final Exception e )
{
final String message = "error procession stream " + e.getMessage();
- getLogger().error( message, e );
+ getContext().error( message, e );
}
return null;
@@ -248,7 +250,7 @@ public class CCMCreateTask
*/
public void stderr( final String line )
{
- getLogger().debug( "err " + line );
+ getContext().debug( "err " + line );
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
index 46e58243d..0d7d2d82b 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
@@ -20,6 +20,8 @@ import java.util.Hashtable;
import java.util.Locale;
import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
@@ -480,12 +482,12 @@ public class Translate
ins = new FileInputStream( bundleFile );
loaded = true;
bundleLastModified[ i ] = new File( bundleFile ).lastModified();
- getLogger().debug( "Using " + bundleFile );
+ getContext().debug( "Using " + bundleFile );
loadResourceMap( ins );
}
catch( IOException ioe )
{
- getLogger().debug( bundleFile + " not found." );
+ getContext().debug( bundleFile + " not found." );
//if all resource files associated with this bundle
//have been scanned for and still not able to
//find a single resrouce file, throw exception
@@ -532,7 +534,7 @@ public class Translate
}
catch( Exception e )
{
- getLogger().debug( "Exception occured while trying to check/create " + " parent directory. " + e.getMessage() );
+ getContext().debug( "Exception occured while trying to check/create " + " parent directory. " + e.getMessage() );
}
destLastModified = dest.lastModified();
srcLastModified = new File( srcFiles[ i ] ).lastModified();
@@ -547,7 +549,7 @@ public class Translate
|| destLastModified < bundleLastModified[ 5 ]
|| destLastModified < bundleLastModified[ 6 ] )
{
- getLogger().debug( "Processing " + srcFiles[ j ] );
+ getContext().debug( "Processing " + srcFiles[ j ] );
FileOutputStream fos = new FileOutputStream( dest );
BufferedWriter out = new BufferedWriter(
new OutputStreamWriter( fos,
@@ -596,7 +598,7 @@ public class Translate
//use the key itself as the value also.
if( replace == null )
{
- getLogger().debug( "Warning: The key: " + matches + " hasn't been defined." );
+ getContext().debug( "Warning: The key: " + matches + " hasn't been defined." );
replace = matches;
}
line = line.substring( 0, startIndex )
@@ -622,7 +624,7 @@ public class Translate
}
else
{
- getLogger().debug( "Skipping " + srcFiles[ j ] + " as destination file is up to date" );
+ getContext().debug( "Skipping " + srcFiles[ j ] + " as destination file is up to date" );
}
}
catch( IOException ioe )
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
index ede583b38..ec4ac16c8 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
@@ -13,6 +13,7 @@ import java.util.Hashtable;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
@@ -164,7 +165,7 @@ public class JJTree
targetName.substring( 0, targetName.indexOf( ".jjt" ) ) + ".jj" );
if( javaFile.exists() && target.lastModified() < javaFile.lastModified() )
{
- getLogger().info( "Target is already built - skipping (" + target + ")" );
+ getContext().info( "Target is already built - skipping (" + target + ")" );
return;
}
cmdl.addArgument( target.getAbsolutePath() );
@@ -182,7 +183,7 @@ public class JJTree
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
- getLogger().debug( cmdl.toString() );
+ getContext().debug( cmdl.toString() );
exe.setCommandline( new Commandline( cmdl.getCommandline() ) );
exe.setReturnCode( 0 );
exe.execute();
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java
index e6f628548..cf42e88ac 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java
@@ -13,6 +13,7 @@ import java.util.Hashtable;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
@@ -217,7 +218,7 @@ public class JavaCC
final File javaFile = getOutputJavaFile( outputDirectory, target );
if( javaFile.exists() && target.lastModified() < javaFile.lastModified() )
{
- getLogger().debug( "Target is already built - skipping (" + target + ")" );
+ getContext().debug( "Target is already built - skipping (" + target + ")" );
return;
}
cmdl.addArgument( target.getAbsolutePath() );
@@ -239,7 +240,7 @@ public class JavaCC
private void runCommand( final CommandlineJava cmdline )
throws TaskException
{
- getLogger().debug( cmdline.toString() );
+ getContext().debug( cmdline.toString() );
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
final String[] commandline = cmdline.getCommandline();
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
index 601b79129..c12c6c22a 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
@@ -14,6 +14,7 @@ import java.io.PrintWriter;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
@@ -252,9 +253,9 @@ public class JDependTask
if( m_outputFile != null )
{
- getLogger().info( "Output to be stored in " + m_outputFile.getPath() );
+ getContext().info( "Output to be stored in " + m_outputFile.getPath() );
}
- getLogger().debug( "Executing: " + commandline.toString() );
+ getContext().debug( "Executing: " + commandline.toString() );
return exe.execute();
}
@@ -295,11 +296,11 @@ public class JDependTask
catch( IOException e )
{
String msg = "JDepend Failed when creating the output file: " + e.getMessage();
- getLogger().info( msg );
+ getContext().info( msg );
throw new TaskException( msg );
}
jdepend.setWriter( new PrintWriter( fw ) );
- getLogger().info( "Output to be stored in " + m_outputFile.getPath() );
+ getContext().info( "Output to be stored in " + m_outputFile.getPath() );
}
final String[] elements = FileUtils.parsePath( m_sourcesPath.toString() );
@@ -311,7 +312,7 @@ public class JDependTask
if( !f.exists() || !f.isDirectory() )
{
String msg = "\"" + f.getPath() + "\" does not represent a valid directory. JDepend would fail.";
- getLogger().info( msg );
+ getContext().info( msg );
throw new TaskException( msg );
}
try
@@ -321,7 +322,7 @@ public class JDependTask
catch( IOException e )
{
String msg = "JDepend Failed when adding a source directory: " + e.getMessage();
- getLogger().info( msg );
+ getContext().info( msg );
throw new TaskException( msg );
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java
index c2e02d180..7f26c95ff 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java
@@ -12,6 +12,7 @@ import java.util.ArrayList;
import java.util.Date;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapter;
import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapterFactory;
@@ -378,13 +379,13 @@ public class JspC extends MatchingTask
{
compiler = "jasper";
}
- getLogger().debug( "compiling " + compileList.size() + " files" );
+ getContext().debug( "compiling " + compileList.size() + " files" );
if( compileList.size() > 0 )
{
CompilerAdapter adapter =
CompilerAdapterFactory.getCompiler( compiler.toString(), getContext() );
- getLogger().info( "Compiling " + compileList.size() +
+ getContext().info( "Compiling " + compileList.size() +
" source file"
+ ( compileList.size() == 1 ? "" : "s" )
+ ( destDir != null ? " to " + destDir : "" ) );
@@ -401,7 +402,7 @@ public class JspC extends MatchingTask
}
else
{
- getLogger().error( FAIL_MSG );
+ getContext().error( FAIL_MSG );
}
}
}
@@ -409,11 +410,11 @@ public class JspC extends MatchingTask
{
if( filecount == 0 )
{
- getLogger().info( "there were no files to compile" );
+ getContext().info( "there were no files to compile" );
}
else
{
- getLogger().debug( "all files are up to date" );
+ getContext().debug( "all files are up to date" );
}
}
}
@@ -460,7 +461,7 @@ public class JspC extends MatchingTask
{
final String message =
"Warning: file modified in the future: " + files[ i ];
- getLogger().warn( message );
+ getContext().warn( message );
}
if( !javaFile.exists() ||
@@ -468,11 +469,11 @@ public class JspC extends MatchingTask
{
if( !javaFile.exists() )
{
- getLogger().debug( "Compiling " + srcFile.getPath() + " because java file " + javaFile.getPath() + " does not exist" );
+ getContext().debug( "Compiling " + srcFile.getPath() + " because java file " + javaFile.getPath() + " does not exist" );
}
else
{
- getLogger().debug( "Compiling " + srcFile.getPath() + " because it is out of date with respect to " + javaFile.getPath() );
+ getContext().debug( "Compiling " + srcFile.getPath() + " because it is out of date with respect to " + javaFile.getPath() );
}
compileList.add( srcFile.getAbsolutePath() );
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
index b2d7529af..a1ad8068f 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
@@ -12,6 +12,8 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.StringTokenizer;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.Java;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.Argument;
@@ -199,7 +201,7 @@ public class WLJspc extends MatchingTask
args[ j++ ] = compileClasspath.toString();
this.scanDir( files );
- getLogger().info( "Compiling " + filesToDo.size() + " JSP files" );
+ getContext().info( "Compiling " + filesToDo.size() + " JSP files" );
for( int i = 0; i < filesToDo.size(); i++ )
{
@@ -235,7 +237,7 @@ public class WLJspc extends MatchingTask
helperTask.addClasspath( compileClasspath );
if( helperTask.executeJava() != 0 )
{
- getLogger().warn( files[ i ] + " failed to compile" );
+ getContext().warn( files[ i ] + " failed to compile" );
}
}
}
@@ -298,13 +300,13 @@ public class WLJspc extends MatchingTask
if( srcFile.lastModified() > now )
{
final String message = "Warning: file modified in the future: " + files[ i ];
- getLogger().warn( message );
+ getContext().warn( message );
}
if( srcFile.lastModified() > classFile.lastModified() )
{
//log("Files are" + srcFile.getAbsolutePath()+" " +classFile.getAbsolutePath());
filesToDo.add( files[ i ] );
- getLogger().debug( "Recompiling File " + files[ i ] );
+ getContext().debug( "Recompiling File " + files[ i ] );
}
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
index a8425d085..fca57dce7 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
@@ -454,24 +454,24 @@ public class JUnitTask extends AbstractTask
{
int pling = u.indexOf( "!" );
String jarName = u.substring( 9, pling );
- getLogger().debug( "Implicitly adding " + jarName + " to classpath" );
+ getContext().debug( "Implicitly adding " + jarName + " to classpath" );
createClasspath().addLocation( new File( jarName ) );
}
else if( u.startsWith( "file:" ) )
{
int tail = u.indexOf( resource );
String dirName = u.substring( 5, tail );
- getLogger().debug( "Implicitly adding " + dirName + " to classpath" );
+ getContext().debug( "Implicitly adding " + dirName + " to classpath" );
createClasspath().addLocation( new File( dirName ) );
}
else
{
- getLogger().debug( "Don\'t know how to handle resource URL " + u );
+ getContext().debug( "Don\'t know how to handle resource URL " + u );
}
}
else
{
- getLogger().debug( "Couldn\'t find " + resource );
+ getContext().debug( "Couldn\'t find " + resource );
}
}
@@ -530,7 +530,7 @@ public class JUnitTask extends AbstractTask
{
final String message = "TEST " + test.getName() + " FAILED" +
( wasKilled ? " (timeout)" : "" );
- getLogger().error( message );
+ getContext().error( message );
if( errorOccurredHere && test.getErrorProperty() != null )
{
final String name = test.getErrorProperty();
@@ -593,7 +593,7 @@ public class JUnitTask extends AbstractTask
cmd.addArgument( "haltOnFailure=" + test.getHaltonfailure() );
if( summary )
{
- getLogger().info( "Running " + test.getName() );
+ getContext().info( "Running " + test.getName() );
cmd.addArgument( "formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter" );
}
@@ -643,7 +643,7 @@ public class JUnitTask extends AbstractTask
exe.setWorkingDirectory( dir );
}
- getLogger().debug( "Executing: " + cmd.toString() );
+ getContext().debug( "Executing: " + cmd.toString() );
try
{
return exe.execute();
@@ -666,7 +666,7 @@ public class JUnitTask extends AbstractTask
test.setProperties( getContext().getProperties() );
if( dir != null )
{
- getLogger().warn( "dir attribute ignored if running in the same VM" );
+ getContext().warn( "dir attribute ignored if running in the same VM" );
}
SysProperties sysProperties = commandline.getSystemProperties();
@@ -676,12 +676,12 @@ public class JUnitTask extends AbstractTask
}
try
{
- getLogger().debug( "Using System properties " + System.getProperties() );
+ getContext().debug( "Using System properties " + System.getProperties() );
ClassLoader classLoader = null;
Path classpath = commandline.getClasspath();
if( classpath != null )
{
- getLogger().debug( "Using CLASSPATH " + classpath );
+ getContext().debug( "Using CLASSPATH " + classpath );
final URL[] urls = PathUtil.toURLs( classpath );
classLoader = new URLClassLoader( urls );
}
@@ -692,7 +692,7 @@ public class JUnitTask extends AbstractTask
classLoader );
if( summary )
{
- getLogger().info( "Running " + test.getName() );
+ getContext().info( "Running " + test.getName() );
SummaryJUnitResultFormatter f =
new SummaryJUnitResultFormatter();
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java
index 1b3313ff7..113afafa4 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java
@@ -20,6 +20,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.avalon.framework.ExceptionUtil;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.ScannerUtil;
@@ -273,7 +274,7 @@ public class XMLResultAggregator
{
try
{
- getLogger().debug( "Parsing file: '" + files[ i ] + "'" );
+ getContext().debug( "Parsing file: '" + files[ i ] + "'" );
//XXX there seems to be a bug in xerces 1.3.0 that doesn't like file object
// will investigate later. It does not use the given directory but
// the vm dir instead ? Works fine with crimson.
@@ -287,19 +288,19 @@ public class XMLResultAggregator
else
{
// issue a warning.
- getLogger().warn( "the file " + files[ i ] + " is not a valid testsuite XML document" );
+ getContext().warn( "the file " + files[ i ] + " is not a valid testsuite XML document" );
}
}
catch( SAXException e )
{
// a testcase might have failed and write a zero-length document,
// It has already failed, but hey.... mm. just put a warning
- getLogger().warn( "The file " + files[ i ] + " is not a valid XML document. It is possibly corrupted." );
- getLogger().debug( ExceptionUtil.printStackTrace( e ) );
+ getContext().warn( "The file " + files[ i ] + " is not a valid XML document. It is possibly corrupted." );
+ getContext().debug( ExceptionUtil.printStackTrace( e ) );
}
catch( IOException e )
{
- getLogger().error( "Error while accessing file " + files[ i ] + ": " + e.getMessage() );
+ getContext().error( "Error while accessing file " + files[ i ] + ": " + e.getMessage() );
}
}
return rootElement;
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
index 1965ab18b..0548ecec9 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
@@ -18,6 +18,7 @@ import java.util.Random;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Commandline;
@@ -207,7 +208,7 @@ public abstract class AbstractMetamataTask
// retrieve all the files we want to scan
m_includedFiles = scanFileSets();
- getLogger().debug( m_includedFiles.size() + " files added for audit" );
+ getContext().debug( m_includedFiles.size() + " files added for audit" );
// write all the options to a temp file and use it ro run the process
ArrayList options = getOptions();
@@ -281,7 +282,7 @@ public abstract class AbstractMetamataTask
{
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
- getLogger().debug( m_cmdl.toString() );
+ getContext().debug( m_cmdl.toString() );
final String[] commandline = m_cmdl.getCommandline();
exe.setCommandline( new Commandline( commandline ) );
exe.setReturnCode( 0 );
@@ -336,7 +337,7 @@ public abstract class AbstractMetamataTask
DirectoryScanner ds = ScannerUtil.getDirectoryScanner( fs );
ds.scan();
String[] f = ds.getIncludedFiles();
- getLogger().debug( i + ") Adding " + f.length + " files from directory " + ds.getBasedir() );
+ getContext().debug( i + ") Adding " + f.length + " files from directory " + ds.getBasedir() );
for( int j = 0; j < f.length; j++ )
{
String pathname = f[ j ];
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java
index 7f8384c8b..578629740 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java
@@ -10,6 +10,8 @@ package org.apache.tools.ant.taskdefs.optional.metamata;
import java.io.File;
import java.util.ArrayList;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.Path;
/**
@@ -174,7 +176,7 @@ public class MAudit
}
if( !m_unused && m_searchPath != null )
{
- getLogger().warn( "'searchpath' element ignored. 'unused' attribute is disabled." );
+ getContext().warn( "'searchpath' element ignored. 'unused' attribute is disabled." );
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java
index ef8d4bc4a..9e08d81b9 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java
@@ -247,7 +247,6 @@ public class MMetrics extends AbstractMetamataTask
{
xmlStream = new FileOutputStream( outFile );
ExecuteStreamHandler xmlHandler = new MMetricsStreamHandler( xmlStream );
- setupLogger( xmlHandler );
xmlHandler.setProcessOutputStream( tmpStream );
xmlHandler.start();
xmlHandler.stop();
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java
index 1aa97b47a..3c9d28d12 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java
@@ -26,7 +26,6 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -43,7 +42,6 @@ import org.xml.sax.helpers.AttributesImpl;
* @author Stephane Bailliez
*/
public class MMetricsStreamHandler
- extends AbstractLogEnabled
implements ExecuteStreamHandler
{
/**
@@ -162,7 +160,6 @@ public class MMetricsStreamHandler
}
catch( Exception e )
{
- e.printStackTrace();
throw new IOException( e.getMessage() );
}
}
@@ -278,7 +275,7 @@ public class MMetricsStreamHandler
* @exception SAXException Description of Exception
*/
protected void parseOutput()
- throws IOException, SAXException
+ throws IOException, SAXException, ParseException
{
BufferedReader br = new BufferedReader( new InputStreamReader( metricsOutput ) );
String line = null;
@@ -296,23 +293,14 @@ public class MMetricsStreamHandler
* @exception SAXException Description of Exception
*/
protected void processLine( String line )
- throws SAXException
+ throws SAXException, ParseException
{
if( line.startsWith( "Construct\tV(G)\tLOC\tDIT\tNOA\tNRM\tNLM\tWMC\tRFC\tDAC\tFANOUT\tCBO\tLCOM\tNOCL" ) )
{
return;
}
- try
- {
- MetricsElement elem = MetricsElement.parse( line );
- startElement( elem );
- }
- catch( ParseException e )
- {
- e.printStackTrace();
- // invalid lines are sent to the output as information, it might be anything,
- getLogger().info( line );
- }
+ MetricsElement elem = MetricsElement.parse( line );
+ startElement( elem );
}
/**
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
index f657dc4f0..e5d4f273b 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
@@ -17,6 +17,7 @@ import org.apache.aut.nativelib.ExecManager;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Commandline;
@@ -283,13 +284,13 @@ public class MParse
File javaFile = new File( pathname );
if( javaFile.exists() && m_target.lastModified() < javaFile.lastModified() )
{
- getLogger().info( "Target is already build - skipping (" + m_target + ")" );
+ getContext().info( "Target is already build - skipping (" + m_target + ")" );
return;
}
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
- getLogger().debug( m_cmdl.toString() );
+ getContext().debug( m_cmdl.toString() );
final String[] commandline = m_cmdl.getCommandline();
exe.setCommandline( new Commandline( commandline ) );
exe.setReturnCode( 0 );
@@ -347,7 +348,7 @@ public class MParse
final File sunjj = new File( m_target.getParent(), name );
if( sunjj.exists() )
{
- getLogger().info( "Removing stale file: " + sunjj.getName() );
+ getContext().info( "Removing stale file: " + sunjj.getName() );
sunjj.delete();
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/FTP.java
index cafbeef40..e44954bdd 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/FTP.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/FTP.java
@@ -288,7 +288,7 @@ public class FTP
try
{
- getLogger().debug( "Opening FTP connection to " + m_server );
+ getContext().debug( "Opening FTP connection to " + m_server );
ftp = new FTPClient();
@@ -298,15 +298,15 @@ public class FTP
throw new TaskException( "FTP connection failed: " + ftp.getReplyString() );
}
- getLogger().debug( "connected" );
- getLogger().debug( "logging in to FTP server" );
+ getContext().debug( "connected" );
+ getContext().debug( "logging in to FTP server" );
if( !ftp.login( m_userid, m_password ) )
{
throw new TaskException( "Could not login to FTP server" );
}
- getLogger().debug( "login succeeded" );
+ getContext().debug( "login succeeded" );
if( m_binary )
{
@@ -321,7 +321,7 @@ public class FTP
if( m_passive )
{
- getLogger().debug( "entering passive mode" );
+ getContext().debug( "entering passive mode" );
ftp.enterLocalPassiveMode();
if( !FTPReply.isPositiveCompletion( ftp.getReplyCode() ) )
{
@@ -344,7 +344,7 @@ public class FTP
{
if( m_remotedir != null )
{
- getLogger().debug( "changing the remote directory" );
+ getContext().debug( "changing the remote directory" );
ftp.changeWorkingDirectory( m_remotedir );
if( !FTPReply.isPositiveCompletion( ftp.getReplyCode() ) )
{
@@ -353,7 +353,7 @@ public class FTP
ftp.getReplyString() );
}
}
- getLogger().info( ACTION_STRS[ m_action ] + " files" );
+ getContext().info( ACTION_STRS[ m_action ] + " files" );
transferFiles( ftp );
}
@@ -368,7 +368,7 @@ public class FTP
{
try
{
- getLogger().debug( "disconnecting" );
+ getContext().debug( "disconnecting" );
ftp.logout();
ftp.disconnect();
}
@@ -411,7 +411,7 @@ public class FTP
if( m_verbose )
{
- getLogger().info( "transferring " + filename + " to " + file.getAbsolutePath() );
+ getContext().info( "transferring " + filename + " to " + file.getAbsolutePath() );
}
final File parent = file.getParentFile();
@@ -427,7 +427,7 @@ public class FTP
String s = "could not get file: " + ftp.getReplyString();
if( m_skipFailedTransfers == true )
{
- getLogger().warn( s );
+ getContext().warn( s );
m_skipped++;
}
else
@@ -438,7 +438,7 @@ public class FTP
}
else
{
- getLogger().debug( "File " + file.getAbsolutePath() + " copied from " + m_server );
+ getContext().debug( "File " + file.getAbsolutePath() + " copied from " + m_server );
m_transferred++;
}
}
@@ -465,7 +465,7 @@ public class FTP
protected boolean isUpToDate( FTPClient ftp, File localFile, String remoteFile )
throws IOException, TaskException
{
- getLogger().debug( "checking date for " + remoteFile );
+ getContext().debug( "checking date for " + remoteFile );
FTPFile[] files = ftp.listFiles( remoteFile );
@@ -478,7 +478,7 @@ public class FTP
if( m_action == SEND_FILES )
{
- getLogger().debug( "Could not date test remote file: " + remoteFile + "assuming out of date." );
+ getContext().debug( "Could not date test remote file: " + remoteFile + "assuming out of date." );
return false;
}
else
@@ -554,7 +554,7 @@ public class FTP
dir = (File)parents.get( i );
if( !m_dirCache.contains( dir ) )
{
- getLogger().debug( "creating remote directory " + remoteResolveFile( dir.getPath() ) );
+ getContext().debug( "creating remote directory " + remoteResolveFile( dir.getPath() ) );
ftp.makeDirectory( remoteResolveFile( dir.getPath() ) );
// Both codes 550 and 553 can be produced by FTP Servers
// to indicate that an attempt to create a directory has
@@ -581,7 +581,7 @@ public class FTP
{
if( m_verbose )
{
- getLogger().info( "deleting " + filename );
+ getContext().info( "deleting " + filename );
}
if( !ftp.deleteFile( remoteResolveFile( filename ) ) )
@@ -589,7 +589,7 @@ public class FTP
String s = "could not delete file: " + ftp.getReplyString();
if( m_skipFailedTransfers == true )
{
- getLogger().warn( s );
+ getContext().warn( s );
m_skipped++;
}
else
@@ -599,7 +599,7 @@ public class FTP
}
else
{
- getLogger().debug( "File " + filename + " deleted from " + m_server );
+ getContext().debug( "File " + filename + " deleted from " + m_server );
m_transferred++;
}
}
@@ -616,7 +616,7 @@ public class FTP
{
if( m_verbose )
{
- getLogger().info( "listing " + filename );
+ getContext().info( "listing " + filename );
}
FTPFile ftpfile = ftp.listFiles( remoteResolveFile( filename ) )[ 0 ];
@@ -639,7 +639,7 @@ public class FTP
{
if( m_verbose )
{
- getLogger().info( "creating directory: " + dir );
+ getContext().info( "creating directory: " + dir );
}
if( !ftp.makeDirectory( dir ) )
@@ -657,14 +657,14 @@ public class FTP
if( m_verbose )
{
- getLogger().info( "directory already exists" );
+ getContext().info( "directory already exists" );
}
}
else
{
if( m_verbose )
{
- getLogger().info( "directory created OK" );
+ getContext().info( "directory created OK" );
}
}
}
@@ -715,7 +715,7 @@ public class FTP
if( m_verbose )
{
- getLogger().info( "transferring " + file.getAbsolutePath() );
+ getContext().info( "transferring " + file.getAbsolutePath() );
}
instream = new BufferedInputStream( new FileInputStream( file ) );
@@ -729,7 +729,7 @@ public class FTP
String s = "could not put file: " + ftp.getReplyString();
if( m_skipFailedTransfers == true )
{
- getLogger().warn( s );
+ getContext().warn( s );
m_skipped++;
}
else
@@ -741,7 +741,7 @@ public class FTP
else
{
- getLogger().debug( "File " + file.getAbsolutePath() + " copied to " + m_server );
+ getContext().debug( "File " + file.getAbsolutePath() + " copied to " + m_server );
m_transferred++;
}
}
@@ -889,10 +889,10 @@ public class FTP
}
}
- getLogger().info( m_transferred + " files " + COMPLETED_ACTION_STRS[ m_action ] );
+ getContext().info( m_transferred + " files " + COMPLETED_ACTION_STRS[ m_action ] );
if( m_skipped != 0 )
{
- getLogger().info( m_skipped + " files were not successfully " + COMPLETED_ACTION_STRS[ m_action ] );
+ getContext().info( m_skipped + " files were not successfully " + COMPLETED_ACTION_STRS[ m_action ] );
}
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java
index 0c901da34..d3c1bcfce 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java
@@ -25,6 +25,7 @@ import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.ScannerUtil;
@@ -263,7 +264,7 @@ public class MimeMail extends AbstractTask
MimeMessage msg = new MimeMessage( sesh );
//set the sender
- getLogger().debug( "message sender: " + from );
+ getContext().debug( "message sender: " + from );
msg.setFrom( new InternetAddress( from ) );
// add recipient lists
@@ -273,7 +274,7 @@ public class MimeMail extends AbstractTask
if( subject != null )
{
- getLogger().debug( "subject: " + subject );
+ getContext().debug( "subject: " + subject );
msg.setSubject( subject );
}
@@ -326,7 +327,7 @@ public class MimeMail extends AbstractTask
throw new TaskException( "File \"" + file.getAbsolutePath()
+ "\" does not exist or is not readable." );
}
- getLogger().debug( "Attaching " + file.toString() + " - " + file.length() + " bytes" );
+ getContext().debug( "Attaching " + file.toString() + " - " + file.length() + " bytes" );
FileDataSource fileData = new FileDataSource( file );
DataHandler fileDataHandler = new DataHandler( fileData );
body.setDataHandler( fileDataHandler );
@@ -337,7 +338,7 @@ public class MimeMail extends AbstractTask
}// for i
msg.setContent( attachments );
- getLogger().info( "sending email " );
+ getContext().info( "sending email " );
Transport.send( msg );
}
@@ -364,7 +365,7 @@ public class MimeMail extends AbstractTask
else
{
String text = e.toString();
- getLogger().error( text );
+ getContext().error( text );
}
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java
index 9108c20c0..a1d08b43c 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java
@@ -15,6 +15,7 @@ import java.util.Calendar;
import java.util.Iterator;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
/**
* Class to provide automated telnet protocol support for the Ant build tool
@@ -226,7 +227,7 @@ public class TelnetTask
output.write( ( string + "\n" ).getBytes() );
if( echoString )
{
- getLogger().info( string );
+ getContext().info( string );
}
output.flush();
}
@@ -269,7 +270,7 @@ public class TelnetTask
sb.append( (char)input.read() );
}
}
- getLogger().info( sb.toString() );
+ getContext().info( sb.toString() );
}
catch( final TaskException te )
{
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java
index f392bcc31..b88bd60d3 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java
@@ -10,6 +10,8 @@ package org.apache.tools.ant.taskdefs.optional.perforce;
import java.io.File;
import java.util.ArrayList;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.ScannerUtil;
@@ -151,7 +153,7 @@ public class P4Add extends P4Base
}
else
{
- getLogger().warn( "No files specified to add!" );
+ getContext().warn( "No files specified to add!" );
}
}
@@ -160,10 +162,10 @@ public class P4Add extends P4Base
private void execP4Add( final StringBuffer list )
throws TaskException
{
- if( getLogger().isInfoEnabled() )
+ if( getContext().isInfoEnabled() )
{
final String message = "Execing add " + m_p4CmdOpts + " " + addCmd + list;
- getLogger().info( message );
+ getContext().info( message );
}
final String command = "-s add " + m_p4CmdOpts + " " + addCmd + list;
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java
index af428cde4..f1cc5af46 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java
@@ -11,6 +11,7 @@ import org.apache.aut.nativelib.ExecManager;
import org.apache.aut.nativelib.ExecOutputHandler;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.oro.text.perl.Perl5Util;
import org.apache.tools.ant.types.Commandline;
@@ -158,7 +159,7 @@ public abstract class P4Base
cmdl += cmdline[ i ] + " ";
}
- getLogger().debug( "Execing " + cmdl );
+ getContext().debug( "Execing " + cmdl );
if( handler == null )
{
handler = this;
@@ -217,7 +218,7 @@ public abstract class P4Base
registerError( new TaskException( line ) );
}
- getLogger().info( util.substitute( "s/^.*: //", line ) );
+ getContext().info( util.substitute( "s/^.*: //", line ) );
}
public void stderr( final String line )
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java
index f28e13da0..b58800ad3 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java
@@ -8,6 +8,8 @@
package org.apache.tools.ant.taskdefs.optional.perforce;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
/**
* P4Change - grab a new changelist from Perforce. P4Change creates a new
@@ -105,7 +107,7 @@ public class P4Change
{
if( util.match( "/error/", line ) )
{
- getLogger().debug( "Client Error" );
+ getContext().debug( "Client Error" );
registerError( new TaskException( "Perforce Error, check client settings and/or server" ) );
}
else if( util.match( "//", line ) )
@@ -135,7 +137,7 @@ public class P4Change
line = util.substitute( "s/[^0-9]//g", line );
final int changenumber = Integer.parseInt( line );
- getLogger().info( "Change Number is " + changenumber );
+ getContext().info( "Change Number is " + changenumber );
try
{
getContext().setProperty( "p4.change", "" + changenumber );
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java
index f9c284925..72a5cbea1 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java
@@ -8,6 +8,8 @@
package org.apache.tools.ant.taskdefs.optional.perforce;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
/**
* P4Counter - Obtain or set the value of a counter. P4Counter can be used to
@@ -73,7 +75,7 @@ public class P4Counter
}
else
{
- getLogger().debug( "P4Counter retrieved line \"" + line + "\"" );
+ getContext().debug( "P4Counter retrieved line \"" + line + "\"" );
try
{
m_value = Integer.parseInt( line );
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java
index e1475c4af..09d93fa13 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java
@@ -10,6 +10,8 @@ package org.apache.tools.ant.taskdefs.optional.perforce;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
/**
* P4Label - create a Perforce Label. P4Label inserts a label into perforce
@@ -46,7 +48,7 @@ public class P4Label
public void stdout( String line )
{
- getLogger().debug( line );
+ getContext().debug( line );
if( null != m_labelSpec )
{
@@ -62,7 +64,7 @@ public class P4Label
public void execute()
throws TaskException
{
- getLogger().info( "P4Label exec:" );
+ getContext().info( "P4Label exec:" );
validate();
@@ -77,13 +79,13 @@ public class P4Label
execP4Command( "label -i", null );
execP4Command( "labelsync -l " + m_name, null );
- getLogger().info( "Created Label " + m_name + " (" + m_description + ")" );
+ getContext().info( "Created Label " + m_name + " (" + m_description + ")" );
//Now lock if required
if( m_lock != null && m_lock.equalsIgnoreCase( "locked" ) )
{
- getLogger().info( "Modifying lock status to 'locked'" );
+ getContext().info( "Modifying lock status to 'locked'" );
//Read back the label spec from perforce,
//Replace Options
@@ -92,12 +94,12 @@ public class P4Label
m_labelSpec = new StringBuffer();
execP4Command( "label -o " + m_name, null );
final String labelSpec = m_labelSpec.toString();
- getLogger().debug( labelSpec );
+ getContext().debug( labelSpec );
//reset labelSpec to null so output is not written to it anymore
m_labelSpec = null;
- getLogger().debug( "Now locking label..." );
+ getContext().debug( "Now locking label..." );
//handler.setOutput( labelSpec );
execP4Command( "label -i", null );
}
@@ -107,19 +109,19 @@ public class P4Label
{
if( m_p4View == null || m_p4View.length() < 1 )
{
- getLogger().warn( "View not set, assuming //depot/..." );
+ getContext().warn( "View not set, assuming //depot/..." );
m_p4View = "//depot/...";
}
if( m_description == null || m_description.length() < 1 )
{
- getLogger().warn( "Label Description not set, assuming 'AntLabel'" );
+ getContext().warn( "Label Description not set, assuming 'AntLabel'" );
m_description = "AntLabel";
}
if( m_lock != null && !m_lock.equalsIgnoreCase( "locked" ) )
{
- getLogger().warn( "lock attribute invalid - ignoring" );
+ getContext().warn( "lock attribute invalid - ignoring" );
}
if( m_name == null || m_name.length() < 1 )
@@ -127,7 +129,7 @@ public class P4Label
SimpleDateFormat formatter = new SimpleDateFormat( "yyyy.MM.dd-hh:mm" );
Date now = new Date();
m_name = "AntLabel-" + formatter.format( now );
- getLogger().warn( "name not set, assuming '" + m_name + "'" );
+ getContext().warn( "name not set, assuming '" + m_name + "'" );
}
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java
index 13f803dc3..cbd4fc9cf 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java
@@ -8,6 +8,8 @@
package org.apache.tools.ant.taskdefs.optional.perforce;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
/**
* P4Submit - submit a numbered changelist to Perforce. Note: P4Submit
@@ -35,7 +37,7 @@ public class P4Submit
*/
public void stdout( final String line )
{
- getLogger().debug( line );
+ getContext().debug( line );
}
public void execute()
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java
index f5da854a3..8b189c267 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java
@@ -8,6 +8,8 @@
package org.apache.tools.ant.taskdefs.optional.perforce;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
/**
* P4Sync - synchronise client space to a perforce depot view. The API allows
@@ -122,7 +124,7 @@ public class P4Sync
}
final String message = "Execing sync " + m_p4CmdOpts + " " + m_syncCmd;
- getLogger().debug( message );
+ getContext().debug( message );
final String command = "-s sync " + m_p4CmdOpts + " " + m_syncCmd;
execP4Command( command, null );
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
index 460252c99..7571e435d 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
@@ -24,6 +24,7 @@ import org.apache.aut.nativelib.ExecOutputHandler;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline;
@@ -187,8 +188,8 @@ public class Pvcs
final File filelist = getFileList();
final Commandline cmd = buildGetCommand( filelist );
- getLogger().info( "Getting files" );
- getLogger().debug( "Executing " + cmd.toString() );
+ getContext().info( "Getting files" );
+ getContext().debug( "Executing " + cmd.toString() );
try
{
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
@@ -258,7 +259,7 @@ public class Pvcs
// Capture output
// build the command line from what we got the format is
final Commandline cmd = buildPCLICommand();
- getLogger().debug( "Executing " + cmd.toString() );
+ getContext().debug( "Executing " + cmd.toString() );
File tmp = null;
@@ -284,7 +285,7 @@ public class Pvcs
}
// Create folders in workspace
- getLogger().info( "Creating folders" );
+ getContext().info( "Creating folders" );
createFolders( tmp );
// Massage PCLI lvf output transforming '\' to '/' so get command works appropriately
@@ -326,7 +327,7 @@ public class Pvcs
catch( final IOException ioe )
{
final String message = "Failed to write to output stream";
- getLogger().error( message );
+ getContext().error( message );
}
}
@@ -336,7 +337,7 @@ public class Pvcs
*/
public void stderr( final String line )
{
- getLogger().warn( line );
+ getContext().warn( line );
}
private Commandline buildPCLICommand()
@@ -420,7 +421,7 @@ public class Pvcs
String line = in.readLine();
while( line != null )
{
- getLogger().debug( "Considering \"" + line + "\"" );
+ getContext().debug( "Considering \"" + line + "\"" );
if( line.startsWith( "\"\\" ) ||
line.startsWith( "\"/" ) ||
line.startsWith( m_lineStart ) )
@@ -434,30 +435,30 @@ public class Pvcs
File dir = new File( f.substring( 0, index ) );
if( !dir.exists() )
{
- getLogger().debug( "Creating " + dir.getAbsolutePath() );
+ getContext().debug( "Creating " + dir.getAbsolutePath() );
if( dir.mkdirs() )
{
- getLogger().info( "Created " + dir.getAbsolutePath() );
+ getContext().info( "Created " + dir.getAbsolutePath() );
}
else
{
- getLogger().info( "Failed to create " + dir.getAbsolutePath() );
+ getContext().info( "Failed to create " + dir.getAbsolutePath() );
}
}
else
{
- getLogger().debug( dir.getAbsolutePath() + " exists. Skipping" );
+ getContext().debug( dir.getAbsolutePath() + " exists. Skipping" );
}
}
else
{
final String message = "File separator problem with " + line;
- getLogger().warn( message );
+ getContext().warn( message );
}
}
else
{
- getLogger().debug( "Skipped \"" + line + "\"" );
+ getContext().debug( "Skipped \"" + line + "\"" );
}
line = in.readLine();
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java
index 6a54fc186..f728d7b80 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java
@@ -18,6 +18,7 @@ import com.starbase.util.Platform;
import java.util.StringTokenizer;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.ScannerUtil;
/**
@@ -622,7 +623,7 @@ public class AntStarTeamCheckOut
// send the message to the project log.
// Tell how many files were checked out.
- getLogger().info( checkedOut + " files checked out." );
+ getContext().info( checkedOut + " files checked out." );
}
/**
@@ -857,7 +858,7 @@ public class AntStarTeamCheckOut
{
strFolder = strFolder.substring( i + 1 );
}
- getLogger().info( " Folder: \"" + strFolder + "\"" );
+ getContext().info( " Folder: \"" + strFolder + "\"" );
prevFolder = f;
// If we displayed the project, view, item type, or folder,
@@ -868,7 +869,7 @@ public class AntStarTeamCheckOut
{
header.append( ",\t" ).append( p2.getDisplayName() );
}
- getLogger().info( header.toString() );
+ getContext().info( header.toString() );
}
// Finally, show the Item properties ...
@@ -897,7 +898,7 @@ public class AntStarTeamCheckOut
{
itemLine.append( ",\tNot locked" );
}
- getLogger().info( itemLine.toString() );
+ getContext().info( itemLine.toString() );
}
// END VERBOSE ONLY
@@ -937,7 +938,7 @@ public class AntStarTeamCheckOut
{
if( getVerbose() )
{
- getLogger().info( "Found " + getProjectName() + delim + getViewName() + delim );
+ getContext().info( "Found " + getProjectName() + delim + getViewName() + delim );
}
runType( s, p, v, s.typeForName( (String)s.getTypeNames().FILE ) );
break;
@@ -961,7 +962,7 @@ public class AntStarTeamCheckOut
{
if( getVerbose() )
{
- getLogger().info( "Found " + getProjectName() + delim );
+ getContext().info( "Found " + getProjectName() + delim );
}
runProject( s, p );
break;
@@ -998,7 +999,7 @@ public class AntStarTeamCheckOut
if( getVerbose() && getFolderName() != null )
{
- getLogger().info( "Found " + getProjectName() + delim + getViewName() +
+ getContext().info( "Found " + getProjectName() + delim + getViewName() +
delim + getFolderName() + delim + "\n" );
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java
index 94b81e4b6..548bb1090 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java
@@ -16,6 +16,7 @@ import java.util.Random;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.DirectoryScanner;
@@ -117,7 +118,7 @@ public class CovMerge
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
- getLogger().debug( cmdl.toString() );
+ getContext().debug( cmdl.toString() );
exe.setCommandline( cmdl );
// JProbe process always return 0 so we will not be
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java
index 32e5000c3..41e94e80e 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java
@@ -20,6 +20,7 @@ import javax.xml.transform.stream.StreamResult;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.EnumeratedAttribute;
@@ -250,15 +251,15 @@ public class CovReport
// use the custom handler for stdin issues
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
- getLogger().debug( cmdl.toString() );
+ getContext().debug( cmdl.toString() );
exe.setCommandline( cmdl );
int exitValue = exe.execute();
if( exitValue != 0 )
{
throw new TaskException( "JProbe Coverage Report failed (" + exitValue + ")" );
}
- getLogger().debug( "coveragePath: " + coveragePath );
- getLogger().debug( "format: " + format );
+ getContext().debug( "coveragePath: " + coveragePath );
+ getContext().debug( "format: " + format );
if( reference != null && "xml".equals( format ) )
{
reference.createEnhancedXMLReport();
@@ -340,7 +341,7 @@ public class CovReport
}
if( reference != null && !"xml".equals( format ) )
{
- getLogger().info( "Ignored reference. It cannot be used in non XML report." );
+ getContext().info( "Ignored reference. It cannot be used in non XML report." );
reference = null;// nullify it so that there is no ambiguity
}
@@ -406,13 +407,13 @@ public class CovReport
if( filters == null || filters.size() == 0 )
{
createFilters();
- getLogger().debug( "Adding default include filter to *.*()" );
+ getContext().debug( "Adding default include filter to *.*()" );
Include include = new Include();
filters.addInclude( include );
}
try
{
- getLogger().debug( "Creating enhanced XML report" );
+ getContext().debug( "Creating enhanced XML report" );
XMLReport report = new XMLReport( CovReport.this, tofile );
report.setReportFilters( filters );
report.setJProbehome( new File( home.getParent() ) );
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java
index de68a26d8..027909a8a 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java
@@ -16,6 +16,7 @@ import java.util.ArrayList;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Commandline;
@@ -251,7 +252,7 @@ public class Coverage
// use the custom handler for stdin issues
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
- getLogger().debug( cmdl.toString() );
+ getContext().debug( cmdl.toString() );
exe.setCommandline( cmdl );
int exitValue = exe.execute();
if( exitValue != 0 )
@@ -412,7 +413,7 @@ public class Coverage
{
//@todo change this when switching to JDK 1.2 and use File.createTmpFile()
File file = File.createTempFile( "jpcoverage", "tmp" );
- getLogger().debug( "Creating parameter file: " + file );
+ getContext().debug( "Creating parameter file: " + file );
// options need to be one per line in the parameter file
// so write them all in a single string
@@ -424,7 +425,7 @@ public class Coverage
pw.println( params[ i ] );
}
pw.flush();
- getLogger().debug( "JProbe Coverage parameters:\n" + sw.toString() );
+ getContext().debug( "JProbe Coverage parameters:\n" + sw.toString() );
// now write them to the file
FileWriter fw = null;
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java
index 3af54a71a..4df5cba0f 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java
@@ -16,6 +16,7 @@ import java.util.NoSuchElementException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.optional.sitraka.bytecode.ClassFile;
import org.apache.tools.ant.taskdefs.optional.sitraka.bytecode.ClassPathLoader;
import org.apache.tools.ant.taskdefs.optional.sitraka.bytecode.MethodInfo;
@@ -194,7 +195,7 @@ public class XMLReport
}
else
{
- task.getLogger().debug( message );
+ task.getContext().debug( message );
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java
index 6561fadcb..a0f86a8a3 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java
@@ -9,6 +9,8 @@ package org.apache.tools.ant.taskdefs.optional.vss;
import java.io.File;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
@@ -133,7 +135,7 @@ public class MSVSSCHECKIN
}
final String message = "Created dir: " + dir.getAbsolutePath();
- getLogger().info( message );
+ getContext().info( message );
}
cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_localPath );
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java
index 03f406819..5a85b9b32 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.optional.vss;
import java.io.File;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
@@ -169,7 +170,7 @@ public class MSVSSCHECKOUT
else
{
final String message = "Created dir: " + dir.getAbsolutePath();
- getLogger().info( message );
+ getContext().info( message );
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java
index df977722a..2df2b34bf 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.optional.vss;
import java.io.File;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
@@ -390,7 +391,7 @@ public class MSVSSGET extends MSVSS
"successful for an unknown reason";
throw new TaskException( msg );
}
- getLogger().info( "Created dir: " + dir.getAbsolutePath() );
+ getContext().info( "Created dir: " + dir.getAbsolutePath() );
}
cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath );
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/Rmic.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/Rmic.java
index 9bbfd80a2..0afc764ca 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/Rmic.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/Rmic.java
@@ -15,6 +15,8 @@ import java.rmi.Remote;
import java.util.ArrayList;
import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.FileNameMapper;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.DirectoryScanner;
@@ -442,20 +444,20 @@ public class Rmic extends MatchingTask
{
final String message = "Unable to verify class " + classname +
". It could not be found.";
- getLogger().warn( message );
+ getContext().warn( message );
}
catch( NoClassDefFoundError e )
{
final String message = "Unable to verify class " + classname +
". It is not defined.";
- getLogger().warn( message );
+ getContext().warn( message );
}
catch( Throwable t )
{
final String message = "Unable to verify class " + classname +
". Loading caused Exception: " +
t.getMessage();
- getLogger().warn( message );
+ getContext().warn( message );
}
// we only get here if an exception has been thrown
return false;
@@ -475,7 +477,7 @@ public class Rmic extends MatchingTask
if( verify )
{
- getLogger().info( "Verify has been turned on." );
+ getContext().info( "Verify has been turned on." );
}
String compiler = getContext().getProperty( "build.rmic" ).toString();
@@ -507,7 +509,7 @@ public class Rmic extends MatchingTask
int fileCount = compileList.size();
if( fileCount > 0 )
{
- getLogger().info( "RMI Compiling " + fileCount + " class" + ( fileCount > 1 ? "es" : "" ) + " to " + baseDir );
+ getContext().info( "RMI Compiling " + fileCount + " class" + ( fileCount > 1 ? "es" : "" ) + " to " + baseDir );
// finally, lets execute the compiler!!
if( !adapter.execute() )
@@ -525,8 +527,8 @@ public class Rmic extends MatchingTask
{
if( idl )
{
- getLogger().warn( "Cannot determine sourcefiles in idl mode, " );
- getLogger().warn( "sourcebase attribute will be ignored." );
+ getContext().warn( "Cannot determine sourcefiles in idl mode, " );
+ getContext().warn( "sourcebase attribute will be ignored." );
}
else
{
@@ -557,17 +559,16 @@ public class Rmic extends MatchingTask
String[] newFiles = files;
if( idl )
{
- getLogger().debug( "will leave uptodate test to rmic implementation in idl mode." );
+ getContext().debug( "will leave uptodate test to rmic implementation in idl mode." );
}
else if( iiop
&& iiopopts != null && iiopopts.indexOf( "-always" ) > -1 )
{
- getLogger().debug( "no uptodate test as -always option has been specified" );
+ getContext().debug( "no uptodate test as -always option has been specified" );
}
else
{
final SourceFileScanner scanner = new SourceFileScanner();
- setupLogger( scanner );
newFiles = scanner.restrict( files, baseDir, baseDir, mapper, getContext() );
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/FixCRLF.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/FixCRLF.java
index 1964d521a..9a6962e4c 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/FixCRLF.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/FixCRLF.java
@@ -24,6 +24,8 @@ import java.util.NoSuchElementException;
import org.apache.aut.nativelib.Os;
import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.DirectoryScanner;
@@ -318,7 +320,7 @@ public class FixCRLF
}
// log options used
- getLogger().debug( "options:" +
+ getContext().debug( "options:" +
" eol=" +
( eol == ASIS ? "asis" : eol == CR ? "cr" : eol == LF ? "lf" : "crlf" ) +
" tab=" + ( tabs == TABS ? "add" : tabs == ASIS ? "asis" : "remove" ) +
@@ -752,11 +754,11 @@ public class FixCRLF
if( destFile.exists() )
{
// Compare the destination with the temp file
- getLogger().debug( "destFile exists" );
+ getContext().debug( "destFile exists" );
boolean result = FileUtil.contentEquals( destFile, tmpFile );
if( !result )
{
- getLogger().debug( destFile + " is being written" );
+ getContext().debug( destFile + " is being written" );
if( !destFile.delete() )
{
throw new TaskException( "Unable to delete "
@@ -774,7 +776,7 @@ public class FixCRLF
}
else
{// destination is equal to temp file
- getLogger().debug( destFile + " is not written, as the contents are identical" );
+ getContext().debug( destFile + " is not written, as the contents are identical" );
if( !tmpFile.delete() )
{
throw new TaskException( "Unable to delete "
@@ -785,7 +787,7 @@ public class FixCRLF
else
{// destFile does not exist - write the temp file
///XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- getLogger().debug( "destFile does not exist" );
+ getContext().debug( "destFile does not exist" );
if( !tmpFile.renameTo( destFile ) )
{
throw new TaskException(
@@ -814,7 +816,7 @@ public class FixCRLF
}
catch( IOException io )
{
- getLogger().error( "Error closing " + srcFile );
+ getContext().error( "Error closing " + srcFile );
}// end of catch
if( tmpFile != null )
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/Native2Ascii.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/Native2Ascii.java
index 566ac9129..50569ab4b 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/Native2Ascii.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/Native2Ascii.java
@@ -9,6 +9,8 @@ package org.apache.tools.ant.taskdefs.text;
import java.io.File;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.FileNameMapper;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.Commandline;
@@ -96,7 +98,6 @@ public class Native2Ascii
String[] files = scanner.getIncludedFiles();
final SourceFileScanner sfs = new SourceFileScanner();
- setupLogger( sfs );
final FileNameMapper mapper = buildMapper();
files = sfs.restrict( files, m_srcDir, m_destDir, mapper, getContext() );
int count = files.length;
@@ -108,7 +109,7 @@ public class Native2Ascii
final String message = "Converting " + count + " file" +
( count != 1 ? "s" : "" ) + " from " + m_srcDir + " to " +
m_destDir;
- getLogger().info( message );
+ getContext().info( message );
for( int i = 0; i < files.length; i++ )
{
@@ -192,7 +193,7 @@ public class Native2Ascii
}
}
- getLogger().debug( "converting " + srcName );
+ getContext().debug( "converting " + srcName );
sun.tools.native2ascii.Main n2a = new sun.tools.native2ascii.Main();
if( !n2a.convert( cmd.getArguments() ) )
{
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/Replace.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/Replace.java
index 2aa68d2d7..2003aa1b5 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/Replace.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/Replace.java
@@ -25,6 +25,8 @@ import java.util.Properties;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.DirectoryScanner;
@@ -227,7 +229,7 @@ public class Replace
if( m_summary )
{
- getLogger().info( "Replaced " + m_replaceCount + " occurrences in " + m_fileCount + " files." );
+ getContext().info( "Replaced " + m_replaceCount + " occurrences in " + m_fileCount + " files." );
}
}
@@ -351,7 +353,7 @@ public class Replace
final String tok = stringReplace( m_token.getText(), "\n", StringUtil.LINE_SEPARATOR );
// for each found token, replace with value
- getLogger().debug( "Replacing in " + src.getPath() + ": " + m_token.getText() + " --> " + m_value.getText() );
+ getContext().debug( "Replacing in " + src.getPath() + ": " + m_token.getText() + " --> " + m_value.getText() );
newString = stringReplace( newString, tok, val );
}
@@ -409,7 +411,7 @@ public class Replace
Replacefilter filter = (Replacefilter)m_replacefilters.get( i );
//for each found token, replace with value
- getLogger().debug( "Replacing in " + filename + ": " + filter.getToken() + " --> " + filter.getReplaceValue() );
+ getContext().debug( "Replacing in " + filename + ": " + filter.getToken() + " --> " + filter.getReplaceValue() );
newString = stringReplace( newString, filter.getToken(), filter.getReplaceValue() );
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/ReplaceRegExp.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/ReplaceRegExp.java
index e4627185f..b568e675b 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/ReplaceRegExp.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/ReplaceRegExp.java
@@ -18,6 +18,7 @@ import java.io.PrintWriter;
import java.util.ArrayList;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.ScannerUtil;
@@ -216,14 +217,14 @@ public class ReplaceRegExp
{
final String message = "An error occurred processing file: '" +
file.getAbsolutePath() + "': " + e.toString();
- getLogger().error( message, e );
+ getContext().error( message, e );
}
}
else if( file != null )
{
final String message =
"The following file is missing: '" + file.getAbsolutePath() + "'";
- getLogger().error( message );
+ getContext().error( message );
}
int sz = filesets.size();
@@ -246,13 +247,13 @@ public class ReplaceRegExp
{
final String message = "An error occurred processing file: '" + f.getAbsolutePath() +
"': " + e.toString();
- getLogger().error( message );
+ getContext().error( message );
}
}
else
{
final String message = "The following file is missing: '" + file.getAbsolutePath() + "'";
- getLogger().error( message );
+ getContext().error( message );
}
}
}
@@ -308,7 +309,7 @@ public class ReplaceRegExp
( byline ? " by line" : "" ) +
( flags.length() > 0 ? " with flags: '" + flags + "'" : "" ) +
".";
- getLogger().warn( message );
+ getContext().warn( message );
if( byline )
{
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/unix/Rpm.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/unix/Rpm.java
index 235c7b4f7..169b462aa 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/unix/Rpm.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/unix/Rpm.java
@@ -11,6 +11,7 @@ import java.io.File;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline;
@@ -101,7 +102,7 @@ public class Rpm
exe.setReturnCode( 0 );
final String message = "Building the RPM based on the " + m_specFile + " file";
- getLogger().info( message );
+ getContext().info( message );
exe.execute();
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java
index 57a781776..9523d7423 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java
@@ -15,7 +15,6 @@ import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Properties;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.framework.Filter;
@@ -26,7 +25,7 @@ import org.apache.myrmidon.framework.Filter;
* @author Michael McCallum
*/
public class FilterSet
- extends AbstractLogEnabled
+ //extends AbstractLogEnabled
implements Cloneable
{
/**
@@ -133,7 +132,6 @@ public class FilterSet
{
if( filtersFile.isFile() )
{
- getLogger().debug( "Reading filters from " + filtersFile );
FileInputStream in = null;
try
{
@@ -142,12 +140,11 @@ public class FilterSet
props.load( in );
Enumeration enum = props.propertyNames();
- ArrayList filters = m_filters;
while( enum.hasMoreElements() )
{
String strPropName = (String)enum.nextElement();
String strValue = props.getProperty( strPropName );
- filters.add( new Filter( strPropName, strValue ) );
+ m_filters.add( new Filter( strPropName, strValue ) );
}
}
catch( Exception e )
@@ -210,7 +207,6 @@ public class FilterSet
if( tokens.containsKey( token ) )
{
value = (String)tokens.get( token );
- getLogger().debug( "Replacing: " + DEFAULT_TOKEN_START + token + DEFAULT_TOKEN_END + " -> " + value );
b.append( value );
i = index + DEFAULT_TOKEN_START.length() + token.length() + DEFAULT_TOKEN_END.length();
}
@@ -230,26 +226,6 @@ public class FilterSet
return line;
}
}
-
- /**
- * The filtersfile nested element.
- *
- * @author Michael McCallum
- * @created Thursday, April 19, 2001
- */
- public class FiltersFile
- {
- /**
- * Sets the file from which filters will be read.
- *
- * @param file the file from which filters will be read.
- */
- public void setFile( final File file )
- throws TaskException
- {
- readFiltersFromFile( file );
- }
- }
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/SourceFileScanner.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/SourceFileScanner.java
index 30b794c64..d7751aebe 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/SourceFileScanner.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/SourceFileScanner.java
@@ -12,7 +12,6 @@ import java.util.ArrayList;
import java.util.Date;
import org.apache.aut.nativelib.Os;
import org.apache.avalon.excalibur.io.FileUtil;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.framework.FileNameMapper;
@@ -28,7 +27,6 @@ import org.apache.myrmidon.framework.FileNameMapper;
* @author Stefan Bodewig
*/
public class SourceFileScanner
- extends AbstractLogEnabled
{
/**
* Restrict the given set of files to those that are newer than their
@@ -72,7 +70,7 @@ public class SourceFileScanner
if( targets == null || targets.length == 0 )
{
final String message = files[ i ] + " skipped - don\'t know how to handle it";
- getLogger().debug( message );
+ context.debug( message );
continue;
}
@@ -80,7 +78,7 @@ public class SourceFileScanner
if( src.lastModified() > now )
{
final String message = "Warning: " + files[ i ] + " modified in the future.";
- getLogger().warn( message );
+ context.warn( message );
}
boolean added = false;
@@ -93,7 +91,7 @@ public class SourceFileScanner
{
final String message =
files[ i ] + " added as " + dest.getAbsolutePath() + " doesn\'t exist.";
- getLogger().debug( message );
+ context.debug( message );
v.add( files[ i ] );
added = true;
}
@@ -101,7 +99,7 @@ public class SourceFileScanner
{
final String message =
files[ i ] + " added as " + dest.getAbsolutePath() + " is outdated.";
- getLogger().debug( message );
+ context.debug( message );
v.add( files[ i ] );
added = true;
}
@@ -119,7 +117,7 @@ public class SourceFileScanner
{
final String message = files[ i ] + " omitted as " + targetList.toString() +
( targets.length == 1 ? " is" : " are " ) + " up to date.";
- getLogger().debug( message );
+ context.debug( message );
}
}