ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound AntSoundPlayer.java
Date Sun, 30 Dec 2001 03:44:05 GMT
donaldp     01/12/29 19:44:05

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant
                        BuildEvent.java BuildListener.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs
                        RecorderEntry.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide
                        VAJAntToolGUI.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound
                        AntSoundPlayer.java
  Log:
  Only place strings into the BuildEvent
  
  Revision  Changes    Path
  1.6       +17 -56    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/BuildEvent.java
  
  Index: BuildEvent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/BuildEvent.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BuildEvent.java	23 Dec 2001 06:34:49 -0000	1.5
  +++ BuildEvent.java	30 Dec 2001 03:44:05 -0000	1.6
  @@ -12,60 +12,32 @@
   public class BuildEvent
       extends EventObject
   {
  -    private int priority = Project.MSG_VERBOSE;
  -    private Throwable exception;
  -    private String message;
  -    private Project project;
  -    private Target target;
  -    private Task task;
  -
  -    /**
  -     * Construct a BuildEvent for a project level event
  -     *
  -     * @param project the project that emitted the event.
  -     */
  -    public BuildEvent( Project project )
  -    {
  -        super( project );
  -        this.project = project;
  -        this.target = null;
  -        this.task = null;
  -    }
  +    private int m_priority = Project.MSG_VERBOSE;
  +    private Throwable m_exception;
  +    private String m_message;
  +    private String m_target;
  +    private String m_task;
   
       /**
        * Construct a BuildEvent for a target level event
        *
        * @param target the target that emitted the event.
        */
  -    public BuildEvent( Target target )
  +    public BuildEvent( String target )
       {
           super( target );
  -        this.project = target.getProject();
  -        this.target = target;
  -        this.task = null;
  -    }
  -
  -    /**
  -     * Construct a BuildEvent for a task level event
  -     *
  -     * @param task the task that emitted the event.
  -     */
  -    public BuildEvent( Task task )
  -    {
  -        super( task );
  -        this.project = task.getProject();
  -        this.task = task;
  +        m_target = target;
       }
   
       public void setException( Throwable exception )
       {
  -        this.exception = exception;
  +        m_exception = exception;
       }
   
       public void setMessage( String message, int priority )
       {
  -        this.message = message;
  -        this.priority = priority;
  +        m_message = message;
  +        m_priority = priority;
       }
   
       /**
  @@ -79,7 +51,7 @@
        */
       public Throwable getException()
       {
  -        return exception;
  +        return m_exception;
       }
   
       /**
  @@ -91,7 +63,7 @@
        */
       public String getMessage()
       {
  -        return message;
  +        return m_message;
       }
   
       /**
  @@ -103,17 +75,7 @@
        */
       public int getPriority()
       {
  -        return priority;
  -    }
  -
  -    /**
  -     * Returns the project that fired this event.
  -     *
  -     * @return The Project value
  -     */
  -    public Project getProject()
  -    {
  -        return project;
  +        return m_priority;
       }
   
       /**
  @@ -121,10 +83,9 @@
        *
        * @return The Target value
        */
  -    public Target getTarget()
  +    public String getTarget()
       {
  -
  -        return target;
  +        return m_target;
       }
   
       /**
  @@ -132,8 +93,8 @@
        *
        * @return The Task value
        */
  -    public Task getTask()
  +    public String getTask()
       {
  -        return task;
  +        return m_task;
       }
   }
  
  
  
  1.4       +2 -3      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/BuildListener.java
  
  Index: BuildListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/BuildListener.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BuildListener.java	23 Dec 2001 06:34:49 -0000	1.3
  +++ BuildListener.java	30 Dec 2001 03:44:05 -0000	1.4
  @@ -13,13 +13,12 @@
    * Classes that implement this interface will be notified when things happend
    * during a build.
    *
  - * @author RT
    * @see BuildEvent
    * @see Project#addBuildListener(BuildListener)
    */
  -public interface BuildListener extends EventListener
  +public interface BuildListener
  +    extends EventListener
   {
  -
       /**
        * Fired before any targets are started.
        *
  
  
  
  1.8       +3 -3      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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RecorderEntry.java	23 Dec 2001 14:21:50 -0000	1.7
  +++ RecorderEntry.java	30 Dec 2001 03:44:05 -0000	1.8
  @@ -157,7 +157,7 @@
           StringBuffer buf = new StringBuffer();
           if( event.getTask() != null )
           {
  -            String name = "[" + event.getTask().getName() + "]";
  +            String name = "[" + event.getTask() + "]";
               /**
                * @todo replace 12 with DefaultLogger.LEFT_COLUMN_SIZE
                */
  @@ -180,10 +180,10 @@
           out.flush();
       }
   
  -    public void targetStarted( BuildEvent event )
  +    public void targetStarted( final BuildEvent event )
       {
           getLogger().debug( ">> TARGET STARTED -- " + event.getTarget() );
  -        getLogger().info( LINE_SEP + event.getTarget().getName() + ":" );
  +        getLogger().info( LINE_SEP + event.getTarget() + ":" );
           targetStartTime = System.currentTimeMillis();
       }
   
  
  
  
  1.8       +6 -3      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJAntToolGUI.java
  
  Index: VAJAntToolGUI.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJAntToolGUI.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- VAJAntToolGUI.java	23 Dec 2001 06:31:56 -0000	1.7
  +++ VAJAntToolGUI.java	30 Dec 2001 03:44:05 -0000	1.8
  @@ -1765,8 +1765,11 @@
               if( event.getPriority() <= getBuildInfo().getOutputMessageLevel() )
               {
                   String msg = "";
  -                if( event.getTask() != null )
  -                    msg = "[" + event.getTask().getName() + "] ";
  +                final String task = event.getTask();
  +                if( task != null )
  +                {
  +                    msg = "[" + task + "] ";
  +                }
                   getMessageTextArea().append( lineSeparator + msg + event.getMessage() );
               }
           }
  @@ -1792,7 +1795,7 @@
           {
               if( getBuildInfo().getOutputMessageLevel() <= Project.MSG_INFO )
               {
  -                getMessageTextArea().append( lineSeparator + event.getTarget().getName()
+ ":" );
  +                getMessageTextArea().append( lineSeparator + event.getTarget() + ":" );
               }
           }
   
  
  
  
  1.8       +12 -23    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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AntSoundPlayer.java	23 Dec 2001 14:22:48 -0000	1.7
  +++ AntSoundPlayer.java	30 Dec 2001 03:44:05 -0000	1.8
  @@ -22,6 +22,7 @@
   import org.apache.tools.ant.BuildEvent;
   import org.apache.tools.ant.BuildListener;
   import org.apache.tools.ant.Project;
  +import org.apache.avalon.framework.logger.AbstractLogEnabled;
   
   /**
    * This class is designed to be used by any AntTask that requires audio output.
  @@ -31,9 +32,10 @@
    * Both seem to work fine.
    *
    * @author Nick Pellow
  - * @version $Revision: 1.7 $, $Date: 2001/12/23 14:22:48 $
  + * @version $Revision: 1.8 $, $Date: 2001/12/30 03:44:05 $
    */
   public class AntSoundPlayer
  +    extends AbstractLogEnabled
       implements LineListener, BuildListener
   {
       private File m_fileSuccess;
  @@ -80,7 +82,6 @@
        * Fired after the last target has finished. This event will still be thrown
        * if an error occured during the build.
        *
  -     * @param event Description of Parameter
        * @see BuildEvent#getException()
        */
       public void buildFinished( BuildEvent event )
  @@ -88,18 +89,16 @@
           if( event.getException() == null && m_fileSuccess != null )
           {
               // build successfull!
  -            play( event.getProject(), m_fileSuccess, m_loopsSuccess, m_durationSuccess
);
  +            play( m_fileSuccess, m_loopsSuccess, m_durationSuccess );
           }
           else if( event.getException() != null && m_fileFail != null )
           {
  -            play( event.getProject(), m_fileFail, m_loopsFail, m_durationFail );
  +            play( m_fileFail, m_loopsFail, m_durationFail );
           }
       }
   
       /**
        * Fired before any targets are started.
  -     *
  -     * @param event Description of Parameter
        */
       public void buildStarted( BuildEvent event )
       {
  @@ -108,7 +107,6 @@
       /**
        * Fired whenever a message is logged.
        *
  -     * @param event Description of Parameter
        * @see BuildEvent#getMessage()
        * @see BuildEvent#getPriority()
        */
  @@ -120,7 +118,6 @@
        * Fired when a target has finished. This event will still be thrown if an
        * error occured during the build.
        *
  -     * @param event Description of Parameter
        * @see BuildEvent#getException()
        */
       public void targetFinished( BuildEvent event )
  @@ -130,7 +127,6 @@
       /**
        * Fired when a target is started.
        *
  -     * @param event Description of Parameter
        * @see BuildEvent#getTarget()
        */
       public void targetStarted( BuildEvent event )
  @@ -141,7 +137,6 @@
        * Fired when a task has finished. This event will still be throw if an
        * error occured during the build.
        *
  -     * @param event Description of Parameter
        * @see BuildEvent#getException()
        */
       public void taskFinished( BuildEvent event )
  @@ -151,7 +146,6 @@
       /**
        * Fired when a task is started.
        *
  -     * @param event Description of Parameter
        * @see BuildEvent#getTask()
        */
       public void taskStarted( BuildEvent event )
  @@ -161,8 +155,6 @@
       /**
        * This is implemented to listen for any line events and closes the clip if
        * required.
  -     *
  -     * @param event Description of Parameter
        */
       public void update( LineEvent event )
       {
  @@ -184,15 +176,9 @@
   
       /**
        * Plays the file for duration milliseconds or loops.
  -     *
  -     * @param project Description of Parameter
  -     * @param file Description of Parameter
  -     * @param loops Description of Parameter
  -     * @param duration Description of Parameter
        */
  -    private void play( Project project, File file, int loops, Long duration )
  +    private void play( File file, int loops, Long duration )
       {
  -
           Clip audioClip = null;
   
           AudioInputStream audioInputStream = null;
  @@ -203,7 +189,8 @@
           }
           catch( UnsupportedAudioFileException uafe )
           {
  -            project.getLogger().info( "Audio format is not yet supported: " + uafe.getMessage()
);
  +            final String message = "Audio format is not yet supported: " + uafe.getMessage();
  +            getLogger().info( message );
           }
           catch( IOException ioe )
           {
  @@ -223,7 +210,8 @@
               }
               catch( LineUnavailableException e )
               {
  -                project.getLogger().info( "The sound device is currently unavailable" );
  +                final String message = "The sound device is currently unavailable";
  +                getLogger().info( message );
                   return;
               }
               catch( IOException e )
  @@ -244,7 +232,8 @@
           }
           else
           {
  -            project.getLogger().info( "Can't get data from file " + file.getName() );
  +            final String message = "Can't get data from file " + file.getName();
  +            getLogger().info( message );
           }
       }
   
  
  
  

--
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