1 package org.jbpm.bpel.data.xpath; 2 3 import org.jaxen.UnresolvableException; 4 import org.jaxen.VariableContext; 5 6 import org.jbpm.context.exe.ContextInstance; 7 import org.jbpm.graph.exe.Token; 8 9 import org.jbpm.bpel.data.exe.VariableInstance; 10 11 15 public class ScopeVariables implements VariableContext { 16 17 private Token token; 18 19 public ScopeVariables(Token token) { 20 this.token = token; 21 } 22 23 public VariableInstance getVariable(String name) { 24 ContextInstance context = token.getProcessInstance().getContextInstance(); 25 return (VariableInstance) context.getVariable(name, token); 26 } 27 28 public Object getVariableValue(String namespaceURI, String prefix, 29 String localName) throws UnresolvableException { 30 if (namespaceURI != null) { 31 throw new UnresolvableException("No such variable: " + prefix + ':' + localName); 32 } 33 VariableInstance instance = getVariable(localName); 34 if (instance == null) { 35 throw new UnresolvableException("No such variable: " + localName); 36 } 37 return instance.getValue(); 38 } 39 } 40 | Popular Tags |