public abstract class IlrVelocityGenerator extends IlrFileGenerator
IlrFileGenerator, when you extend this class you will use
velocity as the template generator.IlrFileGenerator.Parameter, IlrFileGenerator.RuleApp, IlrFileGenerator.RulesetArchivecontentCreated, JAR_EXTENSION| Constructor and Description |
|---|
IlrVelocityGenerator()
Constructs a new generator.
|
| Modifier and Type | Method and Description |
|---|---|
void |
generateProjectContent(org.eclipse.jdt.core.IJavaProject javaProject)
Generates the content of the Java project.
|
protected void |
generateVelocityFile(java.lang.String path,
java.lang.String filePrefix,
java.lang.String templatePath,
java.lang.String newFilename,
java.lang.String extension,
java.lang.Object userData)
Manages the velocity generator in the
generateProjectContent(IJavaProject) method. |
protected void |
generateVelocityFile(java.lang.String path,
java.lang.String filePrefix,
java.lang.String templateDirectory,
java.lang.String templatePath,
java.lang.String newFilename,
java.lang.String extension,
java.lang.Object userData)
Manages the velocity generator in the
generateProjectContent(IJavaProject) method. |
protected void |
generateVelocityFileInSrc(java.lang.String packagePrefix,
java.lang.String filePrefix,
java.lang.String templatePath,
java.lang.String newFilename,
java.lang.String extension,
java.lang.Object userData)
Manages the velocity generator in the
generateProjectContent(IJavaProject) method. |
protected void |
generateVelocityFileInSrc(java.lang.String packagePrefix,
java.lang.String filePrefix,
java.lang.String templateDirectory,
java.lang.String templatePath,
java.lang.String newFilename,
java.lang.String extension,
java.lang.Object userData)
Manages the velocity generator in the
generateProjectContent(IJavaProject) method. |
protected java.lang.String |
getGeneratedExtension()
Gets the name (name and extension) of the file that will be created by the
generateVelocityFile(String,String,String,String,String,Object) method. |
protected java.lang.String |
getGeneratedFileName()
Gets the name (without extension) of the file that will be created by the
generateVelocityFile(String,String,String,String,String,Object) method. |
protected java.lang.String |
getGeneratedName()
Gets the extension of the file that will be created by the
generateVelocityFile(String,String,String,String,String,Object) method. |
protected abstract org.osgi.framework.Bundle |
getTemplateBundle()
Gets the bundle which contains the template.
|
protected abstract java.lang.String |
getTemplateDirectory()
Gets the location (from the bundle) the template paths will
be relative to.
|
protected abstract org.apache.velocity.VelocityContext |
initializeContext(java.lang.Object userData,
org.apache.velocity.VelocityContext context)
Initializes a velocity context.
|
addContainerEntryInClasspath, addLibraryEntryInClasspath, addProjectEntryInClasspath, addVariableEntryInClasspath, changeInClassName, changeInMethodName, completeProjectFromTemplate, copyFile, createPackage, createProjectFromTemplate, generateLaunchConfigurationFile, generateProjectContent, generateProjectContent, generateProjectContent, getCompletionWizard, getCreationWizard, getExecutionServerHome, getInParameters, getInParameters, getInParameters, getInParameters, getInParametersImports, getInParametersImports, getJavaProject, getJavaProjectNameAsClassName, getLaunchConfigurationName, getNewParameter, getNewRulesetArchive, getNotAllowedDescription, getOutParameters, getOutParameters, getOutParametersImports, getParameters, getParameters, getParametersImports, getProject, getRuleAppProject, getRulesetArchives, getRulesetArchives, getRuleStudioHome, getSignatures, getUTF8CharsetAsString, getWizard, getXOMPath, initialize, isAllowed, isJavaProject, setJavaNature, setSignaturespublic IlrVelocityGenerator()
protected abstract org.osgi.framework.Bundle getTemplateBundle()
protected abstract java.lang.String getTemplateDirectory()
public void generateProjectContent(org.eclipse.jdt.core.IJavaProject javaProject)
The default implementation creates a src directory in the Java project.
generateProjectContent in class IlrFileGeneratorjavaProject - The destination of the Java project files.IlrFileGenerator.generateProjectContent(IJavaProject)protected void generateVelocityFileInSrc(java.lang.String packagePrefix,
java.lang.String filePrefix,
java.lang.String templatePath,
java.lang.String newFilename,
java.lang.String extension,
java.lang.Object userData)
generateProjectContent(IJavaProject) method.
This method uses the getTemplateDirectory() method
to know where to look for the template files specified by templatePath parameter.
The initializeContext(Object,VelocityContext) method is called to get the parameter values to put
in the template file.packagePrefix - The relative path to the src directory to
create the file. If the package does not exist, it is created.
If the path is null, the file will be generated in the project
root directory.filePrefix - The prefix that will be added to the template file
to compute the generated file name.templatePath - The relative path of the .vm file. The path is relative
to the path specified by the getTemplateDirectory() method.
The path separator is '/' even on Windows.newFilename - The generated file name. If the value is null, the
generated file name will be computed replacing the ".vm" extension
in the template file name by the extension specified in the extension
parameter.extension - The extension to use to compute the generated file name
using the template file name. It is used only if the newFilename
parameter is null.userData - An object that will be transmitted to the initializeContext(Object,VelocityContext)
method.protected void generateVelocityFileInSrc(java.lang.String packagePrefix,
java.lang.String filePrefix,
java.lang.String templateDirectory,
java.lang.String templatePath,
java.lang.String newFilename,
java.lang.String extension,
java.lang.Object userData)
generateProjectContent(IJavaProject) method.
The template file specified by templatePath parameter is relative to the
templateDirectory parameter.
The initializeContext(Object,VelocityContext) method is called to get the parameter
values to put in the template file.packagePrefix - The relative path to the src directory to
create the file. If the package does not exist, it is created.
If the path is null, the file will be generated in the project
root directory.filePrefix - The prefix that will be added to the template file
to compute the generated file name.templateDirectory - The location (an absolute path) where the template path will
be relative to.templatePath - The relative path of the .vm file. The path is relative
to the path specified by the templateDirectory parameter.
The path separator is '/' even on Windows.newFilename - The generated file name. If the value is null, the
generated file name will be computed replacing the ".vm" extension
in the template file name by the extension specified in the extension
parameter.extension - The extension to use to compute the generated file name
using the template file name. It is used only if the newFilename
parameter is null.userData - An object that will be transmitted to the initializeContext(Object,VelocityContext)
method.protected void generateVelocityFile(java.lang.String path,
java.lang.String filePrefix,
java.lang.String templatePath,
java.lang.String newFilename,
java.lang.String extension,
java.lang.Object userData)
generateProjectContent(IJavaProject) method.
This method uses the getTemplateDirectory() method
to know where to look for the template files specified by templatePath parameter.
The initializeContext(Object,VelocityContext) method is called
to get the parameter values to put in the template file.path - The relative path to the project directory to
create the file. If the path does not exist, it is created.
If the path is null, the file will be generated in the project
root directory (it is equivalent to set the path to "").filePrefix - The prefix that will be added to the template file
to compute the generated file name.templatePath - The relative path of the .vm file. The path is relative
to the path specified by the getTemplateDirectory() method.
The path separator is '/' even on Windows.newFilename - The generated file name. If the value is null, the
generated file name will be computed replacing the ".vm" extension
in the template file name by the extension specified in the extension
parameter.extension - The extension to use to compute the generated file name
using the template file name. It is used only if the newFilename
parameter is null.userData - An object that will be transmitted to the initializeContext(Object,VelocityContext)
method.protected void generateVelocityFile(java.lang.String path,
java.lang.String filePrefix,
java.lang.String templateDirectory,
java.lang.String templatePath,
java.lang.String newFilename,
java.lang.String extension,
java.lang.Object userData)
generateProjectContent(IJavaProject) method.
The template file specified by templatePath parameter is relative to the
templateDirectory parameter.
The initializeContext(Object,VelocityContext) method is called
to get the parameter values to put in the template file.path - The relative path to the project directory to
create the file. If the path does not exist, it is created.
If the path is null, the file will be generated in the project
root directory (it is equivalent to set the path to "").filePrefix - The prefix that will be added to the template file
to compute the generated file name.templateDirectory - The location (an absolute path) where the template path will
be relative to.templatePath - The relative path of the .vm file. The path is relative
to the path specified by the templateDirectory parameter.
The path separator is '/' even on Windows.newFilename - The generated file name. If the value is null, the
generated file name will be computed replacing the ".vm" extension
in the template file name by the extension specified in the extension
parameter.extension - The extension to use to compute the generated file name
using the template file name. It is used only if the newFilename
parameter is null.userData - An object that will be transmitted to the initializeContext(Object,VelocityContext)
method.protected abstract org.apache.velocity.VelocityContext initializeContext(java.lang.Object userData,
org.apache.velocity.VelocityContext context)
generateVelocityFile(String,String,String,String,String,Object)
method. It gets the parameters to put in the velocity template.userData - The object specified in the
generateVelocityFile(String,String,String,String,String,Object) method.context - The velocity context to fill.protected java.lang.String getGeneratedExtension()
generateVelocityFile(String,String,String,String,String,Object) method.protected java.lang.String getGeneratedFileName()
generateVelocityFile(String,String,String,String,String,Object) method.protected java.lang.String getGeneratedName()
generateVelocityFile(String,String,String,String,String,Object) method.© Copyright IBM Corp. 1987, 2017