|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.MatchingTask
org.nuiton.eugene.GeneratorTask
public class GeneratorTask
Ant generator Task. Exemple d'utilisation dans ant :
<taskdef name="generator" classname="org.nuiton.eugene.GeneratorTask"
classpath="${compile.classpath}:${targetbuild}:${resources}" />
<target name="generate" description="generate">
<generator srcdir="${modelDir}" destdir="${targetgen}"
resolver="org.nuiton.exemple.ResourceResolver"
templates="org.nuiton.example.JavaBeanGenerator"
properties="defaultPackage=org.nuiton,fullPackagePath=org.nuiton,extraPackages=org.nuiton"
classpath="${compile.classpath}:${targetbuild}:${resources}" />
</target>
Created: 14 janv. 2004
| Nested Class Summary | |
|---|---|
protected class |
GeneratorTask.XmiVersionHandler
Sax handler to find xmi version into xmi document. |
| Field Summary | |
|---|---|
protected java.lang.String |
buildDirectory
Generation directory (default to 'build') |
protected org.apache.tools.ant.types.Path |
classpath
Ant classpath to use. |
protected java.io.File |
destDir
Destination directory. |
protected java.lang.String |
encoding
Encoding. |
protected boolean |
overwrite
Overwrite already existing generated files. |
protected java.util.Properties |
properties
Additional generator properties. |
protected java.lang.String |
resolver
URI Resolver. |
protected java.io.File |
srcDir
Model directory. |
protected java.io.File |
srcFile
Single model file. |
protected java.lang.String |
templates
Template used in generation (comma separated). |
protected java.lang.String |
transformations
Transformation to do on model (comma separated). |
| Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
|---|
fileset |
| 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 | |
|---|---|
GeneratorTask()
|
|
| Method Summary | |
|---|---|
protected org.apache.tools.ant.types.Path |
createClasspath()
Set the optional classpath to the XSL processor |
protected java.util.List<java.io.File> |
doConvertFiles(java.util.List<java.io.File> srcFiles,
java.io.File destDir)
Convert srcFiles and return only eugene models files. |
protected void |
doExecute(java.io.File srcFile,
java.io.File destDir,
Template[] generators)
Equivalent to doExecute(new File[] { srcFile }, destDir, generators). |
protected void |
doExecute(java.util.List<java.io.File> srcFiles,
java.io.File destDir,
Template[] generators)
Execute generation on specified files. |
void |
execute()
|
protected void |
executeXSLT(java.io.File xmiFile,
java.io.File modelFile,
java.lang.String stylesheet)
Do XSLT transformation on given file using specific stylesheet. |
protected java.lang.String |
getXmiVersion(java.io.File xmiFile)
Try to find xmi version on a file. |
protected boolean |
isArchiveFile(java.io.File file)
Test if file is an archive. |
protected boolean |
isModelFile(java.io.File file)
Test if file is a model |
protected boolean |
isXmiFile(java.io.File file)
Test if file is a xmi. |
void |
setBuilddirectory(java.lang.String buildDirectory)
Set build directory. |
void |
setClasspath(org.apache.tools.ant.types.Path classpath)
Set the optional classpath to the XSL processor |
void |
setDestdir(java.io.File destDir)
Set destination directory |
void |
setEncoding(java.lang.String encoding)
Set encoding. |
void |
setOverwrite(boolean overwrite)
Set overwrite value. |
void |
setProperties(java.lang.String properties)
Permet d'ajouter des properties. exemple: toto=1,package=org.nuiton |
void |
setResolver(java.lang.String resolver)
Set URI resolver (FQN). |
void |
setSrcdir(java.io.File srcDir)
Set source directory. |
void |
setSrcfile(java.io.File srcFile)
Set source file. |
void |
setTemplates(java.lang.String templates)
Set templates (fully-qualified-name) to use (comma-separated). |
void |
setTransformations(java.lang.String transformations)
Transformation to do. |
| Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
|---|
add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems |
| 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 |
|---|
clone, getDescription, getLocation, getProject, setDescription, setLocation |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.apache.tools.ant.types.Path classpath
protected java.lang.String templates
protected java.io.File srcDir
protected java.io.File srcFile
protected java.io.File destDir
protected java.lang.String transformations
protected java.lang.String resolver
protected java.util.Properties properties
protected boolean overwrite
protected java.lang.String encoding
protected java.lang.String buildDirectory
| Constructor Detail |
|---|
public GeneratorTask()
| Method Detail |
|---|
public void setClasspath(org.apache.tools.ant.types.Path classpath)
classpath - the classpath to use when loading the XSL processorpublic void setTemplates(java.lang.String templates)
templates - template to use.public void setTransformations(java.lang.String transformations)
transformations - transformationsprotected org.apache.tools.ant.types.Path createClasspath()
public void setProperties(java.lang.String properties)
properties - propertiespublic void setOverwrite(boolean overwrite)
overwrite - overwrite valuepublic void setEncoding(java.lang.String encoding)
encoding - encodingpublic void setSrcdir(java.io.File srcDir)
srcDir - source directorypublic void setSrcfile(java.io.File srcFile)
srcFile - source filepublic void setDestdir(java.io.File destDir)
destDir - destination directorypublic void setBuilddirectory(java.lang.String buildDirectory)
buildDirectory - build directorypublic void setResolver(java.lang.String resolver)
resolver - uri resolver
public void execute()
throws org.apache.tools.ant.BuildException
execute in class org.apache.tools.ant.Taskorg.apache.tools.ant.BuildException
protected void doExecute(java.io.File srcFile,
java.io.File destDir,
Template[] generators)
throws org.apache.tools.ant.BuildException
srcFile - file to apply generator todestDir - destination directorygenerators - generators to apply
org.apache.tools.ant.BuildException - if can't generate
protected void doExecute(java.util.List<java.io.File> srcFiles,
java.io.File destDir,
Template[] generators)
throws org.apache.tools.ant.BuildException
srcFiles - files to apply generator todestDir - destination directorygenerators - generators to apply
org.apache.tools.ant.BuildException - if can't generate
protected java.util.List<java.io.File> doConvertFiles(java.util.List<java.io.File> srcFiles,
java.io.File destDir)
srcFiles - destDir -
protected boolean isArchiveFile(java.io.File file)
file - file to test
protected boolean isXmiFile(java.io.File file)
file - file to test
protected boolean isModelFile(java.io.File file)
file - file to test
protected java.lang.String getXmiVersion(java.io.File xmiFile)
xmiFile - file to inspect
protected void executeXSLT(java.io.File xmiFile,
java.io.File modelFile,
java.lang.String stylesheet)
xmiFile - xmi file to transformmodelFile - result of transformationstylesheet - stylesheet to use
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||