Author: karthick
Date: Thu Dec 11 16:35:44 2008
New Revision: 725863
URL: http://svn.apache.org/viewvc?rev=725863&view=rev
Log:
ODE-450: Expose Deployment Properties In BPEL Process
Modified:
ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/OdeRTInstanceContext.java
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath20/JaxpFunctionResolver.java
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath20/JaxpFunctionResolver.java
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/TestAssign.bpel
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/deploy.xml
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/test.properties
ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java
ode/trunk/engine/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/common/Constants.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/ASSIGN.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/EvaluationContext.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/ExprEvaluationContextImpl.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/OdeInternalInstance.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/PropertyAliasEvaluationContext.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/RuntimeInstanceImpl.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/xpath20/JaxpFunctionResolver.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ASSIGN.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/BoundVariableEvaluationContext.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/EvaluationContext.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ExprEvaluationContextImpl.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OdeInternalInstance.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/PropertyAliasEvaluationContext.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeInstanceImpl.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/xpath20/JaxpFunctionResolver.java
ode/trunk/runtimes/src/test/java/org/apache/ode/bpel/rtrep/v1/CoreBpelTest.java
ode/trunk/runtimes/src/test/java/org/apache/ode/bpel/rtrep/v2/CoreBpelTest.java
Modified:
ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/OdeRTInstanceContext.java
URL:
http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/OdeRTInstanceContext.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/OdeRTInstanceContext.java
(original)
+++
ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/OdeRTInstanceContext.java
Thu Dec 11 16:35:44 2008
@@ -18,7 +18,10 @@
*/
package org.apache.ode.bpel.rapi;
+import javax.xml.namespace.QName;
+
import org.apache.ode.bpel.evt.ProcessInstanceEvent;
+import org.w3c.dom.Node;
/**
*<p>A collection of interfaces that are implemented by the engine for the
@@ -69,5 +72,6 @@
void setAtomicScopeRetriesDone();
void setAtomicScope(boolean atomicScope);
-
+
+ Node getProcessProperty(QName propertyName);
}
Modified:
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath20/JaxpFunctionResolver.java
URL:
http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath20/JaxpFunctionResolver.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath20/JaxpFunctionResolver.java
(original)
+++
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath20/JaxpFunctionResolver.java
Thu Dec 11 16:35:44 2008
@@ -102,6 +102,8 @@
return new Delete();
} else if (Constants.NON_STDRD_FUNCTION_RENAME.equals(localName)) {
return new Rename();
+ } else if
(Constants.NON_STDRD_FUNCTION_PROCESS_PROPERTY.equals(localName)) {
+ return new ProcessProperty();
}
}
@@ -261,5 +263,14 @@
}
}
+ public class ProcessProperty implements XPathFunction {
+ public Object evaluate(List args) throws XPathFunctionException {
+ if (args.size() != 1) {
+ throw new
CompilationException(__msgs.errInvalidNumberOfArguments(Constants.NON_STDRD_FUNCTION_PROCESS_PROPERTY));
+ }
+ return "";
+ }
+ }
+
}
Modified:
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath20/JaxpFunctionResolver.java
URL:
http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath20/JaxpFunctionResolver.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath20/JaxpFunctionResolver.java
(original)
+++
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath20/JaxpFunctionResolver.java
Thu Dec 11 16:35:44 2008
@@ -29,6 +29,7 @@
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.xpath20.JaxpFunctionResolver.ProcessProperty;
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;
@@ -102,6 +103,8 @@
return new Delete();
} else if (Constants.NON_STDRD_FUNCTION_RENAME.equals(localName)) {
return new Rename();
+ } else if
(Constants.NON_STDRD_FUNCTION_PROCESS_PROPERTY.equals(localName)) {
+ return new ProcessProperty();
}
}
@@ -261,5 +264,14 @@
}
}
+ public class ProcessProperty implements XPathFunction {
+ public Object evaluate(List args) throws XPathFunctionException {
+ if (args.size() != 1) {
+ throw new
CompilationException(__msgs.errInvalidNumberOfArguments(Constants.NON_STDRD_FUNCTION_PROCESS_PROPERTY));
+ }
+ return "";
+ }
+ }
+
}
Modified:
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/TestAssign.bpel
URL:
http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/TestAssign.bpel?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/TestAssign.bpel
(original)
+++
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/TestAssign.bpel
Thu Dec 11 16:35:44 2008
@@ -21,9 +21,13 @@
targetNamespace="http://ode/bpel/unit-testAssign2"
xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
- xmlns:tns="http://ode/bpel/unit-testAssign2"
+ xmlns:ode="http://www.apache.org/ode/type/extension"
+ xmlns:tns="http://ode/bpel/unit-testAssign2"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:test="http://ode/bpel/unit-testAssign2.wsdl"
+ xmlns:test="http://ode/bpel/unit-testAssign2.wsdl"
+ xmlns:sref=" http://docs.oasis-open.org/wsbpel/2.0/serviceref"
+ xmlns:addr="http://example.com/addressing"
+ xmlns:dd="http://www.apache.org/ode/schemas/dd/2007/03"
queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
@@ -52,7 +56,19 @@
<to variable="strVar"/>
</copy>
<copy>
- <from>concat($strVar,' World')</from>
+ <from>concat($strVar, " ")</from>
+ <to variable="strVar"/>
+ </copy>
+ <copy>
+ <from>concat($strVar,
string(ode:process-property("dd:epr")/addr:EndpointReference/addr:ServiceName))</from>
+ <to variable="strVar"/>
+ </copy>
+ <copy>
+ <from>concat($strVar,
string(ode:process-property("dd:punctuation")))</from>
+ <to variable="strVar"/>
+ </copy>
+ <copy>
+ <from>$strVar</from>
<to variable="myVar" part="TestPart"/>
</copy>
<copy>
Modified:
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/deploy.xml
URL:
http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/deploy.xml?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/deploy.xml
(original)
+++
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/deploy.xml
Thu Dec 11 16:35:44 2008
@@ -23,6 +23,18 @@
<process name="pns:TestAssign">
+ <property name="punctuation">!</property>
+ <property name="epr">
+ <sref:service-ref
+ xmlns:sref=" http://docs.oasis-open.org/wsbpel/2.0/serviceref"
+ xmlns:addr="http://example.com/addressing"
+ xmlns:as="http://example.com/auction/wsdl/auctionService/">
+ <addr:EndpointReference>
+
<addr:Address>http://example.com/auction/RegistrationService/</addr:Address>
+ <addr:ServiceName>as:RegistrationService</addr:ServiceName>
+ </addr:EndpointReference>
+ </sref:service-ref>
+ </property>
<active>true</active>
<provide partnerLink="TestAssignPartnerLink">
<service name="wns:TestAssignService"
port="TestAssignPort"/>
Modified:
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/test.properties
URL:
http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/test.properties?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/test.properties
(original)
+++
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestAssignActivity2/test.properties
Thu Dec 11 16:35:44 2008
@@ -19,4 +19,4 @@
service=TestAssignService
operation=testAssign
request1=<message><TestPart>Hello</TestPart></message>
-response1=.*Hello World.*
\ No newline at end of file
+response1=.*Hello as:RegistrationService!.*
\ No newline at end of file
Modified:
ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
URL:
http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
(original)
+++
ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
Thu Dec 11 16:35:44 2008
@@ -993,5 +993,8 @@
public boolean isAtomicScope() {
return _atomicScope;
}
-
+
+ public Node getProcessProperty(QName propertyName) {
+ return _bpelProcess.getProcessProperty(propertyName);
+ }
}
Modified:
ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java
URL:
http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java
(original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java
Thu Dec 11 16:35:44 2008
@@ -84,6 +84,7 @@
import org.apache.ode.utils.ObjectPrinter;
import org.apache.ode.utils.msg.MessageBundle;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
/**
* Entry point into the runtime of a BPEL process.
@@ -1411,4 +1412,11 @@
}
}
+ public Node getProcessProperty(QName propertyName) {
+ Map<QName, Node> properties = _pconf.getProcessProperties();
+ if (properties != null) {
+ return properties.get(propertyName);
+ }
+ return null;
+ }
}
\ No newline at end of file
Modified:
ode/trunk/engine/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java
URL:
http://svn.apache.org/viewvc/ode/trunk/engine/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/engine/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java
(original)
+++
ode/trunk/engine/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java
Thu Dec 11 16:35:44 2008
@@ -153,4 +153,8 @@
public URI getBaseResourceURI() {
return null;
}
+
+ public Node getPropertyValue(QName propertyName) {
+ return null;
+ }
}
Modified:
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/common/Constants.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/common/Constants.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/common/Constants.java
(original)
+++
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/common/Constants.java
Thu Dec 11 16:35:44 2008
@@ -65,7 +65,8 @@
public static final String NON_STDRD_FUNCTION_INSERT_AS_LAST_INTO =
"insert-as-last-into";
public static final String NON_STDRD_FUNCTION_DELETE = "delete";
public static final String NON_STDRD_FUNCTION_RENAME = "rename";
-
+ public static final String NON_STDRD_FUNCTION_PROCESS_PROPERTY =
"process-property";
+
public static final String XQUERY_FUNCTION_HANDLER_COMPILER =
"org.apache.ode.bpel.compiler.v2.xquery10.compiler.XQuery10BpelFunctions";
public static final String XQUERY_FUNCTION_HANDLER_RUNTIME =
"org.apache.ode.bpel.rtrep.v2.xquery10.runtime.XQuery10BpelFunctions";
Modified:
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/ASSIGN.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/ASSIGN.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
--- ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/ASSIGN.java
(original)
+++ ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/ASSIGN.java
Thu Dec 11 16:35:44 2008
@@ -675,6 +675,10 @@
public URI getBaseResourceURI() {
return _ctx.getBaseResourceURI();
}
+
+ public Node getPropertyValue(QName propertyName) {
+ return _ctx.getPropertyValue(propertyName);
+ }
}
}
Modified:
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/EvaluationContext.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/EvaluationContext.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/EvaluationContext.java
(original)
+++
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/EvaluationContext.java
Thu Dec 11 16:35:44 2008
@@ -20,6 +20,8 @@
import java.net.URI;
+import javax.xml.namespace.QName;
+
import org.apache.ode.bpel.common.FaultException;
import org.apache.ode.bpel.rtrep.v1.OExpression;
import org.apache.ode.bpel.rtrep.v1.OLink;
@@ -106,4 +108,12 @@
* @return URI - the URI representing the absolute physical file path
location that this process is defined within.
*/
URI getBaseResourceURI();
+
+ /**
+ * Retrieves the property value that has been defined for this BPEL
Process type.
+ *
+ * @return propertyValue - the value corresponding to the process
property name.
+ */
+ Node getPropertyValue(QName propertyName);
+
}
Modified:
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/ExprEvaluationContextImpl.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/ExprEvaluationContextImpl.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/ExprEvaluationContextImpl.java
(original)
+++
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/ExprEvaluationContextImpl.java
Thu Dec 11 16:35:44 2008
@@ -21,6 +21,8 @@
import java.net.URI;
import java.util.Map;
+import javax.xml.namespace.QName;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.common.FaultException;
@@ -133,4 +135,8 @@
return _native.getBaseResourceURI();
}
+ public Node getPropertyValue(QName propertyName) {
+ return _native.getProcessProperty(propertyName);
+ }
+
}
Modified:
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/OdeInternalInstance.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/OdeInternalInstance.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/OdeInternalInstance.java
(original)
+++
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/OdeInternalInstance.java
Thu Dec 11 16:35:44 2008
@@ -119,4 +119,6 @@
void reply(PartnerLinkInstance plink, String opName, String bpelmex,
Element element, QName fault)
throws FaultException;
+
+ Node getProcessProperty(QName propertyName);
}
\ No newline at end of file
Modified:
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/PropertyAliasEvaluationContext.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/PropertyAliasEvaluationContext.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/PropertyAliasEvaluationContext.java
(original)
+++
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/PropertyAliasEvaluationContext.java
Thu Dec 11 16:35:44 2008
@@ -88,4 +88,8 @@
return null;
}
+ public Node getPropertyValue(QName propertyName) {
+ return null;
+ }
+
}
Modified:
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/RuntimeInstanceImpl.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/RuntimeInstanceImpl.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/RuntimeInstanceImpl.java
(original)
+++
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/RuntimeInstanceImpl.java
Thu Dec 11 16:35:44 2008
@@ -732,4 +732,8 @@
public URI getBaseResourceURI() {
return _runtime._pconf.getBaseURI();
}
+
+ public Node getProcessProperty(QName propertyName) {
+ return _brc.getProcessProperty(propertyName);
+ }
}
\ No newline at end of file
Modified:
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/xpath20/JaxpFunctionResolver.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/xpath20/JaxpFunctionResolver.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/xpath20/JaxpFunctionResolver.java
(original)
+++
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/xpath20/JaxpFunctionResolver.java
Thu Dec 11 16:35:44 2008
@@ -19,8 +19,6 @@
package org.apache.ode.bpel.rtrep.v1.xpath20;
-import java.io.IOException;
-import java.io.StringWriter;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -32,7 +30,6 @@
import javax.xml.namespace.QName;
import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPathFunction;
import javax.xml.xpath.XPathFunctionException;
import javax.xml.xpath.XPathFunctionResolver;
@@ -47,7 +44,11 @@
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.common.FaultException;
import org.apache.ode.bpel.rtrep.common.Constants;
-import org.apache.ode.bpel.rtrep.v1.*;
+import org.apache.ode.bpel.rtrep.v1.EvaluationContext;
+import org.apache.ode.bpel.rtrep.v1.OLink;
+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.bpel.rtrep.v1.xpath10.OXPath10ExpressionBPEL20;
import org.apache.ode.utils.DOMUtils;
@@ -59,7 +60,6 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
-import org.xml.sax.SAXException;
/**
* @author mriou <mriou at apache dot org>
@@ -123,6 +123,8 @@
return new Delete();
} else if (Constants.NON_STDRD_FUNCTION_RENAME.equals(localName)) {
return new Rename();
+ } else if
(Constants.NON_STDRD_FUNCTION_PROCESS_PROPERTY.equals(localName)) {
+ return new ProcessProperty();
}
}
@@ -1053,6 +1055,70 @@
}
}
+ public class ProcessProperty implements XPathFunction {
+ public Object evaluate(List args) throws XPathFunctionException {
+ if (args.size() != 1)
+ throw new XPathFunctionException(new FaultException(new
QName(Namespaces.ODE_EXTENSION_NS, "processPropertyInvalidSource"), "Invalid
arguments"));
+
+ if (__log.isDebugEnabled()) {
+ __log.debug("process-property call(context=" + _ectx + "
args=" + args + ")");
+ }
+
+ QName propertyName = null;
+ Element targetElmt = null;
+ try {
+ if (args.get(0) instanceof List) {
+ List elmts = (List) args.get(0);
+ if (elmts.size() != 1) throw new XPathFunctionException(
+ new
FaultException(_oxpath.getOwner().constants.qnSelectionFailure,
+ "The bpws:process-property function MUST
be passed a single " +
+ "element node."));
+ if (elmts.get(0) instanceof Element) {
+ targetElmt = (Element) elmts.get(0);
+ } else if (elmts.get(0) instanceof String) {
+ propertyName = new QName((String) elmts.get(0));
+ }
+ } else if (args.get(0) instanceof NodeWrapper) {
+ targetElmt = (Element) ((NodeWrapper)
args.get(0)).getUnderlyingNode();
+ } else if (args.get(0) instanceof Element) {
+ targetElmt = (Element) args.get(0);
+ } else if (args.get(0) instanceof QNameValue) {
+ QNameValue qNameValue = (QNameValue) args.get(0);
+ propertyName = new QName(qNameValue.getNamespaceURI(),
qNameValue.getLocalName(), qNameValue.getPrefix());
+ } else if (args.get(0) instanceof String) {
+ String stringValue = (String) args.get(0);
+ if (stringValue.indexOf(":") > 0) {
+ String prefix = stringValue.substring(0,
stringValue.indexOf(":"));
+ String localPart =
stringValue.substring(stringValue.indexOf(":") + 1);
+ String namespaceUri =
_oxpath.namespaceCtx.getNamespaceURI(prefix);
+ propertyName = new QName(namespaceUri,
localPart, prefix);
+ } else {
+ propertyName = new QName(stringValue);
+ }
+ } else if (args.get(0) instanceof QName) {
+ propertyName = (QName) args.get(0);
+ } else {
+ throw new XPathFunctionException("Unexpected argument
type: "+args.get(0).getClass());
+ }
+ if (propertyName == null) {
+ if (targetElmt != null) {
+ propertyName = new
QName(targetElmt.getTextContent());
+ }
+ }
+ } catch (IllegalArgumentException e) {
+ throw new XPathFunctionException(
+ new
FaultException(_oxpath.getOwner().constants.qnInvalidExpressionValue,
+ "Invalid argument: URI Template
expected. " + args.get(0), e));
+ } catch (ClassCastException e) {
+ throw new XPathFunctionException(
+ new
FaultException(_oxpath.getOwner().constants.qnSelectionFailure,
+ "The bpws:process-property function MUST be
passed a single " +
+ "element node."));
+ }
+ return _ectx.getPropertyValue(propertyName);
+ }
+ }
+
public static class Helper {
/**
* Extract a string from the given parameter.<br/>
Modified:
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ASSIGN.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ASSIGN.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
--- ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ASSIGN.java
(original)
+++ ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ASSIGN.java
Thu Dec 11 16:35:44 2008
@@ -706,6 +706,10 @@
public URI getBaseResourceURI() {
return _ctx.getBaseResourceURI();
}
+
+ public Node getPropertyValue(QName propertyName) {
+ return _ctx.getPropertyValue(propertyName);
+ }
}
}
Modified:
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/BoundVariableEvaluationContext.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/BoundVariableEvaluationContext.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/BoundVariableEvaluationContext.java
(original)
+++
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/BoundVariableEvaluationContext.java
Thu Dec 11 16:35:44 2008
@@ -68,4 +68,8 @@
public URI getBaseResourceURI() {
throw new InvalidProcessException("Base URI not available in this
context.");
}
+
+ public Node getPropertyValue(QName propertyName) {
+ throw new InvalidProcessException("Property value not available in
this context.");
+ }
}
Modified:
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/EvaluationContext.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/EvaluationContext.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/EvaluationContext.java
(original)
+++
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/EvaluationContext.java
Thu Dec 11 16:35:44 2008
@@ -20,6 +20,8 @@
import java.net.URI;
+import javax.xml.namespace.QName;
+
import org.apache.ode.bpel.common.FaultException;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -99,4 +101,11 @@
boolean narrowTypes();
URI getBaseResourceURI();
+
+ /**
+ * Retrieves the property value that has been defined for this BPEL
Process type.
+ *
+ * @return propertyValue - the value corresponding to the process
property name.
+ */
+ Node getPropertyValue(QName propertyName);
}
Modified:
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ExprEvaluationContextImpl.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ExprEvaluationContextImpl.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ExprEvaluationContextImpl.java
(original)
+++
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ExprEvaluationContextImpl.java
Thu Dec 11 16:35:44 2008
@@ -21,6 +21,8 @@
import java.util.Map;
import java.net.URI;
+import javax.xml.namespace.QName;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.common.FaultException;
@@ -131,4 +133,9 @@
public URI getBaseResourceURI() {
return _native.getBaseResourceURI();
}
+
+ public Node getPropertyValue(QName propertyName) {
+ return _native.getProcessProperty(propertyName);
+ }
+
}
Modified:
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OdeInternalInstance.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OdeInternalInstance.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OdeInternalInstance.java
(original)
+++
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OdeInternalInstance.java
Thu Dec 11 16:35:44 2008
@@ -133,4 +133,11 @@
void setRetriesDone();
void setAtomicScope(boolean atomicScope);
+
+ /**
+ * Retrieves the property value that has been defined for this BPEL
Process type.
+ *
+ * @return propertyValue - the value corresponding to the process
property name.
+ */
+ Node getProcessProperty(QName propertyName);
}
Modified:
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/PropertyAliasEvaluationContext.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/PropertyAliasEvaluationContext.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/PropertyAliasEvaluationContext.java
(original)
+++
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/PropertyAliasEvaluationContext.java
Thu Dec 11 16:35:44 2008
@@ -87,4 +87,8 @@
return null;
}
+ public Node getPropertyValue(QName propertyName) {
+ return null;
+ }
+
}
Modified:
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeInstanceImpl.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeInstanceImpl.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeInstanceImpl.java
(original)
+++
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeInstanceImpl.java
Thu Dec 11 16:35:44 2008
@@ -762,5 +762,8 @@
public void setAtomicScope(boolean atomicScope) {
_brc.setAtomicScope(atomicScope);
}
-
+
+ public Node getProcessProperty(QName propertyName) {
+ return _brc.getProcessProperty(propertyName);
+ }
}
Modified:
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/xpath20/JaxpFunctionResolver.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/xpath20/JaxpFunctionResolver.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/xpath20/JaxpFunctionResolver.java
(original)
+++
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/xpath20/JaxpFunctionResolver.java
Thu Dec 11 16:35:44 2008
@@ -124,6 +124,8 @@
return new Delete();
} else if (Constants.NON_STDRD_FUNCTION_RENAME.equals(localName)) {
return new Rename();
+ } else if
(Constants.NON_STDRD_FUNCTION_PROCESS_PROPERTY.equals(localName)) {
+ return new ProcessProperty();
}
}
@@ -1062,6 +1064,70 @@
}
}
+ public class ProcessProperty implements XPathFunction {
+ public Object evaluate(List args) throws XPathFunctionException {
+ if (args.size() != 1)
+ throw new XPathFunctionException(new FaultException(new
QName(Namespaces.ODE_EXTENSION_NS, "processPropertyInvalidSource"), "Invalid
arguments"));
+
+ if (__log.isDebugEnabled()) {
+ __log.debug("process-property call(context=" + _ectx + "
args=" + args + ")");
+ }
+
+ QName propertyName = null;
+ Element targetElmt = null;
+ try {
+ if (args.get(0) instanceof List) {
+ List elmts = (List) args.get(0);
+ if (elmts.size() != 1) throw new XPathFunctionException(
+ new
FaultException(_oxpath.getOwner().constants.qnSelectionFailure,
+ "The bpws:process-property function MUST
be passed a single " +
+ "element node."));
+ if (elmts.get(0) instanceof Element) {
+ targetElmt = (Element) elmts.get(0);
+ } else if (elmts.get(0) instanceof String) {
+ propertyName = new QName((String) elmts.get(0));
+ }
+ } else if (args.get(0) instanceof NodeWrapper) {
+ targetElmt = (Element) ((NodeWrapper)
args.get(0)).getUnderlyingNode();
+ } else if (args.get(0) instanceof Element) {
+ targetElmt = (Element) args.get(0);
+ } else if (args.get(0) instanceof QNameValue) {
+ QNameValue qNameValue = (QNameValue) args.get(0);
+ propertyName = new QName(qNameValue.getNamespaceURI(),
qNameValue.getLocalName(), qNameValue.getPrefix());
+ } else if (args.get(0) instanceof String) {
+ String stringValue = (String) args.get(0);
+ if (stringValue.indexOf(":") > 0) {
+ String prefix = stringValue.substring(0,
stringValue.indexOf(":"));
+ String localPart =
stringValue.substring(stringValue.indexOf(":") + 1);
+ String namespaceUri =
_oxpath.namespaceCtx.getNamespaceURI(prefix);
+ propertyName = new QName(namespaceUri,
localPart, prefix);
+ } else {
+ propertyName = new QName(stringValue);
+ }
+ } else if (args.get(0) instanceof QName) {
+ propertyName = (QName) args.get(0);
+ } else {
+ throw new XPathFunctionException("Unexpected argument
type: "+args.get(0).getClass());
+ }
+ if (propertyName == null) {
+ if (targetElmt != null) {
+ propertyName = new
QName(targetElmt.getTextContent());
+ }
+ }
+ } catch (IllegalArgumentException e) {
+ throw new XPathFunctionException(
+ new
FaultException(_oxpath.getOwner().constants.qnInvalidExpressionValue,
+ "Invalid argument: URI Template
expected. " + args.get(0), e));
+ } catch (ClassCastException e) {
+ throw new XPathFunctionException(
+ new
FaultException(_oxpath.getOwner().constants.qnSelectionFailure,
+ "The bpws:process-property function MUST be
passed a single " +
+ "element node."));
+ }
+ return _ectx.getPropertyValue(propertyName);
+ }
+ }
+
public static class Helper {
/**
* Extract a string from the given parameter.<br/>
Modified:
ode/trunk/runtimes/src/test/java/org/apache/ode/bpel/rtrep/v1/CoreBpelTest.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/test/java/org/apache/ode/bpel/rtrep/v1/CoreBpelTest.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/runtimes/src/test/java/org/apache/ode/bpel/rtrep/v1/CoreBpelTest.java
(original)
+++
ode/trunk/runtimes/src/test/java/org/apache/ode/bpel/rtrep/v1/CoreBpelTest.java
Thu Dec 11 16:35:44 2008
@@ -453,4 +453,9 @@
return null;
}
+ public Node getProcessProperty(QName propertyName) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified:
ode/trunk/runtimes/src/test/java/org/apache/ode/bpel/rtrep/v2/CoreBpelTest.java
URL:
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/test/java/org/apache/ode/bpel/rtrep/v2/CoreBpelTest.java?rev=725863&r1=725862&r2=725863&view=diff
==============================================================================
---
ode/trunk/runtimes/src/test/java/org/apache/ode/bpel/rtrep/v2/CoreBpelTest.java
(original)
+++
ode/trunk/runtimes/src/test/java/org/apache/ode/bpel/rtrep/v2/CoreBpelTest.java
Thu Dec 11 16:35:44 2008
@@ -493,4 +493,9 @@
// TODO Auto-generated method stub
}
+
+ public Node getProcessProperty(QName propertyName) {
+ // TODO Auto-generated method stub
+ return null;
+ }
}