InstallAnywhere 2020
Custom rules built using the specifications outlined in the InstallAnywhere API can be tailored to fit the needs of the installation.
The process of creating a custom rule is similar to creating a custom action. To create a rule, you create a custom class that extends com.zerog.ia.api.pub.CustomCodeRule, and this class must implement an evaluateRule method that returns true if the rule succeeds and false if the rule fails.
For example, the implementation of a rule that always succeeds would appear similar to the following:
import com.zerog.ia.api.pub.*;
public class AlwaysSucceedsRule extends CustomCodeRule
{
public boolean evaluateRule( )
{
return true; // always succeed
}
}
You compile the rule class the same way you compile other custom code (by including IAClasses.zip in the compiler classpath), and package the .class file in a .jar file or .zip file as before.
To customize an Evaluate Custom Rule rule:
1. | Compile the class that contains the custom code and package it in a .jar or .zip file. |
2. | In the Advanced Designer, on the Sequence page, click the sequence that contains the action group, action, or panel that should contain a custom rule. |
3. | In the list of actions, select the one that you want to contain a custom rule. |
4. | Select the Rules tab. |
5. | Click the Add Rule button. The Choose a rule dialog box opens. |
6. | Select Evaluate Custom Rule and then click the Add button. InstallAnywhere adds the rule to the rules list. |
7. | In the Evaluate Custom Rule customizer, click the Choose JAR or ZIP button next to the Path field and browse to the .jar or .zip file containing the custom class. |
8. | In the Class field, enter the fully qualified custom rule class name (such as com.acme.MyCustomCodeRule) of the Java class that implements the rule. |
Note • This class must extend com.zerog.ia.api.pub.CustomCodeRule and must implement a public boolean evaluateRule() method.
9. | Optionally, click the Configure Dependencies button to open the Custom Rules Dependencies dialog box, where you can select a .jar or .zip file which contains classes referenced by your custom rule so that those classes are included in the archive and are available to the rule at runtime. |
At run time, if the rule succeeds, the action that is associated with it will be installed or performed; if the rule fails, the action is skipped.
InstallAnywhere 2020 Help LibraryOctober 2019 |
Copyright Information | Flexera |