org.jomc.ant
Class JomcToolTask

Package class diagram package JomcToolTask
java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.jomc.ant.JomcTask
              extended by org.jomc.ant.JomcModelTask
                  extended by org.jomc.ant.JomcToolTask
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
ClassFileProcessorTask, ResourceFileProcessorTask, SourceFileProcessorTask

public class JomcToolTask
extends JomcModelTask

Base class for executing tool based tasks.

Version:
$JOMC: JomcToolTask.java 3878 2011-10-24 00:58:09Z schulte2005 $
Author:
Christian Schulte

Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
JomcToolTask()
          Creates a new JomcToolTask instance.
 
Method Summary
 JomcToolTask clone()
          Creates and returns a copy of this object.
 void configureJomcTool(JomcTool tool)
          Configures a given JomcTool instance using the properties of the instance.
 LocaleType createLocale()
          Creates a new locale element instance.
 KeyValueType createTemplateParameter()
          Creates a new templateParameter element instance.
 PropertiesResourceType createTemplateParameterResource()
          Creates a new templateParameterResource element instance.
 KeyValueType createVelocityProperty()
          Creates a new velocityProperty element instance.
 PropertiesResourceType createVelocityPropertyResource()
          Creates a new velocityPropertyResource element instance.
 String getDefaultTemplateProfile()
          Gets the default template profile to use when accessing templates.
 String getImplementation()
          Gets the identifier of an implementation to process.
 Implementation getImplementation(Model model)
          Gets the implementation to process from a given model.
 String getIndentation()
          Gets the indentation string ('\t' for tab).
 String getInputEncoding()
          Gets the encoding to use for reading files.
 String getLineSeparator()
          Gets the line separator ('\r\n' for DOS, '\r' for Mac, '\n' for Unix).
 LocaleType getLocale()
          Gets the locale.
 String getModule()
          Gets the identifier of a module to process.
 Module getModule(Model model)
          Gets the module to process from a given model.
 String getOutputEncoding()
          Gets the encoding to use for writing files.
 String getSpecification()
          Gets the identifier of a specification to process.
 Specification getSpecification(Model model)
          Gets the specification to process from a given model.
 String getTemplateEncoding()
          Gets the encoding to use for reading templates.
 String getTemplateLocation()
          Gets the location to search for templates in addition to searching the class path of the task.
 List<PropertiesResourceType> getTemplateParameterResources()
          Gets the template parameter resources to apply.
 List<KeyValueType> getTemplateParameters()
          Gets the template parameters to apply.
 String getTemplateProfile()
          Gets the template profile to use when accessing templates.
 List<KeyValueType> getVelocityProperties()
          Gets the Velocity runtime properties to apply.
 List<PropertiesResourceType> getVelocityPropertyResources()
          Gets the Velocity runtime property resources to apply.
 boolean isModulesProcessingRequested()
          Gets a flag indicating all modules are requested to be processed.
 void postExecuteTask()
          Called by the execute method after the preExecuteTask/executeTask methods even if those methods threw an exception.
 void preExecuteTask()
          Called by the execute method prior to the executeTask method.
 void setDefaultTemplateProfile(String value)
          Sets the default template profile to use when accessing templates.
 void setImplementation(String value)
          Sets the identifier of an implementation to process.
 void setIndentation(String value)
          Sets the indentation string ('\t' for tab).
 void setInputEncoding(String value)
          Sets the encoding to use for reading files.
 void setLineSeparator(String value)
          Sets the line separator ('\r\n' for DOS, '\r' for Mac, '\n' for Unix).
 void setModule(String value)
          Sets the identifier of a module to process.
 void setOutputEncoding(String value)
          Sets the encoding to use for writing files.
 void setSpecification(String value)
          Sets the identifier of a specification to process.
 void setTemplateEncoding(String value)
          Sets the encoding to use for reading templates.
 void setTemplateLocation(String value)
          Sets the location to search for templates in addition to searching the class path of the task.
 void setTemplateProfile(String value)
          Sets the template profile to use when accessing templates.
 
Methods inherited from class org.jomc.ant.JomcModelTask
createModuleResource, getModel, getModuleLocation, getModuleResources, getTransformerLocation, isModelObjectClasspathResolutionEnabled, isModelResourceValidationEnabled, newModelContext, setModelObjectClasspathResolutionEnabled, setModelResourceValidationEnabled, setModuleLocation, setTransformerLocation
 
Methods inherited from class org.jomc.ant.JomcTask
assertKeysNotNull, assertLocationsNotNull, assertNamesNotNull, assertNotNull, createClasspath, createModelContextAttribute, createTransformationOutputProperty, createTransformationParameter, createTransformationParameterResource, execute, executeTask, getClasspath, getDirectory, getIf, getModel, getModelContextAttributes, getModelContextFactoryClassName, getModletLocation, getModletSchemaSystemId, getPlatformProviderLocation, getProperties, getProviderLocation, getResource, getResources, getTransformationOutputProperties, getTransformationParameterResources, getTransformationParameters, getTransformer, getUnless, isModelProcessingEnabled, isModletResourceValidationEnabled, logMessage, logMessage, logSeparator, logValidationReport, newProjectClassLoader, setClasspath, setClasspathRef, setIf, setModel, setModelContextFactoryClassName, setModelProcessingEnabled, setModletLocation, setModletResourceValidationEnabled, setModletSchemaSystemId, setPlatformProviderLocation, setProviderLocation, setUnless
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JomcToolTask

