Java Reference
In-Depth Information
Using Logical Divisions to Group Activities
Problem
You have defined variables or activities whose scope you want to limit to only a certain subset
of the process.
Solution
Use a <scope> . These are frequently used, and in a way constitute the building blocks of pro-
cesses. They are simple elements to use, but their usage can be subtle, so check out the dis-
cussion below.
Discussion
In Java, variables and other language constructs have scope, meaning they have a defined
range within the code in which they are visible or usable. A method-local variable is not vis-
ible outside of that method; a private method is not usable from another class. Scope is useful
to logically divide code to ensure that some given functionality is available only within cer-
tain parameters. BPEL provides a similar capability to organize activities within subsets of a
process.
NOTE
BPEL scopes are actually closer to the HTML <div> tag than they are to the implicit scopes in Java.
Not only do they encapsulate what can obtain within a given context, they are explicitly stated, and
do no actual work of their own.
A BPEL scope provides a context for the behavior surrounding one or more units of work.
Using scopes, you can associate various constructs such as event handlers, fault handlers,
compensations, variables, and more.
A BPEL process can include one or more scopes. Each scope can also include other scopes,
nested to any depth. A process can also define peer-level scopes that set off different areas of
code.
Certain commonsense rules apply regarding the visibility of activities and variables within a
scope:
Search WWH ::




Custom Search