You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2008/12/18 19:31:28 UTC

svn commit: r727785 [1/2] - in /ode/trunk: bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/ bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ bpel-compiler...

Author: mriou
Date: Thu Dec 18 10:31:27 2008
New Revision: 727785

URL: http://svn.apache.org/viewvc?rev=727785&view=rev
Log:
ODE-429 Patch to make Saxon and Jaxen optional for XPath 1.0 processing

Added:
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpFunctionResolver.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpVariableResolver.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL11.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20Draft.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerImpl.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpFunctionResolver.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpVariableResolver.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL11.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20Draft.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpXPath10ExpressionCompilerImpl.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/xpath10/jaxp/
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/xpath10/jaxp/JaxpFunctionResolver.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/xpath10/jaxp/JaxpVariableResolver.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/xpath10/jaxp/JaxpXPath10ExpressionRuntime.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/xpath10/jaxp/WrappedFaultException.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/xpath10/jaxp/
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/xpath10/jaxp/JaxpFunctionResolver.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/xpath10/jaxp/JaxpVariableResolver.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/xpath10/jaxp/JaxpXPath10ExpressionRuntime.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/xpath10/jaxp/WrappedFaultException.java
Modified:
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/BpelCompiler11.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/BpelCompiler20.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/BpelCompiler20Draft.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler11.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20Draft.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/xpath20/XPath20ExpressionRuntime.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/xpath20/XPath20ExpressionRuntime.java

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/BpelCompiler11.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/BpelCompiler11.java?rev=727785&r1=727784&r2=727785&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/BpelCompiler11.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/BpelCompiler11.java Thu Dec 18 10:31:27 2008
@@ -1,20 +1,14 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
+ * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
  */
 package org.apache.ode.bpel.compiler.v1;
 
@@ -22,6 +16,7 @@
 import org.apache.ode.bpel.compiler.wsdl.WSDLFactoryBPEL11;
 import org.apache.ode.bpel.compiler.wsdl.WSDLFactory4BPEL;
 import org.apache.ode.bpel.compiler.v1.xpath10.XPath10ExpressionCompilerBPEL11;
+import org.apache.ode.bpel.compiler.v1.xpath10.jaxp.JaxpXPath10ExpressionCompilerBPEL11;
 
 /**
  * BPEL v1.1 compiler.
@@ -49,10 +44,21 @@
         registerActivityCompiler(WaitActivity.class, new WaitGenerator());
         registerActivityCompiler(TerminateActivity.class, new TerminateGenerator());
 
-        registerExpressionLanguage(EXPLANG_XPATH, new XPath10ExpressionCompilerBPEL11());
+        // try to instantiate Jaxen based XPath 1.0 expression language compiler.
+        // if this fails (e.g. because Jaxen is not in classpath), use a pure JAXP based one as fallback.
+        try {
+            registerExpressionLanguage(EXPLANG_XPATH, new XPath10ExpressionCompilerBPEL11());
+        } catch (Exception e) {
+            __log
+                .warn("Error loading Jaxen based XPath 1.0 Expression Language, falling back to Jaxp based implementation.");
+            registerExpressionLanguage(EXPLANG_XPATH, new JaxpXPath10ExpressionCompilerBPEL11());
+        } catch (NoClassDefFoundError e) {
+            __log
+                .warn("Error loading Jaxen based XPath 1.0 Expression Language, falling back to Jaxp based implementation.");
+            registerExpressionLanguage(EXPLANG_XPATH, new JaxpXPath10ExpressionCompilerBPEL11());
+        }
     }
 
-
     protected String getBpwsNamespace() {
         return Bpel11QNames.NS_BPEL4WS_2003_03;
     }

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/BpelCompiler20.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/BpelCompiler20.java?rev=727785&r1=727784&r2=727785&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/BpelCompiler20.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/BpelCompiler20.java Thu Dec 18 10:31:27 2008
@@ -1,20 +1,14 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
+ * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
  */
 package org.apache.ode.bpel.compiler.v1;
 
@@ -23,6 +17,7 @@
 import org.apache.ode.bpel.compiler.wsdl.WSDLFactory4BPEL;
 import org.apache.ode.bpel.compiler.v1.xpath10.XPath10ExpressionCompilerBPEL20;
 import org.apache.ode.bpel.compiler.v1.xpath20.XPath20ExpressionCompilerBPEL20;
+import org.apache.ode.bpel.compiler.v1.xpath10.jaxp.JaxpXPath10ExpressionCompilerBPEL20;
 
 /**
  * OASIS BPEL V2.0 Compiler
@@ -30,7 +25,9 @@
 public class BpelCompiler20 extends BpelCompilerImpl {
 
     public static final String OASIS_EXPLANG_XPATH_1_0 = "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0";
+
     public static final String OASIS_EXPLANG_XPATH_2_0 = "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0";
+
     public static final String OASIS_EXPLANG_XQUERY_1_0 = "urn:oasis:names:tc:wsbpel:2.0:sublang:xquery1.0";
 
     public BpelCompiler20() throws Exception {
@@ -55,19 +52,34 @@
         registerActivityCompiler(RethrowActivity.class, new RethrowGenerator());
         registerActivityCompiler(ForEachActivity.class, new ForEachGenerator());
 
-        registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new XPath10ExpressionCompilerBPEL20());
-        
+        // try to instantiate Jaxen based XPath 1.0 expression language compiler.
+        // if this fails (e.g. because Jaxen is not in classpath), use a pure JAXP based one as fallback.
+        try {
+            registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new XPath10ExpressionCompilerBPEL20());
+        } catch (Exception e) {
+            __log
+                .warn("Error loading Jaxen based XPath 1.0 Expression Language, falling back to Jaxp based implementation.");
+            registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new JaxpXPath10ExpressionCompilerBPEL20());
+        } catch (NoClassDefFoundError e) {
+            __log
+                .warn("Error loading Jaxen based XPath 1.0 Expression Language, falling back to Jaxp based implementation.");
+            registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new JaxpXPath10ExpressionCompilerBPEL20());
+        }
         try {
             registerExpressionLanguage(OASIS_EXPLANG_XPATH_2_0, new XPath20ExpressionCompilerBPEL20());
         } catch (Exception e) {
             __log.error("Error loading XPath 2.0 Expression Language: it will not be available.");
+        } catch (NoClassDefFoundError e) {
+            __log.error("Error loading XPath 2.0 Expression Language: it will not be available.");
         }
-        
+
         try {
             registerExpressionLanguage(OASIS_EXPLANG_XQUERY_1_0,
-                    "org.apache.ode.bpel.compiler.v2.xquery10.compiler.XQuery10ExpressionCompilerBPEL20");
+                "org.apache.ode.bpel.compiler.v2.xquery10.compiler.XQuery10ExpressionCompilerBPEL20");
         } catch (Exception e) {
             __log.error("Error loading XQuery 1.0 Expression Language: it will not be available.");
+        } catch (NoClassDefFoundError e) {
+            __log.error("Error loading XQuery 1.0 Expression Language: it will not be available.");
         }
     }
 

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/BpelCompiler20Draft.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/BpelCompiler20Draft.java?rev=727785&r1=727784&r2=727785&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/BpelCompiler20Draft.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/BpelCompiler20Draft.java Thu Dec 18 10:31:27 2008
@@ -1,20 +1,14 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
+ * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
  */
 
 package org.apache.ode.bpel.compiler.v1;
@@ -22,6 +16,7 @@
 import org.apache.ode.bpel.compiler.bom.*;
 import org.apache.ode.bpel.compiler.v1.xpath10.XPath10ExpressionCompilerBPEL20Draft;
 import org.apache.ode.bpel.compiler.v1.xpath20.XPath20ExpressionCompilerBPEL20Draft;
