Tuesday, April 22, 2014

RuleApp and Ruleset naming conventions

RuleApp and Ruleset naming conventions Question What are the naming conventions for RuleApps and Rulesets? Cause RuleApp or Ruleset names can only contain letters, digits, or underscores. The names can only start with a letter or an underscore. Those conventions are enforced in Rule Studio, the Rule Team Server and Rule Execution Server consoles. In Rule Studio, any forbidden characters will be kept for the 'Display name' but removed for the 'Name' of the RuleApp/Ruleset which is used to build ruleset paths. You can also validate RuleApp and Ruleset names through the API with : until V6.7, the validateRuleAppName/validateRulesetName methods of ilog.rules.bres.model.IlrNameValidator. starting in V7, the ilog.rules.res.model.IlrPath.parsePath static method. In both cases an IlrFormatException will be thrown if a name is not valid. === Question What are the naming conventions for rule artifacts? Answer As a rule author, you are allowed to use spaces within rule artifact names, as well as digits, but you are not allowed to use spaces at the beginning and the end, the following characters: ", ., :, *, /, <, >, ?, \, |.. Those conventions are enforced in both Rule Studio and Rule Team Server. In Rule Studio, creating a package with a name that contains one or more dots ('.') will generate a succession of imbricated folders. The name you create is the Business Name. For the rule to become executable, this name must be translated into a Technical Name. That translation uses JRules IRL code. IRL code is the runtime code that is automatically generated from rule project artifacts. IRL code follows the same syntax as the syntax used for Java identifiers. Therefore, any character that is not allowed in a Java identifier must be processed for the rule name to become valid. The substitutions currently performed to generate a technical name are: A space is replaced by an underscore character: _ $ is replaced by $$ _ is replaced by $_$ A leading digit is replaced by $$ For rule tasks, a "ruleflowName#" prefix is added to the rule name to prevent name conflicts when two rule tasks have the same names. Note: To retrieve the rule business name from its technical name, use the method IlrNameUtil.getBusinessIdentifier(String identifier). ====== Rule project item naming conventions Make sure that you use the Java naming conventions when you create a name for your rule project items. You can use spaces because they are processed into valid characters when you execute, but do not use spaces at the beginning of a name. The name of a rule project item must not: Be empty Be longer than 255 characters Start or end with white space characters Contain the characters ",.,:,*,/,<,>,?,\, or | Contain a character that has a ASCII or Unicode code below 0x1f, included ====== Rule project templates You have a choice of templates for creating your rule project structure. Standard rule project template The standard rule project template creates an empty standard rule project. You can choose from the following options: Rule Project References: To list the dependencies between your new rule project and other existing rule projects. Rule Project Java XOM settings: To define the Java Execution Object Model (XOM). You can set the path on Java folders, JARs or projects. Dynamic XOM settings: To define the dynamic XOM. You can set the path on XML schemas or dynamic XOM files. Rule project model folders: To define the folders in the rule project to help you organize your rule project artifacts. The standard rule project template populates the following folders: Source folder (rules): Stores rule artifacts. It is good practice to organize your rule artifacts in the source folder with rule packages. Rule packages can contain other packages nested within them. Nested packages can contain all types of rule artifacts. BOM folder (bom): Stores BOM entries. BOM entries define the structure of a BOM and its associated vocabulary and BOM to XOM mapping. Query folder (queries): Stores queries. Resource folder (resources): Stores any type of file that is not part of the rule model. Template folder (templates): Stores action rule templates. Predefined rule project template: Hello World project This template creates a rule project containing the following items: A single rule in a single package A ruleflow A BOM with two static methods Rule Project with a BOM template The Rule Project with a BOM template creates an empty rule project. You have the following options: Rule Project XOM settings, to define the: Java Execution Object Model (XOM). You can set the path on Java folders, JARs or projects. Dynamic XOM. You can set the path on XML schemas or dynamic XOM files. BOM entries and verbalization are automatically created for each XOM you specify. Rule Project References, to list the dependencies between your new rule project and other existing rule projects. Custom rule project templates Custom rule project templates provide additional flexibility in creating rule projects. For information about custom rule project templates, refer to Creating a rule project template. http://pic.dhe.ibm.com/infocenter/dmanager/v7r5/index.jsp?topic=%2Fcom.ibm.dserver.rulestudio%2FContent%2FBusiness_Rules%2F_pubskel%2FInfocenter_Primary%2Fps_DS_Rule_Designer621.html ===== Creating a rule project template The use of rule project templates can ensure greater consistency of rule project design and eliminate duplication of developer work. You can create a rule project template based on all types of rule artifacts and any rule project structure, including a XOM project. You can create the template from multiple projects and project dependencies. You create the template using a wizard. You can custom design the template by choosing the resources to be included in the rule project template. You can add template documentation to describe the template structure and use. The end result is an Eclipse plug-in for deployment. To create a rule project template for Rule Designer: On the File menu, click New > Other > Plug-in Project and then click Next. In the Plug-in Project dialog, on the New Plug-in Project page, type in the name of the new rule project template. Click Next. Complete the Plug-in Content dialog and then click Next. In the Templates dialog, select Plug-in that defines a new template for the Rule Project wizard and then click Next. In the Resources to Include as Template Files dialog, on the New plug-in Project with Custom Templates page, select the resources to be included in the template and then click Next. All the resources from the current project are listed for possible inclusion. In the Custom Rule Project Template Settings dialog, complete the settings and then click Finish. When you have created the new plug-in, you can test it. In response to the query, open the associated view. Use the Eclipse export wizard to export the plug-in to, for example, your Rule Designer Eclipse install directory. You can also deploy the plug-in directly, either in the Eclipse application directory or any directory that is an extension to the Eclipse application you are using. When you restart Eclipse, you can select the new rule project template. ==============

No comments: