Creating an Action Template

This is the first template that needs to be created. It consists of: Parameters, Action Configuration Fragment and Enforcement Point Placement.

To create the action template, use the CustomAction.atp file from Sample Action Rule Templates and User Interface Files.

Procedure

  1. Copy the contents of the CustomAction.atp file and rename the file with the custom action name. For example, in the sample custom action Request Counter, we have named the action template file RequestCounter.atp.
  2. Change the Qname of the action, version, specify the category and the subcategory:

  3. Specify the parameters of the action. These parameters are defined inside a parameter group.

    1. Change ‘$PARAMETERGROUPNAME’ to the name of the parameter group name.
    2. Change ‘$INPUT1’ to the name of the first input parameter.
    3. Change the ‘$INPUT 1 DISPLAY NAME’ to the name specified in the previous step or to any alternate name that should be displayed to the user.
    4. Change the ‘$FIRST INPUT’ to enter the description of the parameter that is being defined.
    5. Set hidden to true/false. If set to true, the parameter is not visible to the user on the UI, if set to false it is visible on the UI.
    6. Change ‘$TYPE_OF_INPUT’ to the type of the input parameter.
      For a list of supported types, see Parameters and Action Templates.
      The parameter tags can be repeated to add additional parameters that are needed to define the action.
  4. Change the ‘CustomActionAction’ to the name of the custom action. Change the description, the implementation Id and the Intents.
    NOTE: The implementation Id should be the same as the action qname specified in the action configuration processor.

  5. Change the config fragment as expected by the action. configFragment is interpreted by Velocity Engine at run time to produce the xml fragment that is used to initialize the action. The $INPUT1 and $INPUT2 are the two inputs which are passed in a format that can be interpreted by the velocity engine.

  6. Change the ‘$Path_To_CustomAction.xsd’ to point to the path of the Custom Action schema. ‘useWSPolicySchema’ can be set to true if the custom policy adheres to the WS Policy schema.

  7. Change the $HOST. The host can be a pipeline or host. $ENFORCEMENTPOINT, $STAGE, and $INTERVAL need to be changed depending on where the action needs to be invoked.

    For a complete set of allowed host, section, enforcement points, stage and interval, see Sample Action Source Code.

    The last two tags specify the merge placement and cardinality. AllowedEnforcementPlacements define all the allowed locations where this action could be used.

    The actual place where this is used is determined in the Rule Template by using this Action Template. The mergePlacement and mergeCardinality are defined only in the action template. The Rule template cannot define the placement or cardinality of the action it is using.

    On completion, the custom action template is ready to be used. For a complete action template refer to the following:

    CustomPolicies/samples/requestCounter/template/RequestCounter.atp.

    The CustomPolicies folder is located at:

    TIBCO_HOME/pd/1.2/samples/CustomPolicies