public JomcToolTask()
Creates a new JomcToolTask instance.

Method Detail

getInputEncoding

public final String getInputEncoding()
Gets the encoding to use for reading files.

Returns:
The encoding to use for reading files or null.
See Also:
setInputEncoding(java.lang.String)

setInputEncoding

public final void setInputEncoding(String value)
Sets the encoding to use for reading files.

Parameters:
value - The new encoding to use for reading files or null.
See Also:
getInputEncoding()

getOutputEncoding

public final String getOutputEncoding()
Gets the encoding to use for writing files.

Returns:
The encoding to use for writing files or null.
See Also:
setOutputEncoding(java.lang.String)

setOutputEncoding

public final void setOutputEncoding(String value)
Sets the encoding to use for writing files.

Parameters:
value - The new encoding to use for writing files or null.
See Also:
getOutputEncoding()

getTemplateEncoding

public final String getTemplateEncoding()
Gets the encoding to use for reading templates.

Returns:
The encoding to use for reading templates or null.
See Also:
setTemplateEncoding(java.lang.String)

setTemplateEncoding

public final void setTemplateEncoding(String value)
Sets the encoding to use for reading templates.

Parameters:
value - The new encoding to use for reading templates or null.
See Also:
getTemplateEncoding()

getTemplateLocation

public final String getTemplateLocation()
Gets the location to search for templates in addition to searching the class path of the task.

Returns:
The location to search for templates in addition to searching the class path of the task or null.
See Also:
setTemplateLocation(java.lang.String)

setTemplateLocation

public final void setTemplateLocation(String value)
Sets the location to search for templates in addition to searching the class path of the task.

Parameters:
value - The new location to search for templates in addition to searching the class path of the task or null.
See Also:
getTemplateLocation()

getDefaultTemplateProfile

public final String getDefaultTemplateProfile()
Gets the default template profile to use when accessing templates.

Returns:
The default template profile to use when accessing templates or null.
See Also:
setDefaultTemplateProfile(java.lang.String)

setDefaultTemplateProfile

public final void setDefaultTemplateProfile(String value)
Sets the default template profile to use when accessing templates.

Parameters:
value - The new default template profile to use when accessing templates or null.
See Also:
getDefaultTemplateProfile()

getTemplateProfile

public final String getTemplateProfile()
Gets the template profile to use when accessing templates.

Returns:
The template profile to use when accessing templates or null.
See Also:
setTemplateProfile(java.lang.String)

setTemplateProfile

public final void setTemplateProfile(String value)
Sets the template profile to use when accessing templates.

Parameters:
value - The new template profile to use when accessing templates or null.
See Also:
getTemplateProfile()

getIndentation

public final String getIndentation()
Gets the indentation string ('\t' for tab).

Returns:
The indentation string ('\t' for tab) or null.
See Also:
setIndentation(java.lang.String)

setIndentation

public final void setIndentation(String value)
Sets the indentation string ('\t' for tab).

Parameters:
value - The new indentation string ('\t' for tab) or null.
See Also:
getIndentation()

getLineSeparator

public final String getLineSeparator()
Gets the line separator ('\r\n' for DOS, '\r' for Mac, '\n' for Unix).

Returns:
The line separator ('\r\n' for DOS, '\r' for Mac, '\n' for Unix) or null.
See Also:
setLineSeparator(java.lang.String)

setLineSeparator

public final void setLineSeparator(String value)
Sets the line separator ('\r\n' for DOS, '\r' for Mac, '\n' for Unix).

Parameters:
value - The new line separator ('\r\n' for DOS, '\r' for Mac, '\n' for Unix) or null.
See Also:
getLineSeparator()

getLocale

public final LocaleType getLocale()
Gets the locale.

Returns:
The locale or null.
See Also:
createLocale()

createLocale

public LocaleType createLocale()
Creates a new locale element instance.

Returns:
A new locale element instance.
Throws:
org.apache.tools.ant.BuildException - if a value already has been created.
See Also:
getLocale()

getSpecification

public final String getSpecification()
Gets the identifier of a specification to process.

Returns:
The identifier of a specification to process or null.
See Also:
setSpecification(java.lang.String)

setSpecification

public final void setSpecification(String value)
Sets the identifier of a specification to process.

Parameters:
value - The new identifier of a specification to process or null.
See Also:
getSpecification()

getSpecification

public final Specification getSpecification(Model model)
Gets the specification to process from a given model.

Parameters:
model - The model to get the specification to process from.
Returns:
The specification to process or null.
Throws:
NullPointerException - if model is null.
See Also:
getSpecification()

