CentraSite Documentation : CentraSite Developer's Guide : Developing Custom Actions : Adding Custom Actions Using APIs : Creating Action Rules : Creating a Rule in a Java Class
Creating a Rule in a Java Class
Perform the following steps to 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>
The sample Java action rule "uniquenamechecker" provided in the your CentraSite installation has the following file structure:
*<CentraSite_Install_Dir>\demos\CustomActions\Java\META-INF\assertions.properties
This is the build file for the action. It includes an entry of the following format:
com.softwareag.centrasite.policy.rule.class=com.softwareag.demo.actions.UniqueNameChecker
*<CentraSite_Install_Dir>\demos\CustomActions\Java\src\com\softwareag\demo\actions\UniqueNameChecker.java
This is the sample source file for the action executor. You can modify this file as needed and compile it using the build file.
*<CentraSite_Install_Dir>\demos\CustomActions\Java\build_demos_customer.xml
This build file has the default target “zip”, which will compile the Java file, build a jar out of it and pack it as a zip file.
*<CentraSite_Install_Dir>\demos\CustomActions\Java\uniquenamechecker.zip
This is the Java action rule you create using the ant command "ant -f build_demos_customer.xml".
For more information about the sample Java action, see Sample Custom Actions.
3. Upload the <action_name>.zip file, as described in Uploading Action Rules to Action Templates.
Copyright © 2005-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback