Software AG Products 10.7 | CentraSite for Developers | Custom Policy Actions | Custom Policy Actions | Creating Action Rules in a Java Class
 
Creating Action Rules in a Java Class
You can create a rule in a Java class.
*To create a rule in a Java class
1. Create a Java action executor class that implements the com.softwareag.centrasite.policy.api.IActionExecutor interface. To view the Javadoc for this interface, see the CentraSite Java API Reference.
Important:
The Java executor class must return an AssertionResult object that contains the completion code ResultStatus.SUCCESS (if the action was successful) or ResultStatus.FAILURE (if the action failed). There are other possible completion codes (for example, ResultStatus.IN_PROCESS), however, these codes are used by internal processes and are not intended to be returned by user-defined actions. Custom actions that you create must only return a completion code of ResultStatus.SUCCESS or ResultStatus.FAILURE.
2. Create the <action_name>.zip file by executing the ant command "ant -f build_demos_customer.xml".
Example:
C:\SoftwareAG\CentraSite\demos\CustomActions\Java>ant -f build_demos_customer.xml
The <action_name>.zip file should include the following components:
*A folder named lib, which would contain a jar file with the action’s executor class and the external libraries.
*A folder named META-INF, which would contain a property file named assertion.properties, which is the build file for the action. It includes an entry of the following format:
com.softwareag.centrasite.policy.rule.class=<fully_qualified_class_name>
3. Upload the <action_name>.zip file.