Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs

public Class RecorderEntry

extends Object
implements BuildLogger, SubBuildListener
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.SubBuildListener, org.apache.tools.ant.BuildListener, java.util.EventListener, org.apache.tools.ant.BuildLogger
Imports
java.io.IOException, .PrintStream, java.nio.file.Paths, org.apache.tools.ant.BuildEvent, .BuildException, .BuildLogger, .DefaultLogger, .Project, .SubBuildListener, org.apache.tools.ant.util.FileUtils

This is a class that represents a recorder. This is the listener to the build process.
Since
Ant 1.4

Field Summary

Modifier and TypeField and Description
private boolean
emacsMode

Strip task banners if true.

private String
filename

The name of the file associated with this recorder entry.

private int
loglevel

The current verbosity level to record at.

private PrintStream
out

The output PrintStream to record to.

private Project
project

project instance the recorder is associated with

private boolean
record

The state of the recorder (recorder on or off).

private long
targetStartTime

The start time of the last know target.

Constructor Summary

AccessConstructor and Description
protected
RecorderEntry(String
The name of this recorder (used as the filename).
name
)

Method Summary

Modifier and TypeMethod and Description
public void
buildFinished(BuildEvent
An event with any relevant extra information. Must not be null.
event
)

Implements org.apache.tools.ant.BuildListener.buildFinished.

Signals that the last target has finished.
public void
buildStarted(BuildEvent
An event with any relevant extra information. Must not be null.
event
)

Implements org.apache.tools.ant.BuildListener.buildStarted.

Signals that a build has started.
public void
pack-priv void
closeFile()

Closes the file associated with this recorder.

private void
private static String
formatTime(long millis)

public String

Returns:

the name of the file the output is sent to.
getFilename
()

public int
public Project

Returns:

Project
getProject
()

Get the project associated with this recorder entry.

private void
log(String
The message to log.
mesg
,
int
The verbosity level of the message.
level
)

The thing that actually sends the information to the output.

public void
messageLogged(BuildEvent
An event with any relevant extra information. Must not be null.
event
)

Implements org.apache.tools.ant.BuildListener.messageLogged.

Signals a message logging event.
pack-priv void
openFile(boolean
Indicates if output must be appended to the logfile or that the logfile should be overwritten.
append
)

Initially opens the file associated with this recorder.

private void
openFileImpl(boolean append)

pack-priv void
reopenFile()

Re-opens the file associated with this recorder.

public void
setEmacsMode(boolean
true if output is to be unadorned so that emacs and other editors can parse files names, etc.
emacsMode
)

Implements org.apache.tools.ant.BuildLogger.setEmacsMode.

Sets this logger to produce emacs (and other editor) friendly output.
public void
setErrorPrintStream(PrintStream
The error stream for the logger. Must not be null.
err
)

Implements org.apache.tools.ant.BuildLogger.setErrorPrintStream.

Sets the output stream to which this logger is to send error messages.
public void
setMessageOutputLevel(int
the logging level for the logger.
level
)

Implements org.apache.tools.ant.BuildLogger.setMessageOutputLevel.

Sets the highest level of message this logger should respond to.
public void
setOutputPrintStream(PrintStream
The output stream for the logger. Must not be null.
output
)

Implements org.apache.tools.ant.BuildLogger.setOutputPrintStream.

Sets the output stream to which this logger is to send its output.
public void
setProject(Project
the project instance
project
)

Set the project associated with this recorder entry.

public void
setRecordState(Boolean
true for on, false for off, null for no change.
state
)

Turns off or on this recorder.

public void
subBuildFinished(BuildEvent
the buildFinished event
event
)

Implements org.apache.tools.ant.SubBuildListener.subBuildFinished.

Cleans up any resources held by this recorder entry at the end of a subbuild if it has been created for the subbuild's project instance.
public void
subBuildStarted(BuildEvent
the buildStarted event
event
)

Implements org.apache.tools.ant.SubBuildListener.subBuildStarted.

Empty implementation to satisfy the BuildListener interface.
public void
targetFinished(BuildEvent
An event with any relevant extra information. Must not be null.
event
)

