hudson.model
Interface TaskListener

All Superinterfaces:
Serializable
All Known Subinterfaces:
BuildListener
All Known Implementing Classes:
AbstractTaskListener, LogTaskListener, StreamBuildListener, StreamTaskListener

public interface TaskListener
extends Serializable

Receives events that happen during some lengthy operation that has some chance of failures, such as a build, SCM change polling, slave launch, and so on.

This interface is implemented by Hudson core and passed to extension points so that they can record the progress of the operation without really knowing how those information and handled/stored by Hudson.

The information is one way or the other made available to users, and so the expectation is that when something goes wrong, enough information shall be written to a TaskListener so that the user can diagnose what's going wrong.

StreamTaskListener is the most typical implementation of this interface. All the TaskListener implementations passed to plugins from Hudson core are remotable.

Author:
Kohsuke Kawaguchi
See Also:
AbstractTaskListener

Field Summary
static TaskListener NULL
          TaskListener that discards the output.
 
Method Summary
 void annotate(ConsoleNote ann)
          Annotates the current position in the output log by using the given annotation.
 PrintWriter error(String msg)
          An error in the build.
 PrintWriter error(String format, Object... args)
          Formatter.format(String, Object[]) version of error(String).
 PrintWriter fatalError(String msg)
          A fatal error in the build.
 PrintWriter fatalError(String format, Object... args)
          Formatter.format(String, Object[]) version of fatalError(String).
 PrintStream getLogger()
          This writer will receive the output of the build
 void hyperlink(String url, String text)
          Places a HyperlinkNote on the given text.
 

Field Detail

NULL

static final TaskListener NULL
TaskListener that discards the output.

Method Detail

getLogger

PrintStream getLogger()
This writer will receive the output of the build

Returns:
must be non-null.

annotate

void annotate(ConsoleNote ann)
              throws IOException
Annotates the current position in the output log by using the given annotation. If the implementation doesn't support annotated output log, this method might be no-op.

Throws:
IOException
Since:
1.349

hyperlink

void hyperlink(String url,
               String text)
               throws IOException
Places a HyperlinkNote on the given text.

Parameters:
url - If this starts with '/', it's interpreted as a path within the context path.
Throws:
IOException

error

PrintWriter error(String msg)
An error in the build.

Returns:
A writer to receive details of the error. Not null.

error

PrintWriter error(String format,
                  Object... args)
Formatter.format(String, Object[]) version of error(String).


fatalError

PrintWriter fatalError(String msg)
A fatal error in the build.

Returns:
A writer to receive details of the error. Not null.

fatalError

PrintWriter fatalError(String format,
                       Object... args)
Formatter.format(String, Object[]) version of fatalError(String).



Copyright © 2004-2013. All Rights Reserved.