KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > bpel > data > xpath > GetLinkStatusFunction


1 package org.jbpm.bpel.data.xpath;
2
3 import java.util.List JavaDoc;
4
5 import org.jaxen.*;
6 import org.jaxen.function.StringFunction;
7
8 /**
9  * BPEL library function to indicate the status of a link.
10  * <p><code><i>boolean</i> bpws:getLinkStatus(<i>string</i> linkName)</code></p>
11  * @see "WS-BPEL 2.0 &sect;9.1, 12.5.1"
12  * @author Juan Cantú
13  * @version $Revision: 1.2 $ $Date: 2005/05/31 00:49:52 $
14  */

15 public class GetLinkStatusFunction implements Function {
16
17   public Object JavaDoc call(Context context, List JavaDoc args) throws FunctionCallException {
18     if (args.size() != 1) {
19       throw new FunctionCallException("getLinkStatus() requires one argument");
20     }
21     return evaluate(args.get(0), context);
22   }
23
24   public static Boolean JavaDoc evaluate(Object JavaDoc arg, Context context) throws FunctionCallException {
25     String JavaDoc variableName = StringFunction.evaluate(arg, context.getNavigator());
26     VariableContext variableContext = context.getContextSupport().getVariableContext();
27     try {
28       return (Boolean JavaDoc) variableContext.getVariableValue(null, null, variableName);
29     }
30     catch (UnresolvableException e) {
31       throw new FunctionCallException("variable not found: " + variableName);
32     }
33   }
34 }
Popular Tags