getImplementation

public final String getImplementation()
Gets the identifier of an implementation to process.

Returns:
The identifier of an implementation to process or null.
See Also:
setImplementation(java.lang.String)

setImplementation

public final void setImplementation(String value)
Sets the identifier of an implementation to process.

Parameters:
value - The new identifier of an implementation to process or null.
See Also:
getImplementation()

getImplementation

public final Implementation getImplementation(Model model)
Gets the implementation to process from a given model.

Parameters:
model - The model to get the implementation to process from.
Returns:
The implementation to process or null.
Throws:
NullPointerException - if model is null.
See Also:
getImplementation()

getModule

public final String getModule()
Gets the identifier of a module to process.

Returns:
The identifier of a module to process or null.
See Also:
setModule(java.lang.String)

setModule

public final void setModule(String value)
Sets the identifier of a module to process.

Parameters:
value - The new identifier of a module to process or null.
See Also:
getModule()

getModule

public final Module getModule(Model model)
Gets the module to process from a given model.

Parameters:
model - The model to get the module to process from.
Returns:
The module to process or null.
Throws:
NullPointerException - if model is null.
See Also:
getModule()

isModulesProcessingRequested

public boolean isModulesProcessingRequested()
Gets a flag indicating all modules are requested to be processed.

Returns:
true, if processing of all modules is requested; false, else.
See Also:
getSpecification(), getImplementation(), getModule()

getVelocityProperties

public final List<KeyValueType> getVelocityProperties()
Gets the Velocity runtime properties to apply.

This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the object. This is why there is no set method for the velocity properties property.

Returns:
The Velocity runtime properties to apply.
See Also:
createVelocityProperty()

createVelocityProperty

public KeyValueType createVelocityProperty()
Creates a new velocityProperty element instance.

Returns:
A new velocityProperty element instance.
See Also:
getVelocityProperties()

getVelocityPropertyResources

public final List<PropertiesResourceType> getVelocityPropertyResources()
Gets the Velocity runtime property resources to apply.

This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the object. This is why there is no set method for the velocity property resources property.

Returns:
The Velocity runtime property resources to apply.
See Also:
createVelocityPropertyResource()

createVelocityPropertyResource

public PropertiesResourceType createVelocityPropertyResource()
Creates a new velocityPropertyResource element instance.

Returns:
A new velocityPropertyResource element instance.
See Also:
getVelocityPropertyResources()

getTemplateParameters

public final List<KeyValueType> getTemplateParameters()
Gets the template parameters to apply.

This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the object. This is why there is no set method for the template parameters property.

Returns:
The template parameters to apply.
See Also:
createTemplateParameter()

createTemplateParameter

public KeyValueType createTemplateParameter()
Creates a new templateParameter element instance.

Returns:
A new templateParameter element instance.
See Also:
getTemplateParameters()

getTemplateParameterResources

public final List<PropertiesResourceType> getTemplateParameterResources()
Gets the template parameter resources to apply.

This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the object. This is why there is no set method for the template parameter resources property.

Returns:
The template parameter resources to apply.
See Also:
createTemplateParameterResource()

createTemplateParameterResource

public PropertiesResourceType createTemplateParameterResource()
Creates a new templateParameterResource element instance.

Returns:
A new templateParameterResource element instance.
See Also:
getTemplateParameterResources()

preExecuteTask

public void preExecuteTask()
                    throws org.apache.tools.ant.BuildException
Called by the execute method prior to the executeTask method.

Overrides:
preExecuteTask in class JomcModelTask
Throws:
org.apache.tools.ant.BuildException - if execution fails.
See Also:
JomcTask.execute()

postExecuteTask

public void postExecuteTask()
                     throws org.apache.tools.ant.BuildException
Called by the execute method after the preExecuteTask/executeTask methods even if those methods threw an exception.

Overrides:
postExecuteTask in class JomcTask
Throws:
org.apache.tools.ant.BuildException - if execution fails.
See Also:
JomcTask.execute()

configureJomcTool

public void configureJomcTool(JomcTool tool)
                       throws org.apache.tools.ant.BuildException
Configures a given JomcTool instance using the properties of the instance.

Parameters:
tool - The tool to configure.
Throws:
NullPointerException - if tool is null.
org.apache.tools.ant.BuildException - if configuring tool fails.

clone

public JomcToolTask clone()
Creates and returns a copy of this object.

Overrides:
clone in class JomcModelTask
Returns:
A copy of this object.


Copyright © 2005-2012 The JOMC Project. All Rights Reserved.Get JOMC at SourceForge.net. Fast, secure and Free Open Source software downloads
Please note that this documentation is maintained by non-native english speaking authors. As such, you may encounter phrases or wordings which seem imprecise or may even have a totally different meaning to native english speaking readers than what the individual author was trying to express. If you are a native english speaking reader and find any such phrases or wordings we kindly ask you to send an email to the corresponding author and help us improve this documentation in order to avoid misunderstandings. You will find the authors' email addresses at the top of each class. Please accept our apologies for any inconvenience caused.