Action File

The action file is an XML file specified by the T parameter on the command line.

Using an action file would allow you to put multiple actions in one file, specified using XML format. The format of the action file is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE actions SYSTEM "siftactions.dtd">
<actions>
<action name="action1" output=”action2:file1”>
<arg name="arg1" value="somevalue" sc="a1"/>
……
</action>
……
</actions>

The <action> element defines an action. The <arg> element defines a parameter needed for this action. If there are multiple <action> elements in the file, the program executes them one by one.

The ‘name’ attribute for <action> element specifies the action name. This must be a valid action. The XML file names are all valid actions.

The ‘name’ attribute for <arg> element specifies the parameter name for an action. The name is case sensitive and should not be edited. The ‘sc’ attribute for <arg> element specifies a shortcut name for the ‘name’ attribute, and it is case insensitive. Users can use shortcut names to specify values in command line to replace default values specified in this file. If the action is specified by A parameter in command line, you must specify parameter name for that action rather than a shortcut name. Shortcut names can be found in each XML file.

For actions that retrieve information from a web service, you can specify an output file in the ‘output’ attribute for <action> element. The program saves the retrieved information into the file (in action file format), which can be used as an action file. For example, if you want to add userB into the database, and there is a userA already in the database, whose information can be used for userB, then, you can do the following operations:

  1. Build an action file, userA.xml, to retrieve userA’s information and save the information into an ‘addUser’ action in the file userB.xml.

    The userA.xml looks like:

    <?xml version="1.0" encoding="UTF-8"?> 
    <!DOCTYPE actions SYSTEM "siftactions.dtd">
    <actions>
        <action name=”getUser” output=”addUser:userB.xml”>
            <arg name=”UserId” value=”userA” sc=”UID”/>
        </action>
    </actions>

    The value for ‘output’ attribute is in the format of ActionName:FileName, or ActionName>FileName. Since the generated file is in action file format, both action name and file name are needed. Use a colon (:) to generate a new output file, or use the greater than symbol (>) to append to an existing file.

  2. Run the program to get userA’s information and generate action file userB.xml:

    java –classpath %cp% cfcc.CFAdmin U:userA P:pwdA T:userA.xml

  3. Run the program again with the generated action file to add userB:

    java –classpath %cp% cfcc.CFAdmin U:userB P:pwdB T:userB.xml UID:userB

  4. Use UID:userB to overwrite the UserId parameter from action file, in which the value is userA.

Currently, GetTransfer, GetGroup, GetServer, GetUser and GetUserProfile actions supports writing output into an .xml file. The sample .xml files included in the product create afTmpl.xml, agTmpl.xml, anTmpl.xml, asTmpl.xml, auTmpl.xml and aupTmpl.xml respectively.