git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270367 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -18,8 +18,7 @@ import org.apache.myrmidon.api.TaskException; | |||||
| public class Log | public class Log | ||||
| extends AbstractTask | extends AbstractTask | ||||
| { | { | ||||
| private String m_message; | |||||
| private String m_message; | |||||
| public void setMessage( final String message ) | public void setMessage( final String message ) | ||||
| { | { | ||||
| @@ -11,17 +11,16 @@ import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| import org.apache.avalon.framework.component.ComponentException; | import org.apache.avalon.framework.component.ComponentException; | ||||
| import org.apache.avalon.framework.component.ComponentManager; | import org.apache.avalon.framework.component.ComponentManager; | ||||
| import org.apache.avalon.framework.component.Composable; | |||||
| import org.apache.avalon.framework.configuration.Configurable; | import org.apache.avalon.framework.configuration.Configurable; | ||||
| 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.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.AbstractContainerTask; | |||||
| import org.apache.myrmidon.framework.DataType; | |||||
| import org.apache.myrmidon.interfaces.type.TypeException; | import org.apache.myrmidon.interfaces.type.TypeException; | ||||
| import org.apache.myrmidon.interfaces.type.TypeFactory; | import org.apache.myrmidon.interfaces.type.TypeFactory; | ||||
| import org.apache.myrmidon.interfaces.type.TypeManager; | import org.apache.myrmidon.interfaces.type.TypeManager; | ||||
| import org.apache.myrmidon.framework.AbstractContainerTask; | |||||
| import org.apache.myrmidon.framework.DataType; | |||||
| /** | /** | ||||
| * This is the property "task" to declare a binding of a datatype to a name. | * This is the property "task" to declare a binding of a datatype to a name. | ||||
| @@ -37,10 +36,10 @@ public class Property | |||||
| private static final Resources REZ = | private static final Resources REZ = | ||||
| ResourceManager.getPackageResources( Property.class ); | ResourceManager.getPackageResources( Property.class ); | ||||
| private String m_name; | |||||
| private Object m_value; | |||||
| private boolean m_localScope = true; | |||||
| private TypeFactory m_factory; | |||||
| private String m_name; | |||||
| private Object m_value; | |||||
| private boolean m_localScope = true; | |||||
| private TypeFactory m_factory; | |||||
| public void compose( final ComponentManager componentManager ) | public void compose( final ComponentManager componentManager ) | ||||
| throws ComponentException | throws ComponentException | ||||
| @@ -48,7 +47,10 @@ public class Property | |||||
| super.compose( componentManager ); | super.compose( componentManager ); | ||||
| final TypeManager typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE ); | final TypeManager typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE ); | ||||
| try { m_factory = typeManager.getFactory( DataType.ROLE ); } | |||||
| try | |||||
| { | |||||
| m_factory = typeManager.getFactory( DataType.ROLE ); | |||||
| } | |||||
| catch( final TypeException te ) | catch( final TypeException te ) | ||||
| { | { | ||||
| final String message = REZ.getString( "property.bad-factory.error" ); | final String message = REZ.getString( "property.bad-factory.error" ); | ||||
| @@ -32,7 +32,10 @@ public class StringToByteConverter | |||||
| public Object convert( final Object object, final Context context ) | public Object convert( final Object object, final Context context ) | ||||
| throws ConverterException | throws ConverterException | ||||
| { | { | ||||
| try { return new Byte( (String)object ); } | |||||
| try | |||||
| { | |||||
| return new Byte( (String)object ); | |||||
| } | |||||
| catch( final NumberFormatException nfe ) | catch( final NumberFormatException nfe ) | ||||
| { | { | ||||
| final String message = REZ.getString( "convert.bad-byte.error", object ); | final String message = REZ.getString( "convert.bad-byte.error", object ); | ||||
| @@ -33,7 +33,10 @@ public class StringToClassConverter | |||||
| throws ConverterException | throws ConverterException | ||||
| { | { | ||||
| //TODO: Should we use ContextClassLoader here??? | //TODO: Should we use ContextClassLoader here??? | ||||
| try { return Class.forName( (String)object ); } | |||||
| try | |||||
| { | |||||
| return Class.forName( (String)object ); | |||||
| } | |||||
| catch( final Exception e ) | catch( final Exception e ) | ||||
| { | { | ||||
| final String message = REZ.getString( "convert.bad-class.error", object ); | final String message = REZ.getString( "convert.bad-class.error", object ); | ||||
| @@ -32,7 +32,10 @@ public class StringToDoubleConverter | |||||
| public Object convert( final Object object, final Context context ) | public Object convert( final Object object, final Context context ) | ||||
| throws ConverterException | throws ConverterException | ||||
| { | { | ||||
| try { return new Double( (String)object ); } | |||||
| try | |||||
| { | |||||
| return new Double( (String)object ); | |||||
| } | |||||
| catch( final NumberFormatException nfe ) | catch( final NumberFormatException nfe ) | ||||
| { | { | ||||
| final String message = REZ.getString( "convert.bad-double.error", object ); | final String message = REZ.getString( "convert.bad-double.error", object ); | ||||
| @@ -32,7 +32,10 @@ public class StringToFloatConverter | |||||
| public Object convert( final Object object, final Context context ) | public Object convert( final Object object, final Context context ) | ||||
| throws ConverterException | throws ConverterException | ||||
| { | { | ||||
| try { return new Float( (String)object ); } | |||||
| try | |||||
| { | |||||
| return new Float( (String)object ); | |||||
| } | |||||
| catch( final NumberFormatException nfe ) | catch( final NumberFormatException nfe ) | ||||
| { | { | ||||
| final String message = REZ.getString( "convert.bad-float.error", object ); | final String message = REZ.getString( "convert.bad-float.error", object ); | ||||
| @@ -32,7 +32,10 @@ public class StringToIntegerConverter | |||||
| public Object convert( final Object object, final Context context ) | public Object convert( final Object object, final Context context ) | ||||
| throws ConverterException | throws ConverterException | ||||
| { | { | ||||
| try { return new Integer( (String)object ); } | |||||
| try | |||||
| { | |||||
| return new Integer( (String)object ); | |||||
| } | |||||
| catch( final NumberFormatException nfe ) | catch( final NumberFormatException nfe ) | ||||
| { | { | ||||
| final String message = REZ.getString( "convert.bad-integer.error", object ); | final String message = REZ.getString( "convert.bad-integer.error", object ); | ||||
| @@ -32,7 +32,10 @@ public class StringToLongConverter | |||||
| public Object convert( final Object object, final Context context ) | public Object convert( final Object object, final Context context ) | ||||
| throws ConverterException | throws ConverterException | ||||
| { | { | ||||
| try { return new Long( (String)object ); } | |||||
| try | |||||
| { | |||||
| return new Long( (String)object ); | |||||
| } | |||||
| catch( final NumberFormatException nfe ) | catch( final NumberFormatException nfe ) | ||||
| { | { | ||||
| final String message = REZ.getString( "convert.bad-long.error", object ); | final String message = REZ.getString( "convert.bad-long.error", object ); | ||||
| @@ -32,7 +32,10 @@ public class StringToShortConverter | |||||
| public Object convert( final Object object, final Context context ) | public Object convert( final Object object, final Context context ) | ||||
| throws ConverterException | throws ConverterException | ||||
| { | { | ||||
| try { return new Short( (String)object ); } | |||||
| try | |||||
| { | |||||
| return new Short( (String)object ); | |||||
| } | |||||
| catch( final NumberFormatException nfe ) | catch( final NumberFormatException nfe ) | ||||
| { | { | ||||
| final String message = REZ.getString( "convert.bad-short.error", object ); | final String message = REZ.getString( "convert.bad-short.error", object ); | ||||
| @@ -34,7 +34,10 @@ public class StringToURLConverter | |||||
| public Object convert( final Object object, final Context context ) | public Object convert( final Object object, final Context context ) | ||||
| throws ConverterException | throws ConverterException | ||||
| { | { | ||||
| try { return new URL( (String)object ); } | |||||
| try | |||||
| { | |||||
| return new URL( (String)object ); | |||||
| } | |||||
| catch( final MalformedURLException mue ) | catch( final MalformedURLException mue ) | ||||
| { | { | ||||
| final String message = REZ.getString( "convert.bad-url.error", object ); | final String message = REZ.getString( "convert.bad-url.error", object ); | ||||
| @@ -13,7 +13,6 @@ import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | import org.apache.tools.ant.taskdefs.exec.Execute; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; | |||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.EnvironmentData; | import org.apache.tools.ant.types.EnvironmentData; | ||||
| @@ -8,7 +8,6 @@ | |||||
| package org.apache.antlib.runtime; | package org.apache.antlib.runtime; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.net.MalformedURLException; | |||||
| import java.net.URL; | import java.net.URL; | ||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| @@ -17,10 +16,10 @@ import org.apache.avalon.framework.component.ComponentManager; | |||||
| import org.apache.avalon.framework.component.Composable; | import org.apache.avalon.framework.component.Composable; | ||||
| 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.converter.Converter; | |||||
| import org.apache.myrmidon.interfaces.converter.ConverterRegistry; | import org.apache.myrmidon.interfaces.converter.ConverterRegistry; | ||||
| import org.apache.myrmidon.interfaces.type.DefaultTypeFactory; | import org.apache.myrmidon.interfaces.type.DefaultTypeFactory; | ||||
| import org.apache.myrmidon.interfaces.type.TypeManager; | import org.apache.myrmidon.interfaces.type.TypeManager; | ||||
| import org.apache.myrmidon.converter.Converter; | |||||
| /** | /** | ||||
| * Task to define a converter. | * Task to define a converter. | ||||
| @@ -34,12 +33,12 @@ public class ConverterDef | |||||
| private static final Resources REZ = | private static final Resources REZ = | ||||
| ResourceManager.getPackageResources( ConverterDef.class ); | ResourceManager.getPackageResources( ConverterDef.class ); | ||||
| private String m_sourceType; | |||||
| private String m_destinationType; | |||||
| private File m_lib; | |||||
| private String m_classname; | |||||
| private ConverterRegistry m_converterRegistry; | |||||
| private TypeManager m_typeManager; | |||||
| private String m_sourceType; | |||||
| private String m_destinationType; | |||||
| private File m_lib; | |||||
| private String m_classname; | |||||
| private ConverterRegistry m_converterRegistry; | |||||
| private TypeManager m_typeManager; | |||||
| public void compose( final ComponentManager componentManager ) | public void compose( final ComponentManager componentManager ) | ||||
| throws ComponentException | throws ComponentException | ||||
| @@ -97,7 +96,7 @@ public class ConverterDef | |||||
| m_converterRegistry.registerConverter( m_classname, m_sourceType, m_destinationType ); | m_converterRegistry.registerConverter( m_classname, m_sourceType, m_destinationType ); | ||||
| final URL url = m_lib.toURL(); | final URL url = m_lib.toURL(); | ||||
| final DefaultTypeFactory factory = new DefaultTypeFactory( new URL[] { url } ); | |||||
| final DefaultTypeFactory factory = new DefaultTypeFactory( new URL[]{url} ); | |||||
| factory.addNameClassMapping( m_classname, m_classname ); | factory.addNameClassMapping( m_classname, m_classname ); | ||||
| m_typeManager.registerType( Converter.ROLE, m_classname, factory ); | m_typeManager.registerType( Converter.ROLE, m_classname, factory ); | ||||
| @@ -7,9 +7,6 @@ | |||||
| */ | */ | ||||
| package org.apache.antlib.runtime; | package org.apache.antlib.runtime; | ||||
| import java.io.File; | |||||
| import java.net.MalformedURLException; | |||||
| import java.net.URL; | |||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| import org.apache.avalon.framework.component.ComponentException; | import org.apache.avalon.framework.component.ComponentException; | ||||
| @@ -18,14 +15,13 @@ import org.apache.avalon.framework.component.Composable; | |||||
| import org.apache.avalon.framework.configuration.Configurable; | import org.apache.avalon.framework.configuration.Configurable; | ||||
| 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.myrmidon.api.AbstractTask; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.aspects.AspectHandler; | import org.apache.myrmidon.aspects.AspectHandler; | ||||
| import org.apache.myrmidon.framework.AbstractContainerTask; | |||||
| import org.apache.myrmidon.interfaces.aspect.AspectManager; | import org.apache.myrmidon.interfaces.aspect.AspectManager; | ||||
| import org.apache.myrmidon.interfaces.type.TypeException; | import org.apache.myrmidon.interfaces.type.TypeException; | ||||
| import org.apache.myrmidon.interfaces.type.TypeFactory; | import org.apache.myrmidon.interfaces.type.TypeFactory; | ||||
| import org.apache.myrmidon.interfaces.type.TypeManager; | import org.apache.myrmidon.interfaces.type.TypeManager; | ||||
| import org.apache.myrmidon.framework.AbstractContainerTask; | |||||
| /** | /** | ||||
| * Task that definesMethod to register a single converter. | * Task that definesMethod to register a single converter. | ||||
| @@ -39,11 +35,11 @@ public class Facility | |||||
| private static final Resources REZ = | private static final Resources REZ = | ||||
| ResourceManager.getPackageResources( Facility.class ); | ResourceManager.getPackageResources( Facility.class ); | ||||
| private String m_namespace; | |||||
| private AspectHandler m_aspectHandler; | |||||
| private String m_namespace; | |||||
| private AspectHandler m_aspectHandler; | |||||
| private AspectManager m_aspectManager; | |||||
| private TypeFactory m_factory; | |||||
| private AspectManager m_aspectManager; | |||||
| private TypeFactory m_factory; | |||||
| public void compose( final ComponentManager componentManager ) | public void compose( final ComponentManager componentManager ) | ||||
| throws ComponentException | throws ComponentException | ||||
| @@ -53,7 +49,10 @@ public class Facility | |||||
| m_aspectManager = (AspectManager)componentManager.lookup( AspectManager.ROLE ); | m_aspectManager = (AspectManager)componentManager.lookup( AspectManager.ROLE ); | ||||
| final TypeManager typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE ); | final TypeManager typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE ); | ||||
| try { m_factory = typeManager.getFactory( AspectHandler.ROLE ); } | |||||
| try | |||||
| { | |||||
| m_factory = typeManager.getFactory( AspectHandler.ROLE ); | |||||
| } | |||||
| catch( final TypeException te ) | catch( final TypeException te ) | ||||
| { | { | ||||
| final String message = REZ.getString( "facility.no-factory.error" ); | final String message = REZ.getString( "facility.no-factory.error" ); | ||||
| @@ -7,11 +7,9 @@ | |||||
| */ | */ | ||||
| package org.apache.antlib.runtime; | package org.apache.antlib.runtime; | ||||
| import java.io.File; | |||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| import java.io.File; | |||||
| import java.net.MalformedURLException; | |||||
| import java.net.URL; | |||||
| import org.apache.avalon.framework.component.ComponentException; | import org.apache.avalon.framework.component.ComponentException; | ||||
| import org.apache.avalon.framework.component.ComponentManager; | import org.apache.avalon.framework.component.ComponentManager; | ||||
| import org.apache.avalon.framework.component.Composable; | import org.apache.avalon.framework.component.Composable; | ||||
| @@ -32,8 +30,8 @@ public class Import | |||||
| private static final Resources REZ = | private static final Resources REZ = | ||||
| ResourceManager.getPackageResources( Import.class ); | ResourceManager.getPackageResources( Import.class ); | ||||
| private File m_lib; | |||||
| private Deployer m_deployer; | |||||
| private File m_lib; | |||||
| private Deployer m_deployer; | |||||
| public void compose( final ComponentManager componentManager ) | public void compose( final ComponentManager componentManager ) | ||||
| throws ComponentException | throws ComponentException | ||||
| @@ -7,7 +7,6 @@ | |||||
| */ | */ | ||||
| package org.apache.antlib.runtime; | package org.apache.antlib.runtime; | ||||
| import org.apache.myrmidon.api.Task; | |||||
| import org.apache.myrmidon.framework.AbstractTypeDef; | import org.apache.myrmidon.framework.AbstractTypeDef; | ||||
| /** | /** | ||||
| @@ -18,7 +17,7 @@ import org.apache.myrmidon.framework.AbstractTypeDef; | |||||
| public class TypeDef | public class TypeDef | ||||
| extends AbstractTypeDef | extends AbstractTypeDef | ||||
| { | { | ||||
| private String m_type; | |||||
| private String m_type; | |||||
| public void setType( final String type ) | public void setType( final String type ) | ||||
| { | { | ||||
| @@ -252,7 +252,7 @@ public class XMLValidateTask | |||||
| if( failOnError ) | if( failOnError ) | ||||
| throw new TaskException( errorMsg ); | throw new TaskException( errorMsg ); | ||||
| else | else | ||||
| log( errorMsg, Project.MSG_ERR ); | |||||
| getLogger().error( errorMsg ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -301,19 +301,19 @@ public class XMLValidateTask | |||||
| } | } | ||||
| catch( SAXNotRecognizedException e ) | catch( SAXNotRecognizedException e ) | ||||
| { | { | ||||
| final String message = "Could not set feature '" + feature + "' because the parser doesn't recognize it"; | |||||
| if( warn ) | if( warn ) | ||||
| log( "Could not set feature '" | |||||
| + feature | |||||
| + "' because the parser doesn't recognize it", | |||||
| Project.MSG_WARN ); | |||||
| { | |||||
| getLogger().warn( message ); | |||||
| } | |||||
| } | } | ||||
| catch( SAXNotSupportedException e ) | catch( SAXNotSupportedException e ) | ||||
| { | { | ||||
| final String message = "Could not set feature '" + feature + "' because the parser doesn't support it"; | |||||
| if( warn ) | if( warn ) | ||||
| log( "Could not set feature '" | |||||
| + feature | |||||
| + "' because the parser doesn't support it", | |||||
| Project.MSG_WARN ); | |||||
| { | |||||
| getLogger().warn( message ); | |||||
| } | |||||
| } | } | ||||
| return toReturn; | return toReturn; | ||||
| } | } | ||||
| @@ -326,7 +326,7 @@ public class XMLValidateTask | |||||
| { | { | ||||
| try | try | ||||
| { | { | ||||
| log( "Validating " + afile.getName() + "... ", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Validating " + afile.getName() + "... " ); | |||||
| errorHandler.init( afile ); | errorHandler.init( afile ); | ||||
| 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( '\\', '/' ); | ||||
| @@ -353,7 +353,7 @@ public class XMLValidateTask | |||||
| if( failOnError ) | if( failOnError ) | ||||
| throw new TaskException( afile + " is not a valid XML document." ); | throw new TaskException( afile + " is not a valid XML document." ); | ||||
| else | else | ||||
| log( afile + " is not a valid XML document", Project.MSG_ERR ); | |||||
| getLogger().error( afile + " is not a valid XML document" ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -386,7 +386,7 @@ public class XMLValidateTask | |||||
| { | { | ||||
| xmlReader = (XMLReader)readerClass.newInstance(); | xmlReader = (XMLReader)readerClass.newInstance(); | ||||
| log( "Using SAX2 reader " + readerClassName, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Using SAX2 reader " + readerClassName ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -396,7 +396,7 @@ public class XMLValidateTask | |||||
| { | { | ||||
| Parser parser = (Parser)readerClass.newInstance(); | Parser parser = (Parser)readerClass.newInstance(); | ||||
| xmlReader = new ParserAdapter( parser ); | xmlReader = new ParserAdapter( parser ); | ||||
| log( "Using SAX1 parser " + readerClassName, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Using SAX1 parser " + readerClassName ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -541,7 +541,6 @@ public class XMLValidateTask | |||||
| private void doLog( SAXParseException e, int logLevel ) | private void doLog( SAXParseException e, int logLevel ) | ||||
| { | { | ||||
| log( getMessage( e ), logLevel ); | log( getMessage( e ), logLevel ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -570,7 +569,7 @@ public class XMLValidateTask | |||||
| if( publicId != null ) | if( publicId != null ) | ||||
| { | { | ||||
| fileDTDs.put( publicId, fileDTD ); | fileDTDs.put( publicId, fileDTD ); | ||||
| log( "Mapped publicId " + publicId + " to file " + fileDTD, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Mapped publicId " + publicId + " to file " + fileDTD ); | |||||
| } | } | ||||
| return; | return; | ||||
| } | } | ||||
| @@ -580,7 +579,7 @@ public class XMLValidateTask | |||||
| if( publicId != null ) | if( publicId != null ) | ||||
| { | { | ||||
| resourceDTDs.put( publicId, location ); | resourceDTDs.put( publicId, location ); | ||||
| log( "Mapped publicId " + publicId + " to resource " + location, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Mapped publicId " + publicId + " to resource " + location ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -611,7 +610,7 @@ public class XMLValidateTask | |||||
| { | { | ||||
| try | try | ||||
| { | { | ||||
| log( "Resolved " + publicId + " to local file " + dtdFile, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Resolved " + publicId + " to local file " + dtdFile ); | |||||
| return new InputSource( new FileInputStream( dtdFile ) ); | return new InputSource( new FileInputStream( dtdFile ) ); | ||||
| } | } | ||||
| catch( FileNotFoundException ex ) | catch( FileNotFoundException ex ) | ||||
| @@ -626,7 +625,7 @@ public class XMLValidateTask | |||||
| InputStream is = this.getClass().getResourceAsStream( dtdResourceName ); | InputStream is = this.getClass().getResourceAsStream( dtdResourceName ); | ||||
| if( is != null ) | if( is != null ) | ||||
| { | { | ||||
| log( "Resolved " + publicId + " to local resource " + dtdResourceName, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Resolved " + publicId + " to local resource " + dtdResourceName ); | |||||
| return new InputSource( is ); | return new InputSource( is ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -637,7 +636,7 @@ public class XMLValidateTask | |||||
| try | try | ||||
| { | { | ||||
| InputStream is = dtdUrl.openStream(); | InputStream is = dtdUrl.openStream(); | ||||
| log( "Resolved " + publicId + " to url " + dtdUrl, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Resolved " + publicId + " to url " + dtdUrl ); | |||||
| return new InputSource( is ); | return new InputSource( is ); | ||||
| } | } | ||||
| catch( IOException ioe ) | catch( IOException ioe ) | ||||
| @@ -646,8 +645,7 @@ public class XMLValidateTask | |||||
| } | } | ||||
| } | } | ||||
| log( "Could not resolve ( publicId: " + publicId + ", systemId: " + systemId + ") to a local entity", | |||||
| Project.MSG_INFO ); | |||||
| getLogger().info( "Could not resolve ( publicId: " + publicId + ", systemId: " + systemId + ") to a local entity" ); | |||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -13,7 +13,6 @@ import java.util.Iterator; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | import org.apache.tools.ant.AntClassLoader; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.Reference; | import org.apache.tools.ant.types.Reference; | ||||
| @@ -218,7 +217,7 @@ public class XSLTProcess | |||||
| // check if liaison wants to log errors using us as logger | // check if liaison wants to log errors using us as logger | ||||
| setupLogger( m_liaison ); | setupLogger( m_liaison ); | ||||
| log( "Using " + m_liaison.getClass().toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Using " + m_liaison.getClass().toString() ); | |||||
| File stylesheet = resolveFile( m_xslFile ); | File stylesheet = resolveFile( m_xslFile ); | ||||
| // if we have an in file and out then process them | // if we have an in file and out then process them | ||||
| @@ -239,7 +238,7 @@ public class XSLTProcess | |||||
| throw new TaskException( msg ); | throw new TaskException( msg ); | ||||
| } | } | ||||
| scanner = getDirectoryScanner( m_baseDir ); | scanner = getDirectoryScanner( m_baseDir ); | ||||
| log( "Transforming into " + m_destDir, Project.MSG_INFO ); | |||||
| getLogger().info( "Transforming into " + m_destDir ); | |||||
| // Process all the files marked for styling | // Process all the files marked for styling | ||||
| list = scanner.getIncludedFiles(); | list = scanner.getIncludedFiles(); | ||||
| @@ -23,6 +23,8 @@ import java.util.Iterator; | |||||
| import java.util.zip.ZipEntry; | import java.util.zip.ZipEntry; | ||||
| import java.util.zip.ZipFile; | import java.util.zip.ZipFile; | ||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| import org.apache.avalon.framework.logger.LogEnabled; | |||||
| import org.apache.avalon.framework.logger.Logger; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -38,7 +40,7 @@ import org.apache.tools.ant.types.Path; | |||||
| */ | */ | ||||
| public class AntClassLoader | public class AntClassLoader | ||||
| extends ClassLoader | extends ClassLoader | ||||
| implements BuildListener | |||||
| implements BuildListener, LogEnabled | |||||
| { | { | ||||
| /** | /** | ||||
| * The size of buffers to be used in this classloader. | * The size of buffers to be used in this classloader. | ||||
| @@ -50,6 +52,23 @@ public class AntClassLoader | |||||
| private static Method getContextClassLoader; | private static Method getContextClassLoader; | ||||
| private static Method setContextClassLoader; | private static Method setContextClassLoader; | ||||
| private Logger m_logger; | |||||
| /** | |||||
| * Provide component with a logger. | |||||
| * | |||||
| * @param logger the logger | |||||
| */ | |||||
| public void enableLogging( Logger logger ) | |||||
| { | |||||
| m_logger = logger; | |||||
| } | |||||
| protected final Logger getLogger() | |||||
| { | |||||
| return m_logger; | |||||
| } | |||||
| /** | /** | ||||
| * The components of the classpath that the classloader searches for classes | * The components of the classpath that the classloader searches for classes | ||||
| */ | */ | ||||
| @@ -336,7 +355,7 @@ public class AntClassLoader | |||||
| if( url == null ) | if( url == null ) | ||||
| { | { | ||||
| log( "Couldn't load Resource " + name, Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Couldn't load Resource " + name ); | |||||
| } | } | ||||
| return url; | return url; | ||||
| @@ -477,7 +496,7 @@ public class AntClassLoader | |||||
| public Class findClass( String name ) | public Class findClass( String name ) | ||||
| throws ClassNotFoundException | throws ClassNotFoundException | ||||
| { | { | ||||
| log( "Finding class " + name, Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Finding class " + name ); | |||||
| return findClassInComponents( name ); | return findClassInComponents( name ); | ||||
| } | } | ||||
| @@ -495,7 +514,7 @@ public class AntClassLoader | |||||
| public Class forceLoadClass( String classname ) | public Class forceLoadClass( String classname ) | ||||
| throws ClassNotFoundException | throws ClassNotFoundException | ||||
| { | { | ||||
| log( "force loading " + classname, Project.MSG_DEBUG ); | |||||
| getLogger().debug( "force loading " + classname ); | |||||
| Class theClass = findLoadedClass( classname ); | Class theClass = findLoadedClass( classname ); | ||||
| @@ -521,7 +540,7 @@ public class AntClassLoader | |||||
| public Class forceLoadSystemClass( String classname ) | public Class forceLoadSystemClass( String classname ) | ||||
| throws ClassNotFoundException | throws ClassNotFoundException | ||||
| { | { | ||||
| log( "force system loading " + classname, Project.MSG_DEBUG ); | |||||
| getLogger().debug( "force system loading " + classname ); | |||||
| Class theClass = findLoadedClass( classname ); | Class theClass = findLoadedClass( classname ); | ||||
| @@ -622,12 +641,12 @@ public class AntClassLoader | |||||
| try | try | ||||
| { | { | ||||
| theClass = findBaseClass( classname ); | theClass = findBaseClass( classname ); | ||||
| log( "Class " + classname + " loaded from parent loader", Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Class " + classname + " loaded from parent loader" ); | |||||
| } | } | ||||
| catch( ClassNotFoundException cnfe ) | catch( ClassNotFoundException cnfe ) | ||||
| { | { | ||||
| theClass = findClass( classname ); | theClass = findClass( classname ); | ||||
| log( "Class " + classname + " loaded from ant loader", Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Class " + classname + " loaded from ant loader" ); | |||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| @@ -635,7 +654,7 @@ public class AntClassLoader | |||||
| try | try | ||||
| { | { | ||||
| theClass = findClass( classname ); | theClass = findClass( classname ); | ||||
| log( "Class " + classname + " loaded from ant loader", Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Class " + classname + " loaded from ant loader" ); | |||||
| } | } | ||||
| catch( ClassNotFoundException cnfe ) | catch( ClassNotFoundException cnfe ) | ||||
| { | { | ||||
| @@ -644,7 +663,7 @@ public class AntClassLoader | |||||
| throw cnfe; | throw cnfe; | ||||
| } | } | ||||
| theClass = findBaseClass( classname ); | theClass = findBaseClass( classname ); | ||||
| log( "Class " + classname + " loaded from parent loader", Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Class " + classname + " loaded from parent loader" ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -793,8 +812,7 @@ public class AntClassLoader | |||||
| } | } | ||||
| catch( Exception e ) | catch( Exception e ) | ||||
| { | { | ||||
| log( "Ignoring Exception " + e.getClass().getName() + ": " + e.getMessage() + | |||||
| " reading resource " + resourceName + " from " + file, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Ignoring Exception " + e.getClass().getName() + ": " + e.getMessage() + " reading resource " + resourceName + " from " + file ); | |||||
| } | } | ||||
| return null; | return null; | ||||
| @@ -948,7 +966,7 @@ public class AntClassLoader | |||||
| catch( IOException ioe ) | catch( IOException ioe ) | ||||
| { | { | ||||
| // ioe.printStackTrace(); | // ioe.printStackTrace(); | ||||
| log( "Exception reading component " + pathComponent, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Exception reading component " + pathComponent ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -12,6 +12,8 @@ import java.util.ArrayList; | |||||
| import java.util.Enumeration; | import java.util.Enumeration; | ||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||||
| import org.apache.avalon.framework.logger.Logger; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.types.FilterSet; | import org.apache.tools.ant.types.FilterSet; | ||||
| import org.apache.tools.ant.types.FilterSetCollection; | import org.apache.tools.ant.types.FilterSetCollection; | ||||
| @@ -28,6 +30,7 @@ import org.apache.tools.ant.types.FilterSetCollection; | |||||
| * @author duncan@x180.com | * @author duncan@x180.com | ||||
| */ | */ | ||||
| public class Project | public class Project | ||||
| extends AbstractLogEnabled | |||||
| { | { | ||||
| public final static int MSG_ERR = 0; | public final static int MSG_ERR = 0; | ||||
| public final static int MSG_WARN = 1; | public final static int MSG_WARN = 1; | ||||
| @@ -106,6 +109,11 @@ public class Project | |||||
| } | } | ||||
| } | } | ||||
| public Logger hackGetLogger() | |||||
| { | |||||
| return super.getLogger(); | |||||
| } | |||||
| /** | /** | ||||
| * static query of the java version | * static query of the java version | ||||
| * | * | ||||
| @@ -183,9 +191,9 @@ public class Project | |||||
| throw new TaskException( "Ant cannot work on Java 1.0" ); | throw new TaskException( "Ant cannot work on Java 1.0" ); | ||||
| } | } | ||||
| log( "Detected Java version: " + javaVersion + " in: " + System.getProperty( "java.home" ), MSG_VERBOSE ); | |||||
| getLogger().debug( "Detected Java version: " + javaVersion + " in: " + System.getProperty( "java.home" ) ); | |||||
| log( "Detected OS: " + System.getProperty( "os.name" ), MSG_VERBOSE ); | |||||
| getLogger().debug( "Detected OS: " + System.getProperty( "os.name" ) ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -373,7 +381,7 @@ public class Project | |||||
| String propertyName = (String)j.next(); | String propertyName = (String)j.next(); | ||||
| if( !keys.containsKey( propertyName ) ) | if( !keys.containsKey( propertyName ) ) | ||||
| { | { | ||||
| project.log( "Property ${" + propertyName + "} has not been set", Project.MSG_VERBOSE ); | |||||
| project.getLogger().debug( "Property ${" + propertyName + "} has not been set" ); | |||||
| } | } | ||||
| fragment = ( keys.containsKey( propertyName ) ) ? (String)keys.get( propertyName ) | fragment = ( keys.containsKey( propertyName ) ) ? (String)keys.get( propertyName ) | ||||
| : "${" + propertyName + "}"; | : "${" + propertyName + "}"; | ||||
| @@ -7,6 +7,7 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant; | package org.apache.tools.ant; | ||||
| import org.apache.avalon.framework.logger.Logger; | |||||
| import org.apache.myrmidon.api.AbstractTask; | import org.apache.myrmidon.api.AbstractTask; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| @@ -20,7 +21,12 @@ import org.apache.myrmidon.api.TaskException; | |||||
| public abstract class ProjectComponent | public abstract class ProjectComponent | ||||
| extends AbstractTask | extends AbstractTask | ||||
| { | { | ||||
| private Project project; | |||||
| private Project m_project; | |||||
| public Logger hackGetLogger() | |||||
| { | |||||
| return super.getLogger(); | |||||
| } | |||||
| /** | /** | ||||
| * Sets the project object of this component. This method is used by project | * Sets the project object of this component. This method is used by project | ||||
| @@ -31,7 +37,7 @@ public abstract class ProjectComponent | |||||
| */ | */ | ||||
| public void setProject( Project project ) | public void setProject( Project project ) | ||||
| { | { | ||||
| this.project = project; | |||||
| this.m_project = project; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -41,7 +47,7 @@ public abstract class ProjectComponent | |||||
| */ | */ | ||||
| public Project getProject() | public Project getProject() | ||||
| { | { | ||||
| return project; | |||||
| return m_project; | |||||
| } | } | ||||
| public void execute() | public void execute() | ||||
| @@ -13,12 +13,12 @@ public abstract class Task | |||||
| { | { | ||||
| protected void handleErrorOutput( String line ) | protected void handleErrorOutput( String line ) | ||||
| { | { | ||||
| log( line, Project.MSG_ERR ); | |||||
| getLogger().error( line ); | |||||
| } | } | ||||
| protected void handleOutput( String line ) | protected void handleOutput( String line ) | ||||
| { | { | ||||
| log( line, Project.MSG_INFO ); | |||||
| getLogger().info( line ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -61,8 +61,8 @@ public class TaskAdapter extends Task | |||||
| } | } | ||||
| catch( Exception ex ) | catch( Exception ex ) | ||||
| { | { | ||||
| log( "Error setting project in " + proxy.getClass(), | |||||
| Project.MSG_ERR ); | |||||
| final String message = "Error setting project in " + proxy.getClass(); | |||||
| getLogger().error( message, ex ); | |||||
| throw new TaskException( "Error", ex ); | throw new TaskException( "Error", ex ); | ||||
| } | } | ||||
| @@ -73,7 +73,7 @@ public class TaskAdapter extends Task | |||||
| executeM = c.getMethod( "execute", new Class[ 0 ] ); | executeM = c.getMethod( "execute", new Class[ 0 ] ); | ||||
| if( executeM == null ) | if( executeM == null ) | ||||
| { | { | ||||
| log( "No public execute() in " + proxy.getClass(), Project.MSG_ERR ); | |||||
| getLogger().error( "No public execute() in " + proxy.getClass() ); | |||||
| throw new TaskException( "No public execute() in " + proxy.getClass() ); | throw new TaskException( "No public execute() in " + proxy.getClass() ); | ||||
| } | } | ||||
| executeM.invoke( proxy, null ); | executeM.invoke( proxy, null ); | ||||
| @@ -81,7 +81,7 @@ public class TaskAdapter extends Task | |||||
| } | } | ||||
| catch( Exception ex ) | catch( Exception ex ) | ||||
| { | { | ||||
| log( "Error in " + proxy.getClass(), Project.MSG_ERR ); | |||||
| getLogger().error( "Error in " + proxy.getClass() ); | |||||
| throw new TaskException( "Error", ex ); | throw new TaskException( "Error", ex ); | ||||
| } | } | ||||
| @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | import org.apache.tools.ant.AntClassLoader; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.condition.Condition; | import org.apache.tools.ant.taskdefs.condition.Condition; | ||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| @@ -136,7 +135,7 @@ public class Available | |||||
| if( ( classname != null ) && !checkClass( classname ) ) | if( ( classname != null ) && !checkClass( classname ) ) | ||||
| { | { | ||||
| log( "Unable to load class " + classname + " to set property " + property, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Unable to load class " + classname + " to set property " + property ); | |||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -144,18 +143,18 @@ public class Available | |||||
| { | { | ||||
| if( type != null ) | if( type != null ) | ||||
| { | { | ||||
| log( "Unable to find " + type + " " + file + " to set property " + property, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Unable to find " + type + " " + file + " to set property " + property ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Unable to find " + file + " to set property " + property, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Unable to find " + file + " to set property " + property ); | |||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| if( ( resource != null ) && !checkResource( resource ) ) | if( ( resource != null ) && !checkResource( resource ) ) | ||||
| { | { | ||||
| log( "Unable to load resource " + resource + " to set property " + property, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Unable to load resource " + resource + " to set property " + property ); | |||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -232,7 +231,7 @@ public class Available | |||||
| String[] paths = filepath.list(); | String[] paths = filepath.list(); | ||||
| for( int i = 0; i < paths.length; ++i ) | for( int i = 0; i < paths.length; ++i ) | ||||
| { | { | ||||
| log( "Searching " + paths[ i ], Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Searching " + paths[ i ] ); | |||||
| /* | /* | ||||
| * filepath can be a list of directory and/or | * filepath can be a list of directory and/or | ||||
| * file names (gen'd via <fileset>) | * file names (gen'd via <fileset>) | ||||
| @@ -254,19 +253,19 @@ public class Available | |||||
| { | { | ||||
| if( type == null ) | if( type == null ) | ||||
| { | { | ||||
| log( "Found: " + path, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Found: " + path ); | |||||
| return true; | return true; | ||||
| } | } | ||||
| else if( type.isDir() | else if( type.isDir() | ||||
| && path.isDirectory() ) | && path.isDirectory() ) | ||||
| { | { | ||||
| log( "Found directory: " + path, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Found directory: " + path ); | |||||
| return true; | return true; | ||||
| } | } | ||||
| else if( type.isFile() | else if( type.isFile() | ||||
| && path.isFile() ) | && path.isFile() ) | ||||
| { | { | ||||
| log( "Found file: " + path, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Found file: " + path ); | |||||
| return true; | return true; | ||||
| } | } | ||||
| // not the requested type | // not the requested type | ||||
| @@ -280,12 +279,12 @@ public class Available | |||||
| { | { | ||||
| if( type == null ) | if( type == null ) | ||||
| { | { | ||||
| log( "Found: " + parent, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Found: " + parent ); | |||||
| return true; | return true; | ||||
| } | } | ||||
| else if( type.isDir() ) | else if( type.isDir() ) | ||||
| { | { | ||||
| log( "Found directory: " + parent, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Found directory: " + parent ); | |||||
| return true; | return true; | ||||
| } | } | ||||
| // not the requested type | // not the requested type | ||||
| @@ -338,7 +337,7 @@ public class Available | |||||
| { | { | ||||
| if( f.isDirectory() ) | if( f.isDirectory() ) | ||||
| { | { | ||||
| log( "Found directory: " + text, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Found directory: " + text ); | |||||
| } | } | ||||
| return f.isDirectory(); | return f.isDirectory(); | ||||
| } | } | ||||
| @@ -346,14 +345,14 @@ public class Available | |||||
| { | { | ||||
| if( f.isFile() ) | if( f.isFile() ) | ||||
| { | { | ||||
| log( "Found file: " + text, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Found file: " + text ); | |||||
| } | } | ||||
| return f.isFile(); | return f.isFile(); | ||||
| } | } | ||||
| } | } | ||||
| if( f.exists() ) | if( f.exists() ) | ||||
| { | { | ||||
| log( "Found: " + text, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Found: " + text ); | |||||
| } | } | ||||
| return f.exists(); | return f.exists(); | ||||
| } | } | ||||
| @@ -22,7 +22,6 @@ import java.util.Enumeration; | |||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.taskdefs.condition.Condition; | import org.apache.tools.ant.taskdefs.condition.Condition; | ||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| @@ -215,8 +214,7 @@ public class Checksum extends MatchingTask implements Condition | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( file + " omitted as " + dest + " is up to date.", | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( file + " omitted as " + dest + " is up to date." ); | |||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| @@ -14,7 +14,6 @@ import java.util.Iterator; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.framework.Os; | import org.apache.myrmidon.framework.Os; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| 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,8 +165,7 @@ public class DependSet extends MatchingTask | |||||
| if( dest.lastModified() > now ) | if( dest.lastModified() > now ) | ||||
| { | { | ||||
| log( "Warning: " + targetFiles[ i ] + " modified in the future.", | |||||
| Project.MSG_WARN ); | |||||
| getLogger().warn( "Warning: " + targetFiles[ i ] + " modified in the future." ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -189,7 +187,7 @@ public class DependSet extends MatchingTask | |||||
| File dest = new File( targetFL.getDir( getProject() ), targetFiles[ i ] ); | File dest = new File( targetFL.getDir( getProject() ), targetFiles[ i ] ); | ||||
| if( !dest.exists() ) | if( !dest.exists() ) | ||||
| { | { | ||||
| log( targetFiles[ i ] + " does not exist.", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( targetFiles[ i ] + " does not exist." ); | |||||
| upToDate = false; | upToDate = false; | ||||
| continue; | continue; | ||||
| } | } | ||||
| @@ -199,8 +197,7 @@ public class DependSet extends MatchingTask | |||||
| } | } | ||||
| if( dest.lastModified() > now ) | if( dest.lastModified() > now ) | ||||
| { | { | ||||
| log( "Warning: " + targetFiles[ i ] + " modified in the future.", | |||||
| Project.MSG_WARN ); | |||||
| getLogger().warn( "Warning: " + targetFiles[ i ] + " modified in the future." ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -224,8 +221,7 @@ public class DependSet extends MatchingTask | |||||
| if( src.lastModified() > now ) | if( src.lastModified() > now ) | ||||
| { | { | ||||
| log( "Warning: " + sourceFiles[ i ] + " modified in the future.", | |||||
| Project.MSG_WARN ); | |||||
| getLogger().warn( "Warning: " + sourceFiles[ i ] + " modified in the future." ); | |||||
| } | } | ||||
| Iterator enumTargets = allTargets.iterator(); | Iterator enumTargets = allTargets.iterator(); | ||||
| @@ -235,8 +231,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() ) | ||||
| { | { | ||||
| log( dest.getPath() + " is out of date with respect to " + | |||||
| sourceFiles[ i ], Project.MSG_VERBOSE ); | |||||
| getLogger().debug( dest.getPath() + " is out of date with respect to " + sourceFiles[ i ] ); | |||||
| upToDate = false; | upToDate = false; | ||||
| } | } | ||||
| @@ -264,13 +259,12 @@ public class DependSet extends MatchingTask | |||||
| if( src.lastModified() > now ) | if( src.lastModified() > now ) | ||||
| { | { | ||||
| log( "Warning: " + sourceFiles[ i ] + " modified in the future.", | |||||
| Project.MSG_WARN ); | |||||
| getLogger().warn( "Warning: " + sourceFiles[ i ] + " modified in the future." ); | |||||
| } | } | ||||
| if( !src.exists() ) | if( !src.exists() ) | ||||
| { | { | ||||
| log( sourceFiles[ i ] + " does not exist.", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( sourceFiles[ i ] + " does not exist." ); | |||||
| upToDate = false; | upToDate = false; | ||||
| break; | break; | ||||
| } | } | ||||
| @@ -283,8 +277,7 @@ public class DependSet extends MatchingTask | |||||
| if( src.lastModified() > dest.lastModified() ) | if( src.lastModified() > dest.lastModified() ) | ||||
| { | { | ||||
| log( dest.getPath() + " is out of date with respect to " + | |||||
| sourceFiles[ i ], Project.MSG_VERBOSE ); | |||||
| getLogger().debug( dest.getPath() + " is out of date with respect to " + sourceFiles[ i ] ); | |||||
| upToDate = false; | upToDate = false; | ||||
| } | } | ||||
| @@ -295,11 +288,11 @@ public class DependSet extends MatchingTask | |||||
| if( !upToDate ) | if( !upToDate ) | ||||
| { | { | ||||
| log( "Deleting all target files. ", Project.MSG_VERBOSE ); | |||||
| getLogger().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(); | ||||
| log( "Deleting file " + fileToRemove.getAbsolutePath(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Deleting file " + fileToRemove.getAbsolutePath() ); | |||||
| fileToRemove.delete(); | fileToRemove.delete(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.types.ZipFileSet; | import org.apache.tools.ant.types.ZipFileSet; | ||||
| import org.apache.tools.zip.ZipOutputStream; | import org.apache.tools.zip.ZipOutputStream; | ||||
| @@ -52,7 +51,7 @@ public class Ear extends Jar | |||||
| { | { | ||||
| // 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 | ||||
| log( "addArchives called", Project.MSG_DEBUG ); | |||||
| getLogger().debug( "addArchives called" ); | |||||
| fs.setPrefix( "/" ); | fs.setPrefix( "/" ); | ||||
| super.addFileset( fs ); | super.addFileset( fs ); | ||||
| } | } | ||||
| @@ -90,8 +89,10 @@ public class Ear extends Jar | |||||
| { | { | ||||
| if( deploymentDescriptor == null || !deploymentDescriptor.equals( file ) || descriptorAdded ) | if( deploymentDescriptor == null || !deploymentDescriptor.equals( file ) || descriptorAdded ) | ||||
| { | { | ||||
| log( "Warning: selected " + archiveType + " files include a META-INF/application.xml which will be ignored " + | |||||
| "(please use appxml attribute to " + archiveType + " task)", Project.MSG_WARN ); | |||||
| final String message = "Warning: selected " + archiveType + | |||||
| " files include a META-INF/application.xml which will be ignored " + | |||||
| "(please use appxml attribute to " + archiveType + " task)"; | |||||
| getLogger().warn( message ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -13,7 +13,6 @@ import java.util.ArrayList; | |||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.taskdefs.exec.ExecTask; | import org.apache.tools.ant.taskdefs.exec.ExecTask; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | import org.apache.tools.ant.taskdefs.exec.Execute; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| @@ -412,8 +411,7 @@ public class ExecuteOn extends ExecTask | |||||
| if( fileNames.size() == 0 && skipEmpty ) | if( fileNames.size() == 0 && skipEmpty ) | ||||
| { | { | ||||
| log( "Skipping fileset for directory " | |||||
| + base + ". It is empty.", Project.MSG_INFO ); | |||||
| getLogger().info( "Skipping fileset for directory " + base + ". It is empty." ); | |||||
| continue; | continue; | ||||
| } | } | ||||
| @@ -424,8 +422,7 @@ public class ExecuteOn extends ExecTask | |||||
| for( int j = 0; j < s.length; j++ ) | for( int j = 0; j < s.length; j++ ) | ||||
| { | { | ||||
| String[] command = getCommandline( s[ j ], base ); | String[] command = getCommandline( s[ j ], base ); | ||||
| log( "Executing " + Commandline.toString( command ), | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Executing " + Commandline.toString( command ) ); | |||||
| exe.setCommandline( command ); | exe.setCommandline( command ); | ||||
| runExecute( exe ); | runExecute( exe ); | ||||
| } | } | ||||
| @@ -441,8 +438,7 @@ public class ExecuteOn extends ExecTask | |||||
| File[] b = new File[ baseDirs.size() ]; | File[] b = new File[ baseDirs.size() ]; | ||||
| b = (File[])baseDirs.toArray( b ); | b = (File[])baseDirs.toArray( b ); | ||||
| String[] command = getCommandline( s, b ); | String[] command = getCommandline( s, b ); | ||||
| log( "Executing " + Commandline.toString( command ), | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Executing " + Commandline.toString( command ) ); | |||||
| exe.setCommandline( command ); | exe.setCommandline( command ); | ||||
| runExecute( exe ); | runExecute( exe ); | ||||
| } | } | ||||
| @@ -20,7 +20,6 @@ import java.util.zip.ZipInputStream; | |||||
| 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.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| import org.apache.tools.ant.types.PatternSet; | import org.apache.tools.ant.types.PatternSet; | ||||
| @@ -166,7 +165,7 @@ public class Expand extends MatchingTask | |||||
| ze.isDirectory() ); | ze.isDirectory() ); | ||||
| } | } | ||||
| log( "expand complete", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "expand complete" ); | |||||
| } | } | ||||
| catch( IOException ioe ) | catch( IOException ioe ) | ||||
| { | { | ||||
| @@ -241,13 +240,11 @@ public class Expand extends MatchingTask | |||||
| if( !overwrite && f.exists() | if( !overwrite && f.exists() | ||||
| && f.lastModified() >= entryDate.getTime() ) | && f.lastModified() >= entryDate.getTime() ) | ||||
| { | { | ||||
| log( "Skipping " + f + " as it is up-to-date", | |||||
| Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Skipping " + f + " as it is up-to-date" ); | |||||
| return; | return; | ||||
| } | } | ||||
| log( "expanding " + entryName + " to " + f, | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "expanding " + entryName + " to " + f ); | |||||
| // create intermediary directories - sometimes zip don't add them | // create intermediary directories - sometimes zip don't add them | ||||
| File dirF = f.getParentFile(); | File dirF = f.getParentFile(); | ||||
| dirF.mkdirs(); | dirF.mkdirs(); | ||||
| @@ -293,7 +290,7 @@ public class Expand extends MatchingTask | |||||
| } | } | ||||
| catch( FileNotFoundException ex ) | catch( FileNotFoundException ex ) | ||||
| { | { | ||||
| log( "Unable to expand to file " + f.getPath(), Project.MSG_WARN ); | |||||
| getLogger().warn( "Unable to expand to file " + f.getPath() ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| /** | /** | ||||
| @@ -69,7 +68,7 @@ public class Filter extends Task | |||||
| protected void readFilters() | protected void readFilters() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| log( "Reading filters from " + filtersFile, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Reading filters from " + filtersFile ); | |||||
| getProject().getGlobalFilterSet().readFiltersFromFile( filtersFile ); | getProject().getGlobalFilterSet().readFiltersFromFile( filtersFile ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -23,7 +23,6 @@ import java.util.Iterator; | |||||
| import java.util.NoSuchElementException; | import java.util.NoSuchElementException; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
| @@ -321,14 +320,13 @@ public class FixCRLF extends MatchingTask | |||||
| } | } | ||||
| // log options used | // log options used | ||||
| log( "options:" + | |||||
| " eol=" + | |||||
| ( eol == ASIS ? "asis" : eol == CR ? "cr" : eol == LF ? "lf" : "crlf" ) + | |||||
| " tab=" + ( tabs == TABS ? "add" : tabs == ASIS ? "asis" : "remove" ) + | |||||
| " eof=" + ( ctrlz == ADD ? "add" : ctrlz == ASIS ? "asis" : "remove" ) + | |||||
| " tablength=" + tablength + | |||||
| " encoding=" + ( encoding == null ? "default" : encoding ), | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "options:" + | |||||
| " eol=" + | |||||
| ( eol == ASIS ? "asis" : eol == CR ? "cr" : eol == LF ? "lf" : "crlf" ) + | |||||
| " tab=" + ( tabs == TABS ? "add" : tabs == ASIS ? "asis" : "remove" ) + | |||||
| " eof=" + ( ctrlz == ADD ? "add" : ctrlz == ASIS ? "asis" : "remove" ) + | |||||
| " tablength=" + tablength + | |||||
| " encoding=" + ( encoding == null ? "default" : encoding ) ); | |||||
| DirectoryScanner ds = super.getDirectoryScanner( srcDir ); | DirectoryScanner ds = super.getDirectoryScanner( srcDir ); | ||||
| String[] files = ds.getIncludedFiles(); | String[] files = ds.getIncludedFiles(); | ||||
| @@ -758,10 +756,10 @@ public class FixCRLF extends MatchingTask | |||||
| if( destFile.exists() ) | if( destFile.exists() ) | ||||
| { | { | ||||
| // Compare the destination with the temp file | // Compare the destination with the temp file | ||||
| log( "destFile exists", Project.MSG_DEBUG ); | |||||
| getLogger().debug( "destFile exists" ); | |||||
| if( !FileUtils.contentEquals( destFile, tmpFile ) ) | if( !FileUtils.contentEquals( destFile, tmpFile ) ) | ||||
| { | { | ||||
| log( destFile + " is being written", Project.MSG_DEBUG ); | |||||
| getLogger().debug( destFile + " is being written" ); | |||||
| if( !destFile.delete() ) | if( !destFile.delete() ) | ||||
| { | { | ||||
| throw new TaskException( "Unable to delete " | throw new TaskException( "Unable to delete " | ||||
| @@ -779,9 +777,7 @@ public class FixCRLF extends MatchingTask | |||||
| } | } | ||||
| else | else | ||||
| {// destination is equal to temp file | {// destination is equal to temp file | ||||
| log( destFile + | |||||
| " is not written, as the contents are identical", | |||||
| Project.MSG_DEBUG ); | |||||
| getLogger().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 " | ||||
| @@ -791,7 +787,8 @@ public class FixCRLF extends MatchingTask | |||||
| } | } | ||||
| else | else | ||||
| {// destFile does not exist - write the temp file | {// destFile does not exist - write the temp file | ||||
| log( "destFile does not exist", Project.MSG_DEBUG ); | |||||
| ///XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | |||||
| getLogger().debug( "destFile does not exist" ); | |||||
| if( !tmpFile.renameTo( destFile ) ) | if( !tmpFile.renameTo( destFile ) ) | ||||
| { | { | ||||
| throw new TaskException( | throw new TaskException( | ||||
| @@ -820,7 +817,7 @@ public class FixCRLF extends MatchingTask | |||||
| } | } | ||||
| catch( IOException io ) | catch( IOException io ) | ||||
| { | { | ||||
| log( "Error closing " + srcFile, Project.MSG_ERR ); | |||||
| getLogger().error( "Error closing " + srcFile ); | |||||
| }// end of catch | }// end of catch | ||||
| if( tmpFile != null ) | if( tmpFile != null ) | ||||
| @@ -13,7 +13,6 @@ import java.io.InputStreamReader; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| /** | /** | ||||
| @@ -110,7 +109,7 @@ public class Input extends Task | |||||
| accept.add( stok.nextToken() ); | accept.add( stok.nextToken() ); | ||||
| } | } | ||||
| } | } | ||||
| log( message, Project.MSG_WARN ); | |||||
| getLogger().warn( message ); | |||||
| if( input == null ) | if( input == null ) | ||||
| { | { | ||||
| try | try | ||||
| @@ -121,7 +120,7 @@ public class Input extends Task | |||||
| { | { | ||||
| while( !accept.contains( input ) ) | while( !accept.contains( input ) ) | ||||
| { | { | ||||
| log( message, Project.MSG_WARN ); | |||||
| getLogger().warn( message ); | |||||
| input = in.readLine(); | input = in.readLine(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -149,7 +148,7 @@ public class Input extends Task | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Override ignored for " + addproperty, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Override ignored for " + addproperty ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -21,7 +21,6 @@ import java.util.Enumeration; | |||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.FileScanner; | import org.apache.tools.ant.FileScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.types.ZipFileSet; | import org.apache.tools.ant.types.ZipFileSet; | ||||
| import org.apache.tools.zip.ZipOutputStream; | import org.apache.tools.zip.ZipOutputStream; | ||||
| @@ -96,7 +95,7 @@ public class Jar extends Zip | |||||
| } | } | ||||
| catch( ManifestException e ) | catch( ManifestException e ) | ||||
| { | { | ||||
| log( "Manifest is invalid: " + e.getMessage(), Project.MSG_ERR ); | |||||
| getLogger().error( "Manifest is invalid: " + e.getMessage() ); | |||||
| throw new TaskException( "Invalid Manifest: " + manifestFile, e ); | throw new TaskException( "Invalid Manifest: " + manifestFile, e ); | ||||
| } | } | ||||
| catch( IOException e ) | catch( IOException e ) | ||||
| @@ -121,8 +120,8 @@ public class Jar extends Zip | |||||
| public void setWhenempty( WhenEmpty we ) | public void setWhenempty( WhenEmpty we ) | ||||
| { | { | ||||
| log( "JARs are never empty, they contain at least a manifest file", | |||||
| Project.MSG_WARN ); | |||||
| final String message = "JARs are never empty, they contain at least a manifest file"; | |||||
| getLogger().warn( message ); | |||||
| } | } | ||||
| public void addConfiguredManifest( Manifest newManifest ) | public void addConfiguredManifest( Manifest newManifest ) | ||||
| @@ -165,7 +164,7 @@ public class Jar extends Zip | |||||
| 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 ) | ||||
| { | { | ||||
| log( "Updating jar since the current jar has no manifest", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Updating jar since the current jar has no manifest" ); | |||||
| return false; | return false; | ||||
| } | } | ||||
| Manifest currentManifest = new Manifest( new InputStreamReader( theZipFile.getInputStream( entry ) ) ); | Manifest currentManifest = new Manifest( new InputStreamReader( theZipFile.getInputStream( entry ) ) ); | ||||
| @@ -175,15 +174,14 @@ public class Jar extends Zip | |||||
| } | } | ||||
| if( !currentManifest.equals( manifest ) ) | if( !currentManifest.equals( manifest ) ) | ||||
| { | { | ||||
| log( "Updating jar since jar manifest has changed", Project.MSG_VERBOSE ); | |||||
| getLogger().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 | ||||
| log( "Updating jar since cannot read current jar manifest: " + e.getClass().getName() + e.getMessage(), | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Updating jar since cannot read current jar manifest: " + e.getClass().getName() + e.getMessage() ); | |||||
| return false; | return false; | ||||
| } | } | ||||
| finally | finally | ||||
| @@ -245,7 +243,7 @@ public class Jar extends Zip | |||||
| } | } | ||||
| for( Iterator e = execManifest.getWarnings(); e.hasNext(); ) | for( Iterator e = execManifest.getWarnings(); e.hasNext(); ) | ||||
| { | { | ||||
| log( "Manifest warning: " + (String)e.next(), Project.MSG_WARN ); | |||||
| getLogger().warn( "Manifest warning: " + (String)e.next() ); | |||||
| } | } | ||||
| zipDir( null, zOut, "META-INF/" ); | zipDir( null, zOut, "META-INF/" ); | ||||
| @@ -261,7 +259,7 @@ public class Jar extends Zip | |||||
| } | } | ||||
| catch( ManifestException e ) | catch( ManifestException e ) | ||||
| { | { | ||||
| log( "Manifest is invalid: " + e.getMessage(), Project.MSG_ERR ); | |||||
| getLogger().error( "Manifest is invalid: " + e.getMessage() ); | |||||
| throw new TaskException( "Invalid Manifest", e ); | throw new TaskException( "Invalid Manifest", e ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -275,8 +273,10 @@ public class Jar extends Zip | |||||
| // a <fileset> element. | // a <fileset> element. | ||||
| if( vPath.equalsIgnoreCase( "META-INF/MANIFEST.MF" ) ) | if( vPath.equalsIgnoreCase( "META-INF/MANIFEST.MF" ) ) | ||||
| { | { | ||||
| log( "Warning: selected " + archiveType + " files include a META-INF/MANIFEST.MF which will be ignored " + | |||||
| "(please use manifest attribute to " + archiveType + " task)", Project.MSG_WARN ); | |||||
| final String message = "Warning: selected " + archiveType + | |||||
| " files include a META-INF/MANIFEST.MF which will be ignored " + | |||||
| "(please use manifest attribute to " + archiveType + " task)"; | |||||
| getLogger().warn( message ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -388,7 +388,7 @@ public class Jar extends Zip | |||||
| } | } | ||||
| catch( ManifestException e ) | catch( ManifestException e ) | ||||
| { | { | ||||
| log( "Manifest is invalid: " + e.getMessage(), Project.MSG_ERR ); | |||||
| getLogger().error( "Manifest is invalid: " + e.getMessage() ); | |||||
| throw new TaskException( "Invalid Manifest", e ); | throw new TaskException( "Invalid Manifest", e ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -226,7 +226,7 @@ public class Java extends Task | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Java Result: " + err, Project.MSG_ERR ); | |||||
| getLogger().error( "Java Result: " + err ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -253,7 +253,7 @@ public class Java extends Task | |||||
| if( fork ) | if( fork ) | ||||
| { | { | ||||
| log( "Forking " + cmdl.toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Forking " + cmdl.toString() ); | |||||
| return run( cmdl.getCommandline() ); | return run( cmdl.getCommandline() ); | ||||
| } | } | ||||
| @@ -261,15 +261,14 @@ public class Java extends Task | |||||
| { | { | ||||
| if( cmdl.getVmCommand().size() > 1 ) | if( cmdl.getVmCommand().size() > 1 ) | ||||
| { | { | ||||
| log( "JVM args ignored when same JVM is used.", Project.MSG_WARN ); | |||||
| getLogger().warn( "JVM args ignored when same JVM is used." ); | |||||
| } | } | ||||
| if( dir != null ) | if( dir != null ) | ||||
| { | { | ||||
| log( "Working directory ignored when same JVM is used.", Project.MSG_WARN ); | |||||
| getLogger().warn( "Working directory ignored when same JVM is used." ); | |||||
| } | } | ||||
| log( "Running in same VM " + cmdl.getJavaCommand().toString(), | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Running in same VM " + cmdl.getJavaCommand().toString() ); | |||||
| run( cmdl ); | run( cmdl ); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -772,11 +772,11 @@ public class Javac extends MatchingTask | |||||
| { | { | ||||
| CompilerAdapter adapter = CompilerAdapterFactory.getCompiler( | CompilerAdapter adapter = CompilerAdapterFactory.getCompiler( | ||||
| compiler, this ); | |||||
| getLogger().info( "Compiling " + compileList.length + | |||||
| " source file" | |||||
| + ( compileList.length == 1 ? "" : "s" ) | |||||
| + ( destDir != null ? " to " + destDir : "" ) ); | |||||
| compiler, getLogger() ); | |||||
| final String message = "Compiling " + compileList.length + " source file" + | |||||
| ( compileList.length == 1 ? "" : "s" ) + | |||||
| ( destDir != null ? " to " + destDir : "" ); | |||||
| getLogger().info( message ); | |||||
| // now we need to populate the compiler adapter | // now we need to populate the compiler adapter | ||||
| adapter.setJavac( this ); | adapter.setJavac( this ); | ||||
| @@ -790,7 +790,7 @@ public class Javac extends MatchingTask | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( FAIL_MSG, Project.MSG_ERR ); | |||||
| getLogger().error( FAIL_MSG ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -877,13 +877,13 @@ public class Javac extends MatchingTask | |||||
| { | { | ||||
| if( isJdkCompiler( compiler ) ) | if( isJdkCompiler( compiler ) ) | ||||
| { | { | ||||
| log( "Since fork is true, ignoring build.compiler setting.", | |||||
| Project.MSG_WARN ); | |||||
| final String message = "Since fork is true, ignoring build.compiler setting."; | |||||
| getLogger().warn( message ); | |||||
| compiler = "extJavac"; | compiler = "extJavac"; | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Since build.compiler setting isn't classic or modern, ignoring fork setting.", Project.MSG_WARN ); | |||||
| getLogger().warn( "Since build.compiler setting isn't classic or modern, ignoring fork setting." ); | |||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs; | |||||
| 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.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -224,7 +223,7 @@ public class PathConvert extends Task | |||||
| // Place the result into the specified property | // Place the result into the specified property | ||||
| String value = rslt.toString(); | String value = rslt.toString(); | ||||
| log( "Set property " + property + " = " + value, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Set property " + property + " = " + value ); | |||||
| setProperty( property, value ); | setProperty( property, value ); | ||||
| } | } | ||||
| @@ -18,7 +18,6 @@ import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.myrmidon.framework.exec.Environment; | import org.apache.myrmidon.framework.exec.Environment; | ||||
| import org.apache.myrmidon.framework.exec.ExecException; | import org.apache.myrmidon.framework.exec.ExecException; | ||||
| import org.apache.tools.ant.AntClassLoader; | import org.apache.tools.ant.AntClassLoader; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.Reference; | import org.apache.tools.ant.types.Reference; | ||||
| @@ -214,7 +213,7 @@ public class Property extends Task | |||||
| if( !prefix.endsWith( "." ) ) | if( !prefix.endsWith( "." ) ) | ||||
| prefix += "."; | prefix += "."; | ||||
| log( "Loading EnvironmentData " + prefix, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Loading EnvironmentData " + prefix ); | |||||
| try | try | ||||
| { | { | ||||
| final Properties environment = Environment.getNativeEnvironment(); | final Properties environment = Environment.getNativeEnvironment(); | ||||
| @@ -225,7 +224,7 @@ public class Property extends Task | |||||
| if( value.equals( "" ) ) | if( value.equals( "" ) ) | ||||
| { | { | ||||
| log( "Ignoring: " + key, Project.MSG_WARN ); | |||||
| getLogger().warn( "Ignoring: " + key ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -249,7 +248,7 @@ public class Property extends Task | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| Properties props = new Properties(); | Properties props = new Properties(); | ||||
| log( "Loading " + file.getAbsolutePath(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Loading " + file.getAbsolutePath() ); | |||||
| try | try | ||||
| { | { | ||||
| if( file.exists() ) | if( file.exists() ) | ||||
| @@ -270,8 +269,7 @@ public class Property extends Task | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Unable to find property file: " + file.getAbsolutePath(), | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Unable to find property file: " + file.getAbsolutePath() ); | |||||
| } | } | ||||
| } | } | ||||
| catch( IOException ex ) | catch( IOException ex ) | ||||
| @@ -284,7 +282,7 @@ public class Property extends Task | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| Properties props = new Properties(); | Properties props = new Properties(); | ||||
| log( "Resource Loading " + name, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Resource Loading " + name ); | |||||
| try | try | ||||
| { | { | ||||
| ClassLoader cL = null; | ClassLoader cL = null; | ||||
| @@ -315,7 +313,7 @@ public class Property extends Task | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Unable to find resource " + name, Project.MSG_WARN ); | |||||
| getLogger().warn( "Unable to find resource " + name ); | |||||
| } | } | ||||
| } | } | ||||
| catch( IOException ex ) | catch( IOException ex ) | ||||
| @@ -8,6 +8,7 @@ | |||||
| package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
| import java.io.PrintStream; | import java.io.PrintStream; | ||||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||||
| import org.apache.tools.ant.BuildEvent; | import org.apache.tools.ant.BuildEvent; | ||||
| import org.apache.tools.ant.BuildLogger; | import org.apache.tools.ant.BuildLogger; | ||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| @@ -19,7 +20,9 @@ import org.apache.tools.ant.Project; | |||||
| * @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | * @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | ||||
| * @version 0.5 | * @version 0.5 | ||||
| */ | */ | ||||
| public class RecorderEntry implements BuildLogger | |||||
| public class RecorderEntry | |||||
| extends AbstractLogEnabled | |||||
| implements BuildLogger | |||||
| { | { | ||||
| /** | /** | ||||
| * the line separator for this OS | * the line separator for this OS | ||||
| @@ -126,7 +129,7 @@ public class RecorderEntry implements BuildLogger | |||||
| public void buildFinished( BuildEvent event ) | public void buildFinished( BuildEvent event ) | ||||
| { | { | ||||
| log( "< BUILD FINISHED", Project.MSG_DEBUG ); | |||||
| getLogger().debug( "< BUILD FINISHED" ); | |||||
| Throwable error = event.getException(); | Throwable error = event.getException(); | ||||
| if( error == null ) | if( error == null ) | ||||
| @@ -144,12 +147,12 @@ public class RecorderEntry implements BuildLogger | |||||
| public void buildStarted( BuildEvent event ) | public void buildStarted( BuildEvent event ) | ||||
| { | { | ||||
| log( "> BUILD STARTED", Project.MSG_DEBUG ); | |||||
| getLogger().debug( "> BUILD STARTED" ); | |||||
| } | } | ||||
| public void messageLogged( BuildEvent event ) | public void messageLogged( BuildEvent event ) | ||||
| { | { | ||||
| log( "--- MESSAGE LOGGED", Project.MSG_DEBUG ); | |||||
| getLogger().debug( "--- MESSAGE LOGGED" ); | |||||
| StringBuffer buf = new StringBuffer(); | StringBuffer buf = new StringBuffer(); | ||||
| if( event.getTask() != null ) | if( event.getTask() != null ) | ||||
| @@ -171,28 +174,28 @@ public class RecorderEntry implements BuildLogger | |||||
| public void targetFinished( BuildEvent event ) | public void targetFinished( BuildEvent event ) | ||||
| { | { | ||||
| log( "<< TARGET FINISHED -- " + event.getTarget(), Project.MSG_DEBUG ); | |||||
| getLogger().debug( "<< TARGET FINISHED -- " + event.getTarget() ); | |||||
| String time = formatTime( System.currentTimeMillis() - targetStartTime ); | String time = formatTime( System.currentTimeMillis() - targetStartTime ); | ||||
| log( event.getTarget() + ": duration " + time, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( event.getTarget() + ": duration " + time ); | |||||
| out.flush(); | out.flush(); | ||||
| } | } | ||||
| public void targetStarted( BuildEvent event ) | public void targetStarted( BuildEvent event ) | ||||
| { | { | ||||
| log( ">> TARGET STARTED -- " + event.getTarget(), Project.MSG_DEBUG ); | |||||
| log( LINE_SEP + event.getTarget().getName() + ":", Project.MSG_INFO ); | |||||
| getLogger().debug( ">> TARGET STARTED -- " + event.getTarget() ); | |||||
| getLogger().info( LINE_SEP + event.getTarget().getName() + ":" ); | |||||
| targetStartTime = System.currentTimeMillis(); | targetStartTime = System.currentTimeMillis(); | ||||
| } | } | ||||
| public void taskFinished( BuildEvent event ) | public void taskFinished( BuildEvent event ) | ||||
| { | { | ||||
| log( "<<< TASK FINISHED -- " + event.getTask(), Project.MSG_DEBUG ); | |||||
| getLogger().debug( "<<< TASK FINISHED -- " + event.getTask() ); | |||||
| out.flush(); | out.flush(); | ||||
| } | } | ||||
| public void taskStarted( BuildEvent event ) | public void taskStarted( BuildEvent event ) | ||||
| { | { | ||||
| log( ">>> TASK STARTED -- " + event.getTask(), Project.MSG_DEBUG ); | |||||
| getLogger().debug( ">>> TASK STARTED -- " + event.getTask() ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -24,7 +24,6 @@ import java.util.ArrayList; | |||||
| import java.util.Properties; | import java.util.Properties; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| /** | /** | ||||
| * Replaces all occurrences of one or more string tokens with given values in | * Replaces all occurrences of one or more string tokens with given values in | ||||
| @@ -225,7 +224,7 @@ public class Replace extends MatchingTask | |||||
| if( summary ) | if( summary ) | ||||
| { | { | ||||
| log( "Replaced " + replaceCount + " occurrences in " + fileCount + " files.", Project.MSG_INFO ); | |||||
| getLogger().info( "Replaced " + replaceCount + " occurrences in " + fileCount + " files." ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -350,7 +349,7 @@ public class Replace extends MatchingTask | |||||
| String tok = stringReplace( token.getText(), "\n", linesep ); | String tok = stringReplace( token.getText(), "\n", linesep ); | ||||
| // for each found token, replace with value | // for each found token, replace with value | ||||
| log( "Replacing in " + src.getPath() + ": " + token.getText() + " --> " + value.getText(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Replacing in " + src.getPath() + ": " + token.getText() + " --> " + value.getText() ); | |||||
| newString = stringReplace( newString, tok, val ); | newString = stringReplace( newString, tok, val ); | ||||
| } | } | ||||
| @@ -426,7 +425,7 @@ public class Replace extends MatchingTask | |||||
| Replacefilter filter = (Replacefilter)replacefilters.get( i ); | Replacefilter filter = (Replacefilter)replacefilters.get( i ); | ||||
| //for each found token, replace with value | //for each found token, replace with value | ||||
| log( "Replacing in " + filename + ": " + filter.getToken() + " --> " + filter.getReplaceValue(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Replacing in " + filename + ": " + filter.getToken() + " --> " + filter.getReplaceValue() ); | |||||
| newString = stringReplace( newString, filter.getToken(), filter.getReplaceValue() ); | newString = stringReplace( newString, filter.getToken(), filter.getReplaceValue() ); | ||||
| } | } | ||||
| @@ -15,7 +15,6 @@ import org.apache.avalon.excalibur.io.FileUtil; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | import org.apache.tools.ant.AntClassLoader; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.taskdefs.rmic.RmicAdapter; | import org.apache.tools.ant.taskdefs.rmic.RmicAdapter; | ||||
| import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory; | import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory; | ||||
| import org.apache.tools.ant.types.FilterSetCollection; | import org.apache.tools.ant.types.FilterSetCollection; | ||||
| @@ -474,19 +473,22 @@ public class Rmic extends MatchingTask | |||||
| } | } | ||||
| catch( ClassNotFoundException e ) | catch( ClassNotFoundException e ) | ||||
| { | { | ||||
| log( "Unable to verify class " + classname + | |||||
| ". It could not be found.", Project.MSG_WARN ); | |||||
| final String message = "Unable to verify class " + classname + | |||||
| ". It could not be found."; | |||||
| getLogger().warn( message ); | |||||
| } | } | ||||
| catch( NoClassDefFoundError e ) | catch( NoClassDefFoundError e ) | ||||
| { | { | ||||
| log( "Unable to verify class " + classname + | |||||
| ". It is not defined.", Project.MSG_WARN ); | |||||
| final String message = "Unable to verify class " + classname + | |||||
| ". It is not defined."; | |||||
| getLogger().warn( message ); | |||||
| } | } | ||||
| catch( Throwable t ) | catch( Throwable t ) | ||||
| { | { | ||||
| log( "Unable to verify class " + classname + | |||||
| ". Loading caused Exception: " + | |||||
| t.getMessage(), Project.MSG_WARN ); | |||||
| final String message = "Unable to verify class " + classname + | |||||
| ". Loading caused Exception: " + | |||||
| t.getMessage(); | |||||
| getLogger().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; | ||||
| @@ -536,7 +538,7 @@ public class Rmic extends MatchingTask | |||||
| if( verify ) | if( verify ) | ||||
| { | { | ||||
| log( "Verify has been turned on.", Project.MSG_INFO ); | |||||
| getLogger().info( "Verify has been turned on." ); | |||||
| } | } | ||||
| String compiler = getProject().getProperty( "build.rmic" ); | String compiler = getProject().getProperty( "build.rmic" ); | ||||
| @@ -567,9 +569,7 @@ public class Rmic extends MatchingTask | |||||
| int fileCount = compileList.size(); | int fileCount = compileList.size(); | ||||
| if( fileCount > 0 ) | if( fileCount > 0 ) | ||||
| { | { | ||||
| log( "RMI Compiling " + fileCount + | |||||
| " class" + ( fileCount > 1 ? "es" : "" ) + " to " + baseDir, | |||||
| Project.MSG_INFO ); | |||||
| getLogger().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() ) | ||||
| @@ -587,9 +587,8 @@ public class Rmic extends MatchingTask | |||||
| { | { | ||||
| if( idl ) | if( idl ) | ||||
| { | { | ||||
| log( "Cannot determine sourcefiles in idl mode, ", | |||||
| Project.MSG_WARN ); | |||||
| log( "sourcebase attribute will be ignored.", Project.MSG_WARN ); | |||||
| getLogger().warn( "Cannot determine sourcefiles in idl mode, " ); | |||||
| getLogger().warn( "sourcebase attribute will be ignored." ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -620,14 +619,12 @@ public class Rmic extends MatchingTask | |||||
| String[] newFiles = files; | String[] newFiles = files; | ||||
| if( idl ) | if( idl ) | ||||
| { | { | ||||
| log( "will leave uptodate test to rmic implementation in idl mode.", | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().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 ) | ||||
| { | { | ||||
| log( "no uptodate test as -always option has been specified", | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "no uptodate test as -always option has been specified" ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -33,7 +33,6 @@ import java.util.StringTokenizer; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | import org.apache.tools.ant.AntClassLoader; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| 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; | ||||
| @@ -456,15 +455,14 @@ public class SQLExec extends Task | |||||
| Class dc; | Class dc; | ||||
| if( classpath != null ) | if( classpath != null ) | ||||
| { | { | ||||
| log( "Loading " + driver + " using AntClassLoader with classpath " + classpath, | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Loading " + driver + " using AntClassLoader with classpath " + classpath ); | |||||
| loader = new AntClassLoader( getProject(), classpath ); | loader = new AntClassLoader( getProject(), classpath ); | ||||
| dc = loader.loadClass( driver ); | dc = loader.loadClass( driver ); | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Loading " + driver + " using system loader.", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Loading " + driver + " using system loader." ); | |||||
| dc = Class.forName( driver ); | dc = Class.forName( driver ); | ||||
| } | } | ||||
| driverInstance = (Driver)dc.newInstance(); | driverInstance = (Driver)dc.newInstance(); | ||||
| @@ -484,7 +482,7 @@ public class SQLExec extends Task | |||||
| try | try | ||||
| { | { | ||||
| log( "connecting to " + url, Project.MSG_VERBOSE ); | |||||
| getLogger().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 ); | ||||
| @@ -508,7 +506,7 @@ public class SQLExec extends Task | |||||
| { | { | ||||
| if( output != null ) | if( output != null ) | ||||
| { | { | ||||
| log( "Opening PrintStream to output file " + output, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Opening PrintStream to output file " + output ); | |||||
| out = new PrintStream( new BufferedOutputStream( new FileOutputStream( output ) ) ); | out = new PrintStream( new BufferedOutputStream( new FileOutputStream( output ) ) ); | ||||
| } | } | ||||
| @@ -520,7 +518,7 @@ public class SQLExec extends Task | |||||
| ( (Transaction)e.next() ).runTransaction( out ); | ( (Transaction)e.next() ).runTransaction( out ); | ||||
| if( !autocommit ) | if( !autocommit ) | ||||
| { | { | ||||
| log( "Commiting transaction", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Commiting transaction" ); | |||||
| conn.commit(); | conn.commit(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -602,10 +600,10 @@ public class SQLExec extends Task | |||||
| { | { | ||||
| String theVendor = dmd.getDatabaseProductName().toLowerCase(); | String theVendor = dmd.getDatabaseProductName().toLowerCase(); | ||||
| log( "RDBMS = " + theVendor, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "RDBMS = " + theVendor ); | |||||
| if( theVendor == null || theVendor.indexOf( rdbms ) < 0 ) | if( theVendor == null || theVendor.indexOf( rdbms ) < 0 ) | ||||
| { | { | ||||
| log( "Not the required RDBMS: " + rdbms, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Not the required RDBMS: " + rdbms ); | |||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| @@ -614,12 +612,12 @@ public class SQLExec extends Task | |||||
| { | { | ||||
| String theVersion = dmd.getDatabaseProductVersion().toLowerCase(); | String theVersion = dmd.getDatabaseProductVersion().toLowerCase(); | ||||
| log( "Version = " + theVersion, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Version = " + theVersion ); | |||||
| if( theVersion == null || | if( theVersion == null || | ||||
| !( theVersion.startsWith( version ) || | !( theVersion.startsWith( version ) || | ||||
| theVersion.indexOf( " " + version ) >= 0 ) ) | theVersion.indexOf( " " + version ) >= 0 ) ) | ||||
| { | { | ||||
| log( "Not the required version: \"" + version + "\"", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Not the required version: \"" + version + "\"" ); | |||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| @@ -627,7 +625,7 @@ public class SQLExec extends Task | |||||
| catch( SQLException e ) | catch( SQLException e ) | ||||
| { | { | ||||
| // Could not get the required information | // Could not get the required information | ||||
| log( "Failed to obtain required RDBMS information", Project.MSG_ERR ); | |||||
| getLogger().error( "Failed to obtain required RDBMS information" ); | |||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -653,8 +651,7 @@ public class SQLExec extends Task | |||||
| totalSql++; | totalSql++; | ||||
| if( !statement.execute( sql ) ) | if( !statement.execute( sql ) ) | ||||
| { | { | ||||
| log( statement.getUpdateCount() + " rows affected", | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( statement.getUpdateCount() + " rows affected" ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -667,7 +664,7 @@ public class SQLExec extends Task | |||||
| SQLWarning warning = conn.getWarnings(); | SQLWarning warning = conn.getWarnings(); | ||||
| while( warning != null ) | while( warning != null ) | ||||
| { | { | ||||
| log( warning + " sql warning", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( warning + " sql warning" ); | |||||
| warning = warning.getNextWarning(); | warning = warning.getNextWarning(); | ||||
| } | } | ||||
| conn.clearWarnings(); | conn.clearWarnings(); | ||||
| @@ -675,10 +672,10 @@ public class SQLExec extends Task | |||||
| } | } | ||||
| catch( SQLException e ) | catch( SQLException e ) | ||||
| { | { | ||||
| log( "Failed to execute: " + sql, Project.MSG_ERR ); | |||||
| getLogger().error( "Failed to execute: " + sql ); | |||||
| if( !onError.equals( "continue" ) ) | if( !onError.equals( "continue" ) ) | ||||
| throw e; | throw e; | ||||
| log( e.toString(), Project.MSG_ERR ); | |||||
| getLogger().error( e.toString() ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -697,7 +694,7 @@ public class SQLExec extends Task | |||||
| rs = statement.getResultSet(); | rs = statement.getResultSet(); | ||||
| if( rs != null ) | if( rs != null ) | ||||
| { | { | ||||
| log( "Processing new result set.", Project.MSG_VERBOSE ); | |||||
| getLogger().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(); | ||||
| @@ -781,7 +778,7 @@ public class SQLExec extends Task | |||||
| 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 ) ) | ||||
| { | { | ||||
| log( "SQL: " + sql, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "SQL: " + sql ); | |||||
| execSQL( sql.substring( 0, sql.length() - delimiter.length() ), out ); | execSQL( sql.substring( 0, sql.length() - delimiter.length() ), out ); | ||||
| sql = ""; | sql = ""; | ||||
| } | } | ||||
| @@ -852,14 +849,13 @@ public class SQLExec extends Task | |||||
| { | { | ||||
| if( tSqlCommand.length() != 0 ) | if( tSqlCommand.length() != 0 ) | ||||
| { | { | ||||
| log( "Executing commands", Project.MSG_INFO ); | |||||
| getLogger().info( "Executing commands" ); | |||||
| runStatements( new StringReader( tSqlCommand ), out ); | runStatements( new StringReader( tSqlCommand ), out ); | ||||
| } | } | ||||
| if( tSrcFile != null ) | if( tSrcFile != null ) | ||||
| { | { | ||||
| log( "Executing file: " + tSrcFile.getAbsolutePath(), | |||||
| Project.MSG_INFO ); | |||||
| getLogger().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 ); | ||||
| @@ -16,7 +16,6 @@ import java.util.ArrayList; | |||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.mail.MailMessage; | import org.apache.tools.mail.MailMessage; | ||||
| @@ -402,7 +401,7 @@ public class SendEmail extends Task | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( err, Project.MSG_ERR ); | |||||
| getLogger().error( err ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -8,7 +8,6 @@ | |||||
| package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| /** | /** | ||||
| @@ -128,8 +127,7 @@ public class Sleep extends Task | |||||
| { | { | ||||
| validate(); | validate(); | ||||
| long sleepTime = getSleepTime(); | long sleepTime = getSleepTime(); | ||||
| log( "sleeping for " + sleepTime + " milliseconds", | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "sleeping for " + sleepTime + " milliseconds" ); | |||||
| doSleep( sleepTime ); | doSleep( sleepTime ); | ||||
| } | } | ||||
| catch( Exception e ) | catch( Exception e ) | ||||
| @@ -141,7 +139,7 @@ public class Sleep extends Task | |||||
| else | else | ||||
| { | { | ||||
| String text = e.toString(); | String text = e.toString(); | ||||
| log( text, Project.MSG_ERR ); | |||||
| getLogger().error( text ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -163,12 +163,11 @@ public class Tar | |||||
| if( upToDate ) | if( upToDate ) | ||||
| { | { | ||||
| log( "Nothing to do: " + tarFile.getAbsolutePath() + " is up to date.", | |||||
| Project.MSG_INFO ); | |||||
| getLogger().info( "Nothing to do: " + tarFile.getAbsolutePath() + " is up to date." ); | |||||
| return; | return; | ||||
| } | } | ||||
| log( "Building tar: " + tarFile.getAbsolutePath(), Project.MSG_INFO ); | |||||
| getLogger().info( "Building tar: " + tarFile.getAbsolutePath() ); | |||||
| TarOutputStream tOut = null; | TarOutputStream tOut = null; | ||||
| try | try | ||||
| @@ -256,17 +255,19 @@ public class Tar | |||||
| { | { | ||||
| if( longFileMode.isOmitMode() ) | if( longFileMode.isOmitMode() ) | ||||
| { | { | ||||
| log( "Omitting: " + vPath, Project.MSG_INFO ); | |||||
| getLogger().info( "Omitting: " + vPath ); | |||||
| return; | return; | ||||
| } | } | ||||
| else if( longFileMode.isWarnMode() ) | else if( longFileMode.isWarnMode() ) | ||||
| { | { | ||||
| log( "Entry: " + vPath + " longer than " + | |||||
| TarConstants.NAMELEN + " characters.", Project.MSG_WARN ); | |||||
| final String message = "Entry: " + vPath + " longer than " + | |||||
| TarConstants.NAMELEN + " characters."; | |||||
| getLogger().warn( message ); | |||||
| if( !longWarningGiven ) | if( !longWarningGiven ) | ||||
| { | { | ||||
| log( "Resulting tar file can only be processed successfully" | |||||
| + " by GNU compatible tar commands", Project.MSG_WARN ); | |||||
| final String message2 = "Resulting tar file can only be processed successfully" | |||||
| + " by GNU compatible tar commands"; | |||||
| getLogger().warn( message2 ); | |||||
| longWarningGiven = true; | longWarningGiven = true; | ||||
| } | } | ||||
| } | } | ||||
| @@ -134,7 +134,7 @@ public class Touch extends Task | |||||
| { | { | ||||
| if( !file.exists() ) | if( !file.exists() ) | ||||
| { | { | ||||
| log( "Creating " + file, Project.MSG_INFO ); | |||||
| getLogger().info( "Creating " + file ); | |||||
| try | try | ||||
| { | { | ||||
| FileOutputStream fos = new FileOutputStream( file ); | FileOutputStream fos = new FileOutputStream( file ); | ||||
| @@ -150,8 +150,7 @@ public class Touch extends Task | |||||
| if( millis >= 0 && getProject().getJavaVersion() == Project.JAVA_1_1 ) | if( millis >= 0 && getProject().getJavaVersion() == Project.JAVA_1_1 ) | ||||
| { | { | ||||
| log( "modification time of files cannot be set in JDK 1.1", | |||||
| Project.MSG_WARN ); | |||||
| getLogger().warn( "modification time of files cannot be set in JDK 1.1" ); | |||||
| return; | return; | ||||
| } | } | ||||
| @@ -11,7 +11,6 @@ import java.io.File; | |||||
| import java.io.FileInputStream; | import java.io.FileInputStream; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.tar.TarEntry; | import org.apache.tools.tar.TarEntry; | ||||
| import org.apache.tools.tar.TarInputStream; | import org.apache.tools.tar.TarInputStream; | ||||
| @@ -30,7 +29,7 @@ public class Untar extends Expand | |||||
| TarInputStream tis = null; | TarInputStream tis = null; | ||||
| try | try | ||||
| { | { | ||||
| log( "Expanding: " + srcF + " into " + dir, Project.MSG_INFO ); | |||||
| getLogger().info( "Expanding: " + srcF + " into " + dir ); | |||||
| tis = new TarInputStream( new FileInputStream( srcF ) ); | tis = new TarInputStream( new FileInputStream( srcF ) ); | ||||
| TarEntry te = null; | TarEntry te = null; | ||||
| @@ -41,7 +40,7 @@ public class Untar extends Expand | |||||
| te.getName(), | te.getName(), | ||||
| te.getModTime(), te.isDirectory() ); | te.getModTime(), te.isDirectory() ); | ||||
| } | } | ||||
| log( "expand complete", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "expand complete" ); | |||||
| } | } | ||||
| catch( IOException ioe ) | catch( IOException ioe ) | ||||
| @@ -12,7 +12,6 @@ import java.util.ArrayList; | |||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.taskdefs.condition.Condition; | import org.apache.tools.ant.taskdefs.condition.Condition; | ||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| import org.apache.tools.ant.types.Mapper; | import org.apache.tools.ant.types.Mapper; | ||||
| @@ -150,13 +149,11 @@ public class UpToDate extends MatchingTask implements Condition | |||||
| setProperty( _property, this.getValue() ); | setProperty( _property, this.getValue() ); | ||||
| if( mapperElement == null ) | if( mapperElement == null ) | ||||
| { | { | ||||
| log( "File \"" + _targetFile.getAbsolutePath() + "\" is up to date.", | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "File \"" + _targetFile.getAbsolutePath() + "\" is up to date." ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "All target files have been up to date.", | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "All target files have been up to date." ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.types.ZipFileSet; | import org.apache.tools.ant.types.ZipFileSet; | ||||
| import org.apache.tools.zip.ZipOutputStream; | import org.apache.tools.zip.ZipOutputStream; | ||||
| @@ -101,8 +100,10 @@ public class War extends Jar | |||||
| { | { | ||||
| if( deploymentDescriptor == null || !deploymentDescriptor.equals( file ) || descriptorAdded ) | if( deploymentDescriptor == null || !deploymentDescriptor.equals( file ) || descriptorAdded ) | ||||
| { | { | ||||
| log( "Warning: selected " + archiveType + " files include a WEB-INF/web.xml which will be ignored " + | |||||
| "(please use webxml attribute to " + archiveType + " task)", Project.MSG_WARN ); | |||||
| final String message = "Warning: selected " + archiveType + | |||||
| " files include a WEB-INF/web.xml which will be ignored " + | |||||
| "(please use webxml attribute to " + archiveType + " task)"; | |||||
| getLogger().warn( message ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -23,7 +23,6 @@ import java.util.zip.ZipInputStream; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.FileScanner; | import org.apache.tools.ant.FileScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| 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; | ||||
| import org.apache.tools.ant.types.ZipFileSet; | import org.apache.tools.ant.types.ZipFileSet; | ||||
| @@ -384,8 +383,9 @@ public class Zip extends MatchingTask | |||||
| { | { | ||||
| if( !renamedFile.delete() ) | if( !renamedFile.delete() ) | ||||
| { | { | ||||
| log( "Warning: unable to delete temporary file " + | |||||
| renamedFile.getName(), Project.MSG_WARN ); | |||||
| final String message = "Warning: unable to delete temporary file " + | |||||
| renamedFile.getName(); | |||||
| getLogger().warn( message ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -420,8 +420,9 @@ public class Zip extends MatchingTask | |||||
| { | { | ||||
| if( emptyBehavior.equals( "skip" ) ) | if( emptyBehavior.equals( "skip" ) ) | ||||
| { | { | ||||
| log( "Warning: skipping " + archiveType + " archive " + zipFile + | |||||
| " because no files were included.", Project.MSG_WARN ); | |||||
| final String message = "Warning: skipping " + archiveType + " archive " + zipFile + | |||||
| " because no files were included."; | |||||
| getLogger().warn( message ); | |||||
| return true; | return true; | ||||
| } | } | ||||
| else if( emptyBehavior.equals( "fail" ) ) | else if( emptyBehavior.equals( "fail" ) ) | ||||
| @@ -708,7 +709,7 @@ public class Zip extends MatchingTask | |||||
| // 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. | ||||
| log( "Note: creating empty " + archiveType + " archive " + zipFile, Project.MSG_INFO ); | |||||
| getLogger().info( "Note: creating empty " + archiveType + " archive " + zipFile ); | |||||
| try | try | ||||
| { | { | ||||
| OutputStream os = new FileOutputStream( zipFile ); | OutputStream os = new FileOutputStream( zipFile ); | ||||
| @@ -7,9 +7,8 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.compilers; | package org.apache.tools.ant.taskdefs.compilers; | ||||
| import org.apache.avalon.framework.logger.Logger; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | |||||
| /** | /** | ||||
| * Creates the necessary compiler adapter, given basic criteria. | * Creates the necessary compiler adapter, given basic criteria. | ||||
| @@ -51,7 +50,7 @@ public class CompilerAdapterFactory | |||||
| * @throws TaskException if the compiler type could not be resolved into a | * @throws TaskException if the compiler type could not be resolved into a | ||||
| * compiler adapter. | * compiler adapter. | ||||
| */ | */ | ||||
| public static CompilerAdapter getCompiler( String compilerType, Task task ) | |||||
| public static CompilerAdapter getCompiler( String compilerType, Logger logger ) | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| /* | /* | ||||
| @@ -83,8 +82,9 @@ public class CompilerAdapterFactory | |||||
| } | } | ||||
| catch( ClassNotFoundException cnfe ) | catch( ClassNotFoundException cnfe ) | ||||
| { | { | ||||
| task.log( "Modern compiler is not available - using " | |||||
| + "classic compiler", Project.MSG_WARN ); | |||||
| final String message = "Modern compiler is not available - using " | |||||
| + "classic compiler"; | |||||
| logger.warn( message ); | |||||
| return new Javac12(); | return new Javac12(); | ||||
| } | } | ||||
| return new Javac13(); | return new Javac13(); | ||||
| @@ -11,6 +11,7 @@ import java.io.File; | |||||
| import java.io.FileWriter; | import java.io.FileWriter; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.PrintWriter; | import java.io.PrintWriter; | ||||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.taskdefs.Javac; | import org.apache.tools.ant.taskdefs.Javac; | ||||
| @@ -29,28 +30,30 @@ import org.apache.tools.ant.types.Path; | |||||
| * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | ||||
| * @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | * @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | ||||
| */ | */ | ||||
| public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
| public abstract class DefaultCompilerAdapter | |||||
| extends AbstractLogEnabled | |||||
| implements CompilerAdapter | |||||
| { | { | ||||
| protected static String lSep = System.getProperty( "line.separator" ); | |||||
| protected boolean debug = false; | |||||
| protected boolean optimize = false; | |||||
| protected boolean deprecation = false; | |||||
| protected boolean depend = false; | |||||
| protected boolean verbose = false; | |||||
| protected Javac attributes; | |||||
| protected Path bootclasspath; | |||||
| protected Path compileClasspath; | |||||
| protected File[] compileList; | |||||
| protected File destDir; | |||||
| protected String encoding; | |||||
| protected Path extdirs; | |||||
| protected boolean includeAntRuntime; | |||||
| protected boolean includeJavaRuntime; | |||||
| protected String memoryInitialSize; | |||||
| protected String memoryMaximumSize; | |||||
| protected Project project; | |||||
| protected static String LINE_SEP = System.getProperty( "line.separator" ); | |||||
| protected boolean m_debug; | |||||
| protected boolean m_optimize; | |||||
| protected boolean m_deprecation; | |||||
| protected boolean m_depend; | |||||
| protected boolean m_verbose; | |||||
| protected Javac m_attributes; | |||||
| protected Path m_bootclasspath; | |||||
| protected Path m_compileClasspath; | |||||
| protected File[] m_compileList; | |||||
| protected File m_destDir; | |||||
| protected String m_encoding; | |||||
| protected Path m_extdirs; | |||||
| protected boolean m_includeAntRuntime; | |||||
| protected boolean m_includeJavaRuntime; | |||||
| protected String m_memoryInitialSize; | |||||
| protected String m_memoryMaximumSize; | |||||
| protected Project m_project; | |||||
| /* | /* | ||||
| * jdg - TODO - all these attributes are currently protected, but they | * jdg - TODO - all these attributes are currently protected, but they | ||||
| @@ -61,30 +64,30 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
| public void setJavac( Javac attributes ) | public void setJavac( Javac attributes ) | ||||
| { | { | ||||
| this.attributes = attributes; | |||||
| this.m_attributes = attributes; | |||||
| src = attributes.getSrcdir(); | src = attributes.getSrcdir(); | ||||
| destDir = attributes.getDestdir(); | |||||
| encoding = attributes.getEncoding(); | |||||
| debug = attributes.getDebug(); | |||||
| optimize = attributes.getOptimize(); | |||||
| deprecation = attributes.getDeprecation(); | |||||
| depend = attributes.getDepend(); | |||||
| verbose = attributes.getVerbose(); | |||||
| m_destDir = attributes.getDestdir(); | |||||
| m_encoding = attributes.getEncoding(); | |||||
| m_debug = attributes.getDebug(); | |||||
| m_optimize = attributes.getOptimize(); | |||||
| m_deprecation = attributes.getDeprecation(); | |||||
| m_depend = attributes.getDepend(); | |||||
| m_verbose = attributes.getVerbose(); | |||||
| target = attributes.getTarget(); | target = attributes.getTarget(); | ||||
| bootclasspath = attributes.getBootclasspath(); | |||||
| extdirs = attributes.getExtdirs(); | |||||
| compileList = attributes.getFileList(); | |||||
| compileClasspath = attributes.getClasspath(); | |||||
| project = attributes.getProject(); | |||||
| includeAntRuntime = attributes.getIncludeantruntime(); | |||||
| includeJavaRuntime = attributes.getIncludejavaruntime(); | |||||
| memoryInitialSize = attributes.getMemoryInitialSize(); | |||||
| memoryMaximumSize = attributes.getMemoryMaximumSize(); | |||||
| m_bootclasspath = attributes.getBootclasspath(); | |||||
| m_extdirs = attributes.getExtdirs(); | |||||
| m_compileList = attributes.getFileList(); | |||||
| m_compileClasspath = attributes.getClasspath(); | |||||
| m_project = attributes.getProject(); | |||||
| m_includeAntRuntime = attributes.getIncludeantruntime(); | |||||
| m_includeJavaRuntime = attributes.getIncludejavaruntime(); | |||||
| m_memoryInitialSize = attributes.getMemoryInitialSize(); | |||||
| m_memoryMaximumSize = attributes.getMemoryMaximumSize(); | |||||
| } | } | ||||
| public Javac getJavac() | public Javac getJavac() | ||||
| { | { | ||||
| return attributes; | |||||
| return m_attributes; | |||||
| } | } | ||||
| protected Commandline setupJavacCommand() | protected Commandline setupJavacCommand() | ||||
| @@ -128,46 +131,46 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
| // has its own parameter format | // has its own parameter format | ||||
| boolean usingJava1_1 = Project.getJavaVersion().equals( Project.JAVA_1_1 ); | boolean usingJava1_1 = Project.getJavaVersion().equals( Project.JAVA_1_1 ); | ||||
| String memoryParameterPrefix = usingJava1_1 ? "-J-" : "-J-X"; | String memoryParameterPrefix = usingJava1_1 ? "-J-" : "-J-X"; | ||||
| if( memoryInitialSize != null ) | |||||
| if( m_memoryInitialSize != null ) | |||||
| { | { | ||||
| if( !attributes.isForkedJavac() ) | |||||
| if( !m_attributes.isForkedJavac() ) | |||||
| { | { | ||||
| attributes.log( "Since fork is false, ignoring memoryInitialSize setting.", | |||||
| Project.MSG_WARN ); | |||||
| final String message = "Since fork is false, ignoring memoryInitialSize setting."; | |||||
| getLogger().warn( message ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| cmd.createArgument().setValue( memoryParameterPrefix + "ms" + memoryInitialSize ); | |||||
| cmd.createArgument().setValue( memoryParameterPrefix + "ms" + m_memoryInitialSize ); | |||||
| } | } | ||||
| } | } | ||||
| if( memoryMaximumSize != null ) | |||||
| if( m_memoryMaximumSize != null ) | |||||
| { | { | ||||
| if( !attributes.isForkedJavac() ) | |||||
| if( !m_attributes.isForkedJavac() ) | |||||
| { | { | ||||
| attributes.log( "Since fork is false, ignoring memoryMaximumSize setting.", | |||||
| Project.MSG_WARN ); | |||||
| final String message = "Since fork is false, ignoring memoryMaximumSize setting."; | |||||
| getLogger().warn( message ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| cmd.createArgument().setValue( memoryParameterPrefix + "mx" + memoryMaximumSize ); | |||||
| cmd.createArgument().setValue( memoryParameterPrefix + "mx" + m_memoryMaximumSize ); | |||||
| } | } | ||||
| } | } | ||||
| if( attributes.getNowarn() ) | |||||
| if( m_attributes.getNowarn() ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-nowarn" ); | cmd.createArgument().setValue( "-nowarn" ); | ||||
| } | } | ||||
| if( deprecation == true ) | |||||
| if( m_deprecation == true ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-deprecation" ); | cmd.createArgument().setValue( "-deprecation" ); | ||||
| } | } | ||||
| if( destDir != null ) | |||||
| if( m_destDir != null ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-d" ); | cmd.createArgument().setValue( "-d" ); | ||||
| cmd.createArgument().setFile( destDir ); | |||||
| cmd.createArgument().setFile( m_destDir ); | |||||
| } | } | ||||
| cmd.createArgument().setValue( "-classpath" ); | cmd.createArgument().setValue( "-classpath" ); | ||||
| @@ -176,17 +179,17 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
| // as well as "bootclasspath" and "extdirs" | // as well as "bootclasspath" and "extdirs" | ||||
| if( Project.getJavaVersion().startsWith( "1.1" ) ) | if( Project.getJavaVersion().startsWith( "1.1" ) ) | ||||
| { | { | ||||
| Path cp = new Path( project ); | |||||
| Path cp = new Path( m_project ); | |||||
| /* | /* | ||||
| * XXX - This doesn't mix very well with build.systemclasspath, | * XXX - This doesn't mix very well with build.systemclasspath, | ||||
| */ | */ | ||||
| if( bootclasspath != null ) | |||||
| if( m_bootclasspath != null ) | |||||
| { | { | ||||
| cp.append( bootclasspath ); | |||||
| cp.append( m_bootclasspath ); | |||||
| } | } | ||||
| if( extdirs != null ) | |||||
| if( m_extdirs != null ) | |||||
| { | { | ||||
| cp.addExtdirs( extdirs ); | |||||
| cp.addExtdirs( m_extdirs ); | |||||
| } | } | ||||
| cp.append( classpath ); | cp.append( classpath ); | ||||
| cp.append( src ); | cp.append( src ); | ||||
| @@ -202,31 +205,31 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
| cmd.createArgument().setValue( "-target" ); | cmd.createArgument().setValue( "-target" ); | ||||
| cmd.createArgument().setValue( target ); | cmd.createArgument().setValue( target ); | ||||
| } | } | ||||
| if( bootclasspath != null ) | |||||
| if( m_bootclasspath != null ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-bootclasspath" ); | cmd.createArgument().setValue( "-bootclasspath" ); | ||||
| cmd.createArgument().setPath( bootclasspath ); | |||||
| cmd.createArgument().setPath( m_bootclasspath ); | |||||
| } | } | ||||
| if( extdirs != null ) | |||||
| if( m_extdirs != null ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-extdirs" ); | cmd.createArgument().setValue( "-extdirs" ); | ||||
| cmd.createArgument().setPath( extdirs ); | |||||
| cmd.createArgument().setPath( m_extdirs ); | |||||
| } | } | ||||
| } | } | ||||
| if( encoding != null ) | |||||
| if( m_encoding != null ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-encoding" ); | cmd.createArgument().setValue( "-encoding" ); | ||||
| cmd.createArgument().setValue( encoding ); | |||||
| cmd.createArgument().setValue( m_encoding ); | |||||
| } | } | ||||
| if( debug ) | |||||
| if( m_debug ) | |||||
| { | { | ||||
| if( useDebugLevel | if( useDebugLevel | ||||
| && Project.getJavaVersion() != Project.JAVA_1_0 | && Project.getJavaVersion() != Project.JAVA_1_0 | ||||
| && Project.getJavaVersion() != Project.JAVA_1_1 ) | && Project.getJavaVersion() != Project.JAVA_1_1 ) | ||||
| { | { | ||||
| String debugLevel = attributes.getDebugLevel(); | |||||
| String debugLevel = m_attributes.getDebugLevel(); | |||||
| if( debugLevel != null ) | if( debugLevel != null ) | ||||
| { | { | ||||
| cmd.createArgument().setValue( "-g:" + debugLevel ); | cmd.createArgument().setValue( "-g:" + debugLevel ); | ||||
| @@ -246,12 +249,12 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-g:none" ); | cmd.createArgument().setValue( "-g:none" ); | ||||
| } | } | ||||
| if( optimize ) | |||||
| if( m_optimize ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-O" ); | cmd.createArgument().setValue( "-O" ); | ||||
| } | } | ||||
| if( depend ) | |||||
| if( m_depend ) | |||||
| { | { | ||||
| if( Project.getJavaVersion().startsWith( "1.1" ) ) | if( Project.getJavaVersion().startsWith( "1.1" ) ) | ||||
| { | { | ||||
| @@ -263,12 +266,12 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| attributes.log( "depend attribute is not supported by the modern compiler", | |||||
| Project.MSG_WARN ); | |||||
| final String message = "depend attribute is not supported by the modern compiler"; | |||||
| getLogger().warn( message ); | |||||
| } | } | ||||
| } | } | ||||
| if( verbose ) | |||||
| if( m_verbose ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-verbose" ); | cmd.createArgument().setValue( "-verbose" ); | ||||
| } | } | ||||
| @@ -305,10 +308,10 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| setupJavacCommandlineSwitches( cmd, true ); | setupJavacCommandlineSwitches( cmd, true ); | ||||
| if( attributes.getSource() != null ) | |||||
| if( m_attributes.getSource() != null ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-source" ); | cmd.createArgument().setValue( "-source" ); | ||||
| cmd.createArgument().setValue( attributes.getSource() ); | |||||
| cmd.createArgument().setValue( m_attributes.getSource() ); | |||||
| } | } | ||||
| return cmd; | return cmd; | ||||
| } | } | ||||
| @@ -321,39 +324,39 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
| protected Path getCompileClasspath() | protected Path getCompileClasspath() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| Path classpath = new Path( project ); | |||||
| Path classpath = new Path( m_project ); | |||||
| // add dest dir to classpath so that previously compiled and | // add dest dir to classpath so that previously compiled and | ||||
| // untouched classes are on classpath | // untouched classes are on classpath | ||||
| if( destDir != null ) | |||||
| if( m_destDir != null ) | |||||
| { | { | ||||
| classpath.setLocation( destDir ); | |||||
| classpath.setLocation( m_destDir ); | |||||
| } | } | ||||
| // Combine the build classpath with the system classpath, in an | // Combine the build classpath with the system classpath, in an | ||||
| // order determined by the value of build.classpath | // order determined by the value of build.classpath | ||||
| if( compileClasspath == null ) | |||||
| if( m_compileClasspath == null ) | |||||
| { | { | ||||
| if( includeAntRuntime ) | |||||
| if( m_includeAntRuntime ) | |||||
| { | { | ||||
| classpath.addExisting( Path.systemClasspath ); | classpath.addExisting( Path.systemClasspath ); | ||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| if( includeAntRuntime ) | |||||
| if( m_includeAntRuntime ) | |||||
| { | { | ||||
| classpath.addExisting( compileClasspath.concatSystemClasspath( "last" ) ); | |||||
| classpath.addExisting( m_compileClasspath.concatSystemClasspath( "last" ) ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| classpath.addExisting( compileClasspath.concatSystemClasspath( "ignore" ) ); | |||||
| classpath.addExisting( m_compileClasspath.concatSystemClasspath( "ignore" ) ); | |||||
| } | } | ||||
| } | } | ||||
| if( includeJavaRuntime ) | |||||
| if( m_includeJavaRuntime ) | |||||
| { | { | ||||
| classpath.addJavaRuntime(); | classpath.addJavaRuntime(); | ||||
| } | } | ||||
| @@ -435,9 +438,9 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
| try | try | ||||
| { | { | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( attributes, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( attributes, Project.MSG_WARN ) ); | |||||
| exe.setWorkingDirectory( project.getBaseDir() ); | |||||
| exe.setOutput( new LogOutputStream( m_attributes, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( m_attributes, Project.MSG_WARN ) ); | |||||
| exe.setWorkingDirectory( m_project.getBaseDir() ); | |||||
| exe.setCommandline( commandArray ); | exe.setCommandline( commandArray ); | ||||
| return exe.execute(); | return exe.execute(); | ||||
| } | } | ||||
| @@ -464,27 +467,25 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
| */ | */ | ||||
| protected void logAndAddFilesToCompile( Commandline cmd ) | protected void logAndAddFilesToCompile( Commandline cmd ) | ||||
| { | { | ||||
| attributes.log( "Compilation args: " + cmd.toString(), | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Compilation args: " + cmd.toString() ); | |||||
| StringBuffer niceSourceList = new StringBuffer( "File" ); | StringBuffer niceSourceList = new StringBuffer( "File" ); | ||||
| if( compileList.length != 1 ) | |||||
| if( m_compileList.length != 1 ) | |||||
| { | { | ||||
| niceSourceList.append( "s" ); | niceSourceList.append( "s" ); | ||||
| } | } | ||||
| niceSourceList.append( " to be compiled:" ); | niceSourceList.append( " to be compiled:" ); | ||||
| niceSourceList.append( lSep ); | |||||
| niceSourceList.append( LINE_SEP ); | |||||
| for( int i = 0; i < compileList.length; i++ ) | |||||
| for( int i = 0; i < m_compileList.length; i++ ) | |||||
| { | { | ||||
| String arg = compileList[ i ].getAbsolutePath(); | |||||
| String arg = m_compileList[ i ].getAbsolutePath(); | |||||
| cmd.createArgument().setValue( arg ); | cmd.createArgument().setValue( arg ); | ||||
| niceSourceList.append( " " + arg + lSep ); | |||||
| niceSourceList.append( " " + arg + LINE_SEP ); | |||||
| } | } | ||||
| attributes.log( niceSourceList.toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( niceSourceList.toString() ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -8,7 +8,6 @@ | |||||
| package org.apache.tools.ant.taskdefs.compilers; | package org.apache.tools.ant.taskdefs.compilers; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| 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; | ||||
| @@ -32,7 +31,7 @@ public class Gcj extends DefaultCompilerAdapter | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| Commandline cmd; | Commandline cmd; | ||||
| attributes.log( "Using gcj compiler", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Using gcj compiler" ); | |||||
| cmd = setupGCJCommand(); | cmd = setupGCJCommand(); | ||||
| int firstFileName = cmd.size(); | int firstFileName = cmd.size(); | ||||
| @@ -45,23 +44,23 @@ public class Gcj extends DefaultCompilerAdapter | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
| Path classpath = new Path( project ); | |||||
| Path classpath = new Path( m_project ); | |||||
| // gcj doesn't support bootclasspath dir (-bootclasspath) | // gcj doesn't support bootclasspath dir (-bootclasspath) | ||||
| // so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
| if( bootclasspath != null ) | |||||
| if( m_bootclasspath != null ) | |||||
| { | { | ||||
| classpath.append( bootclasspath ); | |||||
| classpath.append( m_bootclasspath ); | |||||
| } | } | ||||
| // gcj doesn't support an extension dir (-extdir) | // gcj doesn't support an extension dir (-extdir) | ||||
| // so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
| classpath.addExtdirs( extdirs ); | |||||
| classpath.addExtdirs( m_extdirs ); | |||||
| if( ( bootclasspath == null ) || ( bootclasspath.size() == 0 ) ) | |||||
| if( ( m_bootclasspath == null ) || ( m_bootclasspath.size() == 0 ) ) | |||||
| { | { | ||||
| // no bootclasspath, therefore, get one from the java runtime | // no bootclasspath, therefore, get one from the java runtime | ||||
| includeJavaRuntime = true; | |||||
| m_includeJavaRuntime = true; | |||||
| } | } | ||||
| classpath.append( getCompileClasspath() ); | classpath.append( getCompileClasspath() ); | ||||
| @@ -71,12 +70,12 @@ public class Gcj extends DefaultCompilerAdapter | |||||
| cmd.setExecutable( "gcj" ); | cmd.setExecutable( "gcj" ); | ||||
| if( destDir != null ) | |||||
| if( m_destDir != null ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-d" ); | cmd.createArgument().setValue( "-d" ); | ||||
| cmd.createArgument().setFile( destDir ); | |||||
| cmd.createArgument().setFile( m_destDir ); | |||||
| if( destDir.mkdirs() ) | |||||
| if( m_destDir.mkdirs() ) | |||||
| { | { | ||||
| throw new TaskException( "Can't make output directories. Maybe permission is wrong. " ); | throw new TaskException( "Can't make output directories. Maybe permission is wrong. " ); | ||||
| } | } | ||||
| @@ -86,15 +85,15 @@ public class Gcj extends DefaultCompilerAdapter | |||||
| cmd.createArgument().setValue( "-classpath" ); | cmd.createArgument().setValue( "-classpath" ); | ||||
| cmd.createArgument().setPath( classpath ); | cmd.createArgument().setPath( classpath ); | ||||
| if( encoding != null ) | |||||
| if( m_encoding != null ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "--encoding=" + encoding ); | |||||
| cmd.createArgument().setValue( "--encoding=" + m_encoding ); | |||||
| } | } | ||||
| if( debug ) | |||||
| if( m_debug ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-g1" ); | cmd.createArgument().setValue( "-g1" ); | ||||
| } | } | ||||
| if( optimize ) | |||||
| if( m_optimize ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-O" ); | cmd.createArgument().setValue( "-O" ); | ||||
| } | } | ||||
| @@ -32,10 +32,10 @@ public class Javac12 extends DefaultCompilerAdapter | |||||
| public boolean execute() | public boolean execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| attributes.log( "Using classic compiler", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Using classic compiler" ); | |||||
| Commandline cmd = setupJavacCommand( true ); | Commandline cmd = setupJavacCommand( true ); | ||||
| OutputStream logstr = new LogOutputStream( attributes, Project.MSG_WARN ); | |||||
| OutputStream logstr = new LogOutputStream( m_attributes, Project.MSG_WARN ); | |||||
| try | try | ||||
| { | { | ||||
| // Create an instance of the compiler, redirecting output to | // Create an instance of the compiler, redirecting output to | ||||
| @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.compilers; | |||||
| import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| /** | /** | ||||
| @@ -33,7 +32,7 @@ public class Javac13 extends DefaultCompilerAdapter | |||||
| public boolean execute() | public boolean execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| attributes.log( "Using modern compiler", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Using modern compiler" ); | |||||
| Commandline cmd = setupModernJavacCommand(); | Commandline cmd = setupModernJavacCommand(); | ||||
| // Use reflection to be able to build on all JDKs >= 1.1: | // Use reflection to be able to build on all JDKs >= 1.1: | ||||
| @@ -8,7 +8,6 @@ | |||||
| package org.apache.tools.ant.taskdefs.compilers; | package org.apache.tools.ant.taskdefs.compilers; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| /** | /** | ||||
| @@ -28,7 +27,7 @@ public class JavacExternal extends DefaultCompilerAdapter | |||||
| public boolean execute() | public boolean execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| attributes.log( "Using external javac compiler", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Using external javac compiler" ); | |||||
| Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
| cmd.setExecutable( getJavac().getJavacExecutable() ); | cmd.setExecutable( getJavac().getJavacExecutable() ); | ||||
| @@ -22,7 +22,8 @@ import org.apache.tools.ant.types.Path; | |||||
| * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | ||||
| * @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | * @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | ||||
| */ | */ | ||||
| public class Jikes extends DefaultCompilerAdapter | |||||
| public class Jikes | |||||
| extends DefaultCompilerAdapter | |||||
| { | { | ||||
| /** | /** | ||||
| @@ -39,25 +40,25 @@ public class Jikes extends DefaultCompilerAdapter | |||||
| public boolean execute() | public boolean execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| attributes.log( "Using jikes compiler", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Using jikes compiler" ); | |||||
| Path classpath = new Path( project ); | |||||
| Path classpath = new Path( m_project ); | |||||
| // Jikes doesn't support bootclasspath dir (-bootclasspath) | // Jikes doesn't support bootclasspath dir (-bootclasspath) | ||||
| // so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
| if( bootclasspath != null ) | |||||
| if( m_bootclasspath != null ) | |||||
| { | { | ||||
| classpath.append( bootclasspath ); | |||||
| classpath.append( m_bootclasspath ); | |||||
| } | } | ||||
| // Jikes doesn't support an extension dir (-extdir) | // Jikes doesn't support an extension dir (-extdir) | ||||
| // so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
| classpath.addExtdirs( extdirs ); | |||||
| classpath.addExtdirs( m_extdirs ); | |||||
| if( ( bootclasspath == null ) || ( bootclasspath.size() == 0 ) ) | |||||
| if( ( m_bootclasspath == null ) || ( m_bootclasspath.size() == 0 ) ) | |||||
| { | { | ||||
| // no bootclasspath, therefore, get one from the java runtime | // no bootclasspath, therefore, get one from the java runtime | ||||
| includeJavaRuntime = true; | |||||
| m_includeJavaRuntime = true; | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -76,42 +77,42 @@ public class Jikes extends DefaultCompilerAdapter | |||||
| String jikesPath = System.getProperty( "jikes.class.path" ); | String jikesPath = System.getProperty( "jikes.class.path" ); | ||||
| if( jikesPath != null ) | if( jikesPath != null ) | ||||
| { | { | ||||
| classpath.append( new Path( project, jikesPath ) ); | |||||
| classpath.append( new Path( m_project, jikesPath ) ); | |||||
| } | } | ||||
| Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
| cmd.setExecutable( "jikes" ); | cmd.setExecutable( "jikes" ); | ||||
| if( deprecation == true ) | |||||
| if( m_deprecation == true ) | |||||
| cmd.createArgument().setValue( "-deprecation" ); | cmd.createArgument().setValue( "-deprecation" ); | ||||
| if( destDir != null ) | |||||
| if( m_destDir != null ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-d" ); | cmd.createArgument().setValue( "-d" ); | ||||
| cmd.createArgument().setFile( destDir ); | |||||
| cmd.createArgument().setFile( m_destDir ); | |||||
| } | } | ||||
| cmd.createArgument().setValue( "-classpath" ); | cmd.createArgument().setValue( "-classpath" ); | ||||
| cmd.createArgument().setPath( classpath ); | cmd.createArgument().setPath( classpath ); | ||||
| if( encoding != null ) | |||||
| if( m_encoding != null ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-encoding" ); | cmd.createArgument().setValue( "-encoding" ); | ||||
| cmd.createArgument().setValue( encoding ); | |||||
| cmd.createArgument().setValue( m_encoding ); | |||||
| } | } | ||||
| if( debug ) | |||||
| if( m_debug ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-g" ); | cmd.createArgument().setValue( "-g" ); | ||||
| } | } | ||||
| if( optimize ) | |||||
| if( m_optimize ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-O" ); | cmd.createArgument().setValue( "-O" ); | ||||
| } | } | ||||
| if( verbose ) | |||||
| if( m_verbose ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-verbose" ); | cmd.createArgument().setValue( "-verbose" ); | ||||
| } | } | ||||
| if( depend ) | |||||
| if( m_depend ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-depend" ); | cmd.createArgument().setValue( "-depend" ); | ||||
| } | } | ||||
| @@ -126,13 +127,13 @@ public class Jikes extends DefaultCompilerAdapter | |||||
| * by emacs, so that emacs can directly set the cursor to the place, | * by emacs, so that emacs can directly set the cursor to the place, | ||||
| * where the error occured. | * where the error occured. | ||||
| */ | */ | ||||
| String emacsProperty = project.getProperty( "build.compiler.emacs" ); | |||||
| String emacsProperty = m_project.getProperty( "build.compiler.emacs" ); | |||||
| if( emacsProperty != null && Project.toBoolean( emacsProperty ) ) | if( emacsProperty != null && Project.toBoolean( emacsProperty ) ) | ||||
| { | { | ||||
| cmd.createArgument().setValue( "+E" ); | cmd.createArgument().setValue( "+E" ); | ||||
| } | } | ||||
| if( attributes.getNowarn() ) | |||||
| if( m_attributes.getNowarn() ) | |||||
| { | { | ||||
| /* | /* | ||||
| * FIXME later | * FIXME later | ||||
| @@ -146,7 +147,7 @@ public class Jikes extends DefaultCompilerAdapter | |||||
| /** | /** | ||||
| * Jikes can issue pedantic warnings. | * Jikes can issue pedantic warnings. | ||||
| */ | */ | ||||
| String pedanticProperty = project.getProperty( "build.compiler.pedantic" ); | |||||
| String pedanticProperty = m_project.getProperty( "build.compiler.pedantic" ); | |||||
| if( pedanticProperty != null && Project.toBoolean( pedanticProperty ) ) | if( pedanticProperty != null && Project.toBoolean( pedanticProperty ) ) | ||||
| { | { | ||||
| cmd.createArgument().setValue( "+P" ); | cmd.createArgument().setValue( "+P" ); | ||||
| @@ -156,7 +157,7 @@ public class Jikes extends DefaultCompilerAdapter | |||||
| * Jikes supports something it calls "full dependency checking", see the | * Jikes supports something it calls "full dependency checking", see the | ||||
| * jikes documentation for differences between -depend and +F. | * jikes documentation for differences between -depend and +F. | ||||
| */ | */ | ||||
| String fullDependProperty = project.getProperty( "build.compiler.fulldepend" ); | |||||
| String fullDependProperty = m_project.getProperty( "build.compiler.fulldepend" ); | |||||
| if( fullDependProperty != null && Project.toBoolean( fullDependProperty ) ) | if( fullDependProperty != null && Project.toBoolean( fullDependProperty ) ) | ||||
| { | { | ||||
| cmd.createArgument().setValue( "+F" ); | cmd.createArgument().setValue( "+F" ); | ||||
| @@ -8,7 +8,6 @@ | |||||
| package org.apache.tools.ant.taskdefs.compilers; | package org.apache.tools.ant.taskdefs.compilers; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| 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; | ||||
| @@ -28,25 +27,25 @@ public class Jvc extends DefaultCompilerAdapter | |||||
| public boolean execute() | public boolean execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| attributes.log( "Using jvc compiler", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Using jvc compiler" ); | |||||
| Path classpath = new Path( project ); | |||||
| Path classpath = new Path( m_project ); | |||||
| // jvc doesn't support bootclasspath dir (-bootclasspath) | // jvc doesn't support bootclasspath dir (-bootclasspath) | ||||
| // so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
| if( bootclasspath != null ) | |||||
| if( m_bootclasspath != null ) | |||||
| { | { | ||||
| classpath.append( bootclasspath ); | |||||
| classpath.append( m_bootclasspath ); | |||||
| } | } | ||||
| // jvc doesn't support an extension dir (-extdir) | // jvc doesn't support an extension dir (-extdir) | ||||
| // so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
| classpath.addExtdirs( extdirs ); | |||||
| classpath.addExtdirs( m_extdirs ); | |||||
| if( ( bootclasspath == null ) || ( bootclasspath.size() == 0 ) ) | |||||
| if( ( m_bootclasspath == null ) || ( m_bootclasspath.size() == 0 ) ) | |||||
| { | { | ||||
| // no bootclasspath, therefore, get one from the java runtime | // no bootclasspath, therefore, get one from the java runtime | ||||
| includeJavaRuntime = true; | |||||
| m_includeJavaRuntime = true; | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -64,10 +63,10 @@ public class Jvc extends DefaultCompilerAdapter | |||||
| Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
| cmd.setExecutable( "jvc" ); | cmd.setExecutable( "jvc" ); | ||||
| if( destDir != null ) | |||||
| if( m_destDir != null ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "/d" ); | cmd.createArgument().setValue( "/d" ); | ||||
| cmd.createArgument().setFile( destDir ); | |||||
| cmd.createArgument().setFile( m_destDir ); | |||||
| } | } | ||||
| // Add the Classpath before the "internal" one. | // Add the Classpath before the "internal" one. | ||||
| @@ -81,15 +80,15 @@ public class Jvc extends DefaultCompilerAdapter | |||||
| // Do not display Logo | // Do not display Logo | ||||
| cmd.createArgument().setValue( "/nologo" ); | cmd.createArgument().setValue( "/nologo" ); | ||||
| if( debug ) | |||||
| if( m_debug ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "/g" ); | cmd.createArgument().setValue( "/g" ); | ||||
| } | } | ||||
| if( optimize ) | |||||
| if( m_optimize ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "/O" ); | cmd.createArgument().setValue( "/O" ); | ||||
| } | } | ||||
| if( verbose ) | |||||
| if( m_verbose ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "/verbose" ); | cmd.createArgument().setValue( "/verbose" ); | ||||
| } | } | ||||
| @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.compilers; | |||||
| import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| 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; | ||||
| @@ -25,7 +24,7 @@ public class Kjc extends DefaultCompilerAdapter | |||||
| public boolean execute() | public boolean execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| attributes.log( "Using kjc compiler", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Using kjc compiler" ); | |||||
| Commandline cmd = setupKjcCommand(); | Commandline cmd = setupKjcCommand(); | ||||
| try | try | ||||
| @@ -71,31 +70,31 @@ public class Kjc extends DefaultCompilerAdapter | |||||
| // generate classpath, because kjc does't support sourcepath. | // generate classpath, because kjc does't support sourcepath. | ||||
| Path classpath = getCompileClasspath(); | Path classpath = getCompileClasspath(); | ||||
| if( deprecation == true ) | |||||
| if( m_deprecation == true ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-deprecation" ); | cmd.createArgument().setValue( "-deprecation" ); | ||||
| } | } | ||||
| if( destDir != null ) | |||||
| if( m_destDir != null ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-d" ); | cmd.createArgument().setValue( "-d" ); | ||||
| cmd.createArgument().setFile( destDir ); | |||||
| cmd.createArgument().setFile( m_destDir ); | |||||
| } | } | ||||
| // generate the clsspath | // generate the clsspath | ||||
| cmd.createArgument().setValue( "-classpath" ); | cmd.createArgument().setValue( "-classpath" ); | ||||
| Path cp = new Path( project ); | |||||
| Path cp = new Path( m_project ); | |||||
| // kjc don't have bootclasspath option. | // kjc don't have bootclasspath option. | ||||
| if( bootclasspath != null ) | |||||
| if( m_bootclasspath != null ) | |||||
| { | { | ||||
| cp.append( bootclasspath ); | |||||
| cp.append( m_bootclasspath ); | |||||
| } | } | ||||
| if( extdirs != null ) | |||||
| if( m_extdirs != null ) | |||||
| { | { | ||||
| cp.addExtdirs( extdirs ); | |||||
| cp.addExtdirs( m_extdirs ); | |||||
| } | } | ||||
| cp.append( classpath ); | cp.append( classpath ); | ||||
| @@ -105,23 +104,23 @@ public class Kjc extends DefaultCompilerAdapter | |||||
| // kjc-1.5A doesn't support -encoding option now. | // kjc-1.5A doesn't support -encoding option now. | ||||
| // but it will be supported near the feature. | // but it will be supported near the feature. | ||||
| if( encoding != null ) | |||||
| if( m_encoding != null ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-encoding" ); | cmd.createArgument().setValue( "-encoding" ); | ||||
| cmd.createArgument().setValue( encoding ); | |||||
| cmd.createArgument().setValue( m_encoding ); | |||||
| } | } | ||||
| if( debug ) | |||||
| if( m_debug ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-g" ); | cmd.createArgument().setValue( "-g" ); | ||||
| } | } | ||||
| if( optimize ) | |||||
| if( m_optimize ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-O2" ); | cmd.createArgument().setValue( "-O2" ); | ||||
| } | } | ||||
| if( verbose ) | |||||
| if( m_verbose ) | |||||
| { | { | ||||
| cmd.createArgument().setValue( "-verbose" ); | cmd.createArgument().setValue( "-verbose" ); | ||||
| } | } | ||||
| @@ -8,7 +8,6 @@ | |||||
| package org.apache.tools.ant.taskdefs.compilers; | package org.apache.tools.ant.taskdefs.compilers; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| /** | /** | ||||
| @@ -30,12 +29,12 @@ public class Sj extends DefaultCompilerAdapter | |||||
| public boolean execute() | public boolean execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| attributes.log( "Using symantec java compiler", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Using symantec java compiler" ); | |||||
| Commandline cmd = setupJavacCommand(); | Commandline cmd = setupJavacCommand(); | ||||
| cmd.setExecutable( "sj" ); | cmd.setExecutable( "sj" ); | ||||
| int firstFileName = cmd.size() - compileList.length; | |||||
| int firstFileName = cmd.size() - m_compileList.length; | |||||
| return executeExternalCompile( cmd.getCommandline(), firstFileName ) == 0; | return executeExternalCompile( cmd.getCommandline(), firstFileName ) == 0; | ||||
| } | } | ||||
| @@ -12,7 +12,6 @@ import java.net.MalformedURLException; | |||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.net.URLConnection; | import java.net.URLConnection; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.ProjectComponent; | import org.apache.tools.ant.ProjectComponent; | ||||
| /** | /** | ||||
| @@ -39,7 +38,7 @@ public class Http | |||||
| { | { | ||||
| throw new TaskException( "No url specified in HTTP task" ); | throw new TaskException( "No url specified in HTTP task" ); | ||||
| } | } | ||||
| log( "Checking for " + spec, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Checking for " + spec ); | |||||
| try | try | ||||
| { | { | ||||
| URL url = new URL( spec ); | URL url = new URL( spec ); | ||||
| @@ -50,7 +49,7 @@ public class Http | |||||
| { | { | ||||
| HttpURLConnection http = (HttpURLConnection)conn; | HttpURLConnection http = (HttpURLConnection)conn; | ||||
| int code = http.getResponseCode(); | int code = http.getResponseCode(); | ||||
| log( "Result code for " + spec + " was " + code, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Result code for " + spec + " was " + code ); | |||||
| if( code > 0 && code < 500 ) | if( code > 0 && code < 500 ) | ||||
| { | { | ||||
| return true; | return true; | ||||
| @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.condition; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.ProjectComponent; | import org.apache.tools.ant.ProjectComponent; | ||||
| /** | /** | ||||
| @@ -46,7 +45,7 @@ public class Socket | |||||
| { | { | ||||
| throw new TaskException( "No port specified in Socket task" ); | throw new TaskException( "No port specified in Socket task" ); | ||||
| } | } | ||||
| log( "Checking for listener at " + server + ":" + port, Project.MSG_VERBOSE ); | |||||
| getLogger().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 ); | ||||
| @@ -65,7 +65,7 @@ public class Execute | |||||
| { | { | ||||
| try | try | ||||
| { | { | ||||
| task.log( Commandline.toString( cmdline ), Project.MSG_VERBOSE ); | |||||
| task.hackGetLogger().debug( Commandline.toString( cmdline ) ); | |||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( task, Project.MSG_INFO ) ); | exe.setOutput( new LogOutputStream( task, Project.MSG_INFO ) ); | ||||
| exe.setError( new LogOutputStream( task, Project.MSG_WARN ) ); | exe.setError( new LogOutputStream( task, Project.MSG_WARN ) ); | ||||
| @@ -232,8 +232,7 @@ public class Copy | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( m_file + " omitted as " + m_destFile + " is up to date.", | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( m_file + " omitted as " + m_destFile + " is up to date." ); | |||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| @@ -395,7 +394,7 @@ public class Copy | |||||
| { | { | ||||
| if( !d.mkdirs() ) | if( !d.mkdirs() ) | ||||
| { | { | ||||
| log( "Unable to create directory " + d.getAbsolutePath(), Project.MSG_ERR ); | |||||
| getLogger().error( "Unable to create directory " + d.getAbsolutePath() ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -280,8 +280,7 @@ public class Delete | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Could not find file " + file.getAbsolutePath() + " to delete.", | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Could not find file " + file.getAbsolutePath() + " to delete." ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -13,7 +13,6 @@ import java.util.Enumeration; | |||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| 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.tools.ant.Project; | |||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| import org.apache.tools.ant.types.FilterSet; | import org.apache.tools.ant.types.FilterSet; | ||||
| import org.apache.tools.ant.types.FilterSetCollection; | import org.apache.tools.ant.types.FilterSetCollection; | ||||
| @@ -195,7 +194,7 @@ public class Move extends Copy | |||||
| { | { | ||||
| if( !d.mkdirs() ) | if( !d.mkdirs() ) | ||||
| { | { | ||||
| log( "Unable to create directory " + d.getAbsolutePath(), Project.MSG_ERR ); | |||||
| getLogger().error( "Unable to create directory " + d.getAbsolutePath() ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -920,7 +920,7 @@ public class Javadoc | |||||
| if( !Os.isFamily( "netware" ) ) | if( !Os.isFamily( "netware" ) ) | ||||
| { | { | ||||
| getLogger().debug( "Unable to locate " + jdocExecutable.getAbsolutePath() + | getLogger().debug( "Unable to locate " + jdocExecutable.getAbsolutePath() + | ||||
| ". Using \"javadoc\" instead." ); | |||||
| ". Using \"javadoc\" instead." ); | |||||
| } | } | ||||
| return "javadoc"; | return "javadoc"; | ||||
| } | } | ||||
| @@ -76,13 +76,13 @@ public class ANTLR extends Task | |||||
| public void setOutputdirectory( File outputDirectory ) | public void setOutputdirectory( File outputDirectory ) | ||||
| { | { | ||||
| log( "Setting output directory to: " + outputDirectory.toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Setting output directory to: " + outputDirectory.toString() ); | |||||
| this.outputDirectory = outputDirectory; | this.outputDirectory = outputDirectory; | ||||
| } | } | ||||
| public void setTarget( File target ) | public void setTarget( File target ) | ||||
| { | { | ||||
| log( "Setting target to: " + target.toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Setting target to: " + target.toString() ); | |||||
| this.target = target; | this.target = target; | ||||
| } | } | ||||
| @@ -127,7 +127,7 @@ public class ANTLR extends Task | |||||
| if( fork ) | if( fork ) | ||||
| { | { | ||||
| log( "Forking " + commandline.toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Forking " + commandline.toString() ); | |||||
| int err = run( commandline.getCommandline() ); | int err = run( commandline.getCommandline() ); | ||||
| if( err == 1 ) | if( err == 1 ) | ||||
| { | { | ||||
| @@ -163,27 +163,24 @@ public class ANTLR extends Task | |||||
| { | { | ||||
| int pling = u.indexOf( "!" ); | int pling = u.indexOf( "!" ); | ||||
| String jarName = u.substring( 9, pling ); | String jarName = u.substring( 9, pling ); | ||||
| log( "Implicitly adding " + jarName + " to classpath", | |||||
| Project.MSG_DEBUG ); | |||||
| getLogger().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 ); | ||||
| log( "Implicitly adding " + dirName + " to classpath", | |||||
| Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Implicitly adding " + dirName + " to classpath" ); | |||||
| createClasspath().setLocation( new File( ( new File( dirName ) ).getAbsolutePath() ) ); | createClasspath().setLocation( new File( ( new File( dirName ) ).getAbsolutePath() ) ); | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Don\'t know how to handle resource URL " + u, | |||||
| Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Don\'t know how to handle resource URL " + u ); | |||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Couldn\'t find " + resource, Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Couldn\'t find " + resource ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -17,7 +17,6 @@ import java.util.Iterator; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.framework.Os; | import org.apache.myrmidon.framework.Os; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
| import org.apache.tools.ant.taskdefs.exec.ExecTask; | import org.apache.tools.ant.taskdefs.exec.ExecTask; | ||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| @@ -118,7 +117,7 @@ public class Cab extends MatchingTask | |||||
| if( !Os.isFamily( "windows" ) ) | if( !Os.isFamily( "windows" ) ) | ||||
| { | { | ||||
| log( "Using listcab/libcabinet", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Using listcab/libcabinet" ); | |||||
| StringBuffer sb = new StringBuffer(); | StringBuffer sb = new StringBuffer(); | ||||
| @@ -18,7 +18,6 @@ import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.tools.ant.BuildEvent; | import org.apache.tools.ant.BuildEvent; | ||||
| import org.apache.tools.ant.BuildListener; | import org.apache.tools.ant.BuildListener; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.taskdefs.Javac; | import org.apache.tools.ant.taskdefs.Javac; | ||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
| @@ -976,8 +975,8 @@ public class IContract extends MatchingTask | |||||
| if( srcFile.lastModified() > now ) | if( srcFile.lastModified() > now ) | ||||
| { | { | ||||
| log( "Warning: file modified in the future: " + | |||||
| files[ i ], Project.MSG_WARN ); | |||||
| final String message = "Warning: file modified in the future: " + files[ i ]; | |||||
| getLogger().warn( message ); | |||||
| } | } | ||||
| if( !classFile.exists() || srcFile.lastModified() > classFile.lastModified() ) | if( !classFile.exists() || srcFile.lastModified() > classFile.lastModified() ) | ||||
| @@ -1069,7 +1068,7 @@ public class IContract extends MatchingTask | |||||
| if( "jikes".equals( compiler ) ) | if( "jikes".equals( compiler ) ) | ||||
| { | { | ||||
| icCompiler = compiler; | icCompiler = compiler; | ||||
| includeJavaRuntime = true; | |||||
| m_includeJavaRuntime = true; | |||||
| path.append( getCompileClasspath() ); | path.append( getCompileClasspath() ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -290,8 +290,7 @@ public class Javah extends Task | |||||
| protected void logAndAddFilesToCompile( Commandline cmd ) | protected void logAndAddFilesToCompile( Commandline cmd ) | ||||
| { | { | ||||
| int n = 0; | int n = 0; | ||||
| log( "Compilation args: " + cmd.toString(), | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Compilation args: " + cmd.toString() ); | |||||
| StringBuffer niceClassList = new StringBuffer(); | StringBuffer niceClassList = new StringBuffer(); | ||||
| if( cls != null ) | if( cls != null ) | ||||
| @@ -324,7 +323,7 @@ public class Javah extends Task | |||||
| prefix.append( " to be compiled:" ); | prefix.append( " to be compiled:" ); | ||||
| prefix.append( lSep ); | prefix.append( lSep ); | ||||
| log( prefix.toString() + niceClassList.toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( prefix.toString() + niceClassList.toString() ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.optional; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| 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; | ||||
| import org.apache.tools.ant.types.Mapper; | import org.apache.tools.ant.types.Mapper; | ||||
| @@ -225,7 +224,7 @@ public class Native2Ascii extends MatchingTask | |||||
| } | } | ||||
| } | } | ||||
| log( "converting " + srcName, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "converting " + srcName ); | |||||
| sun.tools.native2ascii.Main n2a | sun.tools.native2ascii.Main n2a | ||||
| = new sun.tools.native2ascii.Main(); | = new sun.tools.native2ascii.Main(); | ||||
| if( !n2a.convert( cmd.getArguments() ) ) | if( !n2a.convert( cmd.getArguments() ) ) | ||||
| @@ -20,7 +20,6 @@ import netrexx.lang.Rexx; | |||||
| 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.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
| /** | /** | ||||
| @@ -596,8 +595,7 @@ public class NetRexxC extends MatchingTask | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Dropping from classpath: " + | |||||
| f.getAbsolutePath(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Dropping from classpath: " + f.getAbsolutePath() ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -640,7 +638,7 @@ public class NetRexxC extends MatchingTask | |||||
| private void doNetRexxCompile() | private void doNetRexxCompile() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| log( "Using NetRexx compiler", Project.MSG_VERBOSE ); | |||||
| getLogger().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(); | ||||
| @@ -674,7 +672,7 @@ public class NetRexxC extends MatchingTask | |||||
| compileOptions.append( compileOptionsArray[ i ] ); | compileOptions.append( compileOptionsArray[ i ] ); | ||||
| compileOptions.append( " " ); | compileOptions.append( " " ); | ||||
| } | } | ||||
| log( compileOptions.toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( compileOptions.toString() ); | |||||
| String eol = System.getProperty( "line.separator" ); | String eol = System.getProperty( "line.separator" ); | ||||
| StringBuffer niceSourceList = new StringBuffer( "Files to be compiled:" + eol ); | StringBuffer niceSourceList = new StringBuffer( "Files to be compiled:" + eol ); | ||||
| @@ -686,7 +684,7 @@ public class NetRexxC extends MatchingTask | |||||
| niceSourceList.append( eol ); | niceSourceList.append( eol ); | ||||
| } | } | ||||
| log( niceSourceList.toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().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 | ||||
| @@ -702,17 +700,17 @@ public class NetRexxC extends MatchingTask | |||||
| if( rc > 1 ) | if( rc > 1 ) | ||||
| {// 1 is warnings from real NetRexxC | {// 1 is warnings from real NetRexxC | ||||
| log( out.toString(), Project.MSG_ERR ); | |||||
| getLogger().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 ) | ||||
| { | { | ||||
| log( out.toString(), Project.MSG_WARN ); | |||||
| getLogger().warn( out.toString() ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( out.toString(), Project.MSG_INFO ); | |||||
| getLogger().info( out.toString() ); | |||||
| } | } | ||||
| } | } | ||||
| finally | finally | ||||
| @@ -18,7 +18,6 @@ import java.io.PrintWriter; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| import org.apache.tools.ant.types.RegularExpression; | import org.apache.tools.ant.types.RegularExpression; | ||||
| @@ -191,14 +190,15 @@ public class ReplaceRegExp extends Task | |||||
| } | } | ||||
| catch( IOException e ) | catch( IOException e ) | ||||
| { | { | ||||
| log( "An error occurred processing file: '" + file.getAbsolutePath() + "': " + e.toString(), | |||||
| Project.MSG_ERR ); | |||||
| final String message = "An error occurred processing file: '" + | |||||
| file.getAbsolutePath() + "': " + e.toString(); | |||||
| getLogger().error( message, e ); | |||||
| } | } | ||||
| } | } | ||||
| else if( file != null ) | else if( file != null ) | ||||
| { | { | ||||
| log( "The following file is missing: '" + file.getAbsolutePath() + "'", | |||||
| Project.MSG_ERR ); | |||||
| final String message = "The following file is missing: '" + file.getAbsolutePath() + "'"; | |||||
| getLogger().error( message ); | |||||
| } | } | ||||
| int sz = filesets.size(); | int sz = filesets.size(); | ||||
| @@ -219,14 +219,15 @@ public class ReplaceRegExp extends Task | |||||
| } | } | ||||
| catch( Exception e ) | catch( Exception e ) | ||||
| { | { | ||||
| log( "An error occurred processing file: '" + f.getAbsolutePath() + "': " + e.toString(), | |||||
| Project.MSG_ERR ); | |||||
| final String message = "An error occurred processing file: '" + f.getAbsolutePath() + | |||||
| "': " + e.toString(); | |||||
| getLogger().error( message ); | |||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "The following file is missing: '" + file.getAbsolutePath() + "'", | |||||
| Project.MSG_ERR ); | |||||
| final String message = "The following file is missing: '" + file.getAbsolutePath() + "'"; | |||||
| getLogger().error( message ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -276,12 +277,13 @@ public class ReplaceRegExp extends Task | |||||
| boolean changes = false; | boolean changes = false; | ||||
| log( "Replacing pattern '" + regex.getPattern( getProject() ) + "' with '" + subs.getExpression( getProject() ) + | |||||
| "' in '" + f.getPath() + "'" + | |||||
| ( byline ? " by line" : "" ) + | |||||
| ( flags.length() > 0 ? " with flags: '" + flags + "'" : "" ) + | |||||
| ".", | |||||
| Project.MSG_WARN ); | |||||
| final String message = "Replacing pattern '" + regex.getPattern( getProject() ) + | |||||
| "' with '" + subs.getExpression( getProject() ) + | |||||
| "' in '" + f.getPath() + "'" + | |||||
| ( byline ? " by line" : "" ) + | |||||
| ( flags.length() > 0 ? " with flags: '" + flags + "'" : "" ) + | |||||
| "."; | |||||
| getLogger().warn( message ); | |||||
| if( byline ) | if( byline ) | ||||
| { | { | ||||
| @@ -22,7 +22,6 @@ import java.util.Iterator; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | import org.apache.tools.ant.AntClassLoader; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.Reference; | import org.apache.tools.ant.types.Reference; | ||||
| @@ -226,33 +225,32 @@ public class Depend extends MatchingTask | |||||
| if( dump ) | if( dump ) | ||||
| { | { | ||||
| log( "Reverse Dependency Dump for " + affectedClassMap.size() + | |||||
| " classes:", Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Reverse Dependency Dump for " + affectedClassMap.size() + " classes:" ); | |||||
| for( Enumeration e = affectedClassMap.keys(); e.hasMoreElements(); ) | for( Enumeration e = affectedClassMap.keys(); e.hasMoreElements(); ) | ||||
| { | { | ||||
| String className = (String)e.nextElement(); | String className = (String)e.nextElement(); | ||||
| log( " Class " + className + " affects:", Project.MSG_DEBUG ); | |||||
| getLogger().debug( " Class " + className + " affects:" ); | |||||
| Hashtable affectedClasses = (Hashtable)affectedClassMap.get( className ); | Hashtable affectedClasses = (Hashtable)affectedClassMap.get( className ); | ||||
| for( Enumeration e2 = affectedClasses.keys(); e2.hasMoreElements(); ) | for( Enumeration e2 = affectedClasses.keys(); e2.hasMoreElements(); ) | ||||
| { | { | ||||
| String affectedClass = (String)e2.nextElement(); | String affectedClass = (String)e2.nextElement(); | ||||
| ClassFileInfo info = (ClassFileInfo)affectedClasses.get( affectedClass ); | ClassFileInfo info = (ClassFileInfo)affectedClasses.get( affectedClass ); | ||||
| log( " " + affectedClass + " in " + info.absoluteFile.getPath(), Project.MSG_DEBUG ); | |||||
| getLogger().debug( " " + affectedClass + " in " + info.absoluteFile.getPath() ); | |||||
| } | } | ||||
| } | } | ||||
| if( classpathDependencies != null ) | if( classpathDependencies != null ) | ||||
| { | { | ||||
| log( "Classpath file dependencies (Forward):", Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Classpath file dependencies (Forward):" ); | |||||
| for( Enumeration e = classpathDependencies.keys(); e.hasMoreElements(); ) | for( Enumeration e = classpathDependencies.keys(); e.hasMoreElements(); ) | ||||
| { | { | ||||
| String className = (String)e.nextElement(); | String className = (String)e.nextElement(); | ||||
| log( " Class " + className + " depends on:", Project.MSG_DEBUG ); | |||||
| getLogger().debug( " Class " + className + " depends on:" ); | |||||
| Hashtable dependencies = (Hashtable)classpathDependencies.get( className ); | Hashtable dependencies = (Hashtable)classpathDependencies.get( className ); | ||||
| for( Enumeration e2 = dependencies.elements(); e2.hasMoreElements(); ) | for( Enumeration e2 = dependencies.elements(); e2.hasMoreElements(); ) | ||||
| { | { | ||||
| File classpathFile = (File)e2.nextElement(); | File classpathFile = (File)e2.nextElement(); | ||||
| log( " " + classpathFile.getPath(), Project.MSG_DEBUG ); | |||||
| getLogger().debug( " " + classpathFile.getPath() ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -293,8 +291,7 @@ public class Depend extends MatchingTask | |||||
| File classpathFile = (File)e2.nextElement(); | File classpathFile = (File)e2.nextElement(); | ||||
| if( classpathFile.lastModified() > info.absoluteFile.lastModified() ) | if( classpathFile.lastModified() > info.absoluteFile.lastModified() ) | ||||
| { | { | ||||
| log( "Class " + className + | |||||
| " is out of date with respect to " + classpathFile, Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Class " + className + " is out of date with respect to " + classpathFile ); | |||||
| outOfDateClasses.put( className, className ); | outOfDateClasses.put( className, className ); | ||||
| break; | break; | ||||
| } | } | ||||
| @@ -431,8 +428,7 @@ public class Depend extends MatchingTask | |||||
| ClassFileInfo affectedClassInfo = (ClassFileInfo)affectedClasses.get( affectedClassName ); | ClassFileInfo affectedClassInfo = (ClassFileInfo)affectedClasses.get( affectedClassName ); | ||||
| if( affectedClassInfo.absoluteFile.exists() ) | if( affectedClassInfo.absoluteFile.exists() ) | ||||
| { | { | ||||
| log( "Deleting file " + affectedClassInfo.absoluteFile.getPath() + " since " + | |||||
| className + " out of date", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Deleting file " + affectedClassInfo.absoluteFile.getPath() + " since " + className + " out of date" ); | |||||
| affectedClassInfo.absoluteFile.delete(); | affectedClassInfo.absoluteFile.delete(); | ||||
| count++; | count++; | ||||
| if( closure ) | if( closure ) | ||||
| @@ -449,14 +445,13 @@ public class Depend extends MatchingTask | |||||
| // need to delete the main class | // need to delete the main class | ||||
| String topLevelClassName | String topLevelClassName | ||||
| = affectedClassName.substring( 0, affectedClassName.indexOf( "$" ) ); | = affectedClassName.substring( 0, affectedClassName.indexOf( "$" ) ); | ||||
| log( "Top level class = " + topLevelClassName, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Top level class = " + topLevelClassName ); | |||||
| ClassFileInfo topLevelClassInfo | ClassFileInfo topLevelClassInfo | ||||
| = (ClassFileInfo)classFileInfoMap.get( topLevelClassName ); | = (ClassFileInfo)classFileInfoMap.get( topLevelClassName ); | ||||
| if( topLevelClassInfo != null && | if( topLevelClassInfo != null && | ||||
| topLevelClassInfo.absoluteFile.exists() ) | topLevelClassInfo.absoluteFile.exists() ) | ||||
| { | { | ||||
| log( "Deleting file " + topLevelClassInfo.absoluteFile.getPath() + " since " + | |||||
| "one of its inner classes was removed", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Deleting file " + topLevelClassInfo.absoluteFile.getPath() + " since " + "one of its inner classes was removed" ); | |||||
| topLevelClassInfo.absoluteFile.delete(); | topLevelClassInfo.absoluteFile.delete(); | ||||
| count++; | count++; | ||||
| if( closure ) | if( closure ) | ||||
| @@ -519,7 +514,7 @@ public class Depend extends MatchingTask | |||||
| for( Iterator e = getClassFiles( destPath ).iterator(); e.hasNext(); ) | for( Iterator e = getClassFiles( destPath ).iterator(); e.hasNext(); ) | ||||
| { | { | ||||
| ClassFileInfo info = (ClassFileInfo)e.next(); | ClassFileInfo info = (ClassFileInfo)e.next(); | ||||
| log( "Adding class info for " + info.className, Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Adding class info for " + info.className ); | |||||
| classFileInfoMap.put( info.className, info ); | classFileInfoMap.put( info.className, info ); | ||||
| ArrayList dependencyList = null; | ArrayList dependencyList = null; | ||||
| @@ -622,9 +617,7 @@ public class Depend extends MatchingTask | |||||
| String classFilePath = classURL.getFile(); | String classFilePath = classURL.getFile(); | ||||
| classpathFileObject = new File( classFilePath ); | classpathFileObject = new File( classFilePath ); | ||||
| } | } | ||||
| log( "Class " + className + | |||||
| " depends on " + classpathFileObject + | |||||
| " due to " + dependency, Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Class " + className + " depends on " + classpathFileObject + " due to " + dependency ); | |||||
| } | } | ||||
| } | } | ||||
| classpathFileCache.put( dependency, classpathFileObject ); | classpathFileCache.put( dependency, classpathFileObject ); | ||||
| @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.optional.dotnet; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| /** | /** | ||||
| * Task to assemble .net 'Intermediate Language' files. The task will only work | * Task to assemble .net 'Intermediate Language' files. The task will only work | ||||
| @@ -188,7 +187,7 @@ public class Ilasm | |||||
| public void setOwner( String s ) | public void setOwner( String s ) | ||||
| { | { | ||||
| log( "This option is not supported by ILASM as of Beta-2, and will be ignored", Project.MSG_WARN ); | |||||
| getLogger().warn( "This option is not supported by ILASM as of Beta-2, and will be ignored" ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.dotnet;// imports | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| @@ -29,8 +30,8 @@ import org.apache.tools.ant.types.Commandline; | |||||
| */ | */ | ||||
| public class NetCommand | public class NetCommand | ||||
| extends AbstractLogEnabled | |||||
| { | { | ||||
| /** | /** | ||||
| * trace flag | * trace flag | ||||
| */ | */ | ||||
| @@ -162,7 +163,7 @@ public class NetCommand | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| _owner.log( _title + " Result: " + err, Project.MSG_ERR ); | |||||
| getLogger().error( _title + " Result: " + err ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -179,7 +180,7 @@ public class NetCommand | |||||
| */ | */ | ||||
| protected void logError( String msg ) | protected void logError( String msg ) | ||||
| { | { | ||||
| _owner.log( msg, Project.MSG_ERR ); | |||||
| getLogger().error( msg ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -189,7 +190,7 @@ public class NetCommand | |||||
| */ | */ | ||||
| protected void logVerbose( String msg ) | protected void logVerbose( String msg ) | ||||
| { | { | ||||
| _owner.log( msg, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( msg ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -153,7 +153,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec | |||||
| String s = reader.readLine(); | String s = reader.readLine(); | ||||
| if( s != null ) | if( s != null ) | ||||
| { | { | ||||
| log( "[java2iiop] " + s, Project.MSG_DEBUG ); | |||||
| getLogger().debug( "[java2iiop] " + s ); | |||||
| }// end of if () | }// end of if () | ||||
| } | } | ||||
| @@ -175,13 +175,13 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec | |||||
| String javafile; | String javafile; | ||||
| while( ( javafile = reader.readLine() ) != null ) | while( ( javafile = reader.readLine() ) != null ) | ||||
| { | { | ||||
| log( "buffer:" + javafile, Project.MSG_DEBUG ); | |||||
| getLogger().debug( "buffer:" + javafile ); | |||||
| if( javafile.endsWith( ".java" ) ) | if( javafile.endsWith( ".java" ) ) | ||||
| { | { | ||||
| String classfile = toClassFile( javafile ); | String classfile = toClassFile( javafile ); | ||||
| String key = classfile.substring( getConfig().srcDir.getAbsolutePath().length() + 1 ); | String key = classfile.substring( getConfig().srcDir.getAbsolutePath().length() + 1 ); | ||||
| log( " generated : " + classfile, Project.MSG_DEBUG ); | |||||
| log( " key : " + key, Project.MSG_DEBUG ); | |||||
| getLogger().debug( " generated : " + classfile ); | |||||
| getLogger().debug( " key : " + key ); | |||||
| _genfiles.put( key, new File( classfile ) ); | _genfiles.put( key, new File( classfile ) ); | ||||
| }// end of if () | }// end of if () | ||||
| }// end of while () | }// end of while () | ||||
| @@ -278,7 +278,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec | |||||
| File borlandDD = new File( getConfig().descriptorDir, ddPrefix + BAS_DD ); | File borlandDD = new File( getConfig().descriptorDir, ddPrefix + BAS_DD ); | ||||
| if( borlandDD.exists() ) | if( borlandDD.exists() ) | ||||
| { | { | ||||
| log( "Borland specific file found " + borlandDD, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Borland specific file found " + borlandDD ); | |||||
| ejbFiles.put( META_DIR + BAS_DD, borlandDD ); | ejbFiles.put( META_DIR + BAS_DD, borlandDD ); | ||||
| } | } | ||||
| else | else | ||||
| @@ -314,7 +314,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec | |||||
| //remove .class extension | //remove .class extension | ||||
| String home = toClass( clazz ); | String home = toClass( clazz ); | ||||
| homes.add( home ); | homes.add( home ); | ||||
| log( " Home " + home, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( " Home " + home ); | |||||
| }// end of if () | }// end of if () | ||||
| }// end of while () | }// end of while () | ||||
| @@ -391,8 +391,8 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec | |||||
| try | try | ||||
| { | { | ||||
| log( "Calling java2iiop", Project.MSG_VERBOSE ); | |||||
| log( commandline.toString(), Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Calling java2iiop" ); | |||||
| getLogger().debug( commandline.toString() ); | |||||
| execTask.setCommandline( commandline.getCommandline() ); | execTask.setCommandline( commandline.getCommandline() ); | ||||
| int result = execTask.execute(); | int result = execTask.execute(); | ||||
| if( result != 0 ) | if( result != 0 ) | ||||
| @@ -403,7 +403,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec | |||||
| } | } | ||||
| catch( java.io.IOException e ) | catch( java.io.IOException e ) | ||||
| { | { | ||||
| log( "java2iiop exception :" + e.getMessage(), Project.MSG_ERR ); | |||||
| getLogger().error( "java2iiop exception :" + e.getMessage() ); | |||||
| throw new TaskException( "Error", e ); | throw new TaskException( "Error", e ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -421,7 +421,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec | |||||
| //org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient.class ); | //org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient.class ); | ||||
| org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient gentask = null; | org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient gentask = null; | ||||
| log( "generate client for " + sourceJar, Project.MSG_INFO ); | |||||
| getLogger().info( "generate client for " + sourceJar ); | |||||
| try | try | ||||
| { | { | ||||
| String args = verifyArgs; | String args = verifyArgs; | ||||
| @@ -483,7 +483,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| org.apache.tools.ant.taskdefs.Java javaTask = null; | org.apache.tools.ant.taskdefs.Java javaTask = null; | ||||
| log( "verify " + sourceJar, Project.MSG_INFO ); | |||||
| getLogger().info( "verify " + sourceJar ); | |||||
| try | try | ||||
| { | { | ||||
| @@ -501,7 +501,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec | |||||
| javaTask.setFork( true ); | javaTask.setFork( true ); | ||||
| } | } | ||||
| log( "Calling " + VERIFY + " for " + sourceJar.toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Calling " + VERIFY + " for " + sourceJar.toString() ); | |||||
| javaTask.execute(); | javaTask.execute(); | ||||
| } | } | ||||
| catch( Exception e ) | catch( Exception e ) | ||||
| @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.optional.ejb; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.taskdefs.exec.ExecTask; | import org.apache.tools.ant.taskdefs.exec.ExecTask; | ||||
| @@ -121,7 +120,7 @@ public class BorlandGenerateClient extends Task | |||||
| if( clientjarfile == null || | if( clientjarfile == null || | ||||
| clientjarfile.isDirectory() ) | clientjarfile.isDirectory() ) | ||||
| { | { | ||||
| log( "invalid or missing client jar file.", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "invalid or missing client jar file." ); | |||||
| String ejbjarname = ejbjarfile.getAbsolutePath(); | String ejbjarname = ejbjarfile.getAbsolutePath(); | ||||
| //clientname = ejbjarfile+client.jar | //clientname = ejbjarfile+client.jar | ||||
| String clientname = ejbjarname.substring( 0, ejbjarname.lastIndexOf( "." ) ); | String clientname = ejbjarname.substring( 0, ejbjarname.lastIndexOf( "." ) ); | ||||
| @@ -181,7 +180,7 @@ public class BorlandGenerateClient extends Task | |||||
| execTask.createArg().setValue( "-clientjarfile" ); | execTask.createArg().setValue( "-clientjarfile" ); | ||||
| execTask.createArg().setValue( clientjarfile.getAbsolutePath() ); | execTask.createArg().setValue( clientjarfile.getAbsolutePath() ); | ||||
| log( "Calling java2iiop", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Calling java2iiop" ); | |||||
| execTask.execute(); | execTask.execute(); | ||||
| } | } | ||||
| catch( Exception e ) | catch( Exception e ) | ||||
| @@ -232,7 +231,7 @@ public class BorlandGenerateClient extends Task | |||||
| execTask.createArg().setValue( "-clientjarfile" ); | execTask.createArg().setValue( "-clientjarfile" ); | ||||
| execTask.createArg().setValue( clientjarfile.getAbsolutePath() ); | execTask.createArg().setValue( clientjarfile.getAbsolutePath() ); | ||||
| log( "Calling EJBUtilities", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Calling EJBUtilities" ); | |||||
| execTask.execute(); | execTask.execute(); | ||||
| } | } | ||||
| @@ -14,7 +14,8 @@ import java.io.IOException; | |||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.avalon.framework.logger.LogEnabled; | |||||
| import org.apache.avalon.framework.logger.Logger; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.xml.sax.AttributeList; | import org.xml.sax.AttributeList; | ||||
| import org.xml.sax.InputSource; | import org.xml.sax.InputSource; | ||||
| @@ -30,7 +31,9 @@ import org.xml.sax.SAXException; | |||||
| * | * | ||||
| * @author RT | * @author RT | ||||
| */ | */ | ||||
| public class DescriptorHandler extends org.xml.sax.HandlerBase | |||||
| public class DescriptorHandler | |||||
| extends org.xml.sax.HandlerBase | |||||
| implements LogEnabled | |||||
| { | { | ||||
| private final static int STATE_LOOKING_EJBJAR = 1; | private final static int STATE_LOOKING_EJBJAR = 1; | ||||
| private final static int STATE_IN_EJBJAR = 2; | private final static int STATE_IN_EJBJAR = 2; | ||||
| @@ -105,6 +108,23 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase | |||||
| */ | */ | ||||
| private File srcDir; | private File srcDir; | ||||
| private Logger m_logger; | |||||
| /** | |||||
| * Provide component with a logger. | |||||
| * | |||||
| * @param logger the logger | |||||
| */ | |||||
| public void enableLogging( Logger logger ) | |||||
| { | |||||
| m_logger = logger; | |||||
| } | |||||
| protected final Logger getLogger() | |||||
| { | |||||
| return m_logger; | |||||
| } | |||||
| public DescriptorHandler( Task task, File srcDir ) | public DescriptorHandler( Task task, File srcDir ) | ||||
| { | { | ||||
| this.owningTask = task; | this.owningTask = task; | ||||
| @@ -221,7 +241,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase | |||||
| if( publicId != null ) | if( publicId != null ) | ||||
| { | { | ||||
| fileDTDs.put( publicId, fileDTD ); | fileDTDs.put( publicId, fileDTD ); | ||||
| owningTask.log( "Mapped publicId " + publicId + " to file " + fileDTD, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Mapped publicId " + publicId + " to file " + fileDTD ); | |||||
| } | } | ||||
| return; | return; | ||||
| } | } | ||||
| @@ -231,7 +251,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase | |||||
| if( publicId != null ) | if( publicId != null ) | ||||
| { | { | ||||
| resourceDTDs.put( publicId, location ); | resourceDTDs.put( publicId, location ); | ||||
| owningTask.log( "Mapped publicId " + publicId + " to resource " + location, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Mapped publicId " + publicId + " to resource " + location ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -260,7 +280,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase | |||||
| { | { | ||||
| try | try | ||||
| { | { | ||||
| owningTask.log( "Resolved " + publicId + " to local file " + dtdFile, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Resolved " + publicId + " to local file " + dtdFile ); | |||||
| return new InputSource( new FileInputStream( dtdFile ) ); | return new InputSource( new FileInputStream( dtdFile ) ); | ||||
| } | } | ||||
| catch( FileNotFoundException ex ) | catch( FileNotFoundException ex ) | ||||
| @@ -275,7 +295,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase | |||||
| InputStream is = this.getClass().getResourceAsStream( dtdResourceName ); | InputStream is = this.getClass().getResourceAsStream( dtdResourceName ); | ||||
| if( is != null ) | if( is != null ) | ||||
| { | { | ||||
| owningTask.log( "Resolved " + publicId + " to local resource " + dtdResourceName, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Resolved " + publicId + " to local resource " + dtdResourceName ); | |||||
| return new InputSource( is ); | return new InputSource( is ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -286,7 +306,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase | |||||
| try | try | ||||
| { | { | ||||
| InputStream is = dtdUrl.openStream(); | InputStream is = dtdUrl.openStream(); | ||||
| owningTask.log( "Resolved " + publicId + " to url " + dtdUrl, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Resolved " + publicId + " to url " + dtdUrl ); | |||||
| return new InputSource( is ); | return new InputSource( is ); | ||||
| } | } | ||||
| catch( IOException ioe ) | catch( IOException ioe ) | ||||
| @@ -295,8 +315,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase | |||||
| } | } | ||||
| } | } | ||||
| owningTask.log( "Could not resolve ( publicId: " + publicId + ", systemId: " + systemId + ") to a local entity", | |||||
| Project.MSG_INFO ); | |||||
| getLogger().info( "Could not resolve ( publicId: " + publicId + ", systemId: " + systemId + ") to a local entity" ); | |||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -16,7 +16,6 @@ import javax.xml.parsers.SAXParser; | |||||
| import javax.xml.parsers.SAXParserFactory; | import javax.xml.parsers.SAXParserFactory; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
| 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; | ||||
| @@ -236,7 +235,7 @@ public class EjbJar extends MatchingTask | |||||
| */ | */ | ||||
| public BorlandDeploymentTool createBorland() | public BorlandDeploymentTool createBorland() | ||||
| { | { | ||||
| log( "Borland deployment tools", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Borland deployment tools" ); | |||||
| BorlandDeploymentTool tool = new BorlandDeploymentTool(); | BorlandDeploymentTool tool = new BorlandDeploymentTool(); | ||||
| tool.setTask( this ); | tool.setTask( this ); | ||||
| @@ -283,7 +282,7 @@ public class EjbJar extends MatchingTask | |||||
| */ | */ | ||||
| public IPlanetDeploymentTool createIplanet() | public IPlanetDeploymentTool createIplanet() | ||||
| { | { | ||||
| log( "iPlanet Application Server deployment tools", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "iPlanet Application Server deployment tools" ); | |||||
| IPlanetDeploymentTool tool = new IPlanetDeploymentTool(); | IPlanetDeploymentTool tool = new IPlanetDeploymentTool(); | ||||
| tool.setTask( this ); | tool.setTask( this ); | ||||
| @@ -403,8 +402,7 @@ public class EjbJar extends MatchingTask | |||||
| ds.scan(); | ds.scan(); | ||||
| String[] files = ds.getIncludedFiles(); | String[] files = ds.getIncludedFiles(); | ||||
| log( files.length + " deployment descriptors located.", | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( files.length + " deployment descriptors located." ); | |||||
| // Loop through the files. Each file represents one deployment | // Loop through the files. Each file represents one deployment | ||||
| // descriptor, and hence one bean in our model. | // descriptor, and hence one bean in our model. | ||||
| @@ -23,6 +23,7 @@ import java.util.jar.JarOutputStream; | |||||
| import java.util.jar.Manifest; | import java.util.jar.Manifest; | ||||
| import java.util.zip.ZipEntry; | import java.util.zip.ZipEntry; | ||||
| import javax.xml.parsers.SAXParser; | import javax.xml.parsers.SAXParser; | ||||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||||
| import org.apache.bcel.*; | import org.apache.bcel.*; | ||||
| import org.apache.bcel.classfile.*; | import org.apache.bcel.classfile.*; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| @@ -46,7 +47,9 @@ import org.xml.sax.SAXException; | |||||
| * | * | ||||
| * @author RT | * @author RT | ||||
| */ | */ | ||||
| public class GenericDeploymentTool implements EJBDeploymentTool | |||||
| public class GenericDeploymentTool | |||||
| extends AbstractLogEnabled | |||||
| implements EJBDeploymentTool | |||||
| { | { | ||||
| /** | /** | ||||
| * Private constants that are used when constructing the standard jarfile | * Private constants that are used when constructing the standard jarfile | ||||
| @@ -250,12 +253,9 @@ public class GenericDeploymentTool implements EJBDeploymentTool | |||||
| if( needToRebuild( ejbFiles, jarFile ) ) | if( needToRebuild( ejbFiles, jarFile ) ) | ||||
| { | { | ||||
| // Log that we are going to build... | // Log that we are going to build... | ||||
| log( "building " | |||||
| + jarFile.getName() | |||||
| + " with " | |||||
| + String.valueOf( ejbFiles.size() ) | |||||
| + " files", | |||||
| Project.MSG_INFO ); | |||||
| final String message = | |||||
| "building " + jarFile.getName() + " with " + String.valueOf( ejbFiles.size() ) + " files"; | |||||
| getLogger().info( message ); | |||||
| // Use helper method to write the jarfile | // Use helper method to write the jarfile | ||||
| String publicId = getPublicId(); | String publicId = getPublicId(); | ||||
| @@ -265,8 +265,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool | |||||
| else | else | ||||
| { | { | ||||
| // Log that the file is up to date... | // Log that the file is up to date... | ||||
| log( jarFile.toString() + " is up to date.", | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( jarFile.toString() + " is up to date." ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -525,9 +524,10 @@ public class GenericDeploymentTool implements EJBDeploymentTool | |||||
| } | } | ||||
| catch( IOException ioe ) | catch( IOException ioe ) | ||||
| { | { | ||||
| log( "WARNING: IOException while adding entry " + | |||||
| logicalFilename + " to jarfile from " + inputFile.getPath() + " " + | |||||
| ioe.getClass().getName() + "-" + ioe.getMessage(), Project.MSG_WARN ); | |||||
| final String message = "WARNING: IOException while adding entry " + | |||||
| logicalFilename + " to jarfile from " + inputFile.getPath() + " " + | |||||
| ioe.getClass().getName() + "-" + ioe.getMessage(); | |||||
| getLogger().warn( message ); | |||||
| } | } | ||||
| finally | finally | ||||
| { | { | ||||
| @@ -619,7 +619,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool | |||||
| } | } | ||||
| catch( IOException e ) | catch( IOException e ) | ||||
| { | { | ||||
| log( "exception: " + e.getMessage(), Project.MSG_INFO ); | |||||
| getLogger().info( "exception: " + e.getMessage() ); | |||||
| } | } | ||||
| } | } | ||||
| newSet.clear(); | newSet.clear(); | ||||
| @@ -644,7 +644,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool | |||||
| { | { | ||||
| String next = ( (String)i.next() ).replace( '/', File.separatorChar ); | String next = ( (String)i.next() ).replace( '/', File.separatorChar ); | ||||
| checkEntries.put( next + ".class", new File( base + next + ".class" ) ); | checkEntries.put( next + ".class", new File( base + next + ".class" ) ); | ||||
| log( "dependent class: " + next + ".class" + " - " + base + next + ".class", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "dependent class: " + next + ".class" + " - " + base + next + ".class" ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -701,8 +701,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool | |||||
| if( config.manifest != null && config.manifest.exists() && | if( config.manifest != null && config.manifest.exists() && | ||||
| config.manifest.lastModified() > lastBuild ) | config.manifest.lastModified() > lastBuild ) | ||||
| { | { | ||||
| log( "Build needed because manifest " + config.manifest + " is out of date", | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Build needed because manifest " + config.manifest + " is out of date" ); | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -715,8 +714,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool | |||||
| File currentFile = (File)fileIter.next(); | File currentFile = (File)fileIter.next(); | ||||
| if( lastBuild < currentFile.lastModified() ) | if( lastBuild < currentFile.lastModified() ) | ||||
| { | { | ||||
| log( "Build needed because " + currentFile.getPath() + " is out of date", | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Build needed because " + currentFile.getPath() + " is out of date" ); | |||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| @@ -887,8 +885,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool | |||||
| String entryName = (String)entryIterator.next(); | String entryName = (String)entryIterator.next(); | ||||
| File entryFile = (File)files.get( entryName ); | File entryFile = (File)files.get( entryName ); | ||||
| log( "adding file '" + entryName + "'", | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "adding file '" + entryName + "'" ); | |||||
| addFileToJar( jarStream, entryFile, entryName ); | addFileToJar( jarStream, entryFile, entryName ); | ||||
| @@ -912,8 +909,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool | |||||
| // link the file | // link the file | ||||
| entryFile = new File( config.srcDir, entryName ); | entryFile = new File( config.srcDir, entryName ); | ||||
| log( "adding innerclass file '" + entryName + "'", | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "adding innerclass file '" + entryName + "'" ); | |||||
| addFileToJar( jarStream, entryFile, entryName ); | addFileToJar( jarStream, entryFile, entryName ); | ||||
| @@ -12,7 +12,6 @@ import java.io.IOException; | |||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import javax.xml.parsers.SAXParser; | import javax.xml.parsers.SAXParser; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.xml.sax.SAXException; | import org.xml.sax.SAXException; | ||||
| /** | /** | ||||
| @@ -120,10 +119,10 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool | |||||
| */ | */ | ||||
| public void setGenericJarSuffix( String inString ) | public void setGenericJarSuffix( String inString ) | ||||
| { | { | ||||
| log( "Since a generic JAR file is not created during processing, the " | |||||
| + "iPlanet Deployment Tool does not support the " | |||||
| + "\"genericjarsuffix\" attribute. It will be ignored.", | |||||
| Project.MSG_WARN ); | |||||
| final String message = "Since a generic JAR file is not created during processing, the " | |||||
| + "iPlanet Deployment Tool does not support the " | |||||
| + "\"genericjarsuffix\" attribute. It will be ignored."; | |||||
| getLogger().warn( message ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -166,8 +165,7 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool | |||||
| { | { | ||||
| this.descriptorName = descriptorName; | this.descriptorName = descriptorName; | ||||
| log( "iPlanet Deployment Tool processing: " + descriptorName + " (and " | |||||
| + getIasDescriptorName() + ")", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "iPlanet Deployment Tool processing: " + descriptorName + " (and " + getIasDescriptorName() + ")" ); | |||||
| super.processDescriptor( descriptorName, saxParser ); | super.processDescriptor( descriptorName, saxParser ); | ||||
| } | } | ||||
| @@ -334,7 +332,7 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool | |||||
| File getVendorOutputJarFile( String baseName ) | File getVendorOutputJarFile( String baseName ) | ||||
| { | { | ||||
| File jarFile = new File( getDestDir(), baseName + jarSuffix ); | File jarFile = new File( getDestDir(), baseName + jarSuffix ); | ||||
| log( "JAR file name: " + jarFile.toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "JAR file name: " + jarFile.toString() ); | |||||
| return jarFile; | return jarFile; | ||||
| } | } | ||||
| @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.optional.ejb; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import org.apache.tools.ant.Project; | |||||
| /** | /** | ||||
| * The deployment tool to add the jboss specific deployment descriptor to the | * The deployment tool to add the jboss specific deployment descriptor to the | ||||
| @@ -45,7 +44,7 @@ public class JbossDeploymentTool extends GenericDeploymentTool | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Unable to locate jboss deployment descriptor. It was expected to be in " + jbossDD.getPath(), Project.MSG_WARN ); | |||||
| getLogger().warn( "Unable to locate jboss deployment descriptor. It was expected to be in " + jbossDD.getPath() ); | |||||
| return; | return; | ||||
| } | } | ||||
| @@ -22,7 +22,6 @@ import javax.xml.parsers.SAXParserFactory; | |||||
| 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.tools.ant.AntClassLoader; | import org.apache.tools.ant.AntClassLoader; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.xml.sax.InputSource; | import org.xml.sax.InputSource; | ||||
| @@ -407,8 +406,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool | |||||
| try | try | ||||
| { | { | ||||
| log( "Checking if weblogic Jar needs to be rebuilt for jar " + weblogicJarFile.getName(), | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Checking if weblogic Jar needs to be rebuilt for jar " + weblogicJarFile.getName() ); | |||||
| // Only go forward if the generic and the weblogic file both exist | // Only go forward if the generic and the weblogic file both exist | ||||
| if( genericJarFile.exists() && genericJarFile.isFile() | if( genericJarFile.exists() && genericJarFile.isFile() | ||||
| && weblogicJarFile.exists() && weblogicJarFile.isFile() ) | && weblogicJarFile.exists() && weblogicJarFile.isFile() ) | ||||
| @@ -458,7 +456,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool | |||||
| if( genclass.isInterface() ) | if( genclass.isInterface() ) | ||||
| { | { | ||||
| //Interface changed rebuild jar. | //Interface changed rebuild jar. | ||||
| log( "Interface " + genclass.getName() + " has changed", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Interface " + genclass.getName() + " has changed" ); | |||||
| rebuild = true; | rebuild = true; | ||||
| break; | break; | ||||
| } | } | ||||
| @@ -474,7 +472,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool | |||||
| if( !genericEntry.getName().equals( "META-INF/MANIFEST.MF" ) ) | if( !genericEntry.getName().equals( "META-INF/MANIFEST.MF" ) ) | ||||
| { | { | ||||
| //File other then class changed rebuild | //File other then class changed rebuild | ||||
| log( "Non class file " + genericEntry.getName() + " has changed", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Non class file " + genericEntry.getName() + " has changed" ); | |||||
| rebuild = true; | rebuild = true; | ||||
| break; | break; | ||||
| } | } | ||||
| @@ -484,7 +482,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool | |||||
| else | else | ||||
| {// a file doesnt exist rebuild | {// a file doesnt exist rebuild | ||||
| log( "File " + filepath + " not present in weblogic jar", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "File " + filepath + " not present in weblogic jar" ); | |||||
| rebuild = true; | rebuild = true; | ||||
| break; | break; | ||||
| } | } | ||||
| @@ -492,7 +490,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool | |||||
| if( !rebuild ) | if( !rebuild ) | ||||
| { | { | ||||
| log( "No rebuild needed - updating jar", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "No rebuild needed - updating jar" ); | |||||
| newWLJarFile = new File( weblogicJarFile.getAbsolutePath() + ".temp" ); | newWLJarFile = new File( weblogicJarFile.getAbsolutePath() + ".temp" ); | ||||
| if( newWLJarFile.exists() ) | if( newWLJarFile.exists() ) | ||||
| { | { | ||||
| @@ -522,7 +520,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool | |||||
| // Update with changed Bean class | // Update with changed Bean class | ||||
| if( replaceEntries.containsKey( je.getName() ) ) | if( replaceEntries.containsKey( je.getName() ) ) | ||||
| { | { | ||||
| log( "Updating Bean class from generic Jar " + je.getName(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Updating Bean class from generic Jar " + je.getName() ); | |||||
| // Use the entry from the generic jar | // Use the entry from the generic jar | ||||
| je = (JarEntry)replaceEntries.get( je.getName() ); | je = (JarEntry)replaceEntries.get( je.getName() ); | ||||
| is = genericJar.getInputStream( je ); | is = genericJar.getInputStream( je ); | ||||
| @@ -543,7 +541,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Weblogic Jar rebuild needed due to changed interface or XML", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Weblogic Jar rebuild needed due to changed interface or XML" ); | |||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| @@ -629,16 +627,16 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Unable to locate weblogic deployment descriptor. It was expected to be in " + | |||||
| weblogicDD.getPath(), Project.MSG_WARN ); | |||||
| final String message = "Unable to locate weblogic deployment descriptor. It was expected to be in " + | |||||
| weblogicDD.getPath(); | |||||
| getLogger().warn( message ); | |||||
| return; | return; | ||||
| } | } | ||||
| if( !newCMP ) | if( !newCMP ) | ||||
| { | { | ||||
| log( "The old method for locating CMP files has been DEPRECATED.", Project.MSG_VERBOSE ); | |||||
| log( "Please adjust your weblogic descriptor and set newCMP=\"true\" " + | |||||
| "to use the new CMP descriptor inclusion mechanism. ", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "The old method for locating CMP files has been DEPRECATED." ); | |||||
| getLogger().debug( "Please adjust your weblogic descriptor and set newCMP=\"true\" " + "to use the new CMP descriptor inclusion mechanism. " ); | |||||
| // The the weblogic cmp deployment descriptor | // The the weblogic cmp deployment descriptor | ||||
| File weblogicCMPDD = new File( getConfig().descriptorDir, ddPrefix + WL_CMP_DD ); | File weblogicCMPDD = new File( getConfig().descriptorDir, ddPrefix + WL_CMP_DD ); | ||||
| @@ -716,8 +714,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool | |||||
| } | } | ||||
| if( !keepGeneric ) | if( !keepGeneric ) | ||||
| { | { | ||||
| log( "deleting generic jar " + genericJarFile.toString(), | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "deleting generic jar " + genericJarFile.toString() ); | |||||
| genericJarFile.delete(); | genericJarFile.delete(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -791,7 +788,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Unrecognized publicId " + publicId + " - using EJB 1.1 compiler", Project.MSG_WARN ); | |||||
| getLogger().warn( "Unrecognized publicId " + publicId + " - using EJB 1.1 compiler" ); | |||||
| ejbcClassName = COMPILER_EJB11; | ejbcClassName = COMPILER_EJB11; | ||||
| } | } | ||||
| } | } | ||||
| @@ -836,8 +833,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool | |||||
| javaTask.setClasspath( classpath ); | javaTask.setClasspath( classpath ); | ||||
| } | } | ||||
| log( "Calling " + ejbcClassName + " for " + sourceJar.toString(), | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Calling " + ejbcClassName + " for " + sourceJar.toString() ); | |||||
| if( javaTask.executeJava() != 0 ) | if( javaTask.executeJava() != 0 ) | ||||
| { | { | ||||
| @@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.optional.ejb; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool | public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool | ||||
| { | { | ||||
| @@ -98,8 +97,9 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Unable to locate toplink deployment descriptor. It was expected to be in " + | |||||
| toplinkDD.getPath(), Project.MSG_WARN ); | |||||
| final String message = "Unable to locate toplink deployment descriptor. It was expected to be in " + | |||||
| toplinkDD.getPath(); | |||||
| getLogger().warn( message ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -18,7 +18,6 @@ import java.util.jar.JarFile; | |||||
| import java.util.jar.JarOutputStream; | import java.util.jar.JarOutputStream; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | import org.apache.tools.ant.AntClassLoader; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| @@ -30,8 +29,8 @@ import org.apache.tools.ant.types.Path; | |||||
| * | * | ||||
| * @author <mailto:msahu@interkeel.com>Maneesh Sahu</mailto> | * @author <mailto:msahu@interkeel.com>Maneesh Sahu</mailto> | ||||
| */ | */ | ||||
| public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
| public class WebsphereDeploymentTool | |||||
| extends GenericDeploymentTool | |||||
| { | { | ||||
| public final static String PUBLICID_EJB11 | public final static String PUBLICID_EJB11 | ||||
| @@ -541,8 +540,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
| JarOutputStream newJarStream = null; | JarOutputStream newJarStream = null; | ||||
| try | try | ||||
| { | { | ||||
| log( "Checking if websphere Jar needs to be rebuilt for jar " + websphereJarFile.getName(), | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Checking if websphere Jar needs to be rebuilt for jar " + websphereJarFile.getName() ); | |||||
| // Only go forward if the generic and the websphere file both exist | // Only go forward if the generic and the websphere file both exist | ||||
| @@ -604,7 +602,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
| //Interface changed rebuild jar. | //Interface changed rebuild jar. | ||||
| log( "Interface " + genclass.getName() + " has changed", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Interface " + genclass.getName() + " has changed" ); | |||||
| rebuild = true; | rebuild = true; | ||||
| break; | break; | ||||
| } | } | ||||
| @@ -623,7 +621,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
| //File other then class changed rebuild | //File other then class changed rebuild | ||||
| log( "Non class file " + genericEntry.getName() + " has changed", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Non class file " + genericEntry.getName() + " has changed" ); | |||||
| rebuild = true; | rebuild = true; | ||||
| } | } | ||||
| break; | break; | ||||
| @@ -632,14 +630,14 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
| } | } | ||||
| else | else | ||||
| {// a file doesnt exist rebuild | {// a file doesnt exist rebuild | ||||
| log( "File " + filepath + " not present in websphere jar", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "File " + filepath + " not present in websphere jar" ); | |||||
| rebuild = true; | rebuild = true; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| if( !rebuild ) | if( !rebuild ) | ||||
| { | { | ||||
| log( "No rebuild needed - updating jar", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "No rebuild needed - updating jar" ); | |||||
| newwasJarFile = new File( websphereJarFile.getAbsolutePath() + ".temp" ); | newwasJarFile = new File( websphereJarFile.getAbsolutePath() + ".temp" ); | ||||
| if( newwasJarFile.exists() ) | if( newwasJarFile.exists() ) | ||||
| { | { | ||||
| @@ -674,8 +672,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
| if( replaceEntries.containsKey( je.getName() ) ) | if( replaceEntries.containsKey( je.getName() ) ) | ||||
| { | { | ||||
| log( "Updating Bean class from generic Jar " + je.getName(), | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Updating Bean class from generic Jar " + je.getName() ); | |||||
| // Use the entry from the generic jar | // Use the entry from the generic jar | ||||
| @@ -699,7 +696,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "websphere Jar rebuild needed due to changed interface or XML", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "websphere Jar rebuild needed due to changed interface or XML" ); | |||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| @@ -789,8 +786,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Unable to locate websphere extensions. It was expected to be in " + | |||||
| websphereEXT.getPath(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Unable to locate websphere extensions. It was expected to be in " + websphereEXT.getPath() ); | |||||
| } | } | ||||
| File websphereBND = new File( getConfig().descriptorDir, ddPrefix + WAS_BND ); | File websphereBND = new File( getConfig().descriptorDir, ddPrefix + WAS_BND ); | ||||
| if( websphereBND.exists() ) | if( websphereBND.exists() ) | ||||
| @@ -800,14 +796,12 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Unable to locate websphere bindings. It was expected to be in " + | |||||
| websphereBND.getPath(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Unable to locate websphere bindings. It was expected to be in " + websphereBND.getPath() ); | |||||
| } | } | ||||
| if( !newCMP ) | if( !newCMP ) | ||||
| { | { | ||||
| log( "The old method for locating CMP files has been DEPRECATED.", Project.MSG_VERBOSE ); | |||||
| log( "Please adjust your websphere descriptor and set newCMP=\"true\" " + | |||||
| "to use the new CMP descriptor inclusion mechanism. ", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "The old method for locating CMP files has been DEPRECATED." ); | |||||
| getLogger().debug( "Please adjust your websphere descriptor and set newCMP=\"true\" " + "to use the new CMP descriptor inclusion mechanism. " ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -828,8 +822,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Unable to locate the websphere Map: " + | |||||
| websphereMAP.getPath(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Unable to locate the websphere Map: " + websphereMAP.getPath() ); | |||||
| } | } | ||||
| File websphereSchema = new File( getConfig().descriptorDir, | File websphereSchema = new File( getConfig().descriptorDir, | ||||
| ddPrefix + dbPrefix + WAS_CMP_SCHEMA ); | ddPrefix + dbPrefix + WAS_CMP_SCHEMA ); | ||||
| @@ -840,8 +833,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Unable to locate the websphere Schema: " + | |||||
| websphereSchema.getPath(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Unable to locate the websphere Schema: " + websphereSchema.getPath() ); | |||||
| } | } | ||||
| // Theres nothing else to see here...keep moving sonny | // Theres nothing else to see here...keep moving sonny | ||||
| @@ -884,8 +876,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
| } | } | ||||
| if( !keepGeneric ) | if( !keepGeneric ) | ||||
| { | { | ||||
| log( "deleting generic jar " + genericJarFile.toString(), | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "deleting generic jar " + genericJarFile.toString() ); | |||||
| genericJarFile.delete(); | genericJarFile.delete(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -953,7 +944,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
| // Why do my ""'s get stripped away??? | // Why do my ""'s get stripped away??? | ||||
| log( "EJB Deploy Options: " + args, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "EJB Deploy Options: " + args ); | |||||
| Java javaTask = (Java)getTask().getProject().createTask( "java" ); | Java javaTask = (Java)getTask().getProject().createTask( "java" ); | ||||
| // Set the JvmArgs | // Set the JvmArgs | ||||
| @@ -997,8 +988,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
| { | { | ||||
| javaTask.setFork( true ); | javaTask.setFork( true ); | ||||
| } | } | ||||
| log( "Calling websphere.ejbdeploy for " + sourceJar.toString(), | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Calling websphere.ejbdeploy for " + sourceJar.toString() ); | |||||
| javaTask.execute(); | javaTask.execute(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -21,7 +21,6 @@ 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.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| @@ -484,12 +483,12 @@ public class Translate extends MatchingTask | |||||
| ins = new FileInputStream( bundleFile ); | ins = new FileInputStream( bundleFile ); | ||||
| loaded = true; | loaded = true; | ||||
| bundleLastModified[ i ] = new File( bundleFile ).lastModified(); | bundleLastModified[ i ] = new File( bundleFile ).lastModified(); | ||||
| log( "Using " + bundleFile, Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Using " + bundleFile ); | |||||
| loadResourceMap( ins ); | loadResourceMap( ins ); | ||||
| } | } | ||||
| catch( IOException ioe ) | catch( IOException ioe ) | ||||
| { | { | ||||
| log( bundleFile + " not found.", Project.MSG_DEBUG ); | |||||
| getLogger().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 | ||||
| @@ -536,9 +535,7 @@ public class Translate extends MatchingTask | |||||
| } | } | ||||
| catch( Exception e ) | catch( Exception e ) | ||||
| { | { | ||||
| log( "Exception occured while trying to check/create " | |||||
| + " parent directory. " + e.getMessage(), | |||||
| Project.MSG_DEBUG ); | |||||
| getLogger().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(); | ||||
| @@ -553,8 +550,7 @@ public class Translate extends MatchingTask | |||||
| || destLastModified < bundleLastModified[ 5 ] | || destLastModified < bundleLastModified[ 5 ] | ||||
| || destLastModified < bundleLastModified[ 6 ] ) | || destLastModified < bundleLastModified[ 6 ] ) | ||||
| { | { | ||||
| log( "Processing " + srcFiles[ j ], | |||||
| Project.MSG_DEBUG ); | |||||
| getLogger().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, | ||||
| @@ -604,9 +600,7 @@ public class Translate extends MatchingTask | |||||
| //use the key itself as the value also. | //use the key itself as the value also. | ||||
| if( replace == null ) | if( replace == null ) | ||||
| { | { | ||||
| log( "Warning: The key: " + matches | |||||
| + " hasn't been defined.", | |||||
| Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Warning: The key: " + matches + " hasn't been defined." ); | |||||
| replace = matches; | replace = matches; | ||||
| } | } | ||||
| line = line.substring( 0, startIndex ) | line = line.substring( 0, startIndex ) | ||||
| @@ -632,9 +626,7 @@ public class Translate extends MatchingTask | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Skipping " + srcFiles[ j ] + | |||||
| " as destination file is up to date", | |||||
| Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Skipping " + srcFiles[ j ] + " as destination file is up to date" ); | |||||
| } | } | ||||
| } | } | ||||
| catch( IOException ioe ) | catch( IOException ioe ) | ||||
| @@ -162,7 +162,7 @@ abstract class VAJLocalUtil implements VAJUtil | |||||
| + dest, MSG_INFO ); | + dest, MSG_INFO ); | ||||
| for( int i = 0; i < packages.length; i++ ) | for( int i = 0; i < packages.length; i++ ) | ||||
| { | { | ||||
| log( " " + packages[ i ].getName(), MSG_VERBOSE ); | |||||
| getLogger().debug( " " + packages[ i ].getName() ); | |||||
| } | } | ||||
| ExportCodeSpec exportSpec = new ExportCodeSpec(); | ExportCodeSpec exportSpec = new ExportCodeSpec(); | ||||
| @@ -246,7 +246,7 @@ abstract class VAJLocalUtil implements VAJUtil | |||||
| summaryLog.append( importProject ); | summaryLog.append( importProject ); | ||||
| summaryLog.append( "'." ); | summaryLog.append( "'." ); | ||||
| log( summaryLog.toString(), MSG_INFO ); | |||||
| getLogger().info( summaryLog.toString() ); | |||||
| try | try | ||||
| { | { | ||||
| @@ -257,7 +257,7 @@ abstract class VAJLocalUtil implements VAJUtil | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( importedTypes.length + " types imported", MSG_DEBUG ); | |||||
| getLogger().debug( importedTypes.length + " types imported" ); | |||||
| for( int i = 0; i < importedTypes.length; i++ ) | for( int i = 0; i < importedTypes.length; i++ ) | ||||
| { | { | ||||
| log( importedTypes[ i ].getPackage().getName() | log( importedTypes[ i ].getPackage().getName() | ||||
| @@ -294,7 +294,7 @@ abstract class VAJLocalUtil implements VAJUtil | |||||
| VAJProjectDescription d = (VAJProjectDescription)e.next(); | VAJProjectDescription d = (VAJProjectDescription)e.next(); | ||||
| if( !d.projectFound() ) | if( !d.projectFound() ) | ||||
| { | { | ||||
| log( "No Projects match the name " + d.getName(), MSG_WARN ); | |||||
| getLogger().warn( "No Projects match the name " + d.getName() ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -483,10 +483,10 @@ abstract class VAJLocalUtil implements VAJUtil | |||||
| */ | */ | ||||
| private void logFiles( ArrayList fileNames, String fileType ) | private void logFiles( ArrayList fileNames, String fileType ) | ||||
| { | { | ||||
| log( fileType + " files found for import:", MSG_VERBOSE ); | |||||
| getLogger().debug( fileType + " files found for import:" ); | |||||
| for( Iterator e = fileNames.iterator(); e.hasNext(); ) | for( Iterator e = fileNames.iterator(); e.hasNext(); ) | ||||
| { | { | ||||
| log( " " + e.next(), MSG_VERBOSE ); | |||||
| getLogger().debug( " " + e.next() ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -208,7 +208,7 @@ class VAJRemoteUtil implements VAJUtil | |||||
| boolean requestFailed = false; | boolean requestFailed = false; | ||||
| try | try | ||||
| { | { | ||||
| log( "Request: " + request, MSG_DEBUG ); | |||||
| getLogger().debug( "Request: " + request ); | |||||
| //must be HTTP connection | //must be HTTP connection | ||||
| URL requestUrl = new URL( request ); | URL requestUrl = new URL( request ); | ||||
| @@ -230,7 +230,7 @@ class VAJRemoteUtil implements VAJUtil | |||||
| } | } | ||||
| if( is == null ) | if( is == null ) | ||||
| { | { | ||||
| log( "Can't get " + request, MSG_ERR ); | |||||
| getLogger().error( "Can't get " + request ); | |||||
| throw new TaskException( "Couldn't execute " + request ); | throw new TaskException( "Couldn't execute " + request ); | ||||
| } | } | ||||
| @@ -251,7 +251,7 @@ class VAJRemoteUtil implements VAJUtil | |||||
| } | } | ||||
| catch( Exception e ) | catch( Exception e ) | ||||
| { | { | ||||
| log( "Response line doesn't contain log level!", MSG_ERR ); | |||||
| getLogger().error( "Response line doesn't contain log level!" ); | |||||
| } | } | ||||
| log( line.substring( 2 ), level ); | log( line.substring( 2 ), level ); | ||||
| line = br.readLine(); | line = br.readLine(); | ||||
| @@ -260,7 +260,7 @@ class VAJRemoteUtil implements VAJUtil | |||||
| } | } | ||||
| catch( IOException ex ) | catch( IOException ex ) | ||||
| { | { | ||||
| log( "Error sending tool request to VAJ" + ex, MSG_ERR ); | |||||
| getLogger().error( "Error sending tool request to VAJ" + ex ); | |||||
| throw new TaskException( "Couldn't execute " + request ); | throw new TaskException( "Couldn't execute " + request ); | ||||
| } | } | ||||
| if( requestFailed ) | if( requestFailed ) | ||||
| @@ -65,7 +65,7 @@ public abstract class VAJToolsServlet extends HttpServlet | |||||
| } | } | ||||
| catch( TaskException e ) | catch( TaskException e ) | ||||
| { | { | ||||
| util.log( "Error occured: " + e.getMessage(), VAJUtil.MSG_ERR ); | |||||
| util.getLogger().error( "Error occured: " + e.getMessage() ); | |||||
| } | } | ||||
| catch( Exception e ) | catch( Exception e ) | ||||
| { | { | ||||
| @@ -188,7 +188,7 @@ public class JJTree extends Task | |||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | ||||
| exe.setError( new LogOutputStream( this, Project.MSG_INFO ) ); | exe.setError( new LogOutputStream( this, Project.MSG_INFO ) ); | ||||
| log( cmdl.toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( cmdl.toString() ); | |||||
| exe.setCommandline( cmdl.getCommandline() ); | exe.setCommandline( cmdl.getCommandline() ); | ||||
| try | try | ||||
| @@ -11,7 +11,6 @@ import java.io.File; | |||||
| import java.util.Enumeration; | import java.util.Enumeration; | ||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | import org.apache.tools.ant.taskdefs.exec.Execute; | ||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| @@ -216,7 +215,7 @@ public class JavaCC extends Task | |||||
| 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() ) | ||||
| { | { | ||||
| log( "Target is already built - skipping (" + target + ")", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Target is already built - skipping (" + target + ")" ); | |||||
| return; | return; | ||||
| } | } | ||||
| cmdl.createArgument().setValue( target.getAbsolutePath() ); | cmdl.createArgument().setValue( target.getAbsolutePath() ); | ||||
| @@ -275,7 +275,7 @@ public class JDependTask extends Task | |||||
| if( getHaltonerror() ) | if( getHaltonerror() ) | ||||
| throw new TaskException( "JDepend failed" ); | throw new TaskException( "JDepend failed" ); | ||||
| else | else | ||||
| log( "JDepend FAILED", Project.MSG_ERR ); | |||||
| getLogger().error( "JDepend FAILED" ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -339,7 +339,7 @@ public class JDependTask extends Task | |||||
| if( getOutputFile() != null ) | if( getOutputFile() != null ) | ||||
| getLogger().info( "Output to be stored in " + getOutputFile().getPath() ); | getLogger().info( "Output to be stored in " + getOutputFile().getPath() ); | ||||
| log( "Executing: " + commandline.toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Executing: " + commandline.toString() ); | |||||
| try | try | ||||
| { | { | ||||
| return exe.execute(); | return exe.execute(); | ||||
| @@ -9,7 +9,6 @@ package org.apache.tools.ant.taskdefs.optional.jlink; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -158,18 +157,18 @@ public class JlinkTask extends MatchingTask | |||||
| throw new TaskException( "addfiles or mergefiles required! Please set." ); | throw new TaskException( "addfiles or mergefiles required! Please set." ); | ||||
| } | } | ||||
| getLogger().info( "linking: " + outfile.getPath() ); | getLogger().info( "linking: " + outfile.getPath() ); | ||||
| log( "compression: " + compress, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "compression: " + compress ); | |||||
| jlink linker = new jlink(); | jlink linker = new jlink(); | ||||
| linker.setOutfile( outfile.getPath() ); | linker.setOutfile( outfile.getPath() ); | ||||
| linker.setCompression( compress ); | linker.setCompression( compress ); | ||||
| if( haveMergeFiles() ) | if( haveMergeFiles() ) | ||||
| { | { | ||||
| log( "merge files: " + mergefiles.toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "merge files: " + mergefiles.toString() ); | |||||
| linker.addMergeFiles( mergefiles.list() ); | linker.addMergeFiles( mergefiles.list() ); | ||||
| } | } | ||||
| if( haveAddFiles() ) | if( haveAddFiles() ) | ||||
| { | { | ||||
| log( "add files: " + addfiles.toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "add files: " + addfiles.toString() ); | |||||
| linker.addAddFiles( addfiles.list() ); | linker.addAddFiles( addfiles.list() ); | ||||
| } | } | ||||
| try | try | ||||
| @@ -12,7 +12,6 @@ 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.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| 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; | ||||
| @@ -381,7 +380,7 @@ public class JspC extends MatchingTask | |||||
| { | { | ||||
| compiler = "jasper"; | compiler = "jasper"; | ||||
| } | } | ||||
| log( "compiling " + compileList.size() + " files", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "compiling " + compileList.size() + " files" ); | |||||
| if( compileList.size() > 0 ) | if( compileList.size() > 0 ) | ||||
| { | { | ||||
| @@ -405,7 +404,7 @@ public class JspC extends MatchingTask | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( FAIL_MSG, Project.MSG_ERR ); | |||||
| getLogger().error( FAIL_MSG ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -413,11 +412,11 @@ public class JspC extends MatchingTask | |||||
| { | { | ||||
| if( filecount == 0 ) | if( filecount == 0 ) | ||||
| { | { | ||||
| log( "there were no files to compile", Project.MSG_INFO ); | |||||
| getLogger().info( "there were no files to compile" ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "all files are up to date", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "all files are up to date" ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -462,8 +461,9 @@ public class JspC extends MatchingTask | |||||
| if( srcFile.lastModified() > now ) | if( srcFile.lastModified() > now ) | ||||
| { | { | ||||
| log( "Warning: file modified in the future: " + | |||||
| files[ i ], Project.MSG_WARN ); | |||||
| final String message = | |||||
| "Warning: file modified in the future: " + files[ i ]; | |||||
| getLogger().warn( message ); | |||||
| } | } | ||||
| if( !javaFile.exists() || | if( !javaFile.exists() || | ||||
| @@ -471,16 +471,11 @@ public class JspC extends MatchingTask | |||||
| { | { | ||||
| if( !javaFile.exists() ) | if( !javaFile.exists() ) | ||||
| { | { | ||||
| log( "Compiling " + srcFile.getPath() + | |||||
| " because java file " | |||||
| + javaFile.getPath() + " does not exist", | |||||
| Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Compiling " + srcFile.getPath() + " because java file " + javaFile.getPath() + " does not exist" ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Compiling " + srcFile.getPath() + | |||||
| " because it is out of date with respect to " | |||||
| + javaFile.getPath(), Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Compiling " + srcFile.getPath() + " because it is out of date with respect to " + javaFile.getPath() ); | |||||
| } | } | ||||
| compileList.add( srcFile.getAbsolutePath() ); | compileList.add( srcFile.getAbsolutePath() ); | ||||
| } | } | ||||
| @@ -13,7 +13,6 @@ 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.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| 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.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -233,7 +232,7 @@ public class WLJspc extends MatchingTask | |||||
| helperTask.setClasspath( compileClasspath ); | helperTask.setClasspath( compileClasspath ); | ||||
| if( helperTask.executeJava() != 0 ) | if( helperTask.executeJava() != 0 ) | ||||
| { | { | ||||
| log( files[ i ] + " failed to compile", Project.MSG_WARN ); | |||||
| getLogger().warn( files[ i ] + " failed to compile" ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -295,14 +294,14 @@ public class WLJspc extends MatchingTask | |||||
| if( srcFile.lastModified() > now ) | if( srcFile.lastModified() > now ) | ||||
| { | { | ||||
| log( "Warning: file modified in the future: " + | |||||
| files[ i ], Project.MSG_WARN ); | |||||
| final String message = "Warning: file modified in the future: " + files[ i ]; | |||||
| getLogger().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 ] ); | ||||
| log( "Recompiling File " + files[ i ], Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Recompiling File " + files[ i ] ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -9,7 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.jsp.compilers; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||||
| import org.apache.tools.ant.taskdefs.optional.jsp.JspC; | import org.apache.tools.ant.taskdefs.optional.jsp.JspC; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| @@ -20,6 +20,7 @@ import org.apache.tools.ant.types.Commandline; | |||||
| * @author Matthew Watson <a href="mailto:mattw@i3sp.com">mattw@i3sp.com</a> | * @author Matthew Watson <a href="mailto:mattw@i3sp.com">mattw@i3sp.com</a> | ||||
| */ | */ | ||||
| public abstract class DefaultCompilerAdapter | public abstract class DefaultCompilerAdapter | ||||
| extends AbstractLogEnabled | |||||
| implements CompilerAdapter | implements CompilerAdapter | ||||
| { | { | ||||
| /* | /* | ||||
| @@ -56,7 +57,7 @@ public abstract class DefaultCompilerAdapter | |||||
| ArrayList compileList, | ArrayList compileList, | ||||
| Commandline cmd ) | Commandline cmd ) | ||||
| { | { | ||||
| jspc.log( "Compilation args: " + cmd.toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Compilation args: " + cmd.toString() ); | |||||
| StringBuffer niceSourceList = new StringBuffer( "File" ); | StringBuffer niceSourceList = new StringBuffer( "File" ); | ||||
| if( compileList.size() != 1 ) | if( compileList.size() != 1 ) | ||||
| @@ -75,10 +76,7 @@ public abstract class DefaultCompilerAdapter | |||||
| niceSourceList.append( " " + arg + lSep ); | niceSourceList.append( " " + arg + lSep ); | ||||
| } | } | ||||
| jspc.log( niceSourceList.toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( niceSourceList.toString() ); | |||||
| } | } | ||||
| /* | |||||
| * ------------------------------------------------------------ | |||||
| */ | |||||
| } | } | ||||
| @@ -8,7 +8,6 @@ | |||||
| package org.apache.tools.ant.taskdefs.optional.jsp.compilers; | package org.apache.tools.ant.taskdefs.optional.jsp.compilers; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.taskdefs.optional.jsp.JspC; | import org.apache.tools.ant.taskdefs.optional.jsp.JspC; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| @@ -28,7 +27,7 @@ public class JasperC | |||||
| public boolean execute() | public boolean execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| getJspc().log( "Using jasper compiler", Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Using jasper compiler" ); | |||||
| Commandline cmd = setupJasperCommand(); | Commandline cmd = setupJasperCommand(); | ||||
| try | try | ||||
| @@ -17,7 +17,6 @@ import javax.xml.parsers.DocumentBuilder; | |||||
| import javax.xml.parsers.DocumentBuilderFactory; | import javax.xml.parsers.DocumentBuilderFactory; | ||||
| 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.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| import org.w3c.dom.Document; | import org.w3c.dom.Document; | ||||
| @@ -83,7 +82,7 @@ public class AggregateTransformer | |||||
| */ | */ | ||||
| public void setExtension( String ext ) | public void setExtension( String ext ) | ||||
| { | { | ||||
| task.log( "extension is not used anymore", Project.MSG_WARN ); | |||||
| task.getLogger().warn( "extension is not used anymore" ); | |||||
| } | } | ||||
| public void setFormat( Format format ) | public void setFormat( Format format ) | ||||
| @@ -465,27 +465,24 @@ public class JUnitTask extends Task | |||||
| { | { | ||||
| int pling = u.indexOf( "!" ); | int pling = u.indexOf( "!" ); | ||||
| String jarName = u.substring( 9, pling ); | String jarName = u.substring( 9, pling ); | ||||
| log( "Implicitly adding " + jarName + " to classpath", | |||||
| Project.MSG_DEBUG ); | |||||
| getLogger().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 ); | ||||
| log( "Implicitly adding " + dirName + " to classpath", | |||||
| Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Implicitly adding " + dirName + " to classpath" ); | |||||
| createClasspath().setLocation( new File( ( new File( dirName ) ).getAbsolutePath() ) ); | createClasspath().setLocation( new File( ( new File( dirName ) ).getAbsolutePath() ) ); | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Don\'t know how to handle resource URL " + u, | |||||
| Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Don\'t know how to handle resource URL " + u ); | |||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "Couldn\'t find " + resource, Project.MSG_DEBUG ); | |||||
| getLogger().debug( "Couldn\'t find " + resource ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -542,8 +539,9 @@ public class JUnitTask extends Task | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| log( "TEST " + test.getName() + " FAILED" | |||||
| + ( wasKilled ? " (timeout)" : "" ), Project.MSG_ERR ); | |||||
| final String message = "TEST " + test.getName() + " FAILED" + | |||||
| ( wasKilled ? " (timeout)" : "" ); | |||||
| getLogger().error( message ); | |||||
| if( errorOccurredHere && test.getErrorProperty() != null ) | if( errorOccurredHere && test.getErrorProperty() != null ) | ||||
| { | { | ||||
| setProperty( test.getErrorProperty(), "true" ); | setProperty( test.getErrorProperty(), "true" ); | ||||
| @@ -609,7 +607,7 @@ public class JUnitTask extends Task | |||||
| cmd.createArgument().setValue( "haltOnFailure=" + test.getHaltonfailure() ); | cmd.createArgument().setValue( "haltOnFailure=" + test.getHaltonfailure() ); | ||||
| if( summary ) | if( summary ) | ||||
| { | { | ||||
| log( "Running " + test.getName(), Project.MSG_INFO ); | |||||
| getLogger().info( "Running " + test.getName() ); | |||||
| cmd.createArgument().setValue( "formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter" ); | cmd.createArgument().setValue( "formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter" ); | ||||
| } | } | ||||
| @@ -661,7 +659,7 @@ public class JUnitTask extends Task | |||||
| exe.setWorkingDirectory( dir ); | exe.setWorkingDirectory( dir ); | ||||
| } | } | ||||
| log( "Executing: " + cmd.toString(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Executing: " + cmd.toString() ); | |||||
| int retVal; | int retVal; | ||||
| try | try | ||||
| { | { | ||||
| @@ -693,7 +691,7 @@ public class JUnitTask extends Task | |||||
| test.setProperties( getProject().getProperties() ); | test.setProperties( getProject().getProperties() ); | ||||
| if( dir != null ) | if( dir != null ) | ||||
| { | { | ||||
| log( "dir attribute ignored if running in the same VM", Project.MSG_WARN ); | |||||
| getLogger().warn( "dir attribute ignored if running in the same VM" ); | |||||
| } | } | ||||
| CommandlineJava.SysProperties sysProperties = commandline.getSystemProperties(); | CommandlineJava.SysProperties sysProperties = commandline.getSystemProperties(); | ||||
| @@ -703,12 +701,12 @@ public class JUnitTask extends Task | |||||
| } | } | ||||
| try | try | ||||
| { | { | ||||
| log( "Using System properties " + System.getProperties(), Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Using System properties " + System.getProperties() ); | |||||
| AntClassLoader cl = null; | AntClassLoader cl = null; | ||||
| Path classpath = commandline.getClasspath(); | Path classpath = commandline.getClasspath(); | ||||
| if( classpath != null ) | if( classpath != null ) | ||||
| { | { | ||||
| log( "Using CLASSPATH " + classpath, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( "Using CLASSPATH " + classpath ); | |||||
| cl = new AntClassLoader( null, getProject(), classpath, false ); | cl = new AntClassLoader( null, getProject(), classpath, false ); | ||||
| // make sure the test will be accepted as a TestCase | // make sure the test will be accepted as a TestCase | ||||
| @@ -719,7 +717,7 @@ public class JUnitTask extends Task | |||||
| runner = new JUnitTestRunner( test, test.getHaltonerror(), test.getFiltertrace(), test.getHaltonfailure(), cl ); | runner = new JUnitTestRunner( test, test.getHaltonerror(), test.getFiltertrace(), test.getHaltonfailure(), cl ); | ||||
| if( summary ) | if( summary ) | ||||
| { | { | ||||
| log( "Running " + test.getName(), Project.MSG_INFO ); | |||||
| getLogger().info( "Running " + test.getName() ); | |||||
| SummaryJUnitResultFormatter f = | SummaryJUnitResultFormatter f = | ||||
| new SummaryJUnitResultFormatter(); | new SummaryJUnitResultFormatter(); | ||||
| @@ -21,7 +21,6 @@ import org.apache.avalon.excalibur.io.FileUtil; | |||||
| import org.apache.avalon.framework.ExceptionUtil; | import org.apache.avalon.framework.ExceptionUtil; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| import org.apache.tools.ant.util.DOMElementWriter; | import org.apache.tools.ant.util.DOMElementWriter; | ||||
| @@ -275,7 +274,7 @@ public class XMLResultAggregator extends Task implements XMLConstants | |||||
| { | { | ||||
| try | try | ||||
| { | { | ||||
| log( "Parsing file: '" + files[ i ] + "'", Project.MSG_VERBOSE ); | |||||
| getLogger().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. | ||||
| @@ -289,19 +288,19 @@ public class XMLResultAggregator extends Task implements XMLConstants | |||||
| else | else | ||||
| { | { | ||||
| // issue a warning. | // issue a warning. | ||||
| log( "the file " + files[ i ] + " is not a valid testsuite XML document", Project.MSG_WARN ); | |||||
| getLogger().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 | ||||
| log( "The file " + files[ i ] + " is not a valid XML document. It is possibly corrupted.", Project.MSG_WARN ); | |||||
| log( ExceptionUtil.printStackTrace( e ), Project.MSG_DEBUG ); | |||||
| getLogger().warn( "The file " + files[ i ] + " is not a valid XML document. It is possibly corrupted." ); | |||||
| getLogger().debug( ExceptionUtil.printStackTrace( e ) ); | |||||
| } | } | ||||
| catch( IOException e ) | catch( IOException e ) | ||||
| { | { | ||||
| log( "Error while accessing file " + files[ i ] + ": " + e.getMessage(), Project.MSG_ERR ); | |||||
| getLogger().error( "Error while accessing file " + files[ i ] + ": " + e.getMessage() ); | |||||
| } | } | ||||
| } | } | ||||
| return rootElement; | return rootElement; | ||||