ilog.rules.studio.res.generator

Class IlrFileGenerator

  • java.lang.Object
    • ilog.rules.studio.res.generator.IlrFileGenerator
  • All Implemented Interfaces:
    org.eclipse.jface.wizard.IWizardNode
    Direct Known Subclasses:
    IlrVelocityGenerator


    public abstract class IlrFileGenerator
    extends java.lang.Object
    implements org.eclipse.jface.wizard.IWizardNode
    Defines a generator for the list in the new client project for the RuleApps wizard.
    Since:
    JRules 6.0
    • Field Detail

      • contentCreated

        protected boolean contentCreated
    • Constructor Detail

      • IlrFileGenerator

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

      • isAllowed

        public boolean isAllowed()
        Returns true if the environment is correctly set to allow the generator to be run correctly. Return false otherwise. If false is returned, the getNotAllowedDescription() method is called to get the description to display instead of the generator's description. The default returned value is true.
        Since:
        JRules 6.5.1
        Returns:
        true if the generator is allowed to run, otherwise return false.
      • getNotAllowedDescription

        public java.lang.String getNotAllowedDescription()
        Returns the message to display in the 'Client Project for RuleApps' wizard if the generator is not allowed to run to return the reason why. The method isAllowed() is used to control whether or not this message is displayed. The message will be displayed instead of the generator description.
        Since:
        JRules 6.5.1
        Returns:
        The message to display if the generator is not allowed to run.
      • initialize

        public void initialize(IlrRuleAppProject ruleappProject)
        Initializes the generator with the data specified in the wizard.
        Parameters:
        ruleappProject - The RuleApp project selected in the wizard.
      • getRuleAppProject

        public IlrRuleAppProject getRuleAppProject()
        Gets the RuleApp project selected in the wizard.
        Returns:
        The selected RuleApp project.
      • setSignatures

        public void setSignatures(IlrSignature[] signatures)
        Sets the in and inout ruleset parameter names and values in the wizard.
        Parameters:
        signatures - The in parameter names and values.
      • getSignatures

        public IlrSignature[] getSignatures()
        Gets the in and inout ruleset parameter names and values set in the wizard.
        Returns:
        The stored signatures.
      • isJavaProject

        public boolean isJavaProject()
        Tests if the project is a Java or a simple project. If the method returns true, the new project will be a Java project and src and bin directories will be created. The JRE and Rule Execution Server JARs will be included in the classpath. The method called is generateProjectContent(IJavaProject).

        If the method returns false, a simple project is created without anything else. The method called is generateProjectContent(IProject).

        Returns:
        If the new project is a Java project, true is returned.
      • getJavaProject

        protected org.eclipse.jdt.core.IJavaProject getJavaProject()
        Gets the generated destination Java project.
        Returns:
        The generated destination Java project.
      • getLaunchConfigurationName

        protected java.lang.String getLaunchConfigurationName()
        Gets the launch configuration name that was set during the execution of the generateLaunchConfigurationFile(String) method.
        Since:
        JRules 6.0.1
        Returns:
        The launch configuration name.
      • getJavaProjectNameAsClassName

        protected java.lang.String getJavaProjectNameAsClassName()
        Gets the Java project name as a valid Java class name, with a capital letter as the first letter.
        Returns:
        The Java project name as a valid Java class name.
      • getProject

        protected org.eclipse.core.resources.IProject getProject()
        Gets the generated destination project if the destination project is not a Java project. If the destination project is a Java project, this method returns the IProject associated with this Java project.
        Returns:
        The generated destination project.
      • changeInClassName

        protected java.lang.String changeInClassName(java.lang.String name)
        Gets the name specified, with a capital letter as the first letter.
        Parameters:
        name - The name to change.
        Returns:
        The name specified, with a capital letter as the first letter.
      • changeInMethodName

        protected java.lang.String changeInMethodName(java.lang.String name)
        Gets the name specified, with a lower case letter as the first letter.
        Since:
        JRules 6.5
        Parameters:
        name - The name to change.
        Returns:
        The name specified, with a lower case letter as the first letter.
      • generateProjectContent

        public void generateProjectContent(org.eclipse.jdt.core.IJavaProject javaProject,
                                  org.eclipse.core.runtime.IProgressMonitor monitor)
        Generates the content of the Java project. By default, this method calls the generateProjectContent(IJavaProject) method for compatibility reasons.
        Since:
        JRules 6.5
        Parameters:
        javaProject - The destination of the Java project files.
        monitor - The progress monitor.
      • generateProjectContent

        public void generateProjectContent(org.eclipse.jdt.core.IJavaProject javaProject)
        Generates the content of the Java project. By default, this method only saves the javaProject which will be accessible through the getJavaProject() method.
        Parameters:
        javaProject - The destination of the Java project files.
      • generateProjectContent

        public void generateProjectContent(org.eclipse.core.resources.IProject project,
                                  org.eclipse.core.runtime.IProgressMonitor monitor)
        Generates the content of the simple project. By default, this method calls the generateProjectContent(IProject) method for compatibility reasons.
        Since:
        JRules 6.5
        Parameters:
        project - The destination of the project files.
        monitor - The progress monitor.
      • generateProjectContent

        public void generateProjectContent(org.eclipse.core.resources.IProject project)
        Generates the content of the simple project.
        Parameters:
        project - The destination of the project files.
      • getRuleStudioHome

        protected java.lang.String getRuleStudioHome()
        Gets the location of the ILOG_BR_STUDIO_HOME Eclipse variable.
        Returns:
        The location of the ILOG_BR_STUDIO_HOME Eclipse variable.
      • getExecutionServerHome

        protected java.lang.String getExecutionServerHome()
        Gets the location of the ILOG_EXECUTION_SERVER_HOME Eclipse variable.
        Returns:
        The location of the ILOG_EXECUTION_SERVER_HOME Eclipse variable.
      • addVariableEntryInClasspath

        protected void addVariableEntryInClasspath(java.lang.String path)
        Adds to the Java project build path the path specified as <EclipseVariable>/<relativePath>.
      • addLibraryEntryInClasspath

        protected void addLibraryEntryInClasspath(java.lang.String path)
        Adds to the Java project build path the path specified as an absolute path.
      • addProjectEntryInClasspath

        protected void addProjectEntryInClasspath(java.lang.String path)
        Adds to the Java project build path the path specified as <projectName>.
      • addContainerEntryInClasspath

        protected void addContainerEntryInClasspath(java.lang.String container)
        Adds to the Java project build path the specified container.
        Since:
        JRules 7.0
      • getParametersImports

        protected java.util.Set<java.lang.String> getParametersImports()
        Deprecated. As of ODM 8.5.1.
        Returns a list of fully-qualified types for ruleset parameters that require import statements to be added in the generated code.
      • getInParametersImports

        protected java.util.Set<java.lang.String> getInParametersImports()
        Deprecated. As of ODM 8.5.1.
        Returns a list of fully-qualified types for input ruleset parameters that require import statements to be added in the generated code.
      • getInParametersImports

        protected java.util.Set<java.lang.String> getInParametersImports(IlrRulesetArchiveDescriptor archive)
        Deprecated. As of ODM 8.5.1.
        Returns a list of fully-qualified types for archive input ruleset parameters that require import statements to be added in the generated code.
      • getOutParametersImports

        protected java.util.Set<java.lang.String> getOutParametersImports()
        Deprecated. As of ODM 8.5.1.
        Returns a list of fully-qualified types for output ruleset parameters that require import statements to be added in the generated code.
      • getInParameters

        protected java.util.List<IlrFileGenerator.Parameter> getInParameters()
        Gets a list of the in/inout ruleset parameters for the RuleApp project.
        Returns:
        A list of the in/inout ruleset parameters for the RuleApp project.
      • getInParameters

        protected java.util.List<IlrFileGenerator.Parameter> getInParameters(IlrRulesetArchiveDescriptor desc)
        Gets a list of the in/inout ruleset parameters for a ruleset archive of the RuleApp project.
        Returns:
        A list of the in/inout ruleset parameters for a ruleset archive.
      • getXOMPath

        protected java.util.List<java.lang.String> getXOMPath()
        Gets a list of paths (String) for all the necessary XOMs, for all rulesets in the RuleApp. You can use this list in a generated build.xml file to fill the class path.
        Returns:
        A list of the XOM paths.
      • getRulesetArchives

        protected java.util.List<IlrFileGenerator.RulesetArchive> getRulesetArchives()
        Gets a list of ruleset archives.
        Returns:
        A list of ruleset archives.
      • copyFile

        protected void copyFile(java.lang.String source,
                    java.lang.String destination)
        Copies a file from a location (absolute path) in the generated Java project to a destination directory with a specific file name.
        Parameters:
        source - The location of the file to copy.
        destination - The full path in the generated Java project.
      • generateLaunchConfigurationFile

        public java.lang.String generateLaunchConfigurationFile(java.lang.String main)
        Generates and saves a launch configuration file with the references to the Rule Project from the RuleApp project.
        Parameters:
        main - The main class to execute.
        Returns:
        The name of the configuration. Returns null if an error occurs during creation.
      • createPackage

        protected java.lang.String createPackage(org.eclipse.core.resources.IProject project,
                                     java.lang.String root,
                                     java.lang.String name)
        Creates a package in the root directory (relative to the project) of the destination project.
        Parameters:
        project - The project where the package is created.
        root - The relative path where the package is created.
        name - The new package name.
        Returns:
        The relative path to the new package. The string ends with the path separator.
      • getNewParameter

        protected IlrFileGenerator.Parameter getNewParameter(java.lang.String name,
                                                 java.lang.String type)
        Returns a new object of type Parameter. Redefine this method if you extend the Parameter class and you want your class to be created instead of IlrFileGenerator.Parameter.
        Returns:
        A new parameter.
      • getWizard

        public org.eclipse.jface.wizard.IWizard getWizard()
        Returns the wizard that this node stands for.

        If no wizard is specified in the extension, this method returns null.

        Specified by:
        getWizard in interface org.eclipse.jface.wizard.IWizardNode
        Returns:
        The wizard.
      • getCompletionWizard

        public org.eclipse.jface.wizard.IWizard getCompletionWizard()
        Returns the completion wizard.

        If no wizard is specified in the extension, this method returns the IlrDefaultCompletionWizard class.

        Since:
        JRules 6.5
        Returns:
        The wizard.
      • getCreationWizard

        public org.eclipse.jface.wizard.IWizard getCreationWizard()
        Returns the creation wizard.

        If no wizard is specified in the extension, this method will return the IlrDefaultCreationWizard class.

        Since:
        JRules 6.5
        Returns:
        The wizard.
      • setJavaNature

        protected void setJavaNature(org.eclipse.core.resources.IProject ijProject)
                              throws org.eclipse.core.runtime.CoreException
        Throws:
        org.eclipse.core.runtime.CoreException
      • getUTF8CharsetAsString

        protected java.lang.String getUTF8CharsetAsString()

© Copyright IBM Corp. 1987, 2017