Package org.apache.tools.ant.taskdefs
Class Recorder
- java.lang.Object
- 
- org.apache.tools.ant.ProjectComponent
- 
- org.apache.tools.ant.Task
- 
- org.apache.tools.ant.taskdefs.Recorder
 
 
 
- 
- All Implemented Interfaces:
- java.lang.Cloneable,- java.util.EventListener,- BuildListener,- SubBuildListener
 
 public class Recorder extends Task implements SubBuildListener Adds a listener to the current build process that records the output to a file.Several recorders can exist at the same time. Each recorder is associated with a file. The filename is used as a unique identifier for the recorders. The first call to the recorder task with an unused filename will create a recorder (using the parameters provided) and add it to the listeners of the build. All subsequent calls to the recorder task using this filename will modify that recorders state (recording or not) or other properties (like logging level). Some technical issues: the file's print stream is flushed for "finished" events (buildFinished, targetFinished and taskFinished), and is closed on a buildFinished event. - Since:
- Ant 1.4
- Version:
- 0.5
- See Also:
- RecorderEntry
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classRecorder.ActionChoicesA list of possible values for thesetAction()method.static classRecorder.VerbosityLevelChoicesA list of possible values for thesetLoglevel()method.
 - 
Field Summary- 
Fields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
 
- 
 - 
Constructor SummaryConstructors Constructor Description Recorder()
 - 
Method SummaryModifier and Type Method Description voidbuildFinished(BuildEvent event)Cleans recorder registry.voidbuildStarted(BuildEvent event)Empty implementation required by SubBuildListener interface.voidexecute()The main execution.protected RecorderEntrygetRecorder(java.lang.String name, Project proj)Gets the recorder that's associated with the passed in name.voidinit()Overridden so we can add the task as build listener.voidmessageLogged(BuildEvent event)Empty implementation required by SubBuildListener interface.voidsetAction(Recorder.ActionChoices action)Sets the action for the associated recorder entry.voidsetAppend(boolean append)Whether or not the logger should append to a previous file.voidsetEmacsMode(boolean emacsMode)Set emacs mode.voidsetLoglevel(Recorder.VerbosityLevelChoices level)Sets the level to which this recorder entry should log to.voidsetName(java.lang.String fname)Sets the name of the file to log to, and the name of the recorder entry.voidsubBuildFinished(BuildEvent event)Cleans recorder registry, if this is the subbuild the task has been created in.voidsubBuildStarted(BuildEvent event)Empty implementation required by SubBuildListener interface.voidtargetFinished(BuildEvent event)Empty implementation required by SubBuildListener interface.voidtargetStarted(BuildEvent event)Empty implementation required by SubBuildListener interface.voidtaskFinished(BuildEvent event)Empty implementation required by SubBuildListener interface.voidtaskStarted(BuildEvent event)Empty implementation required by SubBuildListener interface.- 
Methods inherited from class org.apache.tools.ant.TaskbindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 - 
Methods inherited from class org.apache.tools.ant.ProjectComponentclone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
- 
 
- 
- 
- 
Method Detail- 
initpublic void init() Overridden so we can add the task as build listener.
 - 
setNamepublic void setName(java.lang.String fname) Sets the name of the file to log to, and the name of the recorder entry.- Parameters:
- fname- File name of logfile.
 
 - 
setActionpublic void setAction(Recorder.ActionChoices action) Sets the action for the associated recorder entry.- Parameters:
- action- The action for the entry to take: start or stop.
 
 - 
setAppendpublic void setAppend(boolean append) Whether or not the logger should append to a previous file.- Parameters:
- append- if true, append to a previous file.
 
 - 
setEmacsModepublic void setEmacsMode(boolean emacsMode) Set emacs mode.- Parameters:
- emacsMode- if true use emacs mode
 
 - 
setLoglevelpublic void setLoglevel(Recorder.VerbosityLevelChoices level) Sets the level to which this recorder entry should log to.- Parameters:
- level- the level to set.
- See Also:
- Recorder.VerbosityLevelChoices
 
 - 
executepublic void execute() throws BuildExceptionThe main execution.- Overrides:
- executein class- Task
- Throws:
- BuildException- on error
 
 - 
getRecorderprotected RecorderEntry getRecorder(java.lang.String name, Project proj) throws BuildException Gets the recorder that's associated with the passed in name. If the recorder doesn't exist, then a new one is created.- Parameters:
- name- the name of the recorder
- proj- the current project
- Returns:
- a recorder
- Throws:
- BuildException- on error
 
 - 
buildStartedpublic void buildStarted(BuildEvent event) Empty implementation required by SubBuildListener interface.- Specified by:
- buildStartedin interface- BuildListener
- Parameters:
- event- ignored.
- Since:
- Ant 1.7
 
 - 
subBuildStartedpublic void subBuildStarted(BuildEvent event) Empty implementation required by SubBuildListener interface.- Specified by:
- subBuildStartedin interface- SubBuildListener
- Parameters:
- event- ignored.
- Since:
- Ant 1.7
 
 - 
targetStartedpublic void targetStarted(BuildEvent event) Empty implementation required by SubBuildListener interface.- Specified by:
- targetStartedin interface- BuildListener
- Parameters:
- event- ignored.
- Since:
- Ant 1.7
- See Also:
- BuildEvent.getTarget()
 
 - 
targetFinishedpublic void targetFinished(BuildEvent event) Empty implementation required by SubBuildListener interface.- Specified by:
- targetFinishedin interface- BuildListener
- Parameters:
- event- ignored.
- Since:
- Ant 1.7
- See Also:
- BuildEvent.getException()
 
 - 
taskStartedpublic void taskStarted(BuildEvent event) Empty implementation required by SubBuildListener interface.- Specified by:
- taskStartedin interface- BuildListener
- Parameters:
- event- ignored.
- Since:
- Ant 1.7
- See Also:
- BuildEvent.getTask()
 
 - 
taskFinishedpublic void taskFinished(BuildEvent event) Empty implementation required by SubBuildListener interface.- Specified by:
- taskFinishedin interface- BuildListener
- Parameters:
- event- ignored.
- Since:
- Ant 1.7
- See Also:
- BuildEvent.getException()
 
 - 
messageLoggedpublic void messageLogged(BuildEvent event) Empty implementation required by SubBuildListener interface.- Specified by:
- messageLoggedin interface- BuildListener
- Parameters:
- event- ignored.
- Since:
- Ant 1.7
- See Also:
- BuildEvent.getMessage(),- BuildEvent.getException(),- BuildEvent.getPriority()
 
 - 
buildFinishedpublic void buildFinished(BuildEvent event) Cleans recorder registry.- Specified by:
- buildFinishedin interface- BuildListener
- Parameters:
- event- ignored.
- Since:
- Ant 1.7
- See Also:
- BuildEvent.getException()
 
 - 
subBuildFinishedpublic void subBuildFinished(BuildEvent event) Cleans recorder registry, if this is the subbuild the task has been created in.- Specified by:
- subBuildFinishedin interface- SubBuildListener
- Parameters:
- event- ignored.
- Since:
- Ant 1.7
- See Also:
- BuildEvent.getException()
 
 
- 
 
-