Unsupported content

 

This version of the product has reached end of support. The documentation is available for your convenience. However, you must be logged in to access it. You will not be able to leave comments.

Creating the Copy File workflow

In this task, you create the Copy File workflow, which copies a specified file to a target directory. Instead of the Command Line adapter, you use one of the Operations Actions Management modules' utilities to perform the action.

You will use the Copy File workflow with the Directory list workflow in the top-level workflow, Copy Files in Directory.
This page includes the following topics related to the task:

Before you begin

The AutoPilot-OA-Common-Utilities and the AutoPilot-AD-Utilities must have been imported into the BMC Atrium Orchestrator Development Studio workspace and unbundled, and must be active on the grid.

To create the Copy File workflow

  1. In the BMC Atrium Orchestrator Development Studio Project Navigator tree, right-click Samples and select New Process.
  2. In the Create New Process dialog box, type Copy File in the Process Name field, ensure that the Expose Process options In Schedules and In Rules are not selected, and then click OK.
    The new workflow name is added to the module in the Project Navigator, and the design canvas displays the new workflow.

To configure the input parameters

  1. On the design canvas, double-click the Start activity.
  2. In the Input Parameter Name field on the Properties tab of the Property Panel for the Start activity, type connection details.
  3. Press Tab and verify that the name in the Context Name field is the same as in the Input Parameter Name field and that the Required check box is selected.
  4. Repeat steps 2 and 3 to create the following required input parameters:
    • source file
    • destination directory
  5. Click OK.
  6. Save the workflow.

To create the copy command

  1. Click the Activity Palette to open it, and drag an Assign activity to the process canvas and connect it to the workflow.
  2. (optional) Click the activity's Assign label, delete it, and type Create copy command.
  3. Double-click the Assign activity.
  4. On the Properties tab of the Property Panel for the Assign activity, click to add a new assign statement.
  5. Select String as the input parameter type.

  6. Right-click in the text entry field and select Module Configuration> Samples:Samples:CopyCommand (one of the configuration items that you created in a previous task).

    BMC Atrium Orchestrator Development Studio inserts the configuration item in the text entry field as shown in the following figure.

    Text entry field showing the configuration item 


  7. Type a space in the text entry field immediately to the right of the configuration item, and then right-click after the space and select Local Context Item> source file.

    BMC Atrium Orchestrator Development Studio inserts the context item in the text entry field.

  8. Type a space in the text entry field immediately to the right of the context item, and then right-click after the space and select Local Context Item> destination directory.

    BMC Atrium Orchestrator Development Studio inserts the context item in the text entry field, as shown in the following figure.

    Text entry field showing the configuration item and context items

  9. On the Properties tab, enter information for the output context item for the assign statement:

    1. In the Context Type box, select Context Item.

    2. Click to open the Context Browser.

    3. In the Context Browser, click New.

    4. In the Context Name field of the Create Context Data dialog box, type command, and then click OK.

    5. In the Local Context area, click command and click Select.

      The Properties tab of the Property Panel for the assign statement is redisplayed. The output context name is command.

  10. On the Properties tab of the Property Panel for the assign statement, click OK.

    The Properties tab of the Property Panel for the Assign activity shows that one assign statement has been created, as shown in the following figure.

    Information about the assign statement

  11. Click OK to exit the Property Panel.

  12. Save the workflow.

To invoke the command

  1. In the Project Navigator, expand the AutoPilot-OA-Common-Utilities module.

  2. Drag the Invoke Command workflow from the AutoPilot-OA-Common-Utilities module to the process canvas and place it after the Create copy command Assign activity.

  3. Connect the Invoke Command workflow to the Copy File workflow.

    BMC Atrium Orchestrator Development Studio briefly displays a message that two of three inputs have been auto-mapped.

  4. Double-click the Invoke Command Call Process activity and review the Property Panel, as shown in the following figure.

    Property Panel for the Invoke Command Call Process activity


    BMC Atrium Orchestrator Development Studio automatically maps the existing context connection details and commandto the required input parameters with the same names for the Invoke Command workflow. The program also creates output context items for the Call Process activity that match the output parameters for the Invoke Command workflow.

  5. Click OK to close the Property Panel.

  6. Save the Copy File workflow.

