<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
- Licensed Materials - Property of IBM Corp.
- IBM UrbanCode Deploy
- (c) Copyright IBM Corporation 2011, 2017. All Rights Reserved.
-
- U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by
- GSA ADP Schedule Contract with IBM Corp.
-->

<plugin xmlns="http://www.urbancode.com/PluginXMLSchema_v1">
  <header>
    <identifier id="com.urbancode.air.plugin.ibm-odm" name="IBM ODM" version="11"/>
    <description>This plug-in includes steps to work with rules and versions in IBM Operational Decision Manager.</description>
    <tag>Application Server/Java/ODM</tag>
  </header>
  <step-type name="Deploy Rule Archive">
    <description>Deploy a RuleSet or RuleApp archive to IBM Operational Decision Manager.</description>
    <properties>
      <property name="file" required="true">
        <property-ui type="textBox"
                     label="RuleApp Archive"
                     description="The full path to the RuleApp archive that contains the ruleset to deploy."/>
      </property>
      <property name="hostname" required="true">
        <property-ui type="textBox"
                     label="Hostname"
                     description="The host name of the server where the Rule Execution Server console is installed. For example:
                                  192.0.2.1"/>
      </property>
      <property name="port" required="true">
        <property-ui type="textBox"
                     label="Port"
                     description="The port number of the Rule Execution Server console."/>
      </property>
      <property name="username">
        <property-ui type="textBox"
                     label="User Name"
                     description="The user name to use to log in to the Rule Execution Server console."/>
      </property>
      <property name="password">
        <property-ui type="secureBox"
                     label="Password"
                     description="The password to use to log in to the Rule Execution Server console."/>
      </property>
      <property name="merging">
        <property-ui type="selectBox"
                     label="Merging Policy"
                     description="Select the merge policy to use to process the RuleApp archive to automatically assign the
                                  version. The policy supersedes any explicitly set values.."/>
        <value label="NONE">NONE</value>
        <value label="ADD_AT_END_MERGING_POLICY">ADD_AT_END_MERGING_POLICY</value>
        <value label="REPLACE_MERGING_POLICY">REPLACE_MERGING_POLICY</value>
        <value label="ADD_AT_END_RULESET_MERGING_POLICY">ADD_AT_END_RULESET_MERGING_POLICY</value>
        <value label="REPLACE_RULESET_MERGING_POLICY">REPLACE_RULESET_MERGING_POLICY</value>
      </property>
      <property name="version">
        <property-ui type="selectBox"
                     label="Version Policy"
                     description="Select the version policy to use to process the RuleApp archive to automatically assign the
                                  version. The policy supersedes any explicitly set values."/>
        <value label="NONE">NONE</value>
        <value label="MAJOR_VERSION_POLICY">MAJOR_VERSION_POLICY</value>
        <value label="MINOR_VERSION_POLICY">MINOR_VERSION_POLICY</value>
      </property>
      <property name="ruleAppName">
        <property-ui type="textBox"
                     label="RuleApp Name"
                     description="The name for the RuleApp archive in the Rule Execution Server console. To manually specify this
                                  value, Merging Policy and Versioning Policy must both be set to NONE."/>
      </property>
      <property name="ruleAppVersion">
        <property-ui type="textBox"
                     label="RuleApp Version"
                     description="The version for the RuleApp archive in the Rule Execution Server console. To manually specify
                                  this value, Merging Policy and Versioning Policy must both be set to NONE."/>
      </property>
      <property name="ruleSetName">
        <property-ui type="textBox"
                     label="RuleSet Name"
                     description="The name for the RuleSet archive in the Rule Execution Server console. To manually specify this
                                  value, Merging Policy and Versioning Policy must both be set to NONE."/>
      </property>
      <property name="ruleSetVersion">
        <property-ui type="textBox"
                     label="RuleSet Version"
                     description="The version for the RuleSet archive in the Rule Execution Server console. To manually specify
                                  this value, Merging Policy and Versioning Policy must both be set to NONE."/>
      </property>
    </properties>
    <post-processing><![CDATA[
        if (properties.get("exitCode") != 0) {
            properties.put(new java.lang.String("Status"), new java.lang.String("Failure"));
        }
        else {
            properties.put("Status", "Success");
        }
     ]]></post-processing>
    <command program="${GROOVY_HOME}/bin/groovy">
      <arg value="-cp"/>
      <arg path="classes:lib/httpclient.jar:lib/httpcore.jar:lib/HttpComponents-Util.jar:lib/commons-codec.jar:lib/CommonsUtil.jar:lib/log4j.jar:lib/CommonsFileUtils.jar:lib/securedata.jar:lib/jettison-1.1.jar"/>
      <arg file="deployRuleSet.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>
  <step-type name="Deploy Data Model">
    <description>Deploy an XOM resource to a Rule Execution Server instance of IBM Operational Decision Manager.</description>
    <properties>
      <property name="file" required="true">
        <property-ui type="textBox"
                     label="XOM File"
                     description="The XOM resource (Java archive or .zip file) to deploy to the Rule Execution Server."/>
      </property>
      <property name="name" required="true">
        <property-ui type="textBox"
                     label="Resource Name"
                     description="The name for the resource in the Rule Execution Server. Typically, you specify the XOM file
                                  name."/>
      </property>
      <property name="hostname" required="true">
        <property-ui type="textBox"
                     label="Hostname"
                     description="The host name of the server where the Rule Execution Server console is installed. For example:
                                  192.0.2.1"/>
      </property>
      <property name="port" required="true">
        <property-ui type="textBox"
                     label="Port"
                     description="The port number of the Rule Execution Server console."/>
      </property>
      <property name="username">
        <property-ui type="textBox"
                     label="User Name"
                     description="The user name to use to log in to the Rule Execution Server console."/>
      </property>
      <property name="password">
        <property-ui type="secureBox"
                     label="Password"
                     description="The password to use to log in to the Rule Execution Server console."/>
      </property>
    </properties>
    <post-processing><![CDATA[
        if (properties.get("exitCode") != 0) {
            properties.put(new java.lang.String("Status"), new java.lang.String("Failure"));
        }
        else {
            properties.put("Status", "Success");
        }
     ]]></post-processing>
    <command program="${GROOVY_HOME}/bin/groovy">
      <arg value="-cp"/>
      <arg path="classes:lib/httpclient.jar:lib/httpcore.jar:lib/HttpComponents-Util.jar:lib/commons-codec.jar:lib/CommonsUtil.jar:lib/log4j.jar:lib/CommonsFileUtils.jar:lib/securedata.jar:lib/jettison-1.1.jar"/>
      <arg file="deployXOM.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>
  <step-type name="Delete Rule Archive">
    <description>Delete a ruleset or ruleapp archive from a Rule Execution Server.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource"
                     description="The resource to delete from the Rule Execution Server. For a ruleset archive, use the following
                                  format: ruleAppName/ruleAppVersion/ruleSetName/ruleSetVersion. For a ruleapp archive, use the
                                  following format: ruleAppName/ruleAppVersion."/>
      </property>
      <property name="hostname" required="true">
        <property-ui type="textBox"
                     label="Hostname"
                     description="The host name of the server where the Rule Execution Server console is installed. For example:
                                  192.0.2.1"/>
      </property>
      <property name="port" required="true">
        <property-ui type="textBox"
                     label="Port"
                     description="The port number of the Rule Execution Server console."/>
      </property>
      <property name="username">
        <property-ui type="textBox"
                     label="User Name"
                     description="The user name to use to log in to the Rule Execution Server console."/>
      </property>
      <property name="password">
        <property-ui type="secureBox"
                     label="Password"
                     description="The password to use to log in to the Rule Execution Server console."/>
      </property>
    </properties>
    <post-processing><![CDATA[
        if (properties.get("exitCode") != 0) {
            properties.put(new java.lang.String("Status"), new java.lang.String("Failure"));
        }
        else {
            properties.put("Status", "Success");
        }
     ]]></post-processing>
    <command program="${GROOVY_HOME}/bin/groovy">
      <arg value="-cp"/>
      <arg path="classes:lib/httpclient.jar:lib/httpcore.jar:lib/HttpComponents-Util.jar:lib/commons-codec.jar:lib/CommonsUtil.jar:lib/log4j.jar:lib/CommonsFileUtils.jar:lib/securedata.jar:lib/jettison-1.1.jar"/>
      <arg file="deleteRuleArchive.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>
  <step-type name="Delete XOM">
    <description>Delete a XOM from a Rule Execution Server.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource"
                     description="The resource to delete from the Rule Execution Server. Use the
                                  following format: xomName/xomVersion."/>
      </property>
      <property name="hostname" required="true">
        <property-ui type="textBox"
                     label="Hostname"
                     description="The host name of the server where the Rule Execution Server console is installed. For example:
                                  192.0.2.1"/>
      </property>
      <property name="port" required="true">
        <property-ui type="textBox"
                     label="Port"
                     description="The port number of the Rule Execution Server console."/>
      </property>
      <property name="username">
        <property-ui type="textBox"
                     label="User Name"
                     description="The user name to use to log in to the Rule Execution Server console."/>
      </property>
      <property name="password">
        <property-ui type="secureBox"
                     label="Password"
                     description="The password to use to log in to the Rule Execution Server console."/>
      </property>
    </properties>
    <post-processing><![CDATA[
        if (properties.get("exitCode") != 0) {
            properties.put(new java.lang.String("Status"), new java.lang.String("Failure"));
        }
        else {
            properties.put("Status", "Success");
        }
     ]]></post-processing>
    <command program="${GROOVY_HOME}/bin/groovy">
      <arg value="-cp"/>
      <arg path="classes:lib/httpclient.jar:lib/httpcore.jar:lib/HttpComponents-Util.jar:lib/commons-codec.jar:lib/CommonsUtil.jar:lib/log4j.jar:lib/CommonsFileUtils.jar:lib/securedata.jar:lib/jettison-1.1.jar"/>
      <arg file="deleteXom.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>
  <step-type name="Fetch Rule Archive">
    <description>Fetch a ruleset or ruleapp archive from a Rule Execution Server.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource"
                     description="The resource to fetch from the Rule Execution Server. For a ruleset archive, use the following
                                  format: ruleAppName/ruleAppVersion/ruleSetName/ruleSetVersion. For a ruleapp archive, use the
                                  following format: ruleAppName/ruleAppVersion. If no version is specified, the highest will be fetched."/>
      </property>
      <property name="hostname" required="true">
        <property-ui type="textBox"
                     label="Hostname"
                     description="The host name of the server where the Rule Execution Server console is installed. For example:
                                  192.0.2.1"/>
      </property>
      <property name="port" required="true">
        <property-ui type="textBox"
                     label="Port"
                     description="The port number of the Rule Execution Server console."/>
      </property>
      <property name="username">
        <property-ui type="textBox"
                     label="User Name"
                     description="The user name to use to log in to the Rule Execution Server console."/>
      </property>
      <property name="password">
        <property-ui type="secureBox"
                     label="Password"
                     description="The password to use to log in to the Rule Execution Server console."/>
      </property>
    </properties>
    <post-processing><![CDATA[
        if (properties.get("exitCode") != 0) {
            properties.put(new java.lang.String("Status"), new java.lang.String("Failure"));
        }
        else {
            properties.put("Status", "Success");
        }
     ]]></post-processing>
    <command program="${GROOVY_HOME}/bin/groovy">
      <arg value="-cp"/>
      <arg path="classes:lib/httpclient.jar:lib/httpcore.jar:lib/HttpComponents-Util.jar:lib/commons-codec.jar:lib/CommonsUtil.jar:lib/log4j.jar:lib/CommonsFileUtils.jar:lib/securedata.jar:lib/jettison-1.1.jar"/>
      <arg file="fetchResource.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>
  <step-type name="Fetch XOM">
    <description>Fetch a XOM resource from a Rule Execution Server.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource"
                     description="The resource to fetch from the Rule Execution Server. Use the
                                  following format: xomName/xomVersion. If no version is specified, the highest will be fetched."/>
      </property>
      <property name="hostname" required="true">
        <property-ui type="textBox"
                     label="Hostname"
                     description="The host name of the server where the Rule Execution Server console is installed. For example:
                                  192.0.2.1"/>
      </property>
      <property name="port" required="true">
        <property-ui type="textBox"
                     label="Port"
                     description="The port number of the Rule Execution Server console."/>
      </property>
      <property name="username">
        <property-ui type="textBox"
                     label="User Name"
                     description="The user name to use to log in to the Rule Execution Server console."/>
      </property>
      <property name="password">
        <property-ui type="secureBox"
                     label="Password"
                     description="The password to use to log in to the Rule Execution Server console."/>
      </property>
    </properties>
    <post-processing><![CDATA[
        if (properties.get("exitCode") != 0) {
            properties.put(new java.lang.String("Status"), new java.lang.String("Failure"));
        }
        else {
            properties.put("Status", "Success");
        }
     ]]></post-processing>
    <command program="${GROOVY_HOME}/bin/groovy">
      <arg value="-cp"/>
      <arg path="classes:lib/httpclient.jar:lib/httpcore.jar:lib/HttpComponents-Util.jar:lib/commons-codec.jar:lib/CommonsUtil.jar:lib/log4j.jar:lib/CommonsFileUtils.jar:lib/securedata.jar:lib/jettison-1.1.jar"/>
      <arg file="fetchXom.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>
  <step-type name="Set Property">
    <description>Set a property in IBM Operational Decision Manager.</description>
    <properties>
      <property name="hostname" required="true">
        <property-ui type="textBox"
                     label="Hostname"
                     description="The host name of the server where the Rule Execution Server console is installed. For example:
                                  192.0.2.1"/>
      </property>
      <property name="port" required="true">
        <property-ui type="textBox"
                     label="Port"
                     description="The port number of the Rule Execution Server console."/>
      </property>
      <property name="username">
        <property-ui type="textBox"
                     label="User Name"
                     description="The user name to use to log in to the Rule Execution Server console."/>
      </property>
      <property name="password">
        <property-ui type="secureBox"
                     label="Password"
                     description="The password to use to log in to the Rule Execution Server console."/>
      </property>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource Path"
                     description="The resource path for the property to be updated. For a ruleApp, use the format:
                                  ruleAppName/ruleAppVersion.  For a ruleSet, use the format:
                                  ruleAppName/ruleAppVersion/ruleSetName/ruleSetVersion."/>
      </property>
      <property name="addNew">
        <property-ui type="checkBox"
                     label="Create New Property"
                     description="Check this box if creating a new property.
                     Do not check this box if updating an existing property."/>
      </property>
      <property name="propName" required="true">
        <property-ui type="textBox"
                     label="Property Name"
                     description="The existing property name to be updated."/>
      </property>
      <property name="propValue">
        <property-ui type="textBox"
                     label="Property Value"
                     description="The new property value."/>
      </property>
    </properties>
    <post-processing><![CDATA[
        if (properties.get("exitCode") != 0) {
            properties.put(new java.lang.String("Status"), new java.lang.String("Failure"));
        }
        else {
            properties.put("Status", "Success");
        }
     ]]></post-processing>
    <command program="${GROOVY_HOME}/bin/groovy">
      <arg value="-cp"/>
      <arg path="classes:lib/httpclient.jar:lib/httpcore.jar:lib/HttpComponents-Util.jar:lib/commons-codec.jar:lib/CommonsUtil.jar:lib/log4j.jar:lib/CommonsFileUtils.jar:lib/securedata.jar:lib/jettison-1.1.jar"/>
      <arg file="setProperty.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>
</plugin>