Implements org.apache.tools.ant.BuildListener.targetFinished.

Signals that a target has finished.
public void
targetStarted(BuildEvent
An event with any relevant extra information. Must not be null.
event
)

Implements org.apache.tools.ant.BuildListener.targetStarted.

Signals that a target is starting.
public void
taskFinished(BuildEvent
An event with any relevant extra information. Must not be null.
event
)

Implements org.apache.tools.ant.BuildListener.taskFinished.

Signals that a task has finished.
public void
taskStarted(BuildEvent
An event with any relevant extra information. Must not be null.
event
)

Implements org.apache.tools.ant.BuildListener.taskStarted.

Signals that a task is starting.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

emacsModeback to summary
private boolean emacsMode

Strip task banners if true.

filenameback to summary
private String filename

The name of the file associated with this recorder entry.

loglevelback to summary
private int loglevel

The current verbosity level to record at.

outback to summary
private PrintStream out

The output PrintStream to record to.

projectback to summary
private Project project

project instance the recorder is associated with

recordback to summary
private boolean record

The state of the recorder (recorder on or off).

targetStartTimeback to summary
private long targetStartTime

The start time of the last know target.

Constructor Detail

RecorderEntryback to summary
protected RecorderEntry(String name)
Parameters
name:String

The name of this recorder (used as the filename).

Method Detail

buildFinishedback to summary
public void buildFinished(BuildEvent event)

Implements org.apache.tools.ant.BuildListener.buildFinished.

Doc from org.apache.tools.ant.BuildListener.buildFinished.

Signals that the last target has finished. This event will still be fired if an error occurred during the build.

Parameters
event:BuildEvent

An event with any relevant extra information. Must not be null.

See Also
.
buildStartedback to summary
public void buildStarted(BuildEvent event)

Implements org.apache.tools.ant.BuildListener.buildStarted.

Doc from org.apache.tools.ant.BuildListener.buildStarted.

Signals that a build has started. This event is fired before any targets have started.

This event is fired before the project instance is fully configured. In particular no properties have been set and the project may not know its name or default target, yet.

Parameters
event:BuildEvent

An event with any relevant extra information. Must not be null.

See Also
.
cleanupback to summary
public void cleanup()
Since
1.6.2
closeFileback to summary
pack-priv void closeFile()

Closes the file associated with this recorder. Used by Recorder.

Since
1.6.3
flushback to summary
private void flush()
formatTimeback to summary
private static String formatTime(long millis)
getFilenameback to summary
public String getFilename()
Returns:String

the name of the file the output is sent to.

getMessageOutputLevelback to summary
public int getMessageOutputLevel()

Overrides default org.apache.tools.ant.BuildLogger.getMessageOutputLevel.

Returns:int

Doc from org.apache.tools.ant.BuildLogger.getMessageOutputLevel.

Returns the currently set message output level. The default implementation of this method returns MSG_INFO.

Annotations
@Override
getProjectback to summary
public Project getProject()

Get the project associated with this recorder entry.

Returns:Project

Project

Since
1.8.0
logback to summary
private void log(String mesg, int level)

The thing that actually sends the information to the output.

Parameters
mesg:String

The message to log.

level:int

The verbosity level of the message.

messageLoggedback to summary
public void messageLogged(BuildEvent event)

Implements org.apache.tools.ant.BuildListener.messageLogged.

Doc from org.apache.tools.ant.BuildListener.messageLogged.

Signals a message logging event.

Parameters
event:BuildEvent

An event with any relevant extra information. Must not be null.

See Also
.
openFileback to summary
pack-priv void openFile(boolean append) throws BuildException

Initially opens the file associated with this recorder. Used by Recorder.

Parameters
append:boolean

Indicates if output must be appended to the logfile or that the logfile should be overwritten.

Exceptions
BuildException:
if something goes wrong
Since
1.6.3
openFileImplback to summary
private void openFileImpl(boolean append) throws BuildException
reopenFileback to summary
pack-priv void reopenFile() throws BuildException

Re-opens the file associated with this recorder. Used by Recorder.

Exceptions
BuildException:
if something goes wrong
Since
1.6.3
setEmacsModeback to summary
public void setEmacsMode(boolean emacsMode)