To test the Copy File workflow and gather sample data

  1. In the toolbar below the menu bar, click ExecuteProcessAction.

  2. If you have not already logged on to the grid, log on. Otherwise, proceed to step 3.

  3. In the Execution Mode dialog box, select Test as if triggered by a rule, schedule or SOAP, and then click OK.

  4. In the Job Input Parameters dialog box, select XML as the type for the connection details parameter.

  5. From the Conn_Details.txt file that you created in a previous task, copy the connection details definition.

  6. In the Job Input Parameters dialog box, double-click in the Value field for the connection details parameter.

  7. In the Enter XML Data dialog box, paste the connection details definition, and then click OK.

  8. In the Job Input Parameters dialog box, select String as the type for the source file parameter.

  9. In the Job Input Parameters dialog box, double-click in the Value field for the source file parameter and type the fully qualified path and name of a file that you want to copy.

    This file must exist on the peer where the Command Line adapter is enabled.

  10. In the Job Input Parameters dialog box, select String as the type for the destination directory parameter.

  11. In the Job Input Parameters dialog box, double-click in the Value field for the destination directory parameter and type the fully qualified path to the directory into which you want to copy the file.
    This directory must exist on the peer where the Command Line adapter is enabled.

    The Job Input Parameters dialog box appears as shown in the following figure.

    Job Input Parameters dialog box

  12. Click OK.

    BMC Atrium Orchestrator Development Studio runs the Copy File workflow. The console window opens below the process canvas, and the Process Log tab displays the results of the workflow execution. These are the same results that are posted to the processes.log file when the workflow is run on the grid. On the process canvas, the Create copy command and Invoke Command activities have brown boxes around them to indicate that they have been executed.

  13. Verify that the last line in the console window is The process terminated in the completed state

    This message indicates that the workflow that you created ran to completion.

    Do not clear or close the console window.

  14. Review the contents of the console window.

    This is the information that would have been written to the log file if the workflow had been run on the grid.

  15. In the console window, find the adapter response.

    The adapter response starts with [conbaodscrea:adapter response= and ends with ]. For this adapter, the entire adapter response is the command result.

  16. From the adapter response, copy the command result and paste it in an empty text document.
    The command result begins with <command-result> and ends with </command-result>. Do not copy the square bracket at the end.

  17. Save the text file as Sample_Command_Result.txt.

