站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

AntEvent (Ant) - NetBeans API Javadoc (Current Development Version)

org.apache.tools.ant.module/3 3.27.0 2

org.apache.tools.ant.module.spi
Class AntEvent

java.lang.Object
  extended by org.apache.tools.ant.module.spi.AntEvent

public final class AntEvent
extends Object

One event delivered to an AntLogger.

Note that one event is shared across all listeners.

The information available from the event represents a best effort to gather information from the Ant run. Some versions of Ant may not support all of these capabilities, in which case the event method will simply return null or whatever the documented fallback value is. For example, Ant 1.5 does not permit details of task structure to be introspected, but 1.6 does.

Since:
org.apache.tools.ant.module/3 3.12

Field Summary
static int LOG_DEBUG
          Debugging log level.
static int LOG_ERR
          Error log level.
static int LOG_INFO
          Information log level.
static int LOG_VERBOSE
          Verbose log level.
static int LOG_WARN
          Warning log level.
 
Method Summary
 void consume()
          Mark an event as consumed to advise other loggers not to handle it.
 String evaluate(String text)
          Evaluate a string with possible substitutions according to defined properties.
 Throwable getException()
          Get a terminating exception.
 int getLine()
          Get the line number in getScriptLocation() corresponding to this event.
 int getLogLevel()
          Get the log level of the message.
 String getMessage()
          Get the name of the message being logged.
 String getProperty(String name)
          Get a property set on the current Ant project.
 Set<String> getPropertyNames()
          Get a set of property names defined on the current Ant project.
 File getScriptLocation()
          Get the location of the Ant script producing this event.
 AntSession getSession()
          Get the associated session.
 String getTargetName()
          Get the name of the target in getScriptLocation() producing this event.
 String getTaskName()
          Get the name of the task producing this event.
 TaskStructure getTaskStructure()
          Get the configured XML structure of the task producing this event.
 boolean isConsumed()
          Test whether this event has already been consumed by some other logger.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG_ERR

public static final int LOG_ERR
Error log level.

See Also:
Constant Field Values

LOG_WARN

public static final int LOG_WARN
Warning log level.

See Also:
Constant Field Values

LOG_INFO

public static final int LOG_INFO
Information log level.

See Also:
Constant Field Values

LOG_VERBOSE

public static final int LOG_VERBOSE
Verbose log level.

See Also:
Constant Field Values

LOG_DEBUG

public static final int LOG_DEBUG
Debugging log level.

See Also:
Constant Field Values
Method Detail

getSession

public AntSession getSession()
Get the associated session.

Returns:
the session object

consume

public void consume()
             throws IllegalStateException
Mark an event as consumed to advise other loggers not to handle it.

Throws:
IllegalStateException - if it was already consumed

isConsumed

public boolean isConsumed()
Test whether this event has already been consumed by some other logger.

Returns:
true if it has already been consumed

getScriptLocation

public File getScriptLocation()
Get the location of the Ant script producing this event.

Returns:
the script location, or null if unknown

getLine

public int getLine()
Get the line number in getScriptLocation() corresponding to this event. Line numbers start at one.

Returns:
the line number, or -1 if unknown

getTargetName

public String getTargetName()
Get the name of the target in getScriptLocation() producing this event. Some events occur outside targets and so there will be no target name.

Returns:
the target name (never empty), or null if unknown or inapplicable

getTaskName

public String getTaskName()
Get the name of the task producing this event. XXX semantics w.r.t. namespaces, taskdefs, etc.? Some events occur outside of tasks and so there will be no name.

Returns:
the task name (never empty), or null if unknown or inapplicable

getTaskStructure

public TaskStructure getTaskStructure()
Get the configured XML structure of the task producing this event. Some events occur outside of tasks and so there will be no information.

Returns:
the task structure, or null if unknown or inapplicable

getMessage

public String getMessage()
Get the name of the message being logged. Applies only to AntLogger.messageLogged(org.apache.tools.ant.module.spi.AntEvent).

Returns:
the message, or null if inapplicable

getLogLevel

public int getLogLevel()
Get the log level of the message. Applies only to AntLogger.messageLogged(org.apache.tools.ant.module.spi.AntEvent). Note that lower numbers are higher priority.

Returns:
the log level (e.g. LOG_INFO), or -1 if inapplicable

getException

public Throwable getException()
Get a terminating exception. Applies only to AntLogger.buildFinished(org.apache.tools.ant.module.spi.AntEvent) and AntLogger.buildInitializationFailed(org.apache.tools.ant.module.spi.AntEvent).

Returns:
an exception ending the build, or null for normal completion or if inapplicable

getProperty

public String getProperty(String name)
Get a property set on the current Ant project.

Parameters:
name - the property name
Returns:
its value, or null

getPropertyNames

public Set<String> getPropertyNames()
Get a set of property names defined on the current Ant project.

Returns:
a set of property names; may be empty but not null

evaluate

public String evaluate(String text)
Evaluate a string with possible substitutions according to defined properties.

Parameters:
text - the text to evaluate
Returns:
its value (may be the same as the incoming text), never null
See Also:
TaskStructure.getAttribute(java.lang.String), TaskStructure.getText()

toString

public String toString()
Overrides:
toString in class Object

org.apache.tools.ant.module/3 3.27.0 2

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.