- return obj;
- }
-
- private static String depthSpaces(int depth) {
- StringBuffer buf = new StringBuffer(depth * 2);
- for (int i = 0; i < depth; i++)
- buf.append(" ");
- return buf.toString();
- }
-
- public void leaveFlow(ExecutionFlow executionFlow) {
- if (log.isDebugEnabled())
- log.debug(depthSpaces(stack.size()) + "<= " + executionFlow + " #"
- + uuid + ", depth=" + stack.size());
-
- ExecutionFlowRuntime leftEf = stack.pop();
- if (!leftEf.getExecutionFlow().getName()
- .equals(executionFlow.getName()))
- throw new SlcException("Asked to leave " + executionFlow
- + " but last is " + leftEf);
-
- leftEf.getScopedObjects().clear();
- leftEf.getLocalVariables().clear();
-
- }
-
- public void addScopedObject(String name, Object obj) {
- // TODO: check that the object is not set yet ?
- stack.peek().getScopedObjects().put(name, obj);
- }
-
- /** return null if not found */
- public Object findScopedObject(String name) {
- Object obj = null;
- for (int i = stack.size() - 1; i >= 0; i--) {
- if (stack.get(i).getScopedObjects().containsKey(name)) {
- obj = stack.get(i).getScopedObjects().get(name);
- break;
- }
- }
- return obj;