org.figure8.join.services.scripting.ant
Class AntScriptLauncher

java.lang.Object
  extended by org.figure8.join.services.scripting.ScriptLauncher
      extended by org.figure8.join.services.scripting.ant.AntScriptLauncher
All Implemented Interfaces:
Configurable

public class AntScriptLauncher
extends ScriptLauncher

Extension of ScriptLauncher dedicated to the Apache Ant build tool (see http://ant.apache.org). This implementation lets you wrap the execution of an Ant script within a ScriptLauncher.
As a Configurable implementation, this launcher defines 2 more configurable parameters that are the build file target to execute and the log level to apply onto the logger build listener.

Version:
$Revision: 1.2 $
Author:
Laurent Broudoux
See Also:
Configurable

Field Summary
static java.lang.String LOG_LEVEL_PARAM
          Name of configurable parameter denoting the log level of script execution.
protected static ParameterDefinition logLevelParam
          ParameterDefinition representation of parameter denoting the log level of execution.
protected static java.util.List parameters
          List of ParameterDefinitions supported by this launcher
static java.lang.String TARGET_PARAM
          Name of configurable parameter denoting the target to execute in Ant script.
protected static ParameterDefinition targetParam
          ParameterDefinition representation of parameter denoting the target to execute.
 
Fields inherited from class org.figure8.join.services.scripting.ScriptLauncher
SCRIPT_PARAM, scriptParam
 
Constructor Summary
AntScriptLauncher()
          Create a new instance of AntScriptLauncher.
AntScriptLauncher(java.lang.String scriptPath)
          Creates a new instance of AntScriptLauncher with script path
 
Method Summary
 java.lang.String getLogLevel()
           
 java.util.List getParameterDefinitionsAsList()
          Get this object parameters definitions as a list
 java.lang.String getTarget()
           
 void runScript(java.util.Properties properties)
          Run the Ant build file identified by scriptPath inner field.
 void setLogLevel(java.lang.String logLevel)
           
 void setParameter(java.lang.String parameterName, java.lang.String parameterValue)
          Set the value of a parameter using its nama
 void setTarget(java.lang.String target)
           
 
Methods inherited from class org.figure8.join.services.scripting.ScriptLauncher
getLogOutputStream, getParameterDefinitions, getScript, getScriptPath, setLogOutputStream, setParameter, setParameters, setScriptPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TARGET_PARAM

public static final java.lang.String TARGET_PARAM
Name of configurable parameter denoting the target to execute in Ant script.

See Also:
Constant Field Values

LOG_LEVEL_PARAM

public static final java.lang.String LOG_LEVEL_PARAM
Name of configurable parameter denoting the log level of script execution.

See Also:
Constant Field Values

parameters

protected static java.util.List parameters
List of ParameterDefinitions supported by this launcher


targetParam

protected static final ParameterDefinition targetParam
ParameterDefinition representation of parameter denoting the target to execute.


logLevelParam

protected static final ParameterDefinition logLevelParam
ParameterDefinition representation of parameter denoting the log level of execution.

Constructor Detail

AntScriptLauncher

public AntScriptLauncher()
Create a new instance of AntScriptLauncher.


AntScriptLauncher

public AntScriptLauncher(java.lang.String scriptPath)
                  throws InvalidParameterException
Creates a new instance of AntScriptLauncher with script path

Parameters:
scriptPath - the path of script to later execute
Throws:
InvalidParameterException - if path cannot be accessed
Method Detail

getTarget

public java.lang.String getTarget()
Returns:
The target to execute in Ant script

setTarget

public void setTarget(java.lang.String target)
Parameters:
target - The target to execute in Ant script

getLogLevel

public java.lang.String getLogLevel()
Returns:
The level of log during execution

setLogLevel

public void setLogLevel(java.lang.String logLevel)
Parameters:
logLevel - The level of log during execution

runScript

public void runScript(java.util.Properties properties)
               throws ScriptException
Run the Ant build file identified by scriptPath inner field. Properties passed as param are injected into the Ant project as user properties. Script can directly use them using the ${property.name} form.

Specified by:
runScript in class ScriptLauncher
Parameters:
properties - The runtime properties to inject into execution environment
Throws:
ScriptException - if something wrong occurs during script parsing, evaluation, ...

getParameterDefinitionsAsList

public java.util.List getParameterDefinitionsAsList()
Get this object parameters definitions as a list

Specified by:
getParameterDefinitionsAsList in interface Configurable
Overrides:
getParameterDefinitionsAsList in class ScriptLauncher
Returns:
A list of ParameterDefinition objects

setParameter

public void setParameter(java.lang.String parameterName,
                         java.lang.String parameterValue)
                  throws InvalidParameterException
Set the value of a parameter using its nama

Specified by:
setParameter in interface Configurable
Overrides:
setParameter in class ScriptLauncher
Parameters:
parameterName - The name of parameter so set value for
parameterValue - The value of the paramater
Throws:
InvalidParameterException - if this parameter is not supported by this object


Copyright © 2005-2008 Join. All Rights Reserved.