ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound AntSoundPlayer.java
Date Wed, 13 Feb 2002 03:02:55 GMT
adammurdoch    02/02/12 19:02:55

  Modified:    proposal/myrmidon/src/manifest builtin-ant-descriptor.xml
               proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor
                        DefaultEmbeddor.java
               proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace
                        DefaultWorkspace.java
                        LogTargetToListenerAdapter.java
                        ProjectListenerSupport.java
               proposal/myrmidon/src/java/org/apache/myrmidon/frontends
                        CLIMain.java Resources.properties
               proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/embeddor
                        Embeddor.java
               proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/workspace
                        Workspace.java
               proposal/myrmidon/src/java/org/apache/myrmidon/listeners
                        AbstractProjectListener.java
                        ClassicProjectListener.java
                        DefaultProjectListener.java ProjectListener.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs
                        RecorderEntry.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional
                        IContract.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound
                        AntSoundPlayer.java
  Added:       proposal/myrmidon/src/java/org/apache/myrmidon/listeners
                        LogEvent.java NoPrefixProjectListener.java
                        ProjectEvent.java TargetEvent.java TaskEvent.java
  Log:
  Changes to listeners:
  
  * CLIMain now uses the listener's short name, rather than classname, to
    construct the listener.  This is done with the help of the Embeddor.
  
  * Added NoPrefixProjectListener, which emulates the -emacs mode of Ant 1.x.
  
  * Added -p, --noprefix command-line option, to use the NoPrefixProjectListener.
  
  * Changed the methods on ProjectListener to take event objects.  Combined the
    log() methods into a single method.
  
  * Moved state tracking out of AbstractProjectListener, and into DefaultWorkspace
    (where it doesn't need to be tracked).  State info is now available via the
    event objects passed to the listener methods.
  
  Revision  Changes    Path
  1.7       +1 -0      jakarta-ant/proposal/myrmidon/src/manifest/builtin-ant-descriptor.xml
  
  Index: builtin-ant-descriptor.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/manifest/builtin-ant-descriptor.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- builtin-ant-descriptor.xml	12 Feb 2002 10:19:49 -0000	1.6
  +++ builtin-ant-descriptor.xml	13 Feb 2002 03:02:54 -0000	1.7
  @@ -4,6 +4,7 @@
   
       <listener name="default" classname="org.apache.myrmidon.listeners.DefaultProjectListener"/>
       <listener name="classic" classname="org.apache.myrmidon.listeners.ClassicProjectListener"/>
  +    <listener name="noprefix" classname="org.apache.myrmidon.listeners.NoPrefixProjectListener"/>
       <aspect name="noop" classname="org.apache.myrmidon.aspects.NoopAspectHandler"/>
       <project-builder name="ant" classname="org.apache.myrmidon.components.builder.DefaultProjectBuilder"/>
       <project-builder name="xml" classname="org.apache.myrmidon.components.builder.DefaultProjectBuilder"/>
  
  
  
  1.23      +15 -1     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java
  
  Index: DefaultEmbeddor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- DefaultEmbeddor.java	10 Feb 2002 02:34:13 -0000	1.22
  +++ DefaultEmbeddor.java	13 Feb 2002 03:02:54 -0000	1.23
  @@ -41,13 +41,14 @@
   import org.apache.myrmidon.interfaces.type.TypeFactory;
   import org.apache.myrmidon.interfaces.type.TypeManager;
   import org.apache.myrmidon.interfaces.workspace.Workspace;
  +import org.apache.myrmidon.listeners.ProjectListener;
   
   /**
    * Default implementation of Embeddor.
    * Instantiate this to embed inside other applications.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.22 $ $Date: 2002/02/10 02:34:13 $
  + * @version $Revision: 1.23 $ $Date: 2002/02/13 03:02:54 $
    */
   public class DefaultEmbeddor
       extends AbstractLogEnabled
  @@ -124,6 +125,19 @@
               (Workspace)createComponent( component, Workspace.class );
           setupObject( workspace, parameters );
           return workspace;
  +    }
  +
  +    /**
  +     * Creates a project listener.
  +     *
  +     * @param name The shorthand name of the listener.
  +     * @return the listener.
  +     */
  +    public ProjectListener createListener( String name )
  +        throws Exception
  +    {
  +        final TypeFactory factory = m_typeManager.getFactory( ProjectListener.class );
  +        return (ProjectListener)factory.create( name );
       }
   
       /**
  
  
  
  1.21      +4 -4      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java
  
  Index: DefaultWorkspace.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- DefaultWorkspace.java	12 Feb 2002 10:23:01 -0000	1.20
  +++ DefaultWorkspace.java	13 Feb 2002 03:02:54 -0000	1.21
  @@ -45,7 +45,7 @@
    * This is the default implementation of Workspace.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.20 $ $Date: 2002/02/12 10:23:01 $
  + * @version $Revision: 1.21 $ $Date: 2002/02/13 03:02:54 $
    */
   public class DefaultWorkspace
       extends AbstractLogEnabled
  @@ -130,13 +130,13 @@
       {
           final ProjectEntry entry = getProjectEntry( project );
   
  -        m_listenerSupport.projectStarted();
  +        m_listenerSupport.projectStarted( project.getProjectName() );
   
           executeTarget( "<init>", project.getImplicitTarget(), entry.getFrame() );
   
           execute( project, target, entry );
   
  -        m_listenerSupport.projectFinished();
  +        m_listenerSupport.projectFinished( project.getProjectName() );
       }
   
       private TaskContext createBaseContext()
  @@ -383,7 +383,7 @@
           }
   
           //notify listeners
  -        m_listenerSupport.targetStarted( targetName );
  +        m_listenerSupport.targetStarted( project.getProjectName(), targetName );
   
           executeTarget( targetName, target, entry.getFrame() );
   
  
  
  
  1.6       +6 -13     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/LogTargetToListenerAdapter.java
  
  Index: LogTargetToListenerAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/LogTargetToListenerAdapter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LogTargetToListenerAdapter.java	7 Feb 2002 13:02:20 -0000	1.5
  +++ LogTargetToListenerAdapter.java	13 Feb 2002 03:02:54 -0000	1.6
  @@ -15,21 +15,21 @@
    * Adapter between Avalon LogKit and Project listener interfaces.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.5 $ $Date: 2002/02/07 13:02:20 $
  + * @version $Revision: 1.6 $ $Date: 2002/02/13 03:02:54 $
    */
   public class LogTargetToListenerAdapter
       implements LogTarget
   {
  -    private final ProjectListener m_listener;
  +    private final ProjectListenerSupport m_listenerSupport;
   
       /**
        * Constructor taking listener to convert to.
        *
  -     * @param listener the ProjectListener
  +     * @param listenerSupport the ProjectListener
        */
  -    public LogTargetToListenerAdapter( final ProjectListener listener )
  +    public LogTargetToListenerAdapter( final ProjectListenerSupport listenerSupport )
       {
  -        m_listener = listener;
  +        m_listenerSupport = listenerSupport;
       }
   
       /**
  @@ -39,13 +39,6 @@
        */
       public void processEvent( final LogEvent event )
       {
  -        if( null == event.getThrowable() )
  -        {
  -            m_listener.log( event.getMessage() );
  -        }
  -        else
  -        {
  -            m_listener.log( event.getMessage(), event.getThrowable() );
  -        }
  +        m_listenerSupport.log( event.getMessage(), event.getThrowable() );
       }
   }
  
  
  
  1.8       +91 -28    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/ProjectListenerSupport.java
  
  Index: ProjectListenerSupport.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/ProjectListenerSupport.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ProjectListenerSupport.java	7 Feb 2002 13:02:20 -0000	1.7
  +++ ProjectListenerSupport.java	13 Feb 2002 03:02:54 -0000	1.8
  @@ -8,17 +8,26 @@
   package org.apache.myrmidon.components.workspace;
   
   import org.apache.myrmidon.listeners.ProjectListener;
  +import org.apache.myrmidon.listeners.ProjectEvent;
  +import org.apache.myrmidon.listeners.TargetEvent;
  +import org.apache.myrmidon.listeners.TaskEvent;
  +import org.apache.myrmidon.listeners.LogEvent;
   
   /**
    * Support for the project listener event dispatching.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.7 $ $Date: 2002/02/07 13:02:20 $
  + * @version $Revision: 1.8 $ $Date: 2002/02/13 03:02:54 $
    */
   public class ProjectListenerSupport
  -    implements ProjectListener
  +    implements LogEvent
   {
       private ProjectListener[] m_listeners = new ProjectListener[ 0 ];
  +    private String m_projectName;
  +    private String m_targetName;
  +    private String m_taskName;
  +    private String m_message;
  +    private Throwable m_throwable;
   
       /**
        * Add an extra project listener that wants to receive notification of listener events.
  @@ -68,35 +77,47 @@
       /**
        * Fire a projectStarted event.
        */
  -    public void projectStarted()
  +    public void projectStarted( final String projectName )
       {
  +        m_projectName = projectName;
  +        m_targetName = null;
  +        m_taskName = null;
  +
           for( int i = 0; i < m_listeners.length; i++ )
           {
  -            m_listeners[ i ].projectStarted();
  +            m_listeners[ i ].projectStarted( this );
           }
       }
   
       /**
        * Fire a projectFinished event.
        */
  -    public void projectFinished()
  +    public void projectFinished( final String projectName )
       {
  +        m_projectName = projectName;
  +
           for( int i = 0; i < m_listeners.length; i++ )
           {
  -            m_listeners[ i ].projectFinished();
  +            m_listeners[ i ].projectFinished( this );
           }
  +
  +        m_projectName = null;
  +        m_targetName = null;
  +        m_taskName = null;
       }
   
       /**
        * Fire a targetStarted event.
  -     *
  -     * @param targetName the name of target
        */
  -    public void targetStarted( String targetName )
  +    public void targetStarted( final String projectName, final String targetName )
       {
  +        m_projectName = projectName;
  +        m_targetName = targetName;;
  +        m_taskName = null;
  +
           for( int i = 0; i < m_listeners.length; i++ )
           {
  -            m_listeners[ i ].targetStarted( targetName );
  +            m_listeners[ i ].targetStarted( this );
           }
       }
   
  @@ -107,20 +128,23 @@
       {
           for( int i = 0; i < m_listeners.length; i++ )
           {
  -            m_listeners[ i ].targetFinished();
  +            m_listeners[ i ].targetFinished( this );
           }
  +
  +        m_targetName = null;
  +        m_taskName = null;
       }
   
       /**
        * Fire a targetStarted event.
  -     *
  -     * @param targetName the name of target
        */
  -    public void taskStarted( String taskName )
  +    public void taskStarted( final String taskName )
       {
  +        m_taskName = taskName;
  +
           for( int i = 0; i < m_listeners.length; i++ )
           {
  -            m_listeners[ i ].taskStarted( taskName );
  +            m_listeners[ i ].taskStarted( this );
           }
       }
   
  @@ -131,8 +155,10 @@
       {
           for( int i = 0; i < m_listeners.length; i++ )
           {
  -            m_listeners[ i ].taskFinished();
  +            m_listeners[ i ].taskFinished( this );
           }
  +
  +        m_taskName = null;
       }
   
       /**
  @@ -140,25 +166,62 @@
        *
        * @param message the log message
        */
  -    public void log( String message )
  +    public void log( String message, Throwable throwable )
       {
  -        for( int i = 0; i < m_listeners.length; i++ )
  +        m_message = message;
  +        m_throwable = throwable;
  +
  +        try
  +        {
  +            for( int i = 0; i < m_listeners.length; i++ )
  +            {
  +                m_listeners[ i ].log( this );
  +            }
  +        }
  +        finally
           {
  -            m_listeners[ i ].log( message );
  +            m_message = null;
  +            m_throwable = null;
           }
       }
   
       /**
  -     * Fire a log event.
  -     *
  -     * @param message the log message
  -     * @param throwable the throwable to be logged
  +     * Returns the message.
        */
  -    public void log( String message, Throwable throwable )
  +    public String getMessage()
       {
  -        for( int i = 0; i < m_listeners.length; i++ )
  -        {
  -            m_listeners[ i ].log( message, throwable );
  -        }
  +        return m_message;
  +    }
  +
  +    /**
  +     * Returns the error that occurred.
  +     */
  +    public Throwable getThrowable()
  +    {
  +        return m_throwable;
  +    }
  +
  +    /**
  +     * Returns the name of the task.
  +     */
  +    public String getTaskName()
  +    {
  +        return m_taskName;
  +    }
  +
  +    /**
  +     * Returns the name of the target.
  +     */
  +    public String getTargetName()
  +    {
  +        return m_targetName;
  +    }
  +
  +    /**
  +     * Returns the name of the project.
  +     */
  +    public String getProjectName()
  +    {
  +        return m_projectName;
       }
   }
  
  
  
  1.24      +43 -60    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java
  
  Index: CLIMain.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- CLIMain.java	12 Feb 2002 10:28:33 -0000	1.23
  +++ CLIMain.java	13 Feb 2002 03:02:54 -0000	1.24
  @@ -42,7 +42,7 @@
    * to run project.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.23 $ $Date: 2002/02/12 10:28:33 $
  + * @version $Revision: 1.24 $ $Date: 2002/02/13 03:02:54 $
    */
   public class CLIMain
       extends AbstractLogEnabled
  @@ -61,6 +61,7 @@
       private final static int LOG_LEVEL_OPT = 'l';
       private final static int DEFINE_OPT = 'D';
       private final static int BUILDER_PARAM_OPT = 'B';
  +    private final static int NO_PREFIX_OPT = 'p';
       private final static int VERSION_OPT = 1;
       private final static int LISTENER_OPT = 2;
       private final static int TASKLIB_DIR_OPT = 5;
  @@ -72,8 +73,9 @@
       private final static int[] INFO_OPT_INCOMPAT = new int[]
       {
           HELP_OPT, QUIET_OPT, VERBOSE_OPT, FILE_OPT,
  -        LOG_LEVEL_OPT, VERSION_OPT, LISTENER_OPT,
  -        DEFINE_OPT, DRY_RUN_OPT //TASKLIB_DIR_OPT, HOME_DIR_OPT
  +        LOG_LEVEL_OPT, BUILDER_PARAM_OPT, NO_PREFIX_OPT,
  +        VERSION_OPT, LISTENER_OPT, TASKLIB_DIR_OPT,
  +        INCREMENTAL_OPT, HOME_DIR_OPT, DRY_RUN_OPT
       };
   
       //incompatable options for other logging options
  @@ -82,6 +84,12 @@
           QUIET_OPT, VERBOSE_OPT, LOG_LEVEL_OPT
       };
   
  +    //incompatible options for listener options
  +    private final static int[] LISTENER_OPT_INCOMPAT = new int[]
  +    {
  +        LISTENER_OPT, NO_PREFIX_OPT
  +    };
  +
       ///Parameters for run of myrmidon
       private Parameters m_parameters = new Parameters();
   
  @@ -138,79 +146,73 @@
       private CLOptionDescriptor[] createCLOptions()
       {
           //TODO: localise
  -        final CLOptionDescriptor[] options = new CLOptionDescriptor[ 13 ];
  -        options[ 0 ] =
  +        final CLOptionDescriptor[] options = {
               new CLOptionDescriptor( "help",
                                       CLOptionDescriptor.ARGUMENT_DISALLOWED,
                                       HELP_OPT,
                                       REZ.getString( "help.opt" ),
  -                                    INFO_OPT_INCOMPAT );
  -        options[ 1 ] =
  +                                    INFO_OPT_INCOMPAT ),
               new CLOptionDescriptor( "file",
                                       CLOptionDescriptor.ARGUMENT_REQUIRED,
                                       FILE_OPT,
  -                                    REZ.getString( "file.opt" ) );
  -        options[ 2 ] =
  +                                    REZ.getString( "file.opt" ) ),
               new CLOptionDescriptor( "log-level",
                                       CLOptionDescriptor.ARGUMENT_REQUIRED,
                                       LOG_LEVEL_OPT,
                                       REZ.getString( "log-level.opt" ),
  -                                    LOG_OPT_INCOMPAT );
  -        options[ 3 ] =
  +                                    LOG_OPT_INCOMPAT ),
               new CLOptionDescriptor( "quiet",
                                       CLOptionDescriptor.ARGUMENT_DISALLOWED,
                                       QUIET_OPT,
                                       REZ.getString( "quiet.opt" ),
  -                                    LOG_OPT_INCOMPAT );
  -        options[ 4 ] =
  +                                    LOG_OPT_INCOMPAT ),
               new CLOptionDescriptor( "verbose",
                                       CLOptionDescriptor.ARGUMENT_DISALLOWED,
                                       VERBOSE_OPT,
                                       REZ.getString( "verbose.opt" ),
  -                                    LOG_OPT_INCOMPAT );
  -        options[ 5 ] =
  +                                    LOG_OPT_INCOMPAT ),
               new CLOptionDescriptor( "listener",
                                       CLOptionDescriptor.ARGUMENT_REQUIRED,
                                       LISTENER_OPT,
  -                                    REZ.getString( "listener.opt" ) );
  -        options[ 6 ] =
  +                                    REZ.getString( "listener.opt" ),
  +                                    LISTENER_OPT_INCOMPAT ),
  +            new CLOptionDescriptor( "noprefix",
  +                                    CLOptionDescriptor.ARGUMENT_DISALLOWED,
  +                                    NO_PREFIX_OPT,
  +                                    REZ.getString( "noprefix.opt" ),
  +                                    LISTENER_OPT_INCOMPAT ),
               new CLOptionDescriptor( "version",
                                       CLOptionDescriptor.ARGUMENT_DISALLOWED,
                                       VERSION_OPT,
                                       REZ.getString( "version.opt" ),
  -                                    INFO_OPT_INCOMPAT );
  -
  -        options[ 7 ] =
  +                                    INFO_OPT_INCOMPAT ),
               new CLOptionDescriptor( "task-lib-dir",
                                       CLOptionDescriptor.ARGUMENT_REQUIRED,
                                       TASKLIB_DIR_OPT,
  -                                    REZ.getString( "tasklib.opt" ) );
  -        options[ 8 ] =
  +                                    REZ.getString( "tasklib.opt" ) ),
               new CLOptionDescriptor( "incremental",
                                       CLOptionDescriptor.ARGUMENT_DISALLOWED,
                                       INCREMENTAL_OPT,
  -                                    REZ.getString( "incremental.opt" ) );
  -        options[ 9 ] =
  +                                    REZ.getString( "incremental.opt" ) ),
               new CLOptionDescriptor( "ant-home",
                                       CLOptionDescriptor.ARGUMENT_REQUIRED,
                                       HOME_DIR_OPT,
  -                                    REZ.getString( "home.opt" ) );
  -        options[ 10 ] =
  +                                    REZ.getString( "home.opt" ) ),
               new CLOptionDescriptor( "define",
                                       CLOptionDescriptor.ARGUMENTS_REQUIRED_2,
                                       DEFINE_OPT,
                                       REZ.getString( "define.opt" ),
  -                                    new int[ 0 ] );
  -        options[ 11 ] =
  +                                    new int[ 0 ] ),
               new CLOptionDescriptor( "builder-parameter",
                                       CLOptionDescriptor.ARGUMENTS_REQUIRED_2,
                                       BUILDER_PARAM_OPT,
  -                                    REZ.getString( "build.opt" ) );
  -        options[ 12 ] =
  +                                    REZ.getString( "build.opt" ) ),
               new CLOptionDescriptor( "dry-run",
                                       CLOptionDescriptor.ARGUMENT_DISALLOWED,
                                       DRY_RUN_OPT,
  -                                    REZ.getString( "dry-run.opt" ) );
  +                                    REZ.getString( "dry-run.opt" ) )
  +        };
  +
           return options;
       }
   
  @@ -266,9 +268,13 @@
                   case FILE_OPT:
                       m_parameters.setParameter( "filename", option.getArgument() );
                       break;
  +
                   case LISTENER_OPT:
                       m_parameters.setParameter( "listener", option.getArgument() );
                       break;
  +                case NO_PREFIX_OPT:
  +                    m_parameters.setParameter( "listener", "noprefix" );
  +                    break;
   
                   case DEFINE_OPT:
                       m_defines.setParameter( option.getArgument( 0 ), option.getArgument( 1 ) );
  @@ -298,7 +304,7 @@
   
           m_parameters.setParameter( "filename", "build.ant" );
           m_parameters.setParameter( "log.level", "WARN" );
  -        m_parameters.setParameter( "listener", "org.apache.myrmidon.listeners.DefaultProjectListener" );
  +        m_parameters.setParameter( "listener", "default" );
           m_parameters.setParameter( "incremental", "false" );
       }
   
  @@ -332,10 +338,6 @@
               throw new Exception( message );
           }
   
  -        //handle listener..
  -        final String listenerName = m_parameters.getParameter( "listener", null );
  -        final ProjectListener listener = createListener( listenerName );
  -
           if( getLogger().isInfoEnabled() )
           {
               final String message = REZ.getString( "buildfile.notice", buildFile );
  @@ -363,6 +365,10 @@
           embeddor.initialize();
           embeddor.start();
   
  +        //create the listener
  +        final String listenerName = m_parameters.getParameter( "listener", null );
  +        final ProjectListener listener = embeddor.createListener( listenerName );
  +
           //create the project
           final Project project =
               embeddor.createProject( buildFile.toString(), null, m_builderParameters );
  @@ -415,7 +421,7 @@
       /**
        * Actually do the build.
        *
  -     * @param manager the manager
  +     * @param workspace the workspace
        * @param project the project
        * @param targets the targets to build as passed by CLI
        */
  @@ -477,27 +483,4 @@
   
           return logger;
       }
  -
  -    /**
  -     * Setup project listener.
  -     *
  -     * @param listener the classname of project listener
  -     */
  -    private ProjectListener createListener( final String listener )
  -        throws Exception
  -    {
  -        try
  -        {
  -            return (ProjectListener)Class.forName( listener ).newInstance();
  -        }
  -        catch( final Throwable t )
  -        {
  -            final String message =
  -                REZ.getString( "bad-listener.error",
  -                               listener,
  -                               ExceptionUtil.printStackTrace( t, 5, true ) );
  -            throw new Exception( message );
  -        }
  -    }
   }
  -
  
  
  
  1.4       +3 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/Resources.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Resources.properties	12 Feb 2002 10:28:33 -0000	1.3
  +++ Resources.properties	13 Feb 2002 03:02:54 -0000	1.4
  @@ -3,9 +3,10 @@
   help.opt=Display this help message.
   file.opt=Specify the build file.
   log-level.opt=Specify the verbosity level at which to log messages. (DEBUG|INFO|WARN|ERROR|FATAL_ERROR).
  -quiet.opt=Equivelent to --log-level=FATAL_ERROR.
  -verbose.opt=Equivelent to --log-level=INFO.
  +quiet.opt=Equivalent to --log-level=FATAL_ERROR.
  +verbose.opt=Equivalent to --log-level=INFO.
   listener.opt=Specify the listener for log events.
  +noprefix.opt=Do not prefix output with the task name.  Equivalent to --listener noprefix.
   version.opt=Display version.
   tasklib.opt=Specify the task lib directory to scan for .tsk files.
   incremental.opt=Run in incremental mode.
  @@ -16,7 +17,6 @@
   
   home-not-dir.error=myrmidon-home ({0}) is not a directory.
   bad-file.error=File {0} is not a file or doesn't exist.
  -bad-listener.error=Error creating the listener {0}. Reason: {1}.
   bad-loglevel.error=Unknown log level - {0}.
   build-failed.error=BUILD FAILED\nReason:\n{0}
   
  
  
  
  1.7       +18 -4     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/embeddor/Embeddor.java
  
  Index: Embeddor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/embeddor/Embeddor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Embeddor.java	7 Feb 2002 13:01:20 -0000	1.6
  +++ Embeddor.java	13 Feb 2002 03:02:54 -0000	1.7
  @@ -15,12 +15,13 @@
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.myrmidon.interfaces.model.Project;
   import org.apache.myrmidon.interfaces.workspace.Workspace;
  +import org.apache.myrmidon.listeners.ProjectListener;
   
   /**
    * Interface through which you embed Myrmidon into applications.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.6 $ $Date: 2002/02/07 13:01:20 $
  + * @version $Revision: 1.7 $ $Date: 2002/02/13 03:02:54 $
    */
   public interface Embeddor
       extends Component, Parameterizable, Initializable, Startable, Disposable
  @@ -28,17 +29,30 @@
       String ROLE = Embeddor.class.getName();
   
       /**
  -     * Create a project.
  +     * Creates a project from a project file.
        *
  +     * @param location The path to the project file.
  +     * @param type The project file type.  If null the type is inferred from the
  +     *             project file name.
  +     * @param parameters The project builder parameters.
        * @return the created Project
        */
       Project createProject( String location, String type, Parameters parameters )
           throws Exception;
   
       /**
  -     * Create a Workspace for a particular project.
  +     * Creates a project listener.
        *
  -     * @param defines the defines in workspace
  +     * @param name The shorthand name of the listener.
  +     * @return the listener.
  +     */
  +    ProjectListener createListener( String name )
  +        throws Exception;
  +
  +    /**
  +     * Creates a {@link Workspace} that can be used to execute projects.
  +     *
  +     * @param parameters The properties to define in the workspace
        * @return the Workspace
        */
       Workspace createWorkspace( Parameters parameters )
  
  
  
  1.7       +1 -2      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/workspace/Workspace.java
  
  Index: Workspace.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/workspace/Workspace.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Workspace.java	7 Feb 2002 13:01:20 -0000	1.6
  +++ Workspace.java	13 Feb 2002 03:02:54 -0000	1.7
  @@ -16,7 +16,7 @@
    * This is the abstraction through which Projects are managed and executed.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.6 $ $Date: 2002/02/07 13:01:20 $
  + * @version $Revision: 1.7 $ $Date: 2002/02/13 03:02:54 $
    */
   public interface Workspace
       extends Component
  @@ -42,7 +42,6 @@
        *
        * @param project the Project
        * @param target the name of the target
  -     * @param defines the defines
        * @exception TaskException if an error occurs
        */
       void executeProject( Project project, String target )
  
  
  
  1.6       +10 -55    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/AbstractProjectListener.java
  
  Index: AbstractProjectListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/AbstractProjectListener.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractProjectListener.java	7 Feb 2002 13:01:39 -0000	1.5
  +++ AbstractProjectListener.java	13 Feb 2002 03:02:55 -0000	1.6
  @@ -8,106 +8,61 @@
   package org.apache.myrmidon.listeners;
   
   /**
  - * Abstract listener from which to extend.
  + * Abstract listener from which to extend.  This implementation provedes
  + * empty implementions of each of the event methods.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.5 $ $Date: 2002/02/07 13:01:39 $
  + * @version $Revision: 1.6 $ $Date: 2002/02/13 03:02:55 $
    */
   public abstract class AbstractProjectListener
       implements ProjectListener
   {
       /**
  -     * This contains the name of the current target.
  -     */
  -    private String m_target;
  -
  -    /**
  -     * This contains the name of the current task.
  -     */
  -    private String m_task;
  -
  -    /**
        * Notify listener of projectStarted event.
        */
  -    public void projectStarted()
  +    public void projectStarted( final ProjectEvent event )
       {
       }
   
       /**
        * Notify listener of projectFinished event.
        */
  -    public void projectFinished()
  +    public void projectFinished( final ProjectEvent event )
       {
       }
   
       /**
        * Notify listener of targetStarted event.
  -     *
  -     * @param targetName the name of target
        */
  -    public void targetStarted( final String target )
  +    public void targetStarted( final TargetEvent event )
       {
  -        m_target = target;
       }
   
       /**
        * Notify listener of targetFinished event.
        */
  -    public void targetFinished()
  +    public void targetFinished( final TargetEvent event )
       {
  -        m_target = null;
       }
   
       /**
        * Notify listener of taskStarted event.
  -     *
  -     * @param task the name of task
        */
  -    public void taskStarted( final String task )
  +    public void taskStarted( final TaskEvent event )
       {
  -        m_task = task;
       }
   
       /**
        * Notify listener of taskFinished event.
        */
  -    public void taskFinished()
  -    {
  -        m_task = null;
  -    }
  -
  -    /**
  -     * Notify listener of log message event.
  -     *
  -     * @param message the message
  -     */
  -    public void log( String message )
  +    public void taskFinished( final TaskEvent event )
       {
       }
   
       /**
        * Notify listener of log message event.
  -     *
  -     * @param message the message
  -     * @param throwable the throwable
  -     */
  -    public void log( String message, Throwable throwable )
  -    {
  -    }
  -
  -    /**
  -     * Utility method to get the name of current target.
  -     */
  -    protected final String getTarget()
  -    {
  -        return m_target;
  -    }
  -
  -    /**
  -     * Utility method to get the name of current task.
        */
  -    protected final String getTask()
  +    public void log( final LogEvent event )
       {
  -        return m_task;
       }
   }
  
  
  
  1.7       +55 -25    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/ClassicProjectListener.java
  
  Index: ClassicProjectListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/ClassicProjectListener.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ClassicProjectListener.java	7 Feb 2002 13:01:39 -0000	1.6
  +++ ClassicProjectListener.java	13 Feb 2002 03:02:55 -0000	1.7
  @@ -8,63 +8,93 @@
   package org.apache.myrmidon.listeners;
   
   import org.apache.avalon.framework.ExceptionUtil;
  +import java.io.PrintWriter;
   
   /**
  - * Classic listener that emulates the default ant1.x listener notifications.
  + * Classic listener that emulates the default ant1.x listener.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.6 $ $Date: 2002/02/07 13:01:39 $
  + * @version $Revision: 1.7 $ $Date: 2002/02/13 03:02:55 $
    */
  -public final class ClassicProjectListener
  +public class ClassicProjectListener
       extends AbstractProjectListener
   {
  +    private final PrintWriter m_printWriter;
  +
  +    public ClassicProjectListener()
  +    {
  +        m_printWriter = new PrintWriter( System.out, true );
  +    }
  +
       /**
        * Notify listener of targetStarted event.
  -     *
  -     * @param target the name of target
        */
  -    public void targetStarted( final String target )
  +    public void targetStarted( final TargetEvent event )
       {
  -        output( target + ":\n" );
  +        writeTargetHeader( event );
       }
   
       /**
  -     * Notify listener of log message event.
  -     *
  -     * @param message the message
  +     * Notify listener of targetFinished event.
        */
  -    public void log( String message )
  +    public void targetFinished( TargetEvent event )
       {
  -        output( message );
  +        getWriter().println();
       }
   
       /**
        * Notify listener of log message event.
  -     *
  -     * @param message the message
  -     * @param throwable the throwable
        */
  -    public void log( String message, Throwable throwable )
  +    public void log( final LogEvent event  )
  +    {
  +        writeMessage( event );
  +        writeThrowable( event );
  +    }
  +
  +    /**
  +     * Returns the PrintWriter to write to.
  +     */
  +    protected PrintWriter getWriter()
  +    {
  +        return m_printWriter;
  +    }
  +
  +    /**
  +     * Writes the target header.
  +     */
  +    protected void writeTargetHeader( final TargetEvent event )
       {
  -        output( message + "\n" + ExceptionUtil.printStackTrace( throwable, 5, true ) );
  +        getWriter().println( event.getTargetName() + ":" );
       }
   
       /**
  -     * Utility class to output data.
  -     * Overide in sub-classes to direct to a different destination.
  -     *
  -     * @param data the data
  +     * Writes a message
        */
  -    private void output( final String data )
  +    protected void writeMessage( final LogEvent event )
       {
  -        final String task = getTask();
  +        // Write the message
  +        final String message = event.getMessage();
  +        final String task = event.getTaskName();
           if( null != task )
           {
  -            System.out.println( "\t[" + task + "] " + data );
  +            getWriter().println( "\t[" + task + "] " + message );
           }
           else
           {
  -            System.out.println( data );
  +            getWriter().println( message );
  +        }
  +    }
  +
  +    /**
  +     * Writes a throwable.
  +     */
  +    private void writeThrowable( final LogEvent event )
  +    {
  +        // Write the exception, if any
  +        final Throwable throwable = event.getThrowable();
  +        if( throwable != null )
  +        {
  +            getWriter().println( ExceptionUtil.printStackTrace( throwable, 5, true ) );
           }
       }
   }
  
  
  
  1.10      +18 -39    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/DefaultProjectListener.java
  
  Index: DefaultProjectListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/DefaultProjectListener.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultProjectListener.java	7 Feb 2002 13:01:39 -0000	1.9
  +++ DefaultProjectListener.java	13 Feb 2002 03:02:55 -0000	1.10
  @@ -10,70 +10,49 @@
   import org.apache.avalon.framework.ExceptionUtil;
   
   /**
  - * Default listener that emulates the old ant listener notifications.
  + * Default listener that emulates the Ant 1.x no banner listener.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.9 $ $Date: 2002/02/07 13:01:39 $
  + * @version $Revision: 1.10 $ $Date: 2002/02/13 03:02:55 $
    */
  -public final class DefaultProjectListener
  -    extends AbstractProjectListener
  +public class DefaultProjectListener
  +    extends ClassicProjectListener
   {
       private boolean m_targetOutput;
   
       /**
        * Notify listener of targetStarted event.
  -     *
  -     * @param target the name of target
        */
  -    public void targetStarted( final String target )
  +    public void targetStarted( final TargetEvent target )
       {
  -        super.targetStarted( target );
           m_targetOutput = false;
       }
   
       /**
  -     * Notify listener of log message event.
  -     *
  -     * @param message the message
  +     * Notify listener of targetFinished event.
        */
  -    public void log( final String message )
  +    public void targetFinished( final TargetEvent event )
       {
  -        output( message );
  +        if( m_targetOutput )
  +        {
  +            getWriter().println();
  +        }
       }
   
       /**
        * Notify listener of log message event.
  -     *
  -     * @param message the message
  -     * @param throwable the throwable
  -     */
  -    public void log( final String message, final Throwable throwable )
  -    {
  -        output( message + "\n" + ExceptionUtil.printStackTrace( throwable, 5, true ) );
  -    }
  -
  -    /**
  -     * Utility class to output data.
  -     * Overide in sub-classes to direct to a different destination.
  -     *
  -     * @param data the data
        */
  -    private void output( final String data )
  +    public void log( final LogEvent event )
       {
  -        if( !m_targetOutput )
  +        // Write the target header, if necessary
  +        final String target = event.getTargetName();
  +        if( target != null && !m_targetOutput )
           {
  -            System.out.println( getTarget() + ":\n" );
  +            writeTargetHeader( event );
               m_targetOutput = true;
           }
   
  -        final String task = getTask();
  -        if( null != task )
  -        {
  -            System.out.println( "\t[" + task + "] " + data );
  -        }
  -        else
  -        {
  -            System.out.println( data );
  -        }
  +        // Write the message
  +        super.log( event );
       }
   }
  
  
  
  1.7       +21 -29    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/ProjectListener.java
  
  Index: ProjectListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/ProjectListener.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ProjectListener.java	7 Feb 2002 13:01:39 -0000	1.6
  +++ ProjectListener.java	13 Feb 2002 03:02:55 -0000	1.7
  @@ -12,57 +12,49 @@
    * notification of project status.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.6 $ $Date: 2002/02/07 13:01:39 $
  + * @version $Revision: 1.7 $ $Date: 2002/02/13 03:02:55 $
    * @ant:role shorthand="listener"
    */
   public interface ProjectListener
   {
       /**
  -     * Notify listener of projectStarted event.
  +     * Notify the listener that a project is about to start.  This method
  +     * is called for top-level projects only.
        */
  -    void projectStarted();
  +    void projectStarted( ProjectEvent event );
   
       /**
  -     * Notify listener of projectFinished event.
  +     * Notify the listener that a project has finished.  This method is called
  +     * for top-level projects only.
        */
  -    void projectFinished();
  +    void projectFinished( ProjectEvent event );
   
       /**
  -     * Notify listener of targetStarted event.
  -     *
  -     * @param target the name of target
  +     * Notify the listener that a target is about to start.  Note that the
  +     * project name reported by the event may be different to that reported
  +     * in {@link #projectStarted}.
        */
  -    void targetStarted( String target );
  +    void targetStarted( TargetEvent event );
   
       /**
  -     * Notify listener of targetFinished event.
  +     * Notify the listener that a target has finished.
        */
  -    void targetFinished();
  +    void targetFinished( TargetEvent event );
   
       /**
  -     * Notify listener of taskStarted event.
  -     *
  -     * @param task the name of task
  +     * Notify the listener that a task is about to start.
        */
  -    void taskStarted( String task );
  +    void taskStarted( TaskEvent event );
   
       /**
  -     * Notify listener of taskFinished event.
  +     * Notify the listener that a task has finished.
        */
  -    void taskFinished();
  +    void taskFinished( TaskEvent event );
   
       /**
  -     * Notify listener of log message event.
  -     *
  -     * @param message the message
  +     * Notify listener of log message event.  Note that this method may
  +     * be called at any time, so the reported task, target, or project names
  +     * may be null.
        */
  -    void log( String message );
  -
  -    /**
  -     * Notify listener of log message event.
  -     *
  -     * @param message the message
  -     * @param throwable the throwable
  -     */
  -    void log( String message, Throwable throwable );
  +    void log( LogEvent event );
   }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/LogEvent.java
  
  Index: LogEvent.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.listeners;
  
  /**
   * A log message event.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   * @version $Revision: 1.1 $ $Date: 2002/02/13 03:02:55 $
   */
  public interface LogEvent
      extends TaskEvent
  {
      /**
       * Returns the message.
       */
      public String getMessage();
  
      /**
       * Returns the error that occurred.
       */
      public Throwable getThrowable();
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/NoPrefixProjectListener.java
  
  Index: NoPrefixProjectListener.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.listeners;
  
  import java.io.PrintStream;
  import java.io.PrintWriter;
  
  /**
   * A project listener that emulated the Ant 1.x -emacs mode.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   * @version $Revision: 1.1 $ $Date: 2002/02/13 03:02:55 $
   */
  public class NoPrefixProjectListener
      extends DefaultProjectListener
  {
      /**
       * Writes a message
       */
      protected void writeMessage( LogEvent event )
      {
          getWriter().println( event.getMessage() );
      }
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/ProjectEvent.java
  
  Index: ProjectEvent.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.listeners;
  
  import org.apache.myrmidon.interfaces.model.Project;
  
  /**
   * A project level event.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   * @version $Revision: 1.1 $ $Date: 2002/02/13 03:02:55 $
   */
  public interface ProjectEvent
  {
      /**
       * Returns the name of the project.
       */
      public String getProjectName();
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/TargetEvent.java
  
  Index: TargetEvent.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.listeners;
  
  import org.apache.myrmidon.interfaces.model.Target;
  
  /**
   * A target level event.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   * @version $Revision: 1.1 $ $Date: 2002/02/13 03:02:55 $
   */
  public interface TargetEvent
      extends ProjectEvent
  {
      /**
       * Returns the name of the target.
       */
      public String getTargetName();
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/TaskEvent.java
  
  Index: TaskEvent.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.listeners;
  
  /**
   * A task level event.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   * @version $Revision: 1.1 $ $Date: 2002/02/13 03:02:55 $
   */
  public interface TaskEvent
      extends TargetEvent
  {
      /**
       * Returns the name of the task.
       */
      public String getTaskName();
  }
  
  
  
  1.11      +51 -62    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java
  
  Index: RecorderEntry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- RecorderEntry.java	30 Dec 2001 10:46:58 -0000	1.10
  +++ RecorderEntry.java	13 Feb 2002 03:02:55 -0000	1.11
  @@ -12,6 +12,10 @@
   import org.apache.avalon.framework.logger.LogEnabled;
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.myrmidon.listeners.AbstractProjectListener;
  +import org.apache.myrmidon.listeners.LogEvent;
  +import org.apache.myrmidon.listeners.ProjectEvent;
  +import org.apache.myrmidon.listeners.TargetEvent;
  +import org.apache.myrmidon.listeners.TaskEvent;
   import org.apache.tools.ant.Project;
   
   /**
  @@ -46,9 +50,6 @@
   
       private Logger m_logger;
   
  -    /**
  -     * @param name The name of this recorder (used as the filename).
  -     */
       protected RecorderEntry( final PrintStream output )
       {
           m_output = output;
  @@ -93,7 +94,7 @@
       /**
        * Turns off or on this recorder.
        *
  -     * @param state true for on, false for off, null for no change.
  +     * @param record true for on, false for off, null for no change.
        */
       public void setRecordState( final boolean record )
       {
  @@ -102,21 +103,48 @@
   
       /**
        * Notify listener of log message event.
  -     *
  -     * @param message the message
  -     * @param throwable the throwable
        */
  -    public void log( final String message, final Throwable throwable )
  +    public void log( final LogEvent event )
       {
  -        m_output.println( StringUtil.LINE_SEPARATOR + "BUILD FAILED" + StringUtil.LINE_SEPARATOR );
  -        throwable.printStackTrace( m_output );
  -        finishRecording();
  +        final Throwable throwable = event.getThrowable();
  +        if( throwable != null )
  +        {
  +            m_output.println( StringUtil.LINE_SEPARATOR + "BUILD FAILED" + StringUtil.LINE_SEPARATOR );
  +            throwable.printStackTrace( m_output );
  +            finishRecording();
  +        }
  +        else
  +        {
  +            getLogger().debug( "--- MESSAGE LOGGED" );
  +
  +            final StringBuffer sb = new StringBuffer();
  +
  +            final String task = event.getTaskName();
  +            if( task != null )
  +            {
  +                final String name = "[" + task + "]";
  +                final int padding = 12 - name.length();
  +                for( int i = 0; i < padding; i++ )
  +                {
  +                    sb.append( " " );
  +                }
  +                sb.append( name );
  +            }
  +
  +            sb.append( event.getMessage() );
  +
  +            //FIXME: Check log level here
  +            if( m_record )
  +            {
  +                m_output.println( sb.toString() );
  +            }
  +        }
       }
   
       /**
        * Notify listener of projectFinished event.
        */
  -    public void projectFinished()
  +    public void projectFinished( final ProjectEvent event )
       {
           m_output.println( StringUtil.LINE_SEPARATOR + "BUILD SUCCESSFUL" );
           finishRecording();
  @@ -132,88 +160,49 @@
       /**
        * Notify listener of projectStarted event.
        */
  -    public void projectStarted()
  +    public void projectStarted( final ProjectEvent event )
       {
           getLogger().debug( "> BUILD STARTED" );
       }
   
  -    /**
  -     * Notify listener of log message event.
  -     *
  -     * @param message the message
  -     */
  -    public void log( final String message )
  -    {
  -        getLogger().debug( "--- MESSAGE LOGGED" );
  -
  -        final StringBuffer sb = new StringBuffer();
  -
  -        final String task = getTask();
  -        if( task != null )
  -        {
  -            final String name = "[" + task + "]";
  -            final int padding = 12 - name.length();
  -            for( int i = 0; i < padding; i++ )
  -            {
  -                sb.append( " " );
  -            }
  -            sb.append( name );
  -        }
  -
  -        sb.append( message );
  -
  -        //FIXME: Check log level here
  -        if( m_record )
  -        {
  -            m_output.println( sb.toString() );
  -        }
  -    }
   
       /**
        * Notify listener of targetFinished event.
        */
  -    public void targetFinished()
  +    public void targetFinished( final TargetEvent event )
       {
  -        getLogger().debug( "<< TARGET FINISHED -- " + getTarget() );
  +        getLogger().debug( "<< TARGET FINISHED -- " + event.getTargetName() );
           final long millis = System.currentTimeMillis() - m_targetStartTime;
           final String duration = formatTime( millis );
  -        getLogger().debug( getTarget() + ":  duration " + duration );
  +        getLogger().debug( event.getTargetName() + ":  duration " + duration );
           m_output.flush();
  -        super.targetFinished();
       }
   
       /**
        * Notify listener of targetStarted event.
  -     *
  -     * @param target the name of target
        */
  -    public void targetStarted( final String target )
  +    public void targetStarted( final TargetEvent event )
       {
  -        super.targetStarted( target );
  -        getLogger().debug( ">> TARGET STARTED -- " + getTarget() );
  -        getLogger().info( StringUtil.LINE_SEPARATOR + getTarget() + ":" );
  +        getLogger().debug( ">> TARGET STARTED -- " + event.getTargetName() );
  +        getLogger().info( StringUtil.LINE_SEPARATOR + event.getTargetName() + ":" );
           m_targetStartTime = System.currentTimeMillis();
   
       }
   
       /**
        * Notify listener of taskStarted event.
  -     *
  -     * @param task the name of task
        */
  -    public void taskStarted( String task )
  +    public void taskStarted( final TaskEvent event )
       {
  -        super.taskStarted( task );
  -        getLogger().debug( ">>> TASK STARTED -- " + getTask() );
  +        getLogger().debug( ">>> TASK STARTED -- " + event.getTaskName() );
       }
   
       /**
        * Notify listener of taskFinished event.
        */
  -    public void taskFinished()
  +    public void taskFinished( final TaskEvent event )
       {
  -        getLogger().debug( "<<< TASK FINISHED -- " + getTask() );
  +        getLogger().debug( "<<< TASK FINISHED -- " + event.getTaskName() );
           m_output.flush();
  -        super.taskFinished();
       }
   }
  
  
  
  1.19      +2 -3      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java
  
  Index: IContract.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- IContract.java	3 Feb 2002 10:26:21 -0000	1.18
  +++ IContract.java	13 Feb 2002 03:02:55 -0000	1.19
  @@ -16,6 +16,7 @@
   import java.util.Properties;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.listeners.AbstractProjectListener;
  +import org.apache.myrmidon.listeners.LogEvent;
   import org.apache.tools.ant.taskdefs.Java;
   import org.apache.tools.ant.taskdefs.Javac;
   import org.apache.tools.ant.taskdefs.MatchingTask;
  @@ -1067,10 +1068,8 @@
       {
           /**
            * Notify listener of log message event.
  -         *
  -         * @param message the message
            */
  -        public void log( final String message )
  +        public void log( final LogEvent event )
           {
               if( "java.lang.NoClassDefFoundError: com/reliablesystems/iContract/Tool".equals( event.getMessage() ) )
               {
  
  
  
  1.10      +9 -7      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java
  
  Index: AntSoundPlayer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AntSoundPlayer.java	30 Dec 2001 08:18:25 -0000	1.9
  +++ AntSoundPlayer.java	13 Feb 2002 03:02:55 -0000	1.10
  @@ -22,6 +22,8 @@
   import org.apache.avalon.framework.logger.LogEnabled;
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.myrmidon.listeners.AbstractProjectListener;
  +import org.apache.myrmidon.listeners.ProjectEvent;
  +import org.apache.myrmidon.listeners.LogEvent;
   
   /**
    * This class is designed to be used by any AntTask that requires audio output.
  @@ -31,7 +33,7 @@
    * Both seem to work fine.
    *
    * @author Nick Pellow
  - * @version $Revision: 1.9 $, $Date: 2001/12/30 08:18:25 $
  + * @version $Revision: 1.10 $, $Date: 2002/02/13 03:02:55 $
    */
   public class AntSoundPlayer
       extends AbstractProjectListener
  @@ -65,20 +67,20 @@
       /**
        * Notify listener of projectFinished event.
        */
  -    public void projectFinished()
  +    public void projectFinished( final ProjectEvent event )
       {
           success();
       }
   
       /**
        * Notify listener of log message event.
  -     *
  -     * @param message the message
  -     * @param throwable the throwable
        */
  -    public void log( final String message, final Throwable throwable )
  +    public void log( final LogEvent event )
       {
  -        failure();
  +        if( event.getThrowable() != null )
  +        {
  +            failure();
  +        }
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message