You can use WebSphere variables to provide settings for any of the string data type attributes that are contained in the product configuration files.
WebSphere variables are typically used to specify file paths. However, some system components also support the use of these variables. The "Variable settings" topic supplies further details about specifying variables and highlights further details about product components that use them.
The variable scoping mechanism for WebSphere variables enables you to define a variable at the node level, as well as at the server level. This mechanism enables you to specify a setting for all of the servers in a node, cluster, or cell, instead of individually specifying the setting for each server.
When you define variables on the Environment > WebSphere Variables administrative console page, specify the name of the variable in the Name field, and the value for the variable in the Value field. Do not include an equal sign in either the Name or the Value field.
To define a new variable, change the value of an existing variable, or delete an existing variable complete the following steps, as appropriate.
If you need to reference a WebSphere variable from within an application, include the following method in the application to expand the string that uses the WebSphere variable. Applications cannot directly access WebSphere variables. Therefore, if you define a WebSphere variable inside of an application, an error message, such as "Unknown variable," is returned.
private String expandVariable(String s) throws javax.management.JMException { com.ibm.websphere.management.AdminService as = com.ibm.websphere.management.AdminServiceFactory.getAdminService (); String server = as.getProcessName(); java.util.Set result = as.queryNames(new javax.management.ObjectName("*:*,type=AdminOperations,process=" + server), null); return (String)as.invoke((javax.management.ObjectName) result.iterator().next(),"expandVariable",new Object[] {"${"+s+"}"}, new String[] {"java.lang.String"});
set mbean [$AdminControl completeObjectName WebSphere:*,type=AdminOperations] $AdminControl invoke $mbean expandVariable {{"${APP_INSTALL_ROOT}"}}
AdminOperations = AdminControl.completeObjectName('WebSphere:*,type=AdminOperations') print AdminControl.invoke(AdminOperations, 'expandVariable', '${APP_INSTALL_ROOT}')
In this information ...Subtopics
Related tasks
Related reference
| IBM Redbooks, demos, education, and more(Index) |