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 2009/04/28 18:50:45 UTC
svn commit: r769458 [1/2] - in /ode/trunk:
bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/
bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/
bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/
bpel-test/src/test/java/...
Author: mriou
Date: Tue Apr 28 16:50:44 2009
New Revision: 769458
URL: http://svn.apache.org/viewvc?rev=769458&view=rev
Log:
Add support for from-spec inside a variable declaration to initialize it.
Added:
ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/
ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/ExtVarInlineInit.bpel
ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/ExtVarInlineInit.wsdl
ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/ExtVarInlineInit.xsd
ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/deploy.xml
ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/test.properties
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/TestInlineInit.bpel
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/TestInlineInit.wsdl
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/deploy.xml
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/test.properties
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/AssignHelper.java
Modified:
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGenerator.java
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompilerImpl.java
ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java
ode/trunk/bpel-test/src/test/java/org/apache/ode/test/DataHandling20Test.java
ode/trunk/bpel-test/src/test/java/org/apache/ode/test/ExternalVariableTest.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/OScope.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/SCOPE.java
Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java?rev=769458&r1=769457&r2=769458&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java Tue Apr 28 16:50:44 2009
@@ -18,6 +18,8 @@
*/
package org.apache.ode.bpel.compiler.bom;
+import java.util.Collections;
+
import javax.xml.namespace.QName;
import org.w3c.dom.Element;
@@ -114,4 +116,13 @@
public String getRelated() {
return getAttribute(ExtensibilityQNames.EXTVAR_RELATED, null);
}
+
+ /**
+ * Returns from-spec Element for variable inline initialization
+ * @author madars.vitolins _at gmail.com
+ * @return
+ */
+ public From getFrom() {
+ return getFirstChild(From.class);
+ }
}
Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGenerator.java?rev=769458&r1=769457&r2=769458&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGenerator.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGenerator.java Tue Apr 28 16:50:44 2009
@@ -183,7 +183,13 @@
__log.debug("Copy verified OK: " + ocopy);
}
- private OAssign.RValue compileFrom(From from) {
+ /**
+ * Create RValue interface object of 'from-spec'
+ * (madars.vitolins _at gmail.com - 2009.03.26
+ * Made public to reuse directly from compiler)
+ * @param from
+ */
+ public OAssign.RValue compileFrom(From from) {
assert from != null;
try {
if (from.isExtensionVal()) {
Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompilerImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompilerImpl.java?rev=769458&r1=769457&r2=769458&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompilerImpl.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompilerImpl.java Tue Apr 28 16:50:44 2009
@@ -82,6 +82,7 @@
import org.apache.ode.bpel.compiler.bom.Variable;
import org.apache.ode.bpel.compiler.wsdl.Definition4BPEL;
import org.apache.ode.bpel.compiler.wsdl.WSDLFactory4BPEL;
+import org.apache.ode.bpel.compiler.bom.From;
import org.apache.ode.bpel.compiler.*;
import org.apache.ode.bpel.rtrep.v2.DebugInfo;
import org.apache.ode.bpel.rtrep.v2.OActivity;
@@ -1117,6 +1118,17 @@
try {
compile(oscope, src, new Runnable() {
public void run() {
+
+ //madars.vitolins _at gmail.com 2009.04.13 - moved before variables, because
+ //inline variable initialization may depend on partner links
+ for (PartnerLink plink : src.getPartnerLinks()) {
+ try {
+ compile(plink);
+ } catch (CompilationException ce) {
+ recoveredFromError(plink, ce);
+ }
+ }
+
for (Variable var : src.getVariables()) {
try {
compile(var);
@@ -1132,15 +1144,7 @@
recoveredFromError(cset, ce);
}
}
-
- for (PartnerLink plink : src.getPartnerLinks()) {
- try {
- compile(plink);
- } catch (CompilationException ce) {
- recoveredFromError(plink, ce);
- }
- }
-
+
if (!src.getEvents().isEmpty() || !src.getAlarms().isEmpty()) {
oscope.eventHandler = new OEventHandler(_oprocess);
oscope.eventHandler.debugInfo = createDebugInfo(src, "Event Handler for " + src);
@@ -1369,10 +1373,18 @@
}
OScope.Variable ovar = new OScope.Variable(_oprocess, varType);
+ //madars.vitolins _at gmail.com 2009.03.25 Inline variable initialization
+ //reusing 'compileFrom()' from AssignGenerator
+ AssignGenerator agen = new AssignGenerator();
+ agen.setContext(this);
ovar.name = src.getName();
ovar.declaringScope = oscope;
ovar.debugInfo = createDebugInfo(src, null);
-
+ From varfromSpec=src.getFrom();
+ if (varfromSpec!=null)
+ ovar.from=agen.compileFrom(varfromSpec);
+ else
+ ovar.from=null;
ovar.extVar = compileExtVar(src);
oscope.addLocalVariable(ovar);
Modified: ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java?rev=769458&r1=769457&r2=769458&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java (original)
+++ ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java Tue Apr 28 16:50:44 2009
@@ -77,6 +77,8 @@
suite.addTest(new GoodCompileTCase("/2.0/good/xpath20-func/GetVariableProperty1-xp2.0.bpel"));
suite.addTest(new GoodCompileTCase("/2.0/good/xsd-import/helloworld-Server.bpel"));
suite.addTest(new GoodCompileTCase("/2.0/good/extensionActivity/ExtensionActivity1-2.0.bpel"));
+ //madars.vitolins _at gmail.com 2009.04.05 Inline variable initalization test
+ suite.addTest(new GoodCompileTCase("/2.0/good/inlineinit/inlineinit1-2.0.bpel"));
return suite;
}
Modified: ode/trunk/bpel-test/src/test/java/org/apache/ode/test/DataHandling20Test.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/DataHandling20Test.java?rev=769458&r1=769457&r2=769458&view=diff
==============================================================================
--- ode/trunk/bpel-test/src/test/java/org/apache/ode/test/DataHandling20Test.java (original)
+++ ode/trunk/bpel-test/src/test/java/org/apache/ode/test/DataHandling20Test.java Tue Apr 28 16:50:44 2009
@@ -83,4 +83,9 @@
@Test public void testXQueryExpression() throws Throwable {
go("/bpel/2.0/TestXQueryExpression");
}
+ //madars.vitolins _at gmail.com 2009.04.11
+ //Inline variable initialization test
+ @Test public void testInlineVarInit() throws Throwable {
+ go("/bpel/2.0/TestInlineVarInit");
+ }
}
Modified: ode/trunk/bpel-test/src/test/java/org/apache/ode/test/ExternalVariableTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/ExternalVariableTest.java?rev=769458&r1=769457&r2=769458&view=diff
==============================================================================
--- ode/trunk/bpel-test/src/test/java/org/apache/ode/test/ExternalVariableTest.java (original)
+++ ode/trunk/bpel-test/src/test/java/org/apache/ode/test/ExternalVariableTest.java Tue Apr 28 16:50:44 2009
@@ -82,4 +82,14 @@
public void testExtVarKeyGen() throws Throwable {
go("/bpel/2.0/ExtVar-GenKey");
}
+
+ /**
+ * Test inline variable initialization for external variables
+ * @author madars.vitolins _at gmail.com, 2009.04.11
+ * @throws Throwable
+ */
+ @Test
+ public void testExtVarInlineInit() throws Throwable {
+ go("/bpel/2.0/ExtVarInlineInit");
+ }
}
Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/ExtVarInlineInit.bpel
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/ExtVarInlineInit.bpel?rev=769458&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/ExtVarInlineInit.bpel (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/ExtVarInlineInit.bpel Tue Apr 28 16:50:44 2009
@@ -0,0 +1,240 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<process name="ExtVarInlineInit" targetNamespace="http://ode/bpel/unit-test"
+ 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-test"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://ode/bpel/unit-test.wsdl"
+ xmlns:foo="http://foo/extvar"
+ xmlns:xvar="http://ode.apache.org/externalVariables"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import namespace="http://foo/extvar" location="ExtVarInlineInit.xsd" importType="http://www.w3.org/2001/XMLSchema"/>
+
+ <import location="ExtVarInlineInit.wsdl" namespace="http://ode/bpel/unit-test.wsdl" importType="http://schemas.xmlsoap.org/wsdl/" />
+
+
+ <partnerLinks>
+ <partnerLink name="ExtVarPartnerLink" partnerLinkType="test:ExtVarPartnerLinkType" myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:ExtVarMessage"/>
+ <variable name="costPerCustomer-keys" element="foo:costPerCustomer-keys"/>
+ <!-- Test the inline variable initialization! -->
+ <variable name="costPerCustomer" element="foo:costPerCustomer" xvar:id="costPerCustomer" xvar:relates-to="costPerCustomer-keys">
+ <from>
+ <literal>
+ <foo:costPerCustomer>
+ <foo:key1>k1</foo:key1>
+ <foo:value0>v1</foo:value0>
+ </foo:costPerCustomer>
+ </literal>
+ </from>
+ </variable>
+ </variables>
+
+ <sequence>
+ <receive name="start" partnerLink="ExtVarPartnerLink" portType="test:ExtVarPortType"
+ operation="extvar" variable="myVar" createInstance="yes"/>
+
+
+ <!-- insert new row by assigning directly into the external variable -->
+<!--
+ <assign name="insertNewRow">
+ <copy>
+ <from>
+ <literal>
+ <foo:costPerCustomer>
+ <foo:key1>k1</foo:key1>
+ <foo:value0>v1</foo:value0>
+ </foo:costPerCustomer>
+ </literal>
+ </from>
+ <to>$costPerCustomer</to>
+ </copy>
+ </assign>
+-->
+ <!-- Test key -->
+ <if>
+ <condition>normalize-space($costPerCustomer-keys/foo:key1) = 'k1'</condition>
+ <empty/>
+ <else>
+ <throw faultName="foo:key1NotCreated"/>
+ </else>
+ </if>
+ <!-- Test value -->
+ <if>
+ <condition>normalize-space($costPerCustomer/foo:value0) = 'v1'</condition>
+ <empty/>
+ <else>
+ <throw faultName="foo:key1NotCreated"/>
+ </else>
+ </if>
+
+ <!-- send back response -->
+
+ <assign name="assignResponse">
+ <copy>
+ <from>
+ <literal>
+ <foo:response>
+ <foo:keys/>
+ <foo:values/>
+ </foo:response>
+ </literal>
+ </from>
+ <to>$myVar.TestPart</to>
+ </copy>
+ <copy>
+ <from>$costPerCustomer-keys</from>
+ <to>$myVar.TestPart/foo:keys</to>
+ </copy>
+ <copy>
+ <from>$costPerCustomer</from>
+ <to>$myVar.TestPart/foo:values</to>
+ </copy>
+ </assign>
+
+ <reply name="end" partnerLink="ExtVarPartnerLink" portType="test:ExtVarPortType" operation="extvar" variable="myVar"/>
+ </sequence>
+</process>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<process name="ExtVarInlineInit" targetNamespace="http://ode/bpel/unit-test"
+ 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-test"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://ode/bpel/unit-test.wsdl"
+ xmlns:foo="http://foo/extvar"
+ xmlns:xvar="http://ode.apache.org/externalVariables"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import namespace="http://foo/extvar" location="ExtVarInlineInit.xsd" importType="http://www.w3.org/2001/XMLSchema"/>
+
+ <import location="ExtVarInlineInit.wsdl" namespace="http://ode/bpel/unit-test.wsdl" importType="http://schemas.xmlsoap.org/wsdl/" />
+
+
+ <partnerLinks>
+ <partnerLink name="ExtVarPartnerLink" partnerLinkType="test:ExtVarPartnerLinkType" myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:ExtVarMessage"/>
+ <variable name="costPerCustomer-keys" element="foo:costPerCustomer-keys"/>
+ <!-- Test the inline variable initialization! -->
+ <variable name="costPerCustomer" element="foo:costPerCustomer" xvar:id="costPerCustomer" xvar:relates-to="costPerCustomer-keys">
+ <from>
+ <literal>
+ <foo:costPerCustomer>
+ <foo:key1>k1</foo:key1>
+ <foo:value0>v1</foo:value0>
+ </foo:costPerCustomer>
+ </literal>
+ </from>
+ </variable>
+ </variables>
+
+ <sequence>
+ <receive name="start" partnerLink="ExtVarPartnerLink" portType="test:ExtVarPortType"
+ operation="extvar" variable="myVar" createInstance="yes"/>
+
+
+ <!-- insert new row by assigning directly into the external variable -->
+<!--
+ <assign name="insertNewRow">
+ <copy>
+ <from>
+ <literal>
+ <foo:costPerCustomer>
+ <foo:key1>k1</foo:key1>
+ <foo:value0>v1</foo:value0>
+ </foo:costPerCustomer>
+ </literal>
+ </from>
+ <to>$costPerCustomer</to>
+ </copy>
+ </assign>
+-->
+ <!-- Test key -->
+ <if>
+ <condition>normalize-space($costPerCustomer-keys/foo:key1) = 'k1'</condition>
+ <empty/>
+ <else>
+ <throw faultName="foo:key1NotCreated"/>
+ </else>
+ </if>
+ <!-- Test value -->
+ <if>
+ <condition>normalize-space($costPerCustomer/foo:value0) = 'v1'</condition>
+ <empty/>
+ <else>
+ <throw faultName="foo:key1NotCreated"/>
+ </else>
+ </if>
+
+ <!-- send back response -->
+
+ <assign name="assignResponse">
+ <copy>
+ <from>
+ <literal>
+ <foo:response>
+ <foo:keys/>
+ <foo:values/>
+ </foo:response>
+ </literal>
+ </from>
+ <to>$myVar.TestPart</to>
+ </copy>
+ <copy>
+ <from>$costPerCustomer-keys</from>
+ <to>$myVar.TestPart/foo:keys</to>
+ </copy>
+ <copy>
+ <from>$costPerCustomer</from>
+ <to>$myVar.TestPart/foo:values</to>
+ </copy>
+ </assign>
+
+ <reply name="end" partnerLink="ExtVarPartnerLink" portType="test:ExtVarPortType" operation="extvar" variable="myVar"/>
+ </sequence>
+</process>
Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/ExtVarInlineInit.wsdl
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/ExtVarInlineInit.wsdl?rev=769458&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/ExtVarInlineInit.wsdl (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/ExtVarInlineInit.wsdl Tue Apr 28 16:50:44 2009
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ 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.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://ode/bpel/unit-test.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://ode/bpel/unit-test.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+
+
+ <wsdl:message name="ExtVarMessage">
+ <wsdl:part name="TestPart" type="xsd:string"/>
+ </wsdl:message>
+
+ <wsdl:portType name="ExtVarPortType">
+ <wsdl:operation name="extvar">
+ <wsdl:input message="tns:ExtVarMessage" name="TestIn"/>
+ <wsdl:output message="tns:ExtVarMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="ExtVarSoapBinding" type="tns:ExtVarPortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="extvar">
+ <soap:operation soapAction="" style="rpc"/>
+ <wsdl:input>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="ExtVarService">
+ <wsdl:port name="ExtVarPort" binding="tns:ExtVarSoapBinding">
+ <soap:address location="http://localhost:8080/ode/processes/extvarinlineinit"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="ExtVarPartnerLinkType">
+ <plnk:role name="me" portType="tns:ExtVarPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
+
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ 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.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://ode/bpel/unit-test.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://ode/bpel/unit-test.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+
+
+ <wsdl:message name="ExtVarMessage">
+ <wsdl:part name="TestPart" type="xsd:string"/>
+ </wsdl:message>
+
+ <wsdl:portType name="ExtVarPortType">
+ <wsdl:operation name="extvar">
+ <wsdl:input message="tns:ExtVarMessage" name="TestIn"/>
+ <wsdl:output message="tns:ExtVarMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="ExtVarSoapBinding" type="tns:ExtVarPortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="extvar">
+ <soap:operation soapAction="" style="rpc"/>
+ <wsdl:input>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="ExtVarService">
+ <wsdl:port name="ExtVarPort" binding="tns:ExtVarSoapBinding">
+ <soap:address location="http://localhost:8080/ode/processes/extvarinlineinit"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="ExtVarPartnerLinkType">
+ <plnk:role name="me" portType="tns:ExtVarPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
+
Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/ExtVarInlineInit.xsd
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/ExtVarInlineInit.xsd?rev=769458&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/ExtVarInlineInit.xsd (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/ExtVarInlineInit.xsd Tue Apr 28 16:50:44 2009
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://foo/extvar"
+ xmlns:tns="http://foo/extvar"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified">
+
+ <element name="costPerCustomer">
+ <complexType>
+ <sequence>
+ <element name="value0" type="xs:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="costPerCustomer-keys">
+ <complexType>
+ <sequence>
+ <element name="key1" type="xs:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+</schema>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://foo/extvar"
+ xmlns:tns="http://foo/extvar"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified">
+
+ <element name="costPerCustomer">
+ <complexType>
+ <sequence>
+ <element name="value0" type="xs:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="costPerCustomer-keys">
+ <complexType>
+ <sequence>
+ <element name="key1" type="xs:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+</schema>
\ No newline at end of file
Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/deploy.xml
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/deploy.xml?rev=769458&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/deploy.xml (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/deploy.xml Tue Apr 28 16:50:44 2009
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:pns="http://ode/bpel/unit-test"
+ xmlns:wns="http://ode/bpel/unit-test.wsdl"
+ xmlns:xvar="http://ode.apache.org/externalVariables"
+ xmlns:jdbc="http://ode.apache.org/externalVariables/jdbc">
+
+ <process name="pns:ExtVarInlineInit">
+ <active>true</active>
+ <provide partnerLink="ExtVarPartnerLink">
+ <service name="wns:ExtVarService" port="ExtVarPort"/>
+ </provide>
+
+ <xvar:externalVariable id="costPerCustomer">
+ <jdbc:jdbc>
+ <jdbc:datasource-ref>testds</jdbc:datasource-ref>
+ <jdbc:table>costPerCustomer</jdbc:table>
+ <jdbc:column name="key1" key="yes" sql-type="VARCHAR" xsd-type="xs:string" />
+ <jdbc:column name="value0" key="no" sql-type="VARCHAR" xsd-type="xs:string" />
+ <jdbc:init mode="update-insert"></jdbc:init>
+ </jdbc:jdbc>
+ </xvar:externalVariable>
+
+ </process>
+</deploy>
+
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:pns="http://ode/bpel/unit-test"
+ xmlns:wns="http://ode/bpel/unit-test.wsdl"
+ xmlns:xvar="http://ode.apache.org/externalVariables"
+ xmlns:jdbc="http://ode.apache.org/externalVariables/jdbc">
+
+ <process name="pns:ExtVarInlineInit">
+ <active>true</active>
+ <provide partnerLink="ExtVarPartnerLink">
+ <service name="wns:ExtVarService" port="ExtVarPort"/>
+ </provide>
+
+ <xvar:externalVariable id="costPerCustomer">
+ <jdbc:jdbc>
+ <jdbc:datasource-ref>testds</jdbc:datasource-ref>
+ <jdbc:table>costPerCustomer</jdbc:table>
+ <jdbc:column name="key1" key="yes" sql-type="VARCHAR" xsd-type="xs:string" />
+ <jdbc:column name="value0" key="no" sql-type="VARCHAR" xsd-type="xs:string" />
+ <jdbc:init mode="update-insert"></jdbc:init>
+ </jdbc:jdbc>
+ </xvar:externalVariable>
+
+ </process>
+</deploy>
+
Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/test.properties
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/test.properties?rev=769458&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/test.properties (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/ExtVarInlineInit/test.properties Tue Apr 28 16:50:44 2009
@@ -0,0 +1,72 @@
+#
+# 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.
+#
+
+namespace=http://ode/bpel/unit-test.wsdl
+service=ExtVarService
+operation=extvar
+request1=<message><TestPart>Hello</TestPart></message>
+response1=.*k1.*k1.*v1.*
+
+# Response should look something like:
+# <?xml version="1.0" encoding="UTF-8"?>
+#<message>
+# <TestPart>
+# <keys xmlns="http://foo/extvar">
+# <key1>k1</key1>
+# </keys>
+# <values xmlns="http://foo/extvar">
+# <key1>k1</key1>
+# <value0>v1</value0>
+# </values>
+# </TestPart>
+#</message>
+#
+# 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.
+#
+
+namespace=http://ode/bpel/unit-test.wsdl
+service=ExtVarService
+operation=extvar
+request1=<message><TestPart>Hello</TestPart></message>
+response1=.*k1.*k1.*v1.*
+
+# Response should look something like:
+# <?xml version="1.0" encoding="UTF-8"?>
+#<message>
+# <TestPart>
+# <keys xmlns="http://foo/extvar">
+# <key1>k1</key1>
+# </keys>
+# <values xmlns="http://foo/extvar">
+# <key1>k1</key1>
+# <value0>v1</value0>
+# </values>
+# </TestPart>
+#</message>
Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/TestInlineInit.bpel
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/TestInlineInit.bpel?rev=769458&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/TestInlineInit.bpel (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/TestInlineInit.bpel Tue Apr 28 16:50:44 2009
@@ -0,0 +1,188 @@
+<!--
+ ~ 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.
+ -->
+
+<process name="TestInlineInit"
+ targetNamespace="http://ode/bpel/unit-testInlineInit1"
+ xmlns:ode="http://www.apache.org/ode/type/extension"
+ 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-testInlineInit1"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://ode/bpel/unit-testInlineInit1.wsdl"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="TestInlineInit.wsdl"
+ namespace="http://ode/bpel/unit-testInlineInit1.wsdl"
+ importType="http://schemas.xmlsoap.org/wsdl/" />
+
+ <partnerLinks>
+ <partnerLink name="TestInlineInitPLnk" partnerLinkType="test:TestInlineInitPLnkType" myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:TestInlineInitMessage"/>
+ <variable name="otherMsgVar" messageType="test:TestInlineInitMessage"/>
+ </variables>
+
+ <sequence>
+
+ <receive name="start" partnerLink="TestInlineInitPLnk" portType="test:TestInlineInitPortType"
+ operation="testInlineInit" variable="myVar" createInstance="yes"/>
+ <scope>
+ <variables>
+
+ <!-- Int operations -->
+ <variable name="intVar" type="xsd:int">
+ <from>1+1</from>
+ </variable>
+ <variable name="intVar2" type="xsd:int">
+ <from>$intVar</from>
+ </variable>
+ <variable name="intVar3" type="xsd:int">
+ <from>$intVar + 1</from>
+ </variable>
+ <variable name="intVar4" type="xsd:int">
+ <from>abs($intVar + number('2')) + $intVar3 + $intVar2</from>
+ </variable>
+ <variable name="boolVar" type="xsd:boolean">
+ <from>$intVar4 = 9</from>
+ </variable>
+ <!-- String operations -->
+ <variable name="strVar" type="xsd:string">
+ <from>$myVar.TestPart</from>
+ </variable>
+ <variable name="strVar2" type="xsd:string">
+ <from>"testtest"</from>
+ </variable>
+ <variable name="strVar3" type="xsd:string">
+ <from>$ode:pid</from>
+ </variable>
+ </variables>
+ <sequence>
+ <assign name="assign1">
+ <copy>
+ <from>concat($strVar,'-', $strVar2, '-', $intVar,'-',$intVar2,'-',$intVar3,'-',$intVar4,'-',$boolVar)</from>
+ <to variable="myVar" part="TestPart"/>
+ </copy>
+ <copy>
+ <from variable="myVar" part="TestPart"/>
+ <to variable="otherMsgVar" part="TestPart"/>
+ </copy>
+ </assign>
+ </sequence>
+ </scope>
+ <reply name="end" partnerLink="TestInlineInitPLnk" portType="test:TestInlineInitPortType"
+ operation="testInlineInit" variable="otherMsgVar"/>
+ </sequence>
+</process>
+<!--
+ ~ 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.
+ -->
+
+<process name="TestInlineInit"
+ targetNamespace="http://ode/bpel/unit-testInlineInit1"
+ xmlns:ode="http://www.apache.org/ode/type/extension"
+ 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-testInlineInit1"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://ode/bpel/unit-testInlineInit1.wsdl"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="TestInlineInit.wsdl"
+ namespace="http://ode/bpel/unit-testInlineInit1.wsdl"
+ importType="http://schemas.xmlsoap.org/wsdl/" />
+
+ <partnerLinks>
+ <partnerLink name="TestInlineInitPLnk" partnerLinkType="test:TestInlineInitPLnkType" myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:TestInlineInitMessage"/>
+ <variable name="otherMsgVar" messageType="test:TestInlineInitMessage"/>
+ </variables>
+
+ <sequence>
+
+ <receive name="start" partnerLink="TestInlineInitPLnk" portType="test:TestInlineInitPortType"
+ operation="testInlineInit" variable="myVar" createInstance="yes"/>
+ <scope>
+ <variables>
+
+ <!-- Int operations -->
+ <variable name="intVar" type="xsd:int">
+ <from>1+1</from>
+ </variable>
+ <variable name="intVar2" type="xsd:int">
+ <from>$intVar</from>
+ </variable>
+ <variable name="intVar3" type="xsd:int">
+ <from>$intVar + 1</from>
+ </variable>
+ <variable name="intVar4" type="xsd:int">
+ <from>abs($intVar + number('2')) + $intVar3 + $intVar2</from>
+ </variable>
+ <variable name="boolVar" type="xsd:boolean">
+ <from>$intVar4 = 9</from>
+ </variable>
+ <!-- String operations -->
+ <variable name="strVar" type="xsd:string">
+ <from>$myVar.TestPart</from>
+ </variable>
+ <variable name="strVar2" type="xsd:string">
+ <from>"testtest"</from>
+ </variable>
+ <variable name="strVar3" type="xsd:string">
+ <from>$ode:pid</from>
+ </variable>
+ </variables>
+ <sequence>
+ <assign name="assign1">
+ <copy>
+ <from>concat($strVar,'-', $strVar2, '-', $intVar,'-',$intVar2,'-',$intVar3,'-',$intVar4,'-',$boolVar)</from>
+ <to variable="myVar" part="TestPart"/>
+ </copy>
+ <copy>
+ <from variable="myVar" part="TestPart"/>
+ <to variable="otherMsgVar" part="TestPart"/>
+ </copy>
+ </assign>
+ </sequence>
+ </scope>
+ <reply name="end" partnerLink="TestInlineInitPLnk" portType="test:TestInlineInitPortType"
+ operation="testInlineInit" variable="otherMsgVar"/>
+ </sequence>
+</process>
Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/TestInlineInit.wsdl
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/TestInlineInit.wsdl?rev=769458&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/TestInlineInit.wsdl (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/TestInlineInit.wsdl Tue Apr 28 16:50:44 2009
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="utf-8" ?>
+
+<!--
+ ~ 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.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://ode/bpel/unit-testInlineInit1.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://ode/bpel/unit-testInlineInit1.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+
+ <wsdl:message name="TestInlineInitMessage">
+ <wsdl:part name="TestPart" type="xsd:string"/>
+ </wsdl:message>
+
+ <wsdl:portType name="TestInlineInitPortType">
+ <wsdl:operation name="testInlineInit">
+ <wsdl:input message="tns:TestInlineInitMessage" name="TestIn"/>
+ <wsdl:output message="tns:TestInlineInitMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="TestInlineInitSoapBinding" type="tns:TestInlineInitPortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="testInlineInit">
+ <soap:operation soapAction="" style="rpc"/>
+ <wsdl:input>
+ <soap:body namespace="http://ode/bpel/unit-test.wsdl" use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body namespace="http://ode/bpel/unit-test.wsdl" use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="TestInlineInitService">
+ <wsdl:port name="TestInlineInitPort" binding="tns:TestInlineInitSoapBinding">
+ <soap:address location="http://localhost:8080/ode/processes/TestInlineInit"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="TestInlineInitPLnkType">
+ <plnk:role name="me" portType="tns:TestInlineInitPortType"/>
+ <plnk:role name="you" portType="tns:TestInlineInitPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
+
+<?xml version="1.0" encoding="utf-8" ?>
+
+<!--
+ ~ 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.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://ode/bpel/unit-testInlineInit1.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://ode/bpel/unit-testInlineInit1.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+
+ <wsdl:message name="TestInlineInitMessage">
+ <wsdl:part name="TestPart" type="xsd:string"/>
+ </wsdl:message>
+
+ <wsdl:portType name="TestInlineInitPortType">
+ <wsdl:operation name="testInlineInit">
+ <wsdl:input message="tns:TestInlineInitMessage" name="TestIn"/>
+ <wsdl:output message="tns:TestInlineInitMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="TestInlineInitSoapBinding" type="tns:TestInlineInitPortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="testInlineInit">
+ <soap:operation soapAction="" style="rpc"/>
+ <wsdl:input>
+ <soap:body namespace="http://ode/bpel/unit-test.wsdl" use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body namespace="http://ode/bpel/unit-test.wsdl" use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="TestInlineInitService">
+ <wsdl:port name="TestInlineInitPort" binding="tns:TestInlineInitSoapBinding">
+ <soap:address location="http://localhost:8080/ode/processes/TestInlineInit"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="TestInlineInitPLnkType">
+ <plnk:role name="me" portType="tns:TestInlineInitPortType"/>
+ <plnk:role name="you" portType="tns:TestInlineInitPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
+
Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/deploy.xml
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/deploy.xml?rev=769458&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/deploy.xml (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/deploy.xml Tue Apr 28 16:50:44 2009
@@ -0,0 +1,64 @@
+<!--
+ ~ 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.
+ -->
+
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:pns="http://ode/bpel/unit-testInlineInit1"
+ xmlns:wns="http://ode/bpel/unit-testInlineInit1.wsdl">
+
+
+ <process name="pns:TestInlineInit">
+ <active>true</active>
+ <provide partnerLink="TestInlineInitPLnk">
+ <service name="wns:TestInlineInitService" port="TestInlineInitPort"/>
+ <service name="wns:TestInlineInitService" port="TestInlineInitPort"/>
+ </provide>
+ </process>
+</deploy>
+<!--
+ ~ 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.
+ -->
+
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:pns="http://ode/bpel/unit-testInlineInit1"
+ xmlns:wns="http://ode/bpel/unit-testInlineInit1.wsdl">
+
+
+ <process name="pns:TestInlineInit">
+ <active>true</active>
+ <provide partnerLink="TestInlineInitPLnk">
+ <service name="wns:TestInlineInitService" port="TestInlineInitPort"/>
+ <service name="wns:TestInlineInitService" port="TestInlineInitPort"/>
+ </provide>
+ </process>
+</deploy>
Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/test.properties
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/test.properties?rev=769458&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/test.properties (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestInlineVarInit/test.properties Tue Apr 28 16:50:44 2009
@@ -0,0 +1,44 @@
+#
+# 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.
+#
+
+namespace=http://ode/bpel/unit-testInlineInit1.wsdl
+service=TestInlineInitService
+operation=testInlineInit
+request1=<message><TestPart>Hello</TestPart></message>
+response1=.*Hello-testtest-2-2-3-9-true.*
+#
+# 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.
+#
+
+namespace=http://ode/bpel/unit-testInlineInit1.wsdl
+service=TestInlineInitService
+operation=testInlineInit
+request1=<message><TestPart>Hello</TestPart></message>
+response1=.*Hello-testtest-2-2-3-9-true.*
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=769458&r1=769457&r2=769458&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 Tue Apr 28 16:50:44 2009
@@ -37,15 +37,11 @@
import org.apache.ode.bpel.extension.ExtensionOperation;
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.Namespaces;
-import org.apache.ode.utils.msg.MessageBundle;
import org.apache.ode.bpel.evar.ExternalVariableModuleException;
-import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
/**
* Assign activity run-time template.
@@ -57,9 +53,6 @@
private static final long serialVersionUID = 1L;
private static final Log __log = LogFactory.getLog(ASSIGN.class);
-
- private static final ASSIGNMessages __msgs = MessageBundle
- .getMessages(ASSIGNMessages.class);
public ASSIGN(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame linkFrame) {
super(self, scopeFrame, linkFrame);
@@ -120,204 +113,13 @@
return (OAssign) _self.o;
}
- private Node evalLValue(OAssign.LValue to) throws FaultException, ExternalVariableModuleException {
- final OdeInternalInstance napi = getBpelRuntime();
- Node lval = null;
- if (!(to instanceof OAssign.PartnerLinkRef)) {
- VariableInstance lvar = _scopeFrame.resolve(to.getVariable());
- if (!napi.isVariableInitialized(lvar)) {
- Document doc = DOMUtils.newDocument();
- Node val = to.getVariable().type.newInstance(doc);
- if (val.getNodeType() == Node.TEXT_NODE) {
- Element tempwrapper = doc.createElementNS(null, "temporary-simple-type-wrapper");
- doc.appendChild(tempwrapper);
- tempwrapper.appendChild(val);
- val = tempwrapper;
- } else doc.appendChild(val);
- // Only external variables need to be initialized, others are new and going to be overwritten
- if (lvar.declaration.extVar != null) lval = initializeVariable(lvar, val);
- else lval = val;
- } else
- lval = fetchVariableData(lvar, true);
- }
- return lval;
- }
-
- /**
- * Get the r-value. There are several possibilities:
- * <ul>
- * <li>a message is selected - an element representing the whole message is
- * returned.</li>
- * <li>a (element) message part is selected - the element is returned.
- * </li>
- * <li>a (typed) message part is select - a wrapper element is returned.
- * </li>
- * <li>an attribute is selected - an attribute node is returned. </li>
- * <li>a text node/string expression is selected - a text node is returned.
- * </li>
- * </ul>
- *
- * @param from
- *
- * @return Either {@link Element}, {@link org.w3c.dom.Text}, or
- * {@link org.w3c.dom.Attr} node representing the r-value.
- *
- * @throws FaultException
- * DOCUMENTME
- * @throws UnsupportedOperationException
- * DOCUMENTME
- * @throws IllegalStateException
- * DOCUMENTME
- */
- private Node evalRValue(OAssign.RValue from) throws FaultException, ExternalVariableModuleException {
- if (__log.isDebugEnabled())
- __log.debug("Evaluating FROM expression \"" + from + "\".");
-
- Node retVal;
- if (from instanceof OAssign.DirectRef) {
- OAssign.DirectRef dref = (OAssign.DirectRef) from;
- sendVariableReadEvent(_scopeFrame.resolve(dref.variable));
- Node data = fetchVariableData(_scopeFrame.resolve(dref.variable), false);
- retVal = DOMUtils.findChildByName((Element)data, dref.elName);
- } else if (from instanceof OAssign.VariableRef) {
- OAssign.VariableRef varRef = (OAssign.VariableRef) from;
- sendVariableReadEvent(_scopeFrame.resolve(varRef.variable));
- Node data = fetchVariableData(_scopeFrame.resolve(varRef.variable), false);
- retVal = evalQuery(data, varRef.part != null ? varRef.part : varRef.headerPart, varRef.location, getEvaluationContext());
- } else if (from instanceof OAssign.PropertyRef) {
- OAssign.PropertyRef propRef = (OAssign.PropertyRef) from;
- sendVariableReadEvent(_scopeFrame.resolve(propRef.variable));
- Node data = fetchVariableData(_scopeFrame.resolve(propRef.variable), false);
- retVal = evalQuery(data, propRef.propertyAlias.part,
- propRef.propertyAlias.location, getEvaluationContext());
- } else if (from instanceof OAssign.PartnerLinkRef) {
- OAssign.PartnerLinkRef pLinkRef = (OAssign.PartnerLinkRef) from;
- PartnerLinkInstance pLink = _scopeFrame.resolve(pLinkRef.partnerLink);
- Node tempVal =pLinkRef.isMyEndpointReference ?
- getBpelRuntime().fetchMyRoleEndpointReferenceData(pLink)
- : getBpelRuntime().fetchPartnerRoleEndpointReferenceData(pLink);
- if (__log.isDebugEnabled())
- __log.debug("RValue is a partner link, corresponding endpoint "
- + tempVal.getClass().getName() + " has value " + DOMUtils.domToString(tempVal));
- retVal = tempVal;
- } else if (from instanceof OAssign.Expression) {
- OExpression expr = ((OAssign.Expression) from).expression;
- List<Node> l = getBpelRuntime().getExpLangRuntime().evaluate(expr, getEvaluationContext());
-
- if (l.size() == 0) {
- String msg = __msgs.msgRValueNoNodesSelected(expr.toString());
- if (__log.isDebugEnabled()) __log.debug(from + ": " + msg);
- throw new FaultException(getOAsssign().getOwner().constants
- .qnSelectionFailure, msg, new Throwable("ignoreMissingFromData"));
- } else if (l.size() > 1) {
- String msg = __msgs.msgRValueMultipleNodesSelected(expr.toString());
- if (__log.isDebugEnabled()) __log.debug(from + ": " + msg);
- throw new FaultException(getOAsssign().getOwner().constants.qnSelectionFailure, msg);
- }
- retVal = l.get(0);
- } else if (from instanceof OAssign.Literal) {
- Element literalRoot = ((OAssign.Literal) from).getXmlLiteral().getDocumentElement();
- assert literalRoot.getLocalName().equals("literal");
- // We'd like a single text node...
-
- literalRoot.normalize();
- retVal = literalRoot.getFirstChild();
-
- // Adjust for whitespace before an element.
- if (retVal != null && retVal.getNodeType() == Node.TEXT_NODE
- && retVal.getTextContent().trim().length() == 0
- && retVal.getNextSibling() != null) {
- retVal = retVal.getNextSibling();
- }
-
- if (retVal == null) {
- // Special case, no children --> empty TII
- retVal = literalRoot.getOwnerDocument().createTextNode("");
- } else if (retVal.getNodeType() == Node.ELEMENT_NODE) {
- // Make sure there is no more elements.
- Node x = retVal.getNextSibling();
- while (x != null) {
- if (x.getNodeType() == Node.ELEMENT_NODE) {
- String msg = __msgs.msgLiteralContainsMultipleEIIs();
- if (__log.isDebugEnabled())
- __log.debug(from + ": " + msg);
- throw new FaultException(
- getOAsssign().getOwner().constants.qnSelectionFailure,
- msg);
-
- }
- x = x.getNextSibling();
- }
- } else if (retVal.getNodeType() == Node.TEXT_NODE) {
- // Make sure there are no elements following this text node.
- Node x = retVal.getNextSibling();
- while (x != null) {
- if (x.getNodeType() == Node.ELEMENT_NODE) {
- String msg = __msgs.msgLiteralContainsMixedContent();
- if (__log.isDebugEnabled())
- __log.debug(from + ": " + msg);
- throw new FaultException(
- getOAsssign().getOwner().constants.qnSelectionFailure,
- msg);
-
- }
- x = x.getNextSibling();
- }
-
- }
-
- if (retVal == null) {
- String msg = __msgs.msgLiteralMustContainTIIorEII();
- if (__log.isDebugEnabled())
- __log.debug(from + ": " + msg);
- throw new FaultException(
- getOAsssign().getOwner().constants.qnSelectionFailure,
- msg);
- }
- } else {
- String msg = __msgs
- .msgInternalError("Unknown RVALUE type: " + from);
- if (__log.isErrorEnabled())
- __log.error(from + ": " + msg);
- throw new FaultException(
- getOAsssign().getOwner().constants.qnSelectionFailure, msg);
- }
-
- // Now verify we got something.
- if (retVal == null) {
- String msg = __msgs.msgEmptyRValue();
- if (__log.isDebugEnabled())
- __log.debug(from + ": " + msg);
- throw new FaultException(
- getOAsssign().getOwner().constants.qnSelectionFailure, msg);
- }
-
- // Now check that we got the right thing.
- switch (retVal.getNodeType()) {
- case Node.TEXT_NODE:
- case Node.ATTRIBUTE_NODE:
- case Node.ELEMENT_NODE:
- case Node.CDATA_SECTION_NODE:
- break;
- default:
- String msg = __msgs.msgInvalidRValue();
- if (__log.isDebugEnabled())
- __log.debug(from + ": " + msg);
-
- throw new FaultException(
- getOAsssign().getOwner().constants.qnSelectionFailure, msg);
-
- }
-
- return retVal;
- }
-
private void copy(OAssign.Copy ocopy) throws FaultException, ExternalVariableModuleException {
if (__log.isDebugEnabled())
__log.debug("Assign.copy(" + ocopy + ")");
ScopeEvent se;
+ AssignHelper assignHelper = new AssignHelper(_self, _scopeFrame, _linkFrame);
// Check for message to message - copy, we can do this efficiently in
// the database.
@@ -350,8 +152,8 @@
}
} else {
// Conventional Assignment logic.
- Node rvalue = evalRValue(ocopy.from);
- Node lvalue = evalLValue(ocopy.to);
+ Node rvalue = assignHelper.evalRValue(ocopy.from);
+ Node lvalue = assignHelper.evalLValue(ocopy.to);
if (__log.isDebugEnabled()) {
__log.debug("lvalue after eval " + lvalue);
if (lvalue != null) __log.debug("content " + DOMUtils.domToString(lvalue));
@@ -413,10 +215,10 @@
if (headerAssign && lvaluePtr.getParentNode().getNodeName().equals("message") && rvalue.getNodeType()==Node.ELEMENT_NODE) {
lvalue = copyInto((Element)lvalue, (Element) lvaluePtr, (Element) rvalue);
} else if (rvalue.getNodeType() == Node.ELEMENT_NODE && lvaluePtr.getNodeType() == Node.ELEMENT_NODE) {
- lvalue = replaceElement((Element)lvalue, (Element) lvaluePtr, (Element) rvalue,
+ lvalue = assignHelper.replaceElement((Element)lvalue, (Element) lvaluePtr, (Element) rvalue,
ocopy.keepSrcElementName);
} else {
- lvalue = replaceContent(lvalue, lvaluePtr, rvalue.getTextContent());
+ lvalue = assignHelper.replaceContent(lvalue, lvaluePtr, rvalue.getTextContent());
}
final VariableInstance lval = _scopeFrame.resolve(ocopy.to.getVariable());
if (__log.isDebugEnabled())
@@ -471,120 +273,14 @@
getBpelRuntime().writeEndpointReference(plval, (Element)rvalue);
}
- private Element replaceElement(Element lval, Element ptr, Element src,
- boolean keepSrcElement) {
- Document doc = ptr.getOwnerDocument();
- Node parent = ptr.getParentNode();
- if (keepSrcElement) {
- Element replacement = (Element)doc.importNode(src, true);
- parent.replaceChild(replacement, ptr);
- return (lval == ptr) ? replacement : lval;
- }
-
- Element replacement = doc.createElementNS(ptr.getNamespaceURI(), ptr.getLocalName());
- NodeList nl = src.getChildNodes();
- for (int i = 0; i < nl.getLength(); ++i)
- replacement.appendChild(doc.importNode(nl.item(i), true));
- NamedNodeMap attrs = src.getAttributes();
- for (int i = 0; i < attrs.getLength(); ++i) {
- Attr attr = (Attr)attrs.item(i);
- if (!attr.getName().startsWith("xmlns")) {
- replacement.setAttributeNodeNS((Attr)doc.importNode(attrs.item(i), true));
- // Case of qualified attribute values, we're forced to add corresponding namespace declaration manually
- int colonIdx = attr.getValue().indexOf(":");
- if (colonIdx > 0) {
- String prefix = attr.getValue().substring(0, colonIdx);
- String attrValNs = src.lookupPrefix(prefix);
- if (attrValNs != null)
- replacement.setAttributeNS(DOMUtils.NS_URI_XMLNS, "xmlns:"+ prefix, attrValNs);
- }
- }
- }
- parent.replaceChild(replacement, ptr);
- DOMUtils.copyNSContext(ptr, replacement);
-
- return (lval == ptr) ? replacement : lval;
- }
+
private Element copyInto(Element lval, Element ptr, Element src) {
ptr.appendChild(ptr.getOwnerDocument().importNode(src, true));
return lval;
}
- /**
- * isInsert flag desginates this as an 'element' type insertion, which
- * requires insert the actual element value, rather than it's children
- *
- * @return
- * @throws FaultException
- */
- private Node replaceContent(Node lvalue, Node lvaluePtr, String rvalue)
- throws FaultException {
- Document d = lvaluePtr.getOwnerDocument();
-
- if (__log.isDebugEnabled()) {
- __log.debug("lvaluePtr type " + lvaluePtr.getNodeType());
- __log.debug("lvaluePtr " + DOMUtils.domToString(lvaluePtr));
- __log.debug("lvalue " + lvalue);
- __log.debug("rvalue " + rvalue);
- }
-
- switch (lvaluePtr.getNodeType()) {
- case Node.ELEMENT_NODE:
-
- // Remove all the children.
- while (lvaluePtr.hasChildNodes())
- lvaluePtr.removeChild(lvaluePtr.getFirstChild());
-
- // Append a new text node.
- lvaluePtr.appendChild(d.createTextNode(rvalue));
-
- // If lvalue is a text, removing all lvaluePtr children had just removed it
- // so we need to rebuild it as a child of lvaluePtr
- if (lvalue instanceof Text)
- lvalue = lvaluePtr.getFirstChild();
- break;
-
- case Node.TEXT_NODE:
-
- Node newval = d.createTextNode(rvalue);
- // Replace ourselves .
- lvaluePtr.getParentNode().replaceChild(newval, lvaluePtr);
-
- // A little kludge, let our caller know that the root element has changed.
- // (used for assignment to a simple typed variable)
- if (lvalue.getNodeType() == Node.ELEMENT_NODE) {
- // No children, adding an empty text children to point to
- if (lvalue.getFirstChild() == null) {
- Text txt = lvalue.getOwnerDocument().createTextNode("");
- lvalue.appendChild(txt);
- }
- if (lvalue.getFirstChild().getNodeType() == Node.TEXT_NODE)
- lvalue = lvalue.getFirstChild();
- }
- if (lvalue.getNodeType() == Node.TEXT_NODE && ((Text) lvalue).getWholeText().equals(
- ((Text) lvaluePtr).getWholeText()))
- lvalue = lvaluePtr = newval;
- break;
-
- case Node.ATTRIBUTE_NODE:
-
- ((Attr) lvaluePtr).setValue(rvalue);
- break;
-
- default:
- // This could occur if the expression language selects something
- // like
- // a PI or a CDATA.
- String msg = __msgs.msgInvalidLValue();
- if (__log.isDebugEnabled())
- __log.debug(lvaluePtr + ": " + msg);
- throw new FaultException(
- getOAsssign().getOwner().constants.qnSelectionFailure, msg);
- }
-
- return lvalue;
- }
+
private Node evalQuery(Node data, OMessageVarType.Part part,
OExpression expression, EvaluationContext ec) throws FaultException {