+import org.apache.ode.bpel.compiler.v1.xpath10.jaxp.JaxpXPath10ExpressionCompilerBPEL20Draft;
 import org.apache.ode.bpel.compiler.wsdl.WSDLFactoryBPEL20Draft;
 import org.apache.ode.bpel.compiler.wsdl.WSDLFactory4BPEL;
 
@@ -31,7 +26,9 @@
 public class BpelCompiler20Draft extends BpelCompilerImpl {
 
     public static final String OASIS_EXPLANG_XPATH_1_0 = "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0";
+
     public static final String OASIS_EXPLANG_XPATH_2_0 = "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0";
+
     public static final String OASIS_EXPLANG_XQUERY_1_0 = "urn:oasis:names:tc:wsbpel:2.0:sublang:xquery1.0";
 
     public BpelCompiler20Draft() throws Exception {
@@ -55,19 +52,34 @@
         registerActivityCompiler(RethrowActivity.class, new RethrowGenerator());
         registerActivityCompiler(ForEachActivity.class, new ForEachGenerator());
 
-        registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new XPath10ExpressionCompilerBPEL20Draft());
-
+        // try to instantiate Jaxen based XPath 1.0 expression language compiler.
+        // if this fails (e.g. because Jaxen is not in classpath), use a pure JAXP based one as fallback.
+        try {
+            registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new XPath10ExpressionCompilerBPEL20Draft());
+        } catch (Exception e) {
+            __log
+                .warn("Error loading Jaxen based XPath 1.0 Expression Language, falling back to Jaxp based implementation.");
+            registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new JaxpXPath10ExpressionCompilerBPEL20Draft());
+        } catch (NoClassDefFoundError e) {
+            __log
+                .warn("Error loading Jaxen based XPath 1.0 Expression Language, falling back to Jaxp based implementation.");
+            registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new JaxpXPath10ExpressionCompilerBPEL20Draft());
+        }
         try {
             registerExpressionLanguage(OASIS_EXPLANG_XPATH_2_0, new XPath20ExpressionCompilerBPEL20Draft());
         } catch (Exception e) {
             __log.error("Error loading XPath 2.0 Expression Language: it will not be available.");
+        } catch (NoClassDefFoundError e) {
+            __log.error("Error loading XPath 2.0 Expression Language: it will not be available.");
         }
 
         try {
             registerExpressionLanguage(OASIS_EXPLANG_XQUERY_1_0,
-                    "org.apache.ode.bpel.comipler.v2.xquery10.compiler.XQuery10ExpressionCompilerBPEL20Draft");
+                "org.apache.ode.bpel.comipler.v2.xquery10.compiler.XQuery10ExpressionCompilerBPEL20Draft");
         } catch (Exception e) {
             __log.error("Error loading XQuery 1.0 Expression Language: it will not be available.");
+        } catch (NoClassDefFoundError e) {
+            __log.error("Error loading XQuery 1.0 Expression Language: it will not be available.");
         }
     }
 

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpFunctionResolver.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpFunctionResolver.java?rev=727785&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpFunctionResolver.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpFunctionResolver.java Thu Dec 18 10:31:27 2008
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
+ * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
+package org.apache.ode.bpel.compiler.v1.xpath10.jaxp;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.xpath.XPathFunction;
+import javax.xml.xpath.XPathFunctionException;
+import javax.xml.xpath.XPathFunctionResolver;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.compiler.WrappedResolverException;
+import org.apache.ode.bpel.compiler.XPathMessages;
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.compiler.v1.CompilerContext;
+import org.apache.ode.bpel.compiler.v1.xpath10.XslCompileUriResolver;
+import org.apache.ode.bpel.rtrep.common.Constants;
+import org.apache.ode.bpel.rtrep.v1.OExpression;
+import org.apache.ode.bpel.rtrep.v1.OLink;
+import org.apache.ode.bpel.rtrep.v1.OMessageVarType;
+import org.apache.ode.bpel.rtrep.v1.OProcess;
+import org.apache.ode.bpel.rtrep.v1.OScope;
+import org.apache.ode.bpel.rtrep.v1.OXslSheet;
+import org.apache.ode.bpel.rtrep.v1.xpath10.OXPath10Expression;
+import org.apache.ode.utils.NSContext;
+import org.apache.ode.utils.msg.MessageBundle;
+import org.apache.ode.utils.xsl.XslTransformHandler;
+
+/**
+ * mock JAXP function resolver for checking the functions during compile time.
+ */
+public class JaxpFunctionResolver implements XPathFunctionResolver {
+    private static final Log __log = LogFactory.getLog(JaxpFunctionResolver.class);
+
+    private static final XPathMessages __msgs = MessageBundle.getMessages(XPathMessages.class);
+
+    private CompilerContext _cctx;
+
+    private OXPath10Expression _out;
+
+    private NSContext _nsContext;
+
+    private String _bpelNS;
+
+    public JaxpFunctionResolver(CompilerContext cctx, OXPath10Expression out, NSContext nsContext, String bpelNS) {
+        _cctx = cctx;
+        _bpelNS = bpelNS;
+        _nsContext = nsContext;
+        _bpelNS = bpelNS;
+        _out = out;
+    }
+
+    public XPathFunction resolveFunction(QName functionName, int arity) {
+        __log.debug("JAXP compiler: Resolving function " + functionName);
+        if (functionName.getNamespaceURI() == null) {
+            throw new WrappedResolverException("Undeclared namespace for " + functionName);
+        } else if (functionName.getNamespaceURI().equals(_bpelNS)) {
+            String localName = functionName.getLocalPart();
+            if (Constants.EXT_FUNCTION_GETVARIABLEDATA.equals(localName)) {
+                return new GetVariableData();
+            }
+            if (Constants.EXT_FUNCTION_GETVARIABLEPROPERTY.equals(localName)) {
+                return new GetVariableProperty();
+            }
+            if (Constants.EXT_FUNCTION_GETLINKSTATUS.equals(localName)) {
+                return new GetLinkStatus();
+            }
+            if (Constants.EXT_FUNCTION_DOXSLTRANSFORM.equals(localName)) {
+                return new DoXslTransform();
+            }
+            throw new WrappedResolverException(__msgs.errUnknownBpelFunction(localName));
+        }
+
+        return null;
+    }
+
+    public class GetVariableData implements XPathFunction {
+        public Object evaluate(List params) throws XPathFunctionException {
+            if (params.size() < 1 || params.size() > 3) {
+                throw new CompilationException(__msgs
+                    .errInvalidNumberOfArguments(Constants.EXT_FUNCTION_GETVARIABLEDATA));
+            }
+            String varname = (String) params.get(0);
+            String partname = params.size() > 1 ? (String) params.get(1) : null;
+            String locationstr = params.size() > 2 ? (String) params.get(2) : null;
+
+            OScope.Variable var = _cctx.resolveVariable(varname);
+            OMessageVarType.Part part = partname != null ? _cctx.resolvePart(var, partname) : null;
+            OExpression location = null;
+            if (locationstr != null) {
+                location = _cctx.compileExpr(locationstr, _nsContext);
+            }
+
+            _out.addGetVariableDataSig(varname, partname, locationstr, new OXPath10Expression.OSigGetVariableData(
+                _cctx.getOProcess(), var, part, location));
+            return "";
+        }
+    }
+
+    public class GetVariableProperty implements XPathFunction {
+        public Object evaluate(List params) throws XPathFunctionException {
+            if (params.size() != 2) {
+                throw new CompilationException(__msgs
+                    .errInvalidNumberOfArguments(Constants.EXT_FUNCTION_GETVARIABLEPROPERTY));
+            }
+            String varName = (String) params.get(0);
+            OScope.Variable v = _cctx.resolveVariable(varName);
+            _out.vars.put(varName, v);
+
+            String propName = (String) params.get(1);
+            QName qname = _nsContext.derefQName(propName);
+
+            if (qname == null)
+                throw new CompilationException(__msgs.errInvalidQName(propName));
+
+            OProcess.OProperty property = _cctx.resolveProperty(qname);
+            // Make sure we can...
+            _cctx.resolvePropertyAlias(v, qname);
+
+            _out.properties.put(propName, property);
+            _out.vars.put(varName, v);
+            return "";
+        }
+    }
+
+    public class GetLinkStatus implements XPathFunction {
+        public Object evaluate(List params) throws XPathFunctionException {
+            if (params.size() != 1) {
+                throw new CompilationException(__msgs
+                    .errInvalidNumberOfArguments(Constants.EXT_FUNCTION_GETLINKSTATUS));
+            }
+            String linkName = (String) params.get(0);
+            OLink olink = _cctx.resolveLink(linkName);
+            _out.links.put(linkName, olink);
+
+            return "";
+        }
+    }
+
+    public class DoXslTransform implements XPathFunction {
+        public Object evaluate(List params) throws XPathFunctionException {
+            if (params.size() < 2 || params.size() % 2 != 0) {
+                throw new CompilationException(__msgs
+                    .errInvalidNumberOfArguments(Constants.EXT_FUNCTION_DOXSLTRANSFORM));
+            }
+
+            String xslUri = (String) params.get(0);
+            OXslSheet xslSheet = _cctx.compileXslt(xslUri);
+            try {
+                XslTransformHandler.getInstance().parseXSLSheet(_cctx.getBaseResourceURI(), xslSheet.uri,
+                    xslSheet.sheetBody, new XslCompileUriResolver(_cctx, _out));
+            } catch (Exception e) {
+                throw new CompilationException(__msgs.errXslCompilation(xslUri, e.toString()));
+            }
+
+            _out.xslSheets.put(xslSheet.uri, xslSheet);
+            return "";
+        }
+    }
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpVariableResolver.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpVariableResolver.java?rev=727785&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpVariableResolver.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpVariableResolver.java Thu Dec 18 10:31:27 2008
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
+ * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
+package org.apache.ode.bpel.compiler.v1.xpath10.jaxp;
+
+import javax.xml.namespace.QName;
+import javax.xml.xpath.XPathVariableResolver;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.compiler.WrappedResolverException;
+import org.apache.ode.bpel.compiler.XPathMessages;
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.compiler.v1.CompilerContext;
+import org.apache.ode.bpel.rtrep.v1.OElementVarType;
+import org.apache.ode.bpel.rtrep.v1.OLink;
+import org.apache.ode.bpel.rtrep.v1.OMessageVarType;
+import org.apache.ode.bpel.rtrep.v1.OScope;
+import org.apache.ode.bpel.rtrep.v1.OVarType;
+import org.apache.ode.bpel.rtrep.v1.OXsdTypeVarType;
+import org.apache.ode.bpel.rtrep.v1.xpath10.OXPath10Expression;
+import org.apache.ode.bpel.rtrep.v1.xpath10.OXPath10ExpressionBPEL20;
+import org.apache.ode.utils.DOMUtils;
+import org.apache.ode.utils.Namespaces;
+import org.apache.ode.utils.msg.MessageBundle;
+import org.w3c.dom.Document;
+
+/**
+ * This is a mock implementation of the XPathVariableResolver for compilation. It always returns an empty string which
+ * allows execution of XPath expressions even if we don't have any values yet. This way we can easily rule out invalid
+ * variables and isolate properly BPEL variables.
+ */
+public class JaxpVariableResolver implements XPathVariableResolver {
+    private static final Log __log = LogFactory.getLog(XPathVariableResolver.class);
+
+    private static final XPathMessages __msgs = MessageBundle.getMessages(XPathMessages.class);
+
+    private CompilerContext _cctx;
+
+    private OXPath10Expression _oxpath;
+
+    public JaxpVariableResolver(CompilerContext cctx, OXPath10Expression oxpath) {
+        _cctx = cctx;
+        _oxpath = oxpath;
+    }
+
+    public Object resolveVariable(QName variableName) {
+        __log.debug("JAXP compiler: Resolving variable " + variableName);
+        // Custom variables
+        if ("ode".equals(variableName.getPrefix())
+            || Namespaces.ODE_EXTENSION_NS.equals(variableName.getNamespaceURI())) {
+            if ("pid".equals(variableName.getLocalPart()))
+                return "";
+        }
+
+        try {
+            String name = variableName.getLocalPart();
+            if (_oxpath instanceof OXPath10ExpressionBPEL20
+                && ((OXPath10ExpressionBPEL20) _oxpath).isJoinExpression) {
+                // these resolve to links
+                OLink olink = _cctx.resolveLink(name);
+                _oxpath.links.put(name, olink);
+                return Boolean.TRUE;
+            } else {
+                int dot = name.indexOf('.');
+                if (dot != -1)
+                    name = name.substring(0, dot);
+                OScope.Variable var = _cctx.resolveVariable(name);
+                _oxpath.vars.put(name, var);
+                return extractValue(var, var.type);
+            }
+        } catch (CompilationException e) {
+            throw new WrappedResolverException(e);
+        }
+    }
+
+    private Object extractValue(OScope.Variable var, OVarType varType) {
+        if (varType instanceof OXsdTypeVarType) {
+            return generateFromType(((OXsdTypeVarType) varType).xsdType);
+        } else if (varType instanceof OElementVarType) {
+            return generateFromType(((OElementVarType) varType).elementType);
+        } else if (varType instanceof OMessageVarType) {
+            // MR That's an ugly hack but otherwise, xpath compilation doesn't work
+            if (((OMessageVarType) varType).parts.size() == 0)
+                throw new WrappedResolverException(__msgs.errExpressionMessageNoPart(var.name));
+            return extractValue(var, ((OMessageVarType) varType).parts.values().iterator().next().type);
+        }
+        return "";
+    }
+
+    private Object generateFromType(QName typeName) {
+        if (typeName.getNamespaceURI().equals(Namespaces.XML_SCHEMA)) {
+            if (typeName.getLocalPart().equals("int") || typeName.getLocalPart().equals("integer")
+                || typeName.getLocalPart().equals("short") || typeName.getLocalPart().equals("long")
+                || typeName.getLocalPart().equals("byte") || typeName.getLocalPart().equals("float")
+                || typeName.getLocalPart().equals("double") || typeName.getLocalPart().equals("nonPositiveInteger")
+                || typeName.getLocalPart().equals("nonNegativeInteger")
+                || typeName.getLocalPart().equals("negativeInteger")
+                || typeName.getLocalPart().equals("unsignedLong") || typeName.getLocalPart().equals("unsignedInt")
+                || typeName.getLocalPart().equals("unsignedShort")
+                || typeName.getLocalPart().equals("unsignedByte"))
+                return 0;
+            if (typeName.getLocalPart().equals("boolean"))
+                return Boolean.TRUE;
+            if (typeName.getLocalPart().equals("string"))
+                return "";
+        }
+        Document doc = DOMUtils.newDocument();
+        doc.appendChild(doc.createElement("empty"));
+        return doc.getDocumentElement();
+    }
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL11.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL11.java?rev=727785&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL11.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL11.java Thu Dec 18 10:31:27 2008
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ode.bpel.compiler.v1.xpath10.jaxp;
+
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.compiler.bom.Expression;
+import org.apache.ode.bpel.rtrep.v1.xpath10.OXPath10Expression;
+import org.apache.ode.bpel.rtrep.v1.OExpression;
+import org.apache.ode.bpel.rtrep.v1.OLValueExpression;
+import org.apache.ode.utils.Namespaces;
+
+/**
+ * JAXP based XPath 1.0 expression compiler for BPEL v1.1.
+ */
+public class JaxpXPath10ExpressionCompilerBPEL11 extends JaxpXPath10ExpressionCompilerImpl {
+  public JaxpXPath10ExpressionCompilerBPEL11() {
+    super(Namespaces.BPEL11_NS);
+  }
+  
+  /**
+   * @see org.apache.ode.bpel.compiler.v1.ExpressionCompiler#compileJoinCondition(java.lang.Object)
+   */
+  public OExpression compileJoinCondition(Object source) throws CompilationException {
+  	return compile(source);
+  }
+  
+  public OLValueExpression compileLValue(Object source) throws CompilationException {
+  	throw new UnsupportedOperationException("Not supported for bpel 1.1");
+  }
+
+  /**
+   * @see org.apache.ode.bpel.compiler.v1.ExpressionCompiler#compile(java.lang.Object)
+   */
+  public OExpression compile(Object source) throws CompilationException {
+    Expression xpath = (Expression)source;
+    OXPath10Expression oexp = new OXPath10Expression(
+            _compilerContext.getOProcess(),
+            _qnFnGetVariableData,
+            _qnFnGetVariableProperty,
+            _qnFnGetLinkStatus);
+    oexp.namespaceCtx = xpath.getNamespaceContext();
+    doJaxpCompile(oexp, xpath);
+    return oexp;
+  }
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20.java?rev=727785&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20.java Thu Dec 18 10:31:27 2008
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ode.bpel.compiler.v1.xpath10.jaxp;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.TransformerFactory;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.compiler.bom.Expression;
+import org.apache.ode.bpel.compiler.v1.CompilerContext;
+import org.apache.ode.bpel.compiler.v1.xpath10.XslCompilationErrorListener;
+import org.apache.ode.bpel.rtrep.v1.OExpression;
+import org.apache.ode.bpel.rtrep.v1.OLValueExpression;
+import org.apache.ode.bpel.rtrep.v1.xpath10.OXPath10Expression;
+import org.apache.ode.bpel.rtrep.v1.xpath10.OXPath10ExpressionBPEL20;
+import org.apache.ode.utils.Namespaces;
+import org.apache.ode.utils.xsl.XslTransformHandler;
+
+/**
+ * JAXP based XPath 1.0 expression compiler for BPEL 2.0
+ */
+public class JaxpXPath10ExpressionCompilerBPEL20 extends JaxpXPath10ExpressionCompilerImpl {
+    /** Class-level logger. */
+    private static final Log __log = LogFactory.getLog(JaxpXPath10ExpressionCompilerBPEL20.class);
+
+    protected QName _qnDoXslTransform;
+
+    public JaxpXPath10ExpressionCompilerBPEL20() {
+        this(Namespaces.WSBPEL2_0_FINAL_EXEC);
+    }
+
+    public JaxpXPath10ExpressionCompilerBPEL20(String bpelNS) {
+        super(bpelNS);
+        
+        TransformerFactory trsf = TransformerFactory.newInstance();
+        __log.debug("JAXP compiler: TransformerFactory impl = " + trsf.getClass());
+        XslTransformHandler.getInstance().setTransformerFactory(trsf);
+
+        _qnDoXslTransform = new QName(bpelNS, "doXslTransform");
+    }
+
+    /**
+     * @see org.apache.ode.bpel.compiler.v1.ExpressionCompiler#compileJoinCondition(java.lang.Object)
+     */
+    public OExpression compileJoinCondition(Object source) throws CompilationException {
+        return _compile((Expression)source, true);
+    }
+
+    @Override
+    public void setCompilerContext(CompilerContext ctx) {
+        super.setCompilerContext(ctx);
+        XslCompilationErrorListener xe = new XslCompilationErrorListener(ctx);
+        XslTransformHandler.getInstance().setErrorListener(xe);
+    }
+    /**
+     * @see org.apache.ode.bpel.compiler.v2.ExpressionCompiler#compile(java.lang.Object)
+     */
+    public OExpression compile(Object source) throws CompilationException {
+        return _compile((Expression)source, false);
+    }
+    /**
+     * @see org.apache.ode.bpel.compiler.v2.ExpressionCompiler#compileLValue(java.lang.Object)
+     */
+    public OLValueExpression compileLValue(Object source) throws CompilationException {
+        return (OLValueExpression)_compile((Expression)source, false);
+    }
+
+    private OExpression _compile(Expression xpath, boolean isJoinCondition) throws CompilationException {
+        OXPath10Expression oexp = new OXPath10ExpressionBPEL20(
+                _compilerContext.getOProcess(),
+                _qnFnGetVariableData,
+                _qnFnGetVariableProperty,
+                _qnFnGetLinkStatus,
+                _qnDoXslTransform,
+                isJoinCondition);
+        oexp.namespaceCtx = xpath.getNamespaceContext();
+        doJaxpCompile(oexp, xpath);
+        return oexp;
+    }
+
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20Draft.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20Draft.java?rev=727785&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20Draft.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20Draft.java Thu Dec 18 10:31:27 2008
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ode.bpel.compiler.v1.xpath10.jaxp;
+
+import org.apache.ode.utils.Namespaces;
+
+/**
+ * JAXP based XPath 1.0 expression compiler for BPEL 2.0 draft
+ */
+public class JaxpXPath10ExpressionCompilerBPEL20Draft extends JaxpXPath10ExpressionCompilerBPEL20 {
+
+    public JaxpXPath10ExpressionCompilerBPEL20Draft() {
+        super(Namespaces.WS_BPEL_20_NS);
+    }
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerImpl.java?rev=727785&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerImpl.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/jaxp/JaxpXPath10ExpressionCompilerImpl.java Thu Dec 18 10:31:27 2008
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
+ * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.ode.bpel.compiler.v1.xpath10.jaxp;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.compiler.XPathMessages;
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.compiler.bom.Expression;
+import org.apache.ode.bpel.compiler.v1.CompilerContext;
+import org.apache.ode.bpel.compiler.v1.ExpressionCompiler;
+import org.apache.ode.bpel.rtrep.v1.xpath10.OXPath10Expression;
+import org.apache.ode.utils.DOMUtils;
+import org.apache.ode.utils.msg.MessageBundle;
+import org.w3c.dom.Node;
+
+/**
+ * XPath compiler based on a pure JAXP implementation. Supports both 2.0 and 1.1 BPEL.
+ */
+public abstract class JaxpXPath10ExpressionCompilerImpl implements ExpressionCompiler {
+    /** Class-level logger. */
+    private static final Log __log = LogFactory.getLog(JaxpXPath10ExpressionCompilerImpl.class);
+
+    private static final XPathMessages __msgs = MessageBundle.getMessages(XPathMessages.class);
+
+    protected CompilerContext _compilerContext;
+
+    /** Namespace of the BPEL functions (for v2 to v1 compatibility) . */
+    private String _bpelNsURI;
+
+    protected QName _qnFnGetVariableData;
+
+    protected QName _qnFnGetVariableProperty;
+
+    protected QName _qnFnGetLinkStatus;
+
+    protected Map<String, String> _properties = new HashMap<String, String>();
+
+    /**
+     * Construtor.
+     * 
+     * @param bpelNsURI
+     *            the BPEL extension function namespace; varies depending on BPEL version.
+     */
+    public JaxpXPath10ExpressionCompilerImpl(String bpelNsURI) {
+        _bpelNsURI = bpelNsURI;
+        _qnFnGetVariableData = new QName(_bpelNsURI, "getVariableData");
+        _qnFnGetVariableProperty = new QName(_bpelNsURI, "getVariableProperty");
+        _qnFnGetLinkStatus = new QName(_bpelNsURI, "getLinkStatus");
+        _properties.put("runtime-class", "org.apache.ode.bpel.rtrep.v1.xpath10.jaxp.JaxpXPath10ExpressionRuntime");
+    }
+
+    /**
+     * @see org.apache.ode.bpel.compiler.v1.ExpressionCompiler#setCompilerContext(org.apache.ode.bpel.compiler.v1.CompilerContext)
+     */
+    public void setCompilerContext(CompilerContext compilerContext) {
+        _compilerContext = compilerContext;
+    }
+
+    /**
+     * @see org.apache.ode.bpel.compiler.v1.ExpressionCompiler#getProperties()
+     */
+    public Map<String, String> getProperties() {
+        return _properties;
+    }
+
+    /**
+     * Verifies validity of a xpath expression.
+     */
+    protected void doJaxpCompile(OXPath10Expression out, Expression source) throws CompilationException {
+        String xpathStr;
+        Node node = source.getExpression();
+        if (node == null) {
+            throw new IllegalStateException("XPath string and xpath node are both null");
+        }
+
+        xpathStr = node.getNodeValue();
+        xpathStr = xpathStr.trim();
+        if (xpathStr.length() == 0) {
+            throw new CompilationException(__msgs.errXPathSyntax(xpathStr));
+        }
+
+        try {
+            __log.debug("JAXP compile: xpath = " + xpathStr);
+            // use default XPath implementation
+            XPathFactory xpf = XPathFactory.newInstance();
+            __log.debug("JAXP compile: XPathFactory impl = " + xpf.getClass());
+            XPath xpath = xpf.newXPath();
+            xpath.setXPathFunctionResolver(new JaxpFunctionResolver(_compilerContext, out, source
+                .getNamespaceContext(), _bpelNsURI));
+            xpath.setXPathVariableResolver(new JaxpVariableResolver(_compilerContext, out));
+            xpath.setNamespaceContext(source.getNamespaceContext());
+            XPathExpression xpe = xpath.compile(xpathStr);
+            // dummy evaluation to resolve variables and functions (hopefully complete...)
+            xpe.evaluate(DOMUtils.newDocument());
+            out.xpath = xpathStr;
+        } catch (XPathExpressionException e) {
+            throw new CompilationException(__msgs.errUnexpectedCompilationError(e.getMessage()), e);
+        }
+    }
+}

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler11.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler11.java?rev=727785&r1=727784&r2=727785&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler11.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler11.java Thu Dec 18 10:31:27 2008
@@ -1,20 +1,14 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
+ * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
  */
 package org.apache.ode.bpel.compiler.v2;
 
@@ -33,6 +27,8 @@
 import org.apache.ode.bpel.compiler.bom.ThrowActivity;
 import org.apache.ode.bpel.compiler.bom.WaitActivity;
 import org.apache.ode.bpel.compiler.bom.WhileActivity;
+import org.apache.ode.bpel.compiler.v2.xpath10.XPath10ExpressionCompilerBPEL11;
+import org.apache.ode.bpel.compiler.v2.xpath10.jaxp.JaxpXPath10ExpressionCompilerBPEL11;
 import org.apache.ode.bpel.compiler.wsdl.WSDLFactory4BPEL;
 import org.apache.ode.bpel.compiler.wsdl.WSDLFactoryBPEL11;
 
@@ -62,10 +58,21 @@
         registerActivityCompiler(WaitActivity.class, new WaitGenerator());
         registerActivityCompiler(TerminateActivity.class, new TerminateGenerator());
 
-        registerExpressionLanguage(EXPLANG_XPATH, "org.apache.ode.bpel.compiler.v2.xpath10.XPath10ExpressionCompilerBPEL11");
+        // try to instantiate Jaxen based XPath 1.0 expression language compiler.
+        // if this fails (e.g. because Jaxen is not in classpath), use a pure JAXP based one as fallback.
+        try {
+            registerExpressionLanguage(EXPLANG_XPATH, new XPath10ExpressionCompilerBPEL11());
+        } catch (Exception e) {
+            __log
+                .warn("Error loading Jaxen based XPath 1.0 Expression Language, falling back to Jaxp based implementation.");
+            registerExpressionLanguage(EXPLANG_XPATH, new JaxpXPath10ExpressionCompilerBPEL11());
+        } catch (NoClassDefFoundError e) {
+            __log
+                .warn("Error loading Jaxen based XPath 1.0 Expression Language, falling back to Jaxp based implementation.");
+            registerExpressionLanguage(EXPLANG_XPATH, new JaxpXPath10ExpressionCompilerBPEL11());
+        }
     }
 
-
     protected String getBpwsNamespace() {
         return Bpel11QNames.NS_BPEL4WS_2003_03;
     }

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20.java?rev=727785&r1=727784&r2=727785&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20.java Thu Dec 18 10:31:27 2008
@@ -1,20 +1,14 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
+ * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
  */
 package org.apache.ode.bpel.compiler.v2;
 
@@ -41,6 +35,7 @@
 import org.apache.ode.bpel.compiler.wsdl.WSDLFactory4BPEL;
 import org.apache.ode.bpel.compiler.wsdl.WSDLFactoryBPEL20;
 import org.apache.ode.bpel.compiler.v2.xpath10.XPath10ExpressionCompilerBPEL20;
+import org.apache.ode.bpel.compiler.v2.xpath10.jaxp.JaxpXPath10ExpressionCompilerBPEL20;
 
 /**
  * OASIS BPEL V2.0 Compiler
@@ -48,7 +43,9 @@
 public class BpelCompiler20 extends BpelCompilerImpl {
 
     public static final String OASIS_EXPLANG_XPATH_1_0 = "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0";
+
     public static final String OASIS_EXPLANG_XPATH_2_0 = "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0";
+
     public static final String OASIS_EXPLANG_XQUERY_1_0 = "urn:oasis:names:tc:wsbpel:2.0:sublang:xquery1.0";
 
     public BpelCompiler20() {
@@ -73,22 +70,37 @@
         registerActivityCompiler(RethrowActivity.class, new RethrowGenerator());
         registerActivityCompiler(ForEachActivity.class, new ForEachGenerator());
         registerActivityCompiler(ExtensionActivity.class, new ExtensionActivtityGenerator());
-        
-        registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new XPath10ExpressionCompilerBPEL20());
-        
+
+        // try to instantiate Jaxen based XPath 1.0 expression language compiler.
+        // if this fails (e.g. because Jaxen is not in classpath), use a pure JAXP based one as fallback.
+        try {
+            registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new XPath10ExpressionCompilerBPEL20());
+        } catch (Exception e) {
+            __log
+                .warn("Error loading Jaxen based XPath 1.0 Expression Language, falling back to Jaxp based implementation.");
+            registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new JaxpXPath10ExpressionCompilerBPEL20());
+        } catch (NoClassDefFoundError e) {
+            __log
+                .warn("Error loading Jaxen based XPath 1.0 Expression Language, falling back to Jaxp based implementation.");
+            registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new JaxpXPath10ExpressionCompilerBPEL20());
+        }
         try {
             registerExpressionLanguage(OASIS_EXPLANG_XPATH_2_0,
-                    "org.apache.ode.bpel.compiler.v2.xpath20.XPath20ExpressionCompilerBPEL20");
+                "org.apache.ode.bpel.compiler.v2.xpath20.XPath20ExpressionCompilerBPEL20");
         } catch (Exception e) {
             __log.error("Error loading XPath 2.0 Expression Language: it will not be available.");
+        } catch (NoClassDefFoundError e) {
+            __log.error("Error loading XPath 2.0 Expression Language: it will not be available.");
         }
-        
+
         try {
-        	registerExpressionLanguage(OASIS_EXPLANG_XQUERY_1_0,
-	        		"org.apache.ode.bpel.compiler.v2.xquery10.compiler.XQuery10ExpressionCompilerBPEL20");
-    	} catch (Exception e) {
-    		__log.error("Error loading XQuery 1.0 Expression Language: it will not be available.");
-    	}
+            registerExpressionLanguage(OASIS_EXPLANG_XQUERY_1_0,
+                "org.apache.ode.bpel.compiler.v2.xquery10.compiler.XQuery10ExpressionCompilerBPEL20");
+        } catch (Exception e) {
+            __log.error("Error loading XQuery 1.0 Expression Language: it will not be available.");
+        } catch (NoClassDefFoundError e) {
+            __log.error("Error loading XQuery 1.0 Expression Language: it will not be available.");
+        }
     }
 
     protected String getBpwsNamespace() {

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20Draft.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20Draft.java?rev=727785&r1=727784&r2=727785&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20Draft.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20Draft.java Thu Dec 18 10:31:27 2008
@@ -1,20 +1,14 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
+ * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
  */
 
 package org.apache.ode.bpel.compiler.v2;
@@ -38,9 +32,10 @@
 import org.apache.ode.bpel.compiler.bom.ThrowActivity;
 import org.apache.ode.bpel.compiler.bom.WaitActivity;
 import org.apache.ode.bpel.compiler.bom.WhileActivity;
+import org.apache.ode.bpel.compiler.v2.xpath10.XPath10ExpressionCompilerBPEL20Draft;
+import org.apache.ode.bpel.compiler.v2.xpath10.jaxp.JaxpXPath10ExpressionCompilerBPEL20Draft;
 import org.apache.ode.bpel.compiler.wsdl.WSDLFactory4BPEL;
 import org.apache.ode.bpel.compiler.wsdl.WSDLFactoryBPEL20Draft;
-import org.apache.ode.bpel.compiler.v2.xpath10.XPath10ExpressionCompilerBPEL20Draft;
 
 /**
  * @author Matthieu Riou <mriou at apache dot org>
@@ -48,7 +43,9 @@
 public class BpelCompiler20Draft extends BpelCompilerImpl {
 
     public static final String OASIS_EXPLANG_XPATH_1_0 = "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0";
+
     public static final String OASIS_EXPLANG_XPATH_2_0 = "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0";
+
     public static final String OASIS_EXPLANG_XQUERY_1_0 = "urn:oasis:names:tc:wsbpel:2.0:sublang:xquery1.0";
 
     public BpelCompiler20Draft() {
@@ -73,18 +70,34 @@
         registerActivityCompiler(ForEachActivity.class, new ForEachGenerator());
         registerActivityCompiler(ExtensionActivity.class, new ExtensionActivtityGenerator());
 
-        registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new XPath10ExpressionCompilerBPEL20Draft());
+        // try to instantiate Jaxen based XPath 1.0 expression language compiler.
+        // if this fails (e.g. because Jaxen is not in classpath), use a pure JAXP based one as fallback.
+        try {
+            registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new XPath10ExpressionCompilerBPEL20Draft());
+        } catch (Exception e) {
+            __log
+                .warn("Error loading Jaxen based XPath 1.0 Expression Language, falling back to Jaxp based implementation.");
+            registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new JaxpXPath10ExpressionCompilerBPEL20Draft());
+        } catch (NoClassDefFoundError e) {
+            __log
+                .warn("Error loading Jaxen based XPath 1.0 Expression Language, falling back to Jaxp based implementation.");
+            registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new JaxpXPath10ExpressionCompilerBPEL20Draft());
+        }
         try {
             registerExpressionLanguage(OASIS_EXPLANG_XPATH_2_0,
-                    "org.apache.ode.bpel.compiler.v2.xpath20.XPath20ExpressionCompilerBPEL20Draft");
+                "org.apache.ode.bpel.compiler.v2.xpath20.XPath20ExpressionCompilerBPEL20Draft");
         } catch (Exception e) {
             __log.error("Error loading XPath 2.0 Expression Language: it will not be available.");
+        } catch (NoClassDefFoundError e) {
+            __log.error("Error loading XPath 2.0 Expression Language: it will not be available.");
         }
         try {
             registerExpressionLanguage(OASIS_EXPLANG_XQUERY_1_0,
-		    		"org.apache.ode.bpel.compiler.v2.xquery10.compiler.XQuery10ExpressionCompilerBPEL20");
+                "org.apache.ode.bpel.compiler.v2.xquery10.compiler.XQuery10ExpressionCompilerBPEL20");
         } catch (Exception e) {
             __log.error("Error loading XQuery 1.0 Expression Language: it will not be available.");
+        } catch (NoClassDefFoundError e) {
+            __log.error("Error loading XQuery 1.0 Expression Language: it will not be available.");
         }
     }
 

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpFunctionResolver.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpFunctionResolver.java?rev=727785&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpFunctionResolver.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpFunctionResolver.java Thu Dec 18 10:31:27 2008
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
+ * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
+package org.apache.ode.bpel.compiler.v2.xpath10.jaxp;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.xpath.XPathFunction;
+import javax.xml.xpath.XPathFunctionException;
+import javax.xml.xpath.XPathFunctionResolver;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.compiler.WrappedResolverException;
+import org.apache.ode.bpel.compiler.XPathMessages;
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.compiler.v2.CompilerContext;
+import org.apache.ode.bpel.compiler.v2.xpath10.XslCompileUriResolver;
+import org.apache.ode.bpel.rtrep.common.Constants;
+import org.apache.ode.bpel.rtrep.v2.OExpression;
+import org.apache.ode.bpel.rtrep.v2.OLink;
+import org.apache.ode.bpel.rtrep.v2.OMessageVarType;
+import org.apache.ode.bpel.rtrep.v2.OProcess;
+import org.apache.ode.bpel.rtrep.v2.OScope;
+import org.apache.ode.bpel.rtrep.v2.OXslSheet;
+import org.apache.ode.bpel.rtrep.v2.xpath10.OXPath10Expression;
+import org.apache.ode.utils.NSContext;
+import org.apache.ode.utils.msg.MessageBundle;
+import org.apache.ode.utils.xsl.XslTransformHandler;
+
+/**
+ * mock JAXP function resolver for checking the functions during compile time.
+ */
+public class JaxpFunctionResolver implements XPathFunctionResolver {
+    private static final Log __log = LogFactory.getLog(JaxpFunctionResolver.class);
+
+    private static final XPathMessages __msgs = MessageBundle.getMessages(XPathMessages.class);
+
+    private CompilerContext _cctx;
+
+    private OXPath10Expression _out;
+
+    private NSContext _nsContext;
+
+    private String _bpelNS;
+
+    public JaxpFunctionResolver(CompilerContext cctx, OXPath10Expression out, NSContext nsContext, String bpelNS) {
+        _cctx = cctx;
+        _bpelNS = bpelNS;
+        _nsContext = nsContext;
+        _bpelNS = bpelNS;
+        _out = out;
+    }
+
+    public XPathFunction resolveFunction(QName functionName, int arity) {
+        __log.debug("JAXP compiler: Resolving function " + functionName);
+        if (functionName.getNamespaceURI() == null) {
+            throw new WrappedResolverException("Undeclared namespace for " + functionName);
+        } else if (functionName.getNamespaceURI().equals(_bpelNS)) {
+            String localName = functionName.getLocalPart();
+            if (Constants.EXT_FUNCTION_GETVARIABLEDATA.equals(localName)) {
+                return new GetVariableData();
+            }
+            if (Constants.EXT_FUNCTION_GETVARIABLEPROPERTY.equals(localName)) {
+                return new GetVariableProperty();
+            }
+            if (Constants.EXT_FUNCTION_GETLINKSTATUS.equals(localName)) {
+                return new GetLinkStatus();
+            }
+            if (Constants.EXT_FUNCTION_DOXSLTRANSFORM.equals(localName)) {
+                return new DoXslTransform();
+            }
+            throw new WrappedResolverException(__msgs.errUnknownBpelFunction(localName));
+        }
+
+        return null;
+    }
+
+    public class GetVariableData implements XPathFunction {
+        public Object evaluate(List params) throws XPathFunctionException {
+            if (params.size() < 1 || params.size() > 3) {
+                throw new CompilationException(__msgs
+                    .errInvalidNumberOfArguments(Constants.EXT_FUNCTION_GETVARIABLEDATA));
+            }
+            String varname = (String) params.get(0);
+            String partname = params.size() > 1 ? (String) params.get(1) : null;
+            String locationstr = params.size() > 2 ? (String) params.get(2) : null;
+
+            OScope.Variable var = _cctx.resolveVariable(varname);
+            OMessageVarType.Part part = partname != null ? _cctx.resolvePart(var, partname) : null;
+            OExpression location = null;
+            if (locationstr != null) {
+                location = _cctx.compileExpr(locationstr, _nsContext);
+            }
+
+            _out.addGetVariableDataSig(varname, partname, locationstr, new OXPath10Expression.OSigGetVariableData(
+                _cctx.getOProcess(), var, part, location));
+            return "";
+        }
+    }
+
+    public class GetVariableProperty implements XPathFunction {
+        public Object evaluate(List params) throws XPathFunctionException {
+            if (params.size() != 2) {
+                throw new CompilationException(__msgs
+                    .errInvalidNumberOfArguments(Constants.EXT_FUNCTION_GETVARIABLEPROPERTY));
+            }
+            String varName = (String) params.get(0);
+            OScope.Variable v = _cctx.resolveVariable(varName);
+            _out.vars.put(varName, v);
+
+            String propName = (String) params.get(1);
+            QName qname = _nsContext.derefQName(propName);
+
+            if (qname == null)
+                throw new CompilationException(__msgs.errInvalidQName(propName));
+
+            OProcess.OProperty property = _cctx.resolveProperty(qname);
+            // Make sure we can...
+            _cctx.resolvePropertyAlias(v, qname);
+
+            _out.properties.put(propName, property);
+            _out.vars.put(varName, v);
+            return "";
+        }
+    }
+
+    public class GetLinkStatus implements XPathFunction {
+        public Object evaluate(List params) throws XPathFunctionException {
+            if (params.size() != 1) {
+                throw new CompilationException(__msgs
+                    .errInvalidNumberOfArguments(Constants.EXT_FUNCTION_GETLINKSTATUS));
+            }
+            String linkName = (String) params.get(0);
+            OLink olink = _cctx.resolveLink(linkName);
+            _out.links.put(linkName, olink);
+
+            return "";
+        }
+    }
+
+    public class DoXslTransform implements XPathFunction {
+        public Object evaluate(List params) throws XPathFunctionException {
+            if (params.size() < 2 || params.size() % 2 != 0) {
+                throw new CompilationException(__msgs
+                    .errInvalidNumberOfArguments(Constants.EXT_FUNCTION_DOXSLTRANSFORM));
+            }
+
+            String xslUri = (String) params.get(0);
+            OXslSheet xslSheet = _cctx.compileXslt(xslUri);
+            try {
+                XslTransformHandler.getInstance().parseXSLSheet(_cctx.getBaseResourceURI(), xslSheet.uri,
+                    xslSheet.sheetBody, new XslCompileUriResolver(_cctx, _out));
+            } catch (Exception e) {
+                throw new CompilationException(__msgs.errXslCompilation(xslUri, e.toString()));
+            }
+
+            _out.xslSheets.put(xslSheet.uri, xslSheet);
+            return "";
+        }
+    }
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpVariableResolver.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpVariableResolver.java?rev=727785&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpVariableResolver.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpVariableResolver.java Thu Dec 18 10:31:27 2008
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
+ * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
+package org.apache.ode.bpel.compiler.v2.xpath10.jaxp;
+
+import javax.xml.namespace.QName;
+import javax.xml.xpath.XPathVariableResolver;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.compiler.WrappedResolverException;
+import org.apache.ode.bpel.compiler.XPathMessages;
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.compiler.v2.CompilerContext;
+import org.apache.ode.bpel.rtrep.v2.OElementVarType;
+import org.apache.ode.bpel.rtrep.v2.OLink;
+import org.apache.ode.bpel.rtrep.v2.OMessageVarType;
+import org.apache.ode.bpel.rtrep.v2.OScope;
+import org.apache.ode.bpel.rtrep.v2.OVarType;
+import org.apache.ode.bpel.rtrep.v2.OXsdTypeVarType;
+import org.apache.ode.bpel.rtrep.v2.xpath10.OXPath10Expression;
+import org.apache.ode.bpel.rtrep.v2.xpath10.OXPath10ExpressionBPEL20;
+import org.apache.ode.utils.DOMUtils;
+import org.apache.ode.utils.Namespaces;
+import org.apache.ode.utils.msg.MessageBundle;
+import org.w3c.dom.Document;
+
+/**
+ * This is a mock implementation of the XPathVariableResolver for compilation. It always returns an empty string which
+ * allows execution of XPath expressions even if we don't have any values yet. This way we can easily rule out invalid
+ * variables and isolate properly BPEL variables.
+ */
+public class JaxpVariableResolver implements XPathVariableResolver {
+    private static final Log __log = LogFactory.getLog(XPathVariableResolver.class);
+
+    private static final XPathMessages __msgs = MessageBundle.getMessages(XPathMessages.class);
+
+    private CompilerContext _cctx;
+
+    private OXPath10Expression _oxpath;
+
+    public JaxpVariableResolver(CompilerContext cctx, OXPath10Expression oxpath) {
+        _cctx = cctx;
+        _oxpath = oxpath;
+    }
+
+    public Object resolveVariable(QName variableName) {
+        __log.debug("JAXP compiler: Resolving variable " + variableName);
+        // Custom variables
+        if ("ode".equals(variableName.getPrefix())
+            || Namespaces.ODE_EXTENSION_NS.equals(variableName.getNamespaceURI())) {
+            if ("pid".equals(variableName.getLocalPart()))
+                return "";
+        }
+
+        try {
+            String name = variableName.getLocalPart();
+            if (_oxpath instanceof OXPath10ExpressionBPEL20
+                && ((OXPath10ExpressionBPEL20) _oxpath).isJoinExpression) {
+                // these resolve to links
+                OLink olink = _cctx.resolveLink(name);
+                _oxpath.links.put(name, olink);
+                return Boolean.TRUE;
+            } else {
+                int dot = name.indexOf('.');
+                if (dot != -1)
+                    name = name.substring(0, dot);
+                OScope.Variable var = _cctx.resolveVariable(name);
+                _oxpath.vars.put(name, var);
+                return extractValue(var, var.type);
+            }
+        } catch (CompilationException e) {
+            throw new WrappedResolverException(e);
+        }
+    }
+
+    private Object extractValue(OScope.Variable var, OVarType varType) {
+        if (varType instanceof OXsdTypeVarType) {
+            return generateFromType(((OXsdTypeVarType) varType).xsdType);
+        } else if (varType instanceof OElementVarType) {
+            return generateFromType(((OElementVarType) varType).elementType);
+        } else if (varType instanceof OMessageVarType) {
+            // MR That's an ugly hack but otherwise, xpath compilation doesn't work
+            if (((OMessageVarType) varType).parts.size() == 0)
+                throw new WrappedResolverException(__msgs.errExpressionMessageNoPart(var.name));
+            return extractValue(var, ((OMessageVarType) varType).parts.values().iterator().next().type);
+        }
+        return "";
+    }
+
+    private Object generateFromType(QName typeName) {
+        if (typeName.getNamespaceURI().equals(Namespaces.XML_SCHEMA)) {
+            if (typeName.getLocalPart().equals("int") || typeName.getLocalPart().equals("integer")
+                || typeName.getLocalPart().equals("short") || typeName.getLocalPart().equals("long")
+                || typeName.getLocalPart().equals("byte") || typeName.getLocalPart().equals("float")
+                || typeName.getLocalPart().equals("double") || typeName.getLocalPart().equals("nonPositiveInteger")
+                || typeName.getLocalPart().equals("nonNegativeInteger")
+                || typeName.getLocalPart().equals("negativeInteger")
+                || typeName.getLocalPart().equals("unsignedLong") || typeName.getLocalPart().equals("unsignedInt")
+                || typeName.getLocalPart().equals("unsignedShort")
+                || typeName.getLocalPart().equals("unsignedByte"))
+                return 0;
+            if (typeName.getLocalPart().equals("boolean"))
+                return Boolean.TRUE;
+            if (typeName.getLocalPart().equals("string"))
+                return "";
+        }
+        Document doc = DOMUtils.newDocument();
+        doc.appendChild(doc.createElement("empty"));
+        return doc.getDocumentElement();
+    }
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL11.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL11.java?rev=727785&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL11.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL11.java Thu Dec 18 10:31:27 2008
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ode.bpel.compiler.v2.xpath10.jaxp;
+
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.compiler.bom.Expression;
+import org.apache.ode.bpel.rtrep.v2.xpath10.OXPath10Expression;
+import org.apache.ode.bpel.rtrep.v2.OExpression;
+import org.apache.ode.bpel.rtrep.v2.OLValueExpression;
+import org.apache.ode.utils.Namespaces;
+
+/**
+ * JAXP based XPath 1.0 expression compiler for BPEL v1.1.
+ */
+public class JaxpXPath10ExpressionCompilerBPEL11 extends JaxpXPath10ExpressionCompilerImpl {
+  public JaxpXPath10ExpressionCompilerBPEL11() {
+    super(Namespaces.BPEL11_NS);
+  }
+  
+  /**
+   * @see org.apache.ode.bpel.compiler.v2.ExpressionCompiler#compileJoinCondition(java.lang.Object)
+   */
+  public OExpression compileJoinCondition(Object source) throws CompilationException {
+  	return compile(source);
+  }
+  
+  public OLValueExpression compileLValue(Object source) throws CompilationException {
+  	throw new UnsupportedOperationException("Not supported for bpel 1.1");
+  }
+
+  /**
+   * @see org.apache.ode.bpel.compiler.v2.ExpressionCompiler#compile(java.lang.Object)
+   */
+  public OExpression compile(Object source) throws CompilationException {
+    Expression xpath = (Expression)source;
+    OXPath10Expression oexp = new OXPath10Expression(
+            _compilerContext.getOProcess(),
+            _qnFnGetVariableData,
+            _qnFnGetVariableProperty,
+            _qnFnGetLinkStatus);
+    oexp.namespaceCtx = xpath.getNamespaceContext();
+    doJaxpCompile(oexp, xpath);
+    return oexp;
+  }
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20.java?rev=727785&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20.java Thu Dec 18 10:31:27 2008
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ode.bpel.compiler.v2.xpath10.jaxp;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.TransformerFactory;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.compiler.bom.Expression;
+import org.apache.ode.bpel.compiler.v2.CompilerContext;
+import org.apache.ode.bpel.compiler.v2.xpath10.XslCompilationErrorListener;
+import org.apache.ode.bpel.rtrep.v2.OExpression;
+import org.apache.ode.bpel.rtrep.v2.OLValueExpression;
+import org.apache.ode.bpel.rtrep.v2.xpath10.OXPath10Expression;
+import org.apache.ode.bpel.rtrep.v2.xpath10.OXPath10ExpressionBPEL20;
+import org.apache.ode.utils.Namespaces;
+import org.apache.ode.utils.xsl.XslTransformHandler;
+
+/**
+ * JAXP based XPath 1.0 expression compiler for BPEL 2.0
+ */
+public class JaxpXPath10ExpressionCompilerBPEL20 extends JaxpXPath10ExpressionCompilerImpl {
+    /** Class-level logger. */
+    private static final Log __log = LogFactory.getLog(JaxpXPath10ExpressionCompilerBPEL20.class);
+
+    protected QName _qnDoXslTransform;
+
+    public JaxpXPath10ExpressionCompilerBPEL20() {
+        this(Namespaces.WSBPEL2_0_FINAL_EXEC);
+    }
+
+    public JaxpXPath10ExpressionCompilerBPEL20(String bpelNS) {
+        super(bpelNS);
+        
+        TransformerFactory trsf = TransformerFactory.newInstance();
+        __log.debug("JAXP compiler: TransformerFactory impl = " + trsf.getClass());
+        XslTransformHandler.getInstance().setTransformerFactory(trsf);
+
+        _qnDoXslTransform = new QName(bpelNS, "doXslTransform");
+    }
+
+    /**
+     * @see org.apache.ode.bpel.compiler.v2.ExpressionCompiler#compileJoinCondition(java.lang.Object)
+     */
+    public OExpression compileJoinCondition(Object source) throws CompilationException {
+        return _compile((Expression)source, true);
+    }
+
+    @Override
+    public void setCompilerContext(CompilerContext ctx) {
+        super.setCompilerContext(ctx);
+        XslCompilationErrorListener xe = new XslCompilationErrorListener(ctx);
+        XslTransformHandler.getInstance().setErrorListener(xe);
+    }
+    /**
+     * @see org.apache.ode.bpel.compiler.v2.ExpressionCompiler#compile(java.lang.Object)
+     */
+    public OExpression compile(Object source) throws CompilationException {
+        return _compile((Expression)source, false);
+    }
+    /**
+     * @see org.apache.ode.bpel.compiler.v2.ExpressionCompiler#compileLValue(java.lang.Object)
+     */
+    public OLValueExpression compileLValue(Object source) throws CompilationException {
+        return (OLValueExpression)_compile((Expression)source, false);
+    }
+
+    private OExpression _compile(Expression xpath, boolean isJoinCondition) throws CompilationException {
+        OXPath10Expression oexp = new OXPath10ExpressionBPEL20(
+                _compilerContext.getOProcess(),
+                _qnFnGetVariableData,
+                _qnFnGetVariableProperty,
+                _qnFnGetLinkStatus,
+                _qnDoXslTransform,
+                isJoinCondition);
+        oexp.namespaceCtx = xpath.getNamespaceContext();
+        doJaxpCompile(oexp, xpath);
+        return oexp;
+    }
+
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20Draft.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20Draft.java?rev=727785&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20Draft.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/jaxp/JaxpXPath10ExpressionCompilerBPEL20Draft.java Thu Dec 18 10:31:27 2008
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ode.bpel.compiler.v2.xpath10.jaxp;
+
+import org.apache.ode.utils.Namespaces;
+
+/**
+ * JAXP based XPath 1.0 expression compiler for BPEL 2.0 draft
+ */
+public class JaxpXPath10ExpressionCompilerBPEL20Draft extends JaxpXPath10ExpressionCompilerBPEL20 {
+
+    public JaxpXPath10ExpressionCompilerBPEL20Draft() {
+        super(Namespaces.WS_BPEL_20_NS);
+    }
+
+}