org.clapper.util.ant
Class HostnameTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.clapper.util.ant.HostnameTask

public class HostnameTask
extends org.apache.tools.ant.Task

Ant task to retrieve the name of the host on which the build is running, storing the name in a property. Example:

 <taskdef name="host"
          classname="org.clapper.util.ant.HostnameTask"
          classpath="${build}"/>
 <host property="build.host"/>
 
The specified property is always set to something. If the task cannot retrieve the current host name, it displays a message to standard error and sets the property to "localhost".

Version:
$Id: HostnameTask.java 6735 2007-05-12 11:30:05Z bmc $
Author:
Copyright © 2004-2007 Brian M. Clapper

Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
HostnameTask()
          Default constructor
 
Method Summary
 void execute()
          Execute the Ant task, retrieving the host name and storing it in the property.
 void setProperty(java.lang.String prop)
          Called by Ant to set the "property" attribute.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HostnameTask

public HostnameTask()
Default constructor

Method Detail

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Execute the Ant task, retrieving the host name and storing it in the property.

Overrides:
execute in class org.apache.tools.ant.Task
Throws:
org.apache.tools.ant.BuildException - on error

setProperty

public void setProperty(java.lang.String prop)
Called by Ant to set the "property" attribute.

Parameters:
prop - the name of the property to be set to the host name


Copyright © 2004-2007 Brian M. Clapper. All Rights Reserved.