As in OGRE, the XML is executed inside an environment which can be programmed to.
At the level of the script, values can be placed into the environment as attributes or elements of the Assign and Declare tasks, and can be primitiveAssignable, POEs, collections or maps (see Ogrescript XML); at the level of the Java code, a task can place any object it might construct directly into the environment. Hence, values dereferenced using ${...
} or $G{...
} may be of any Java type.
- Concerning the possibility of scripting the construction of instances of arbitrary Java types using
ncsa.tools.ogrescript.types.JavaConstructor
, see Assign and Declare.
Again as in OGRE, the environment is scoped. This is achieved through the control flow containers, which extend their current environment (adding a new frame upon entry) and truncate it (eliminating their local frame upon return) as follows:
CONTAINER |
EXTENDS |
TRUNCATES |
---|---|---|
|
yes* |
no |
|
yes* |
no |
|
yes* |
no |
|
yes |
yes |
|
yes |
yes |
|
yes |
yes |
|
yes |
yes |
|
yes |
yes |
|
yes |
yes |
|
yes |
yes |
|
no |
no |
Note that synchronized
does not modify its environment. The parallel containers make a new shallow copy of the inherited environment for each of their children, and each of these gets extended, meaning that each thread environment has shared and local portions; these thread-specific environments die with the thread to which they are assigned.
The bottom-most frame serves as the "global" environment; assignment and declaration can be made directly to that frame by setting the attribute global = "true". Otherwise, declaration is to the local frame, and assignment to the first variable with the given name in scope; see again Assign and Declare.