res-diagnose-xom-uri

The res-diagnose-xom-uri Ant task returns the results of diagnostic tests on the URI that is passed as a parameter and read from the Rule Execution Server instance. Use this task to validate the URI against a rule execution environment.

The res-diagnose-xom-uri Ant task is based on the following algorithm:

resuri protocol

If the passed uri is a short version of resuri, the test runs on the last version of resuri (rather than on the latest version) and adds the canonical ruleset path to the result.

The test operates as follows:
  • Checks whether resuri exists in the persistence layer and, if resuri does not exist, returns non-passed tests as URL_NOT_REACHABLE.
  • Checks whether the resuri found can be read and, if resuri cannot be read, returns non-passed tests as URL_NOT_REACHABLE.
  • Checks whether the stored SHA-1 checksum is equal to the computed one and, if it is not, returns non-passed tests as WRONG_CHECKSUM.
  • Checks whether resuri is referenced by a ruleset or library and, if resuri is not referenced, returns non-passed tests as URL_NOT_USED_IN_REPOSITORY.
  • Returns a passed test in all other cases.
reslib protocol

If the passed uri is a short version of reslib, the test runs on the last version of reslib (rather than the latest version) and adds the canonical ruleset path to the result.

The test operates as follows:
  • Checks whether reslib exists in the persistence layer, and if reslib does not exist, returns non-passed tests as URL_NOT_REACHABLE.
  • Checks whether all the listed URLs of reslib are valid and, if the lib contains an invalid URL, returns non-passed tests as WRONG_LIRARY_CONTENT.
  • Checks whether reslib is referenced by a ruleset or another library and, if reslib is not referenced, returns non-passed tests as URL_NOT_USED_IN_REPOSITORY.
  • Returns a passed test in all other cases.
Other protocol
The test tries to access the URL and to read its content.
  • If the attempt fails, the test returns non-passed tests as URL_NOT_REACHABLE.
  • If the attempt is successful, the Ant task returns a passed test.
The following table describes the res-diagnose-xom-uri element attributes and specifies whether they are mandatory or optional.
Table 1. res-diagnose-xom-uri 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

The test returns a string. If you set this attribute, you can assign this string to a new property that you create with the given name.

The diagnosis string returns one of the following values:
  • OK
  • URL_NOT_REACHABLE
  • URL_NOT_USED_IN_REPOSITORY
  • WRONG_CHECKSUM

To rename a resource inside the internal persistence system, the best way is to rename the JAR file before the deployment process.

Optional
password The password of the user who 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
uri The URI to diagnose. This URI must be well-formed and comply with the supported formats. Otherwise, an exception is thrown. Mandatory
webapp The context root of the Rule Execution Server console

Optional.

The default value is res.

In most cases, the last version and the latest version of a ruleset are the same. However, they can be different. This example shows the difference.
Suppose the following sequence of actions:
  1. Deploy for the first time: myruleset.jar => resuri://myruleset.jar/1.0
  2. Deploy for the second time: myruleset.jar => resuri://myruleset.jar/2.0
  3. Deploy for the third time: myruleset.jar => resuri://myruleset.jar/3.0
  4. Remove resuri://myruleset.jar/2.0
  5. Deploy for the fourth time: myruleset.jar => resuri://myruleset.jar/2.0
This result shows that the ruleset version that is selected for deployment after the removal is the latest: (resuri://myruleset.jar/3.0, not the last:resuri://myruleset.jar/2.0.