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:
|
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. |
importOrganizing | Boolean value indicating whether the imports should be organized to remove unused imports. |
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"/>
Modifier and Type | Class and Description |
---|---|
static class |
GeneratorTask.ModelLocation |
static class |
GeneratorTask.ReconcileGenModelType |
Modifier and Type | Field and Description |
---|---|
protected java.lang.Boolean |
autoBuild |
protected Commandline |
commandline |
protected java.lang.String |
copyright |
protected boolean |
generateEditorProject |
protected boolean |
generateEditProject |
protected boolean |
generateJavaCode |
protected boolean |
generateModelProject |
protected boolean |
generateTestsProject |
protected java.io.File |
genModel |
protected static int |
GENMODEL_KEEP |
protected static int |
GENMODEL_OVERWRITE |
protected static int |
GENMODEL_RELOAD |
protected boolean |
importOrganizing |
protected java.lang.String |
jdkLevel |
protected java.io.File |
model |
protected java.lang.String |
modelPluginID |
protected java.io.File |
modelProject |
protected java.lang.String |
modelProjectFragmentPath |
protected int |
reconcileGenModel |
protected boolean |
sdo |
protected java.io.File |
templatePath |
protected java.lang.String |
validateModel |
Constructor and Description |
---|
GeneratorTask() |
Modifier and Type | Method and Description |
---|---|
protected void |
addGenModelArguments() |
protected void |
addGenModelPathArgument() |
protected void |
addModelPathArgument() |
protected void |
adjustEditAndEditorProjects() |
protected void |
checkAttributes()
All the attribute checks should be performed in this method.
|
Commandline.Argument |
createArg() |
protected abstract void |
createGenModel(java.lang.String[] arguments) |
GeneratorTask.ModelLocation |
createModel() |
protected void |
doExecute()
Performs the task specific code.
|
protected void |
generateCodeFromGenModel(java.lang.String[] arguments) |
protected Commandline |
getCommandline() |
protected java.util.List<java.lang.String> |
getGeneratorArguments() |
protected GenJDKLevel |
getJDKLevel() |
void |
setAutoBuild(boolean autoBuild) |
void |
setCopyright(java.lang.String copyright) |
void |
setGenerateEditorProject(boolean generate) |
void |
setGenerateEditProject(boolean generate) |
void |
setGenerateJavaCode(boolean generateJavaCode) |
void |
setGenerateModelProject(boolean generate) |
void |
setGenerateTestsProject(boolean generate) |
void |
setGenModel(java.io.File genModel) |
void |
setImportOrganzing(boolean importOrganizing) |
void |
setJdkLevel(java.lang.String jdkLevel) |
void |
setModel(java.io.File model) |
void |
setModelPluginID(java.lang.String modelPluginID) |
void |
setModelProject(java.io.File modelProject) |
void |
setModelProjectFragmentPath(java.lang.String modelProjectFragmentPath) |
void |
setReconcileGenModel(GeneratorTask.ReconcileGenModelType type) |
void |
setReconcileGenModel(java.lang.String type) |
void |
setSDO(boolean sdo) |
void |
setTemplatePath(java.io.File templatePath) |
void |
setValidateModel(boolean validateModel) |
protected boolean |
supportMultipleURIs() |
assertTrue, execute, getProgressMonitor
protected static final int GENMODEL_OVERWRITE
protected static final int GENMODEL_KEEP
protected static final int GENMODEL_RELOAD
protected java.io.File model
protected java.io.File genModel
protected java.io.File modelProject
protected java.lang.String modelPluginID
protected java.lang.String modelProjectFragmentPath
protected java.io.File templatePath
protected java.lang.String copyright
protected boolean sdo
protected boolean importOrganizing
protected java.lang.String jdkLevel
protected java.lang.String validateModel
protected int reconcileGenModel
protected boolean generateJavaCode
protected Commandline commandline
protected boolean generateModelProject
protected boolean generateEditProject
protected boolean generateEditorProject
protected boolean generateTestsProject
protected java.lang.Boolean autoBuild
protected boolean supportMultipleURIs()
public void setModel(java.io.File model)
public GeneratorTask.ModelLocation createModel()
public void setGenModel(java.io.File genModel)
public void setModelProject(java.io.File modelProject)
public void setModelProjectFragmentPath(java.lang.String modelProjectFragmentPath)
public void setModelPluginID(java.lang.String modelPluginID)
public void setGenerateModelProject(boolean generate)
public void setGenerateEditProject(boolean generate)
public void setGenerateEditorProject(boolean generate)
public void setGenerateTestsProject(boolean generate)
public Commandline.Argument createArg()
public void setTemplatePath(java.io.File templatePath)
public void setCopyright(java.lang.String copyright)
public void setSDO(boolean sdo)
public void setReconcileGenModel(GeneratorTask.ReconcileGenModelType type)
public void setReconcileGenModel(java.lang.String type)
public void setGenerateJavaCode(boolean generateJavaCode)
public void setAutoBuild(boolean autoBuild)
public void setValidateModel(boolean validateModel)
public void setJdkLevel(java.lang.String jdkLevel)
protected GenJDKLevel getJDKLevel()
public void setImportOrganzing(boolean importOrganizing)
protected Commandline getCommandline()
protected void checkAttributes() throws BuildException
EMFTask
checkAttributes
in class EMFTask
BuildException
protected void doExecute() throws java.lang.Exception
EMFTask
protected abstract void createGenModel(java.lang.String[] arguments) throws java.lang.Exception
java.lang.Exception
protected void addGenModelPathArgument()
protected void addModelPathArgument()
protected void addGenModelArguments()
protected void adjustEditAndEditorProjects()
protected java.util.List<java.lang.String> getGeneratorArguments()
protected void generateCodeFromGenModel(java.lang.String[] arguments)