The Scenario Manager configuration file is located in your config path at /atg/scenario/scenarioManager.xml. You can add a new condition to this configuration by creating a file with the same name in your localconfig directory (<ATG10dir>/home/localconfig/atg/scenario/scenarioManager.xml).

Below is an example of a scenarioManager.xml file showing the condition registry entries that you would define in order to add the new condition. (Note that sample also shows the action definition, which is essentially the same as the example from the previous section of this chapter except that it uses the Resources.properties file shown later to determine display names for the ACC.)

The first operand of the condition is a String code of “1”, “2”, “3” or “4” that determines the phase to be checked for (new, waxing, full, or waning, respectively). The second operand is a scenario expression of type Date that determines the date on which the moon’s phase will be evaluated and checked. If the moon was, is, or will be in the specified phase on the specified date, the condition evaluates to true; otherwise, it is false.

Note that the order of the operands is important. The filter class that evaluates the condition (see Extending the ExpressionFilter Class for the New Condition) processes the operands in the order in which you define them here.

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE process-manager-configuration
        PUBLIC "-//Art Technology Group, Inc.//DTD Process Manager//EN"
        'http://www.atg.com/dtds/processmanager/processmanager_1.0.dtd'>

<process-manager-configuration>

  <action-registry>
    <action>
      <action-name>
        logInfo
      </action-name>
      <action-class>
        astroweb.LogAction
      </action-class>
      <resource-bundle>
        astroweb.Resources
      </resource-bundle>
      <display-name-resource>
       logAction.displayName
      </display-name-resource>
      <description-resource>
        logAction.decription
      </description-resource>
      <action-execution-policy>
        individual
      </action-execution-policy>
      <action-error-response>
        continue
      </action-error-response>

      <action-parameter>
        <action-parameter-name>
          logString
        </action-parameter-name>
        <action-parameter-class>
          java.lang.String
        </action-parameter-class>
        <required>
          true
        </required>
        <display-name-resource>
          logAction.logString.displayName
        </display-name-resource>
        <description-resource>
          logAction.logString.description
        </description-resource>
      </action-parameter>

      <action-parameter>
        <action-parameter-name>
          logInteger
        </action-parameter-name>
        <action-parameter-class>
          java.lang.Integer
        </action-parameter-class>
        <required>
          true
        </required>
        <display-name-resource>
          logAction.logInteger.displayName
        </display-name-resource>
        <description-resource>
          logAction.logInteger.description
        </description-resource>
      </action-parameter>
    </action>
  </action-registry>

  <!--
  Register a custom condition named "moonPhase" that determines
  whether the moon is in a given phase on a particular date.
-->

  <condition-registry>
    <condition>
      <condition-name>
        moonPhase
      </condition-name>
      <filter-class>
        astroweb.MoonFilter
      </filter-class>
      <resource-bundle>
        astroweb.Resources
      </resource-bundle>
      <display-name-resource>
        moonPhase.displayName
      </display-name-resource>
      <description-resource>
        moonPhase.description
      </description-resource>
      <icon-resource>
        moonPhase.icon
      </icon-resource>

      <action-parameter>
        <action-parameter-name>
         phase
        </action-parameter-name>
        <display-name-resource>
         moonPhase.phase.displayName
        </display-name-resource>
        <action-parameter-class>
         java.lang.String
        </action-parameter-class>
        <required>
         true
        </required>
        <description-resource>
         moonPhase.phase.description
        </description-resource>
      </action-parameter>

      <action-parameter>
        <action-parameter-name>
         date
        </action-parameter-name>
        <display-name-resource>
         moonPhase.date.displayName
        </display-name-resource>
        <action-parameter-class>
         java.util.Date
        </action-parameter-class>
        <required>
         true
        </required>
        <description-resource>
         moonPhase.date.description
        </description-resource>
      </action-parameter>

    </condition>
  </condition-registry>

</process-manager-configuration>
Adding an Icon to a Custom Element

Optionally, you can create an icon that will appear next to your custom condition in the ACC. In the example above, the <icon-resource> tags reference the file astroweb/moon-phase.gif, specified along with other display elements in the resource file shown in the next section.

Using a Resource Bundle Properties File to Define Display Elements

To ease the process of internationalizing the ACC, the custom condition uses a resource bundle properties file to determine display names for this condition. The file created for this condition, which is called Resources.properties, has the following contents:

#
# Resource bundle properties used by example custom scenario elements
#
logAction.displayName=Log data
logAction.description=test action to log values
logAction.logString.displayName=with string value
logAction.logString.description=a string value to evaluate and display
logAction.logInteger.displayName=and integer value
logAction.logInteger.description=an integer value to evaluate and display
moonPhase.displayName=Moon
moonPhase.description=lunar calendar condition
moonPhase.icon=astroweb/moon-phase.gif
moonPhase.phase.displayName=in phase
moonPhase.phase.description=1:new, 2:waxing, 3:full, 4:waning
moonPhase.date.displayName=on date
moonPhase.date.description=the date for which the phase is checked
vmSystem.displayName=Virtual Machine

(Note that the vmSystem.displayName=Virtual Machine line is included here only for the purposes of the custom bean expression example later in this chapter.)

For more information, refer to Resource Bundles in the ATG Platform Programming Guide.


Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved. Legal Notices