Implements org.apache.tools.ant.BuildLogger.setEmacsMode.

Doc from org.apache.tools.ant.BuildLogger.setEmacsMode.

Sets this logger to produce emacs (and other editor) friendly output.

Parameters
emacsMode:boolean

true if output is to be unadorned so that emacs and other editors can parse files names, etc.

See Also
.
setErrorPrintStreamback to summary
public void setErrorPrintStream(PrintStream err)

Implements org.apache.tools.ant.BuildLogger.setErrorPrintStream.

Doc from org.apache.tools.ant.BuildLogger.setErrorPrintStream.

Sets the output stream to which this logger is to send error messages.

Parameters
err:PrintStream

The error stream for the logger. Must not be null.

See Also
.
setMessageOutputLevelback to summary
public void setMessageOutputLevel(int level)

Implements org.apache.tools.ant.BuildLogger.setMessageOutputLevel.

Doc from org.apache.tools.ant.BuildLogger.setMessageOutputLevel.

Sets the highest level of message this logger should respond to. Only messages with a message level lower than or equal to the given level should be written to the log.

Constants for the message levels are in the Project class. The order of the levels, from least to most verbose, is MSG_ERR, MSG_WARN, MSG_INFO, MSG_VERBOSE, MSG_DEBUG.

Parameters
level:int

the logging level for the logger.

See Also
.
setOutputPrintStreamback to summary
public void setOutputPrintStream(PrintStream output)

Implements org.apache.tools.ant.BuildLogger.setOutputPrintStream.

Doc from org.apache.tools.ant.BuildLogger.setOutputPrintStream.

Sets the output stream to which this logger is to send its output.

Parameters
output:PrintStream

The output stream for the logger. Must not be null.

See Also
.
setProjectback to summary
public void setProject(Project project)

Set the project associated with this recorder entry.

Parameters
project:Project

the project instance

Since
1.6.2
setRecordStateback to summary
public void setRecordState(Boolean state)

Turns off or on this recorder.

Parameters
state:Boolean

true for on, false for off, null for no change.

subBuildFinishedback to summary
public void subBuildFinished(BuildEvent event)

Implements org.apache.tools.ant.SubBuildListener.subBuildFinished.

Cleans up any resources held by this recorder entry at the end of a subbuild if it has been created for the subbuild's project instance.

Parameters
event:BuildEvent

the buildFinished event

Since
Ant 1.6.2
subBuildStartedback to summary
public void subBuildStarted(BuildEvent event)

Implements org.apache.tools.ant.SubBuildListener.subBuildStarted.

Empty implementation to satisfy the BuildListener interface.

Parameters
event:BuildEvent

the buildStarted event

Since
Ant 1.6.2
targetFinishedback to summary
public void targetFinished(BuildEvent event)

Implements org.apache.tools.ant.BuildListener.targetFinished.

Doc from org.apache.tools.ant.BuildListener.targetFinished.

Signals that a target has finished. This event will still be fired if an error occurred during the build.

Parameters
event:BuildEvent

An event with any relevant extra information. Must not be null.

See Also
.
targetStartedback to summary
public void targetStarted(BuildEvent event)

Implements org.apache.tools.ant.BuildListener.targetStarted.

Doc from org.apache.tools.ant.BuildListener.targetStarted.

Signals that a target is starting.

Parameters
event:BuildEvent

An event with any relevant extra information. Must not be null.

See Also
.
taskFinishedback to summary
public void taskFinished(BuildEvent event)

Implements org.apache.tools.ant.BuildListener.taskFinished.

Doc from org.apache.tools.ant.BuildListener.taskFinished.

Signals that a task has finished. This event will still be fired if an error occurred during the build.

Parameters
event:BuildEvent

An event with any relevant extra information. Must not be null.

See Also
.
taskStartedback to summary
public void taskStarted(BuildEvent event)

Implements org.apache.tools.ant.BuildListener.taskStarted.

Doc from org.apache.tools.ant.BuildListener.taskStarted.

Signals that a task is starting.

Parameters
event:BuildEvent

An event with any relevant extra information. Must not be null.

See Also
.