org.eclipse.emf.ant.taskdefs.codegen.ecore
Class GeneratorTask

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.Task
          extended byorg.eclipse.emf.ant.taskdefs.EMFTask
              extended byorg.eclipse.emf.ant.taskdefs.codegen.ecore.GeneratorTask
Direct Known Subclasses:
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:

AttributeDescription
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.
sdo Boolean value indicating whether the SDO API should be generated.
copyright The copyright text.

Since:
2.1.0

Nested Class Summary
static class GeneratorTask.ReconcileGenModelType
           
 
Field Summary
protected  org.apache.tools.ant.types.Commandline commandline
           
protected  boolean generateEditorProject
           
protected  boolean generateEditProject
           
protected  boolean generateModelProject
           
protected  boolean useModelAttribute
           
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
GeneratorTask()
           
 
Method Summary
protected  void addGenModelArguments()
           
protected  void adjustEditAndEditorProjects()
           
protected  void checkAttributes()
          All the attribute checks should be performed in this method.
 org.apache.tools.ant.types.Commandline.Argument createArg()
           
protected abstract  void createGenModel(String[] arguments)
           
protected  void doExecute()
          Performs the task specific code.
protected  void generateCodeFromGenModel(String[] arguments)
           
protected  org.apache.tools.ant.types.Commandline getCommandline()
           
protected  List getGeneratorArguments()
           
 void setCopyright(String copyright)
           
 void setGenerateEditorProject(boolean generate)
           
 void setGenerateEditProject(boolean generate)
           
 void setGenerateJavaCode(boolean generateJavaCode)
           
 void setGenerateModelProject(boolean generate)
           
 void setGenModel(File genModel)
           
 void setModel(File model)
           
 void setModelPluginID(String modelPluginID)
           
 void setModelProject(File modelProject)
           
 void setModelProjectFragmentPath(String modelProjectFragmentPath)
           
 void setReconcileGenModel(GeneratorTask.ReconcileGenModelType type)
           
 void setReconcileGenModel(String type)
           
 void setSDO(boolean sdo)
           
 void setTemplatePath(File templatePath)
           
 
Methods inherited from class org.eclipse.emf.ant.taskdefs.EMFTask
assertTrue, execute, getProgressMonitor
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, 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
 

Field Detail

commandline

protected org.apache.tools.ant.types.Commandline commandline

useModelAttribute

protected boolean useModelAttribute

generateModelProject

protected boolean generateModelProject

generateEditProject

protected boolean generateEditProject

generateEditorProject

protected boolean generateEditorProject
Constructor Detail

GeneratorTask

public GeneratorTask()
Method Detail

setModel

public void setModel(File model)

setGenModel

public void setGenModel(File genModel)

setModelProject

public void setModelProject(File modelProject)

setModelProjectFragmentPath

public void setModelProjectFragmentPath(String modelProjectFragmentPath)

setModelPluginID

public void setModelPluginID(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(File templatePath)

setCopyright

public void setCopyright(String copyright)

setSDO

public void setSDO(boolean sdo)

setReconcileGenModel

public void setReconcileGenModel(GeneratorTask.ReconcileGenModelType type)

setReconcileGenModel

public void setReconcileGenModel(String type)

setGenerateJavaCode

public void setGenerateJavaCode(boolean generateJavaCode)

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 Exception
Description copied from class: EMFTask
Performs the task specific code.

Specified by:
doExecute in class EMFTask
Throws:
Exception

createGenModel

protected abstract void createGenModel(String[] arguments)
                                throws Exception
Throws:
Exception

addGenModelArguments

protected void addGenModelArguments()

adjustEditAndEditorProjects

protected void adjustEditAndEditorProjects()

getGeneratorArguments

protected List getGeneratorArguments()

generateCodeFromGenModel

protected void generateCodeFromGenModel(String[] arguments)

Copyright 2001-2004 IBM Corporation and others.
All Rights Reserved.