Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 11 Deploying, Starting and Monitoring a TIBCO BusinessWorks Service : Creating the FileTest Process

Creating the FileTest Process
This section guides you through creating a simple process definition. The process, will be named FileTest. It:
1.
2.
The tutorial uses a variable file name to illustrate how to use the TIBCO BusinessWorks mapping capabilities.
Create the Example Directory and File
The File Poller activity requires an input file.
1.
2.
3.
The cherry blossoms are beautiful.
Create the FileTest Process
1.
In TIBCO Designer, select the project name (bwtutorial) in the project panel.
2.
If no palettes are in the palette panel, click the Switch Palette Mode icon to display the palettes.
3.
From the palette panel, drag a Process Definition into the design panel.
4.
In the configuration panel, type the name FileTest in the Name field to rename the process. Then click Apply.
5.
Save your project by choosing Project > Save from the menu.
Add Activities to the Process
1.
Select the FileTest process in the project tree.
The Start and End activities should be displayed in the design panel.
2.
Find the File palette in the palette panel and select it.
If the File palette is not one of the available palettes, click Palettes > Browse to display the Palette Browser. Type File in the Filter string/pattern field and click Filter. Select the File palette and click Close.
3.
Drag a File Poller activity into the design panel (but not on top of the Start activity).
The Start activity is replaced by the File Poller activity.
4.
a.
Type TestFilePoller in the Name field.
b.
c.
Select text in the drop-down list in the Content as field, and select the appropriate encoding for your operating system in the Encoding field. Other fields should use defaults.
Figure 66 Adding Activities to the Process
d.
Click Apply.
5.
Drag a Create File activity into the design panel and place it to the right of TestFilePoller.
6.
Name the Create File activity CreateTestFile, and click the Overwrite checkbox, and then click the Apply button.
Figure 67 Enter the Details in Configuration Tab
7.
Drag a Write File activity into the design panel and place it to the right of the CreateTestFile activity (before the End activity).
8.
Name the Write File activity WriteToTestFile, and then click the Apply button.
Figure 68 Activity Icons
9.
Click View in the menu bar and select Connect.
10.
11.
12.
The result should appear as follows:
13.
Choose Project > Save from the menu.
The process now includes appropriately connected activities. However, no information about the name and content of the file to be created is included. To set those, you use the TIBCO Designer mapping facilities.
The goal in this exercise is to create a file that has the name Filechange_type.txt, where change_type is the type of change that occurred to the original file (create, modify, or remove). The content of the changed file is then written to the new file, and the time the change in the file occurred is appended to the end of the contents. For example, if the text in the changed file is The cherry blossoms are beautiful. the content of the new file will be The cherry blossoms are beautiful. 1017163931036.
To map the data flow between activities, follow these steps:
1.
Click View in the menu bar and select Select.
2.
Figure 69 Mapping Data Flow between Activities
Each activity’s output is available to subsequent activities in the process definition. You can use data from previous activities to specify the input of the current activity. For example, you can use the content of the original text file as the content of the new text file.
The left panel of the Input tab contains a list of data from all activities preceding the current activity in the process diagram. Each activity’s name appears with a dollar sign ($) in front of it to indicate that this is a process variable.
The right panel of the Input tab lists the current activity’s input. Input fields in red indicate an error in the data specified for the field. In this case, the fileName field is required. Because no value has been supplied yet, the field is displayed in red.
3.
Click the plus (+) sign next to the process variable $TestFilePoller in the Process Data panel and expand the schema tree containing the output of the TestFilePoller process starter.
4.
In the right panel, expand the tree and select the fileName field in the Activity Input pane, and then click the icon.
5.
a.
Select the Functions tab, expand the String folder, select concat, and drag it into the XPath Formula panel.
The display in the right panel changes to display a concat XPath expression.
b.
Replace << string1 >> with "C:\projects\bwtest\File" (include the quotes).
c.
In the left panel, select the Data tab, choose the $TestFilePoller/EventSourceOutputTextClass/action item and drag it over << string2 >>. A red box appears over << string2 >> indicating you can release the data over this item and the correct XPath expression will appear.
d.
Add a comma after $TestFilePoller/EventSourceOutputTextClass/action, and then add the string ".txt" (include the quotes).
The expression should look like the following:
      concat("c:\tibco\test\File",
      $TestFilePoller/EventSourceOutputTextClass/action, ".txt")
6.
Click the Apply button to accept the formula, and then click Close. Click the Apply button in the configuration panel of the activity.
7.
Select the WriteToTestFile activity, and then click the Input tab in the configuration panel.
8.
a.
Select $CreateTestFile/CreateActivityOutputClass/fileInfo/
fullName
and drag it to the fileName item in the Activity Input pane.
You do not need to use the XPath Formula Builder to map this item because you do not need to use XPath functions. The content of the field is exactly the same as the value of the $CreateTestFile/CreateActivityOutputClass/fileInfo/fullName process variable.
b.
In the right panel, select the textContent field and click the icon.
c.
d.
Add " ", between <<string1>>, and <<string2>> so that there is a space between the two strings in the concat function.
e.
Click the Data tab and drag $TestFilePoller/
EventSourceOutputTextClass/fileContent/textContent
over << string1 >>.
f.
Drag $TestFilePoller/EventSourceOutputTextClass/timeOccurred over << string2 >>.
The formula should look like this:
      concat($TestFilePoller/EventSourceOutputTextClass/
      fileContent/textContent," ",$TestFilePoller/
      EventSourceOutputTextClass/timeOccurred )
g.
Click the Apply button to accept the formula and click Close.
9.
Click the Apply button on the activity’s configuration panel, and then choose Project > Save to save your project.
You are now ready to test the project.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved