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


Chapter 1 Project Tasks : Working with Global Variables

Working with Global Variables
Global variables provide an easy way to set defaults for use throughout your project. When the project is deployed all occurrences of the global variable name are replaced with the provided global variable value, or a deploy-time override.
For example, you could assign the value 7474 to the global variable RvDaemon. You can then use the variable in a Rendezvous Transport resource. At deploy time you can override the default value as needed.
A project folder called defaultVars is available but not exposed in BusinessEvents Studio Explorer, so that you can share the global variables using source control software. It is not used for other purposes.
Setting and Overriding Global Variables from a Project Library
You can export global variables to a project library and import the library into other projects (see Working with Project Libraries).
When multiple global variables have the same name, one overrides the rest and is used in the project. The name, datatype, and default value of the overriding global variable are used. The override order is as follows:
The Global Variables view presents a merged list. A blue upward pointing arrow in the row for a global variable () indicates that this global variable overrides another global variable. The source of the global variable is shown in the Project Source column to the right of the arrow.
To see all global variables, including overridden ones, open the global variable editor and expand the Project Dependencies and project libraries. Global variables from project libraries are not editable.
Adding and Managing Global Variables
In a new TIBCO BusinessEvents Studio project no global variables are predefined. When you import a project from an earlier version of TIBCO BusinessEvents, however, you see predefined global variables (as well as any others defined in the project).
You may also see global variables in project libraries. All global variables are visible in the editor including overridden ones. To see the merged list of global variables that are used in the project, open the Global Variables view in one of the following ways:
Click the Global Variables View button from the toolbar.
From the top menus, select Window > Show View > Other > TIBCO BusinessEvents > Global Variables.
To Add and Manage Global Variables
1.
2.
From the toolbar, click the Global Variables Editor button.
From the top menus, select Project > Edit Global Variables.
You see the Global Variables Editor listing the variables available, if any.
3.
To add a variable, click Add Variable and complete the fields.
Using Groups  Groups are used for organizing variables. Variable groups are especially useful if multiple developers share a project using a version control system. When referencing a variable that is in a group, use the complete path, for example %%mygroup/mysubgroup/myvariable%%. (Because the complete path is used, the name of a variable in a group can be the same as the name of a variable in a different group.)
4.
Save the resource. Groups and references to the defaultVars.substvar file appear in the defaultVars project folder.
For deployment with TIBCO BusinessEvents Monitoring and Management  You can only override global variables if both the Deployment settable and Service Settable checkboxes are checked.
For deployment with TIBCO Administrator  If checked, the variable is visible and settable when deploying using TIBCO Administrator. The values set at that time are saved in the project that TIBCO Administrator creates from the provided EAR file.
For deployment with TIBCO BusinessEvents Monitoring and Management  You can only override global variables if both the Deployment settable and Service Settable checkboxes are checked.
For deployment with TIBCO Administrator  If both Deployment Settable and Service Settable are checked, the value of the global variable can be set differently for each deployable instance.
Note  Even if Service Settable is checked, the variable is included in the EAR only when the Include all service level global variables option is selected when building the enterprise archive file.
Using Global Variables
To Use Global Variables in TIBCO BusinessEvents Studio Project Fields
To use a global variable as the value for a project setting, drag it from the list of variables into the text box for the setting, or enter it manually. Use the following syntax:
%%Variable_Group/Variable_Name%%
As whown above, you must include the global variable group hierarchy, if one exists.
For example, to use a global variable in a File Path field, you might enter the following:
%%filePathVars/certificateFilePath%%
To Use Global Variables in the Rule Editor
To use a global variable in the rule editor, use one of the System.getGlobalVariableAs* functions. For example:
System.getGlobalVariableAsString("myvars/Hostname", "Localhost")
Where myvars/Hostname is the name of the variable group and variable, and Localhost is an optional literal value to use if the variable is not found.
To Use Global Variables in Debugger
To use a global variable in Debugger, add it as a VM argument. Prefix the variable with -V, as shown:
-VVariable_Group/Variable_Name=
Overriding Global Variables at Deploy Time
You can override default values by setting global variable values in one of these ways, depending on how you will deploy:
At the command line, using the --propVar option, or using the -p option to specify a property file where the override properties are defined. See Starting a TIBCO BusinessEvents Engine at the Command Line in TIBCO BusinessEvents Administration.
Order of Precedence of Global Variable Overrides
Global variable values are selected at runtime using values set in the following ways, shown in the order of prededence, highest to lowest:
1.
2.
3.
4.
5.

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