org.eclipse.emf.ant.taskdefs.codegen.ecore
Class GeneratorTask
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.eclipse.emf.ant.taskdefs.EMFTask
org.eclipse.emf.ant.taskdefs.codegen.ecore.GeneratorTask
- All Implemented Interfaces:
- java.lang.Cloneable
- Direct Known Subclasses:
- EcoreGeneratorTask, JavaGeneratorTask, RoseGeneratorTask
public abstract class GeneratorTask
- extends EMFTask
Base class for all the "generator tasks" that provides the common attributes
and behavior. A "generator task" is an Ant task that encompasses the
two operations performed when generating code with EMF: the creation of the EMF files
(genmodel and ecore) from a given model specification and the code generation.
These are the common attributes provided by this class:
Attribute | Description |
model |
The file that defines the model. |
genModel |
The .genmodel file. |
reconcileGenModel |
Specifies how the genmodel file is to be supposed to be handled. The possible values are:
- overwrite - (default)Replaces the genmodel file if it exists;
- keep - Doesn't generate the genmodel if one is provided; and
- reload - Reloads the genmodel to reflect model changes.
|
generateJavaCode |
Boolean value indicating whether the java code should be generated. Should be set to
false when you want to generate only the .ecore and .genmodel files |
generateModelProject |
The model project will be only generated if this attribute is set to true and if the project's
information is specified in the task.
The default value is true. |
generateEditProject |
The edit project will be only generated if this attribute is set to true and if the project's
information is specified in the task.
The default value is true. |
generateEditorProject |
The editor project will be only generated if this attribute is set to true and if the project's
information is specified in the task.
The default value is true. |
templatePath |
The directory where your customized JET templates are located. |
modelProject |
The directory where the files generated for the model will be placed into. |
modelProjectFragmentPath |
The model project relative path of the source folder. |
modelPluginID |
The ID of the generated model plugin. |
autoBuild |
Boolean value that sets the Eclipse's 'Build Automatically' flag. If not specified, this task doesn't
change the current workspace's setting. |
sdo |
Boolean value indicating whether the SDO API should be generated. |
copyright |
The copyright text. |
jdkLevel |
The JDK level for the generated code. "1.4", "5.0", and
"6.0" are valid values. |
validateModel |
Boolean value indicating whether the Ecore model should be validated before
generating the code. |
If the Ant task knows how to handle multiple model specifications,
<model> elements can be used (instead of the model attribute). Here's
an example:
<model uri="http://www.example.eclipse.org/library.xsd"/>
<model file="c:/common.xsd"/>
- Since:
- 2.1.0
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 |
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, setProject |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GENMODEL_OVERWRITE
protected static final int GENMODEL_OVERWRITE
- See Also:
- Constant Field Values
GENMODEL_KEEP
protected static final int GENMODEL_KEEP
- See Also:
- Constant Field Values
GENMODEL_RELOAD
protected static final int GENMODEL_RELOAD
- See Also:
- Constant Field Values
model
protected java.io.File model
genModel
protected java.io.File genModel
modelProject
protected java.io.File modelProject
modelPluginID
protected java.lang.String modelPluginID
modelProjectFragmentPath
protected java.lang.String modelProjectFragmentPath
templatePath
protected java.io.File templatePath
copyright
protected java.lang.String copyright
sdo
protected boolean sdo
jdkLevel
protected java.lang.String jdkLevel
validateModel
protected java.lang.String validateModel
reconcileGenModel
protected int reconcileGenModel
generateJavaCode
protected boolean generateJavaCode
commandline
protected org.apache.tools.ant.types.Commandline commandline
generateModelProject
protected boolean generateModelProject
generateEditProject
protected boolean generateEditProject
generateEditorProject
protected boolean generateEditorProject
autoBuild
protected java.lang.Boolean autoBuild
GeneratorTask
public GeneratorTask()
supportMultipleURIs
protected boolean supportMultipleURIs()
setModel
public void setModel(java.io.File model)
createModel
public GeneratorTask.ModelLocation createModel()
setGenModel
public void setGenModel(java.io.File genModel)
setModelProject
public void setModelProject(java.io.File modelProject)
setModelProjectFragmentPath
public void setModelProjectFragmentPath(java.lang.String modelProjectFragmentPath)
setModelPluginID
public void setModelPluginID(java.lang.String modelPluginID)
setGenerateModelProject
public void setGenerateModelProject(boolean generate)
setGenerateEditProject
public void setGenerateEditProject(boolean generate)
setGenerateEditorProject
public void setGenerateEditorProject(boolean generate)
createArg
public org.apache.tools.ant.types.Commandline.Argument createArg()
setTemplatePath
public void setTemplatePath(java.io.File templatePath)
setCopyright
public void setCopyright(java.lang.String copyright)
setSDO
public void setSDO(boolean sdo)
setReconcileGenModel
public void setReconcileGenModel(GeneratorTask.ReconcileGenModelType type)
setReconcileGenModel
public void setReconcileGenModel(java.lang.String type)
setGenerateJavaCode
public void setGenerateJavaCode(boolean generateJavaCode)
setAutoBuild
public void setAutoBuild(boolean autoBuild)
setValidateModel
public void setValidateModel(boolean validateModel)
setJdkLevel
public void setJdkLevel(java.lang.String jdkLevel)
getJDKLevel
protected GenJDKLevel getJDKLevel()
getCommandline
protected org.apache.tools.ant.types.Commandline getCommandline()
checkAttributes
protected void checkAttributes()
throws org.apache.tools.ant.BuildException
- Description copied from class:
EMFTask
- All the attribute checks should be performed in this method.
- Overrides:
checkAttributes
in class EMFTask
- Throws:
org.apache.tools.ant.BuildException
doExecute
protected void doExecute()
throws java.lang.Exception
- Description copied from class:
EMFTask
- Performs the task specific code.
- Specified by:
doExecute
in class EMFTask
- Throws:
java.lang.Exception
createGenModel
protected abstract void createGenModel(java.lang.String[] arguments)
throws java.lang.Exception
- Throws:
java.lang.Exception
addGenModelPathArgument
protected void addGenModelPathArgument()
addModelPathArgument
protected void addModelPathArgument()
addGenModelArguments
protected void addGenModelArguments()
adjustEditAndEditorProjects
protected void adjustEditAndEditorProjects()
getGeneratorArguments
protected java.util.List<java.lang.String> getGeneratorArguments()
generateCodeFromGenModel
protected void generateCodeFromGenModel(java.lang.String[] arguments)