res-get-xom-resources

The res-get-xom-resources Ant task returns the list of XOM, JAR, ZIP, or Java™ resources from the Rule Execution Server database persistence layer.

The result is a comma-separated list of resuri identifiers. The default result is displayed through the System.out but you can assign it a new value for batch processing (for example, if you schedule a nightly clean-up of the repository).

res-get-xom-resources element attributes

The following table describes the res-get-xom-resources element attributes and specifies whether they are mandatory or optional.

Table 1. res-get-xom-resources element attributes
Element attribute Description Mandatory/optional
credentialsfile

A file that contains the userid and password, encrypted the first time the attribute is used. If you set this attribute, do not use the userid and password attributes.

A credentials file is a text file that sets two properties: username and password.

Optional
failonerror If you set this attribute to false, a warning message is logged when an error occurs, but the build process is not stopped.

Optional

The default value is true.

hostname The host name of the server where the Rule Execution Server console is installed. Mandatory
outputRulesetProperty If you set this attribute, the result is a comma-separated list of resuri identifiers. You can assign this list as a new property, which is created with the given name. To rename a resource inside the internal persistence layer, the best way is to rename the JAR file before the deployment process. Optional
password The password of the user that is allowed to log in to the Rule Execution Server console. If you set this attribute, do not use the credentialsfile attribute. Optional
portnumber The port number of the Rule Execution Server console. Mandatory
secured If you set this attribute to true, the task works through an HTTPS connection.

Optional

The default value is false.

userid The user name to log in to the Rule Execution Server console. If you set this attribute, do not use the credentialsfile attribute. Optional
webapp The context root of the Rule Execution Server console

Optional.

The default value is res.

Example: Using foreach of a list of retrieved resources

You can then use the foreach task of the Ant-Contrib to use the returned list, as follows:
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
      <classpath>
         <pathelement location="lib/ant-contrib-1.0b3.jar"/>
      </classpath>
   </taskdef>
   
   <target name="run">
      <res-get-xom-resources
         hostname="localhost"
         portnumber="9080"
         webapp="res"
         userid="resAdmin"
         password="resAdmin"
         outputRulesetProperty="managedxom.resources">
      </res-get-xom-resources>
      <foreach list="${managedxom.resources}" param="url" target="diagnoseURL"/>
   </target>
   
   <target name="diagnoseURL">
      <echo message="Diagnose: ${url}"/>
      <res-diagnose-xom-uri
         hostname="localhost"
         portnumber="9080"
         webapp="res"
         userid="resAdmin"
         password="resAdmin"
         uri="${url}"
         outputRulesetProperty="managedxom.diag">
      </res-diagnose-xom-uri>
      <echo message="Resulting property: ${managedxom.diag}"/>
   </target>