To save the results of the Invoke Command activity

  1. Drag an Assign activity to the process canvas after the Invoke Command activity and connect it to the workflow.

  2. Double-click the Assign activity.

  3. On the Properties tab of the Property Panel for the Assign activity, click  to add a new assign statement.

  4. On the Properties tab of the Property Panel for the assign statement, select Context item as the input parameter type, and use the Context Browser to select the adapter response context item as follows:

    1. Click to open the Context Browser.

    2. In the Local Context area of the Context Browser, click adapter response, and then click Select.

    3. In the Insert Context/Configuration Element dialog box, click OK.

  5. On the Properties tab on the Property Panel for the assign statement, click Basic to open the Basic transform editor.

  6. Use the Basic transform editor to extract the status information from the adapter response as follows:

    1. Click to open a sample from the resource area.

      The Select Resource dialog box is displayed.

    2. Highlight the My Samples folder and click  to create a new sample.

    3. In the File Name field of the Input dialog box, type sample command result, and then click OK.

      In the bottom pane of the Select Resource dialog box, <value/> is displayed.

    4. Use a text editor to open the Sample_Command_Result.txt file.

    5. From the Sample_Command_Result.txt file, copy the command result.

      Copy from <command-result> to </command-result>, including all of the angle brackets.

    6. In the bottom pane of the Select Resource dialog box, delete the <value/> text and paste the command result text that you copied from the Sample_Command_Result.txt file.

    7. Click  and then click OK.

      The Select Resource dialog box closes and the Basic Transform Editor displays the command result text in the left pane.

    8. In the Basic transform editor, in the Function field, select XML> Element name matches.

    9. In the first Operand field, type command-output/metadata/status.

    10. In the upper-right corner of the Basic transform editor, click Generate Preview.

      The Preview pane displays success.

    11. In the Basic transform editor, in the Function sequence area, click  to add a new function.

    12. In the Basic transform editor, in the Function field, select XML> XML to Text.

    13. In the upper-right corner of the Basic transform editor, click Generate Preview.

      The Preview pane displays success.

    14. Click OK to close the Basic transform editor.

      The Transform field on the Properties tab on the Property Panel for the assign statement displays a description of the functions that you selected.

  7. On the Properties tab, for Output Context Type, select Context item.

  8. Use the Context Browser to create a new context item called status as follows:

      1. Click to open the Context Browser.

      2. In the Context Browser, click New.

      3. In the Context Name field of the Create Context Data dialog box, type status, and then click OK.

      4. In the Local Context area, click status and click Select.

  9. Click OK to close the Properties tab for this assign statement.

  10. On the Properties tab of the Property Panel for the Assign activity, click  to add a new assign statement.

  11. On the Properties tab of the Property Panel for the assign statement, select Context item as the input parameter type, and use the Context Browser to select the adapter response context item.

  12. On the Properties tab on the Property Panel for the assign statement, click Basic to open the Basic transform editor.

  13. Use the Basic transform editor to extract the error information from the adapter response as follows:

    1. (optional) If the Basic transform editor does not display the sample command result in the Test Value pane, click  to open a sample from the resource area; otherwise, skip to step c.

    2. (optionalSelect sample command result from My Samples. Then click OK.

    3. In the Basic transform editor, in the Function field, select XML> Element name matches.

    4. In the first Operand field, type command-output/metadata/error.

    5. In the upper-right corner of the Basic transform editor, click Generate Preview.

      Because there are no errors to display, the Preview pane displays <result/>.

    6. In the Basic transform editor, in the Function sequence area, click  to add a new function.

    7. In the Basic transform editor, in the Function field, select XML> XML to Text.

    8. Click OK to close the Basic transform editor.

      The Transform field on the Properties tab on the Property Panel for the assign statement displays a description of the functions that you selected.

  14. On the Properties tab, for Output Context Type, select Context item.

  15. Use the Context Browser to create a new context item called error.

  16. Click OK to close the Properties tab for this assign statement.

  17. Click OK to close the Property Panel for the Assign activity.

  18. Save the workflow.

To log the results of the Assign activity

  1. On the design canvas, double-click the second Assign activity.

  2. On the Property Panel for the Assign activity, click the Logging tab and then click the After Execution tab.

  3. Select the Log check box, and type After File Copy in the text field.

  4. Right-click in the Context Item text field, and from the Insert window, select Local Context Item> status.

    The After Execution tab shows the status context item in the Context Item text field.

  5. Repeat the previous step to insert the error context item.

    The Context Item field on the Logging => After Execution tab of the Property Panel for the Assign activity shows the context items that you selected, as shown in the following figure.

    Logging After Execution tab showing status and error context items

  6. Click OK to return to the process canvas.

  7. Click   to save the workflow.

To configure the output parameters

  1. On the design canvas, double-click the End activity.

  2. On the Properties tab of the Property Panel for the End activity, click .
  3. In the Context Browser-Select Multiple dialog box, press the Ctrl key and select adapter response, error, and status. Click Select.

  4. On the Properties tab of the Property Panel for the End activity, use the blue arrows to change the order of the context items to the order shown in the following figure. Ensure that each context item's Required check box is cleared.

    Output parameters of the End activity of the Copy File workflow

  5. Click OK to return to the design canvas.

  6. Save the workflow. 

The following figure shows the process canvas view of the finished Copy File workflow.

Completed Copy File workflow


This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

Comments