ilog.rules.studio.res.generator

Class IlrVelocityGenerator

  • All Implemented Interfaces:
    org.eclipse.jface.wizard.IWizardNode
    Direct Known Subclasses:
    IlrTraceFileGenerator


    public abstract class IlrVelocityGenerator
    extends IlrFileGenerator
    Adds a generator to the generator list in the New Client Project for RuleApps wizard. Contrary to the IlrFileGenerator, when you extend this class you will use velocity as the template generator.
    Since:
    JRules 6.0
    • Constructor Detail

      • IlrVelocityGenerator

        public IlrVelocityGenerator()
        Constructs a new generator. The class that extends this one must declare a public default constructor, which calls this constructor. The default constructor is the only one called to create a generator.
        Since:
        JRules 6.6
    • Method Detail

      • getTemplateBundle

        protected abstract org.osgi.framework.Bundle getTemplateBundle()
        Gets the bundle which contains the template.
        Returns:
        The bundle where the templates are stored
      • getTemplateDirectory

        protected abstract java.lang.String getTemplateDirectory()
        Gets the location (from the bundle) the template paths will be relative to.
        Returns:
        The location where the templates are stored.
      • generateVelocityFileInSrc

        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. 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.
        Parameters:
        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.
      • generateVelocityFileInSrc

        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. 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.
        Since:
        JRules 6.5
        Parameters:
        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.
      • generateVelocityFile

        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. 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.
        Parameters:
        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.
      • generateVelocityFile

        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. 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.
        Since:
        JRules 6.5
        Parameters:
        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.

© Copyright IBM Corp. 1987, 2020