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