org.objectweb.jonas.ant.jonasbase
Class JTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.objectweb.jonas.ant.BootstrapTask
              extended by org.objectweb.jonas.ant.jonasbase.JTask
All Implemented Interfaces:
BaseTaskItf
Direct Known Subclasses:
Db, Dbm, JdbcRa, JmsRa, JonasProperties, Mail, Services, WsdlPublish, XMLSerializerTask

public class JTask
extends BootstrapTask
implements BaseTaskItf

Defines a common task

Author:
Florent Benoit

Field Summary
static java.lang.String SEPARATORS
          Property separators (4 spaces)
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
JTask()
           
 
Method Summary
protected  void changeValueForKey(java.lang.String info, java.lang.String confDir, java.lang.String confFile, java.lang.String property, java.lang.String name, boolean add)
          Add a value for a specific property in a configuration file.
protected  void changeValueForKey(java.lang.String info, java.lang.String confDir, java.lang.String confFile, java.lang.String property, java.lang.String name, java.lang.String separators, boolean add)
          Add a value for a specific property in a configuration file
protected  java.lang.String getConfigurationFile()
           
 java.io.File getDestDir()
          Gets the destination directory
 java.lang.String getLogInfo()
          Gets logger info (to be displayed)
 void setConfigurationFile(java.lang.String configurationFile)
          Sets the configuration file
 void setDestDir(java.io.File destDir)
           
 void setLogInfo(java.lang.String logInfo)
          Set the info to be displayed by the logger
protected  void writePropsToFile(java.lang.String info, java.util.Properties props, java.io.File f)
          Write properties object to a file with some logging info
 
Methods inherited from class org.objectweb.jonas.ant.BootstrapTask
createClasspath, getBootstraptask, getCatalinaHome, getDomainName, getJettyHome, getJonasRoot, getServerName, getTaskName, setCatalinaHome, setClasspath, setDomainName, setJettyHome, setJonasbase, setJonasRoot, setJvmopts, setServerName, setTaskName
 
Methods inherited from class org.apache.tools.ant.Task
execute, getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, 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
 
Methods inherited from interface org.objectweb.jonas.ant.jonasbase.BaseTaskItf
execute, setJonasRoot
 

Field Detail

SEPARATORS

public static final java.lang.String SEPARATORS
Property separators (4 spaces)

See Also:
Constant Field Values
Constructor Detail

JTask

public JTask()
Method Detail

setConfigurationFile

public void setConfigurationFile(java.lang.String configurationFile)
Sets the configuration file

Specified by:
setConfigurationFile in interface BaseTaskItf
Parameters:
configurationFile - The configurationFile to set.

setDestDir

public void setDestDir(java.io.File destDir)
Specified by:
setDestDir in interface BaseTaskItf
Parameters:
destDir - The destDir to set.

getLogInfo

public java.lang.String getLogInfo()
Gets logger info (to be displayed)

Specified by:
getLogInfo in interface BaseTaskItf
Returns:
logger info
See Also:
BaseTaskItf.getLogInfo()

setLogInfo

public void setLogInfo(java.lang.String logInfo)
Set the info to be displayed by the logger

Specified by:
setLogInfo in interface BaseTaskItf
Parameters:
logInfo - information to be displayed
See Also:
BaseTaskItf.setLogInfo(java.lang.String)

getDestDir

public java.io.File getDestDir()
Gets the destination directory

Returns:
the destination directory

writePropsToFile

protected void writePropsToFile(java.lang.String info,
                                java.util.Properties props,
                                java.io.File f)
Write properties object to a file with some logging info

Parameters:
info - header for logging
props - Properties to write
f - file for writing

changeValueForKey

protected void changeValueForKey(java.lang.String info,
                                 java.lang.String confDir,
                                 java.lang.String confFile,
                                 java.lang.String property,
                                 java.lang.String name,
                                 boolean add)
Add a value for a specific property in a configuration file. The separator uses between the property name and the property value is the default separator value.

Parameters:
info - text to be displayed for header
confDir - configuration directory (can be JONAS_BASE/conf)
confFile - configuration file (can be jonas.properties)
property - which must be found in confFile
name - value for the property to add
add - if true, add it, else replace

changeValueForKey

protected void changeValueForKey(java.lang.String info,
                                 java.lang.String confDir,
                                 java.lang.String confFile,
                                 java.lang.String property,
                                 java.lang.String name,
                                 java.lang.String separators,
                                 boolean add)
Add a value for a specific property in a configuration file

Parameters:
info - text to be displayed for header
confDir - configuration directory (can be JONAS_BASE/conf)
confFile - configuration file (can be jonas.properties)
property - which must be found in confFile
name - value for the property to add
separators - separator using between the property name and the property value
add - if true, add it, else replace

getConfigurationFile

protected java.lang.String getConfigurationFile()
Returns:
the configurationFile.