Appendix B Managing Projects and Resources : Working With Global Variables

Working With Global Variables
Global variables provide an easy way to set defaults for use throughout your project. There are several ways in which they can be used:
Define a variable using TIBCO Designer, then override the value for individual applications at deployment time using TIBCO Administrator. You can also override values for predefined variables, unless the GUI does not allow you to make them settable later.
Predefine a variable using TIBCO Designer, then override the value for individual services (for example, publication service or TIBCO BusinessWorks process) at deployment time using TIBCO Administrator. The values you specify are then used at runtime.
You can also override values for predefined variables, unless the GUI does not allow you to make them settable later.
For example, you could assign the value 7474 to the predefined global variable RvDaemon. You can then use the variable in different sessions in your adapter. If you want to change the TIBCO Rendezvous daemon for your adapter, you can globally set it to a different value or override it from the command line.
When you want to use the global variable in the fields of a resource, enter the variable name surrounded by %% on both sides. Some fields in the configuration panel, such as user name and password fields, allow you to drag and drop global variables into the field.
When the project is deployed and the configured components run, all occurrences of the global variable name are replaced with the global variable value. For example, a global variable named RvServiceTest with a value of 7800 would be replaced with 7800.
A number of global variables are predefined in TIBCO Designer. You can add definitions of any variables you need to the predefined variables.
Global Variables Editor
Use the global variables editor to create or modify global variables, mark variables as settable from TIBCO Administrator, and assign a type to a variable.
To display the global variables editor, in the project panel, select the Global Variables tab or drop down, then click the Open Advanced Editor (pen) icon. If you select a global variable, then click the pen icon, the editor opens with the variable selected.
The next diagram shows the global variables editor.
Adding a Global Variable or Global Variable Group
To add a global variable, select the create variable icon. A new line for the variable appears. Type a name for the variable by triple-clicking the name field.
The name MessageEncoding is reserved and cannot be used to name a global variable. A global variable of this name is created by Designer when generating an EAR file.
When creating a global variable group or variable, it is added to the bottom of the list. When you reopen the global variables editor, the group or variable displays alphabetically in the list.
Global variable groups are used for organizing variables. Variable groups are especially useful if multiple developers share a project using a version control system. To add a global variable group, select the add variable group icon.
You must add at least one variable to a group, or the group will not be saved. If you delete all global variables in a global variable group, the group itself is also automatically deleted.
Using a Filter
By default, all global variables are visible in the editor. You can provide a filter in the Filter string/pattern field to limit the display. The filter uses regular expression matching. That is, if you enter Rv in the field, only variables that have Rv in their name are displayed. Matching is case insensitive. Entering a new expression and clicking Filter again performs a new search on all variables and will not refine the current search.
To clear the filter expression and display all variables either click Show all or remove the expression from the entry box and click Filter again.
Global Variable Attributes
To add or edit a name, value, constraint or description attribute, triple-click in the attribute field. The type attribute has a drop down menu that displays choices. Click in the type field to display the menu.
Name — Provide a name for the variable.
Value — Provide a value for the variable, depending on the type you select.
Deployment — Select the deployment check box to make the variable visible and settable when deploying using TIBCO Administrator. If the check box is clear, the variable is not visible in TIBCO Administrator.
Service — Indicates that the variable should be included when the Include all service level global variables option is selected when building the enterprise archive file. A variable that is settable on a per-service basis can be set for each adapter service or TIBCO BusinessWorks top-level process. Service level variables are only included in the service archive if the service uses them. This option is used for TIBCO adapter archives. TIBCO BusinessWorks includes all process-level variables regardless of usage.
Type — Click in the field to select the variable type, String, Integer, Boolean, or Password. If Password is selected, the value you provide is obfuscated in the repository.
Constraint — For String and Integer types, provide a range of allowed values. The constraint field for Strings is an enumeration, for example, one, two, three. The constraint field for Integers is for a range, for example, 1-100. Note that constraints are currently not implemented in TIBCO Administrator.
Description — Provide a description of the variable.
Deleting a Global Variable
Delete a global variable by selecting it and clicking the delete variable icon. You cannot delete a global variable that is in use. To find where global variables are used, click Tools > Find Global Variable Usages.