You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ms...@apache.org on 2007/11/13 23:46:45 UTC

svn commit: r594685 - in /ode/branches/APACHE_ODE_1.1: bpel-api/src/main/java/org/apache/ode/bpel/iapi/ bpel-api/src/main/java/org/apche/ bpel-api/src/main/java/org/apche/ode/ bpel-api/src/main/java/org/apche/ode/bpel/ bpel-api/src/main/java/org/apche/...

Author: mszefler
Date: Tue Nov 13 14:46:41 2007
New Revision: 594685

URL: http://svn.apache.org/viewvc?rev=594685&view=rev
Log:
JDBC External Variables 

Added:
    ode/branches/APACHE_ODE_1.1/bpel-api/src/main/java/org/apche/
      - copied from r594653, ode/branches/extvar/bpel-api/src/main/java/org/apche/
    ode/branches/APACHE_ODE_1.1/bpel-api/src/main/java/org/apche/ode/
      - copied from r594653, ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/
    ode/branches/APACHE_ODE_1.1/bpel-api/src/main/java/org/apche/ode/bpel/
      - copied from r594653, ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/
    ode/branches/APACHE_ODE_1.1/bpel-api/src/main/java/org/apche/ode/bpel/evar/
      - copied from r594653, ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/evar/
    ode/branches/APACHE_ODE_1.1/bpel-api/src/main/java/org/apche/ode/bpel/evar/ExternalVariableModule.java
      - copied unchanged from r594653, ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/evar/ExternalVariableModule.java
    ode/branches/APACHE_ODE_1.1/bpel-api/src/main/java/org/apche/ode/bpel/evar/ExternalVariableModuleException.java
      - copied unchanged from r594653, ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/evar/ExternalVariableModuleException.java
    ode/branches/APACHE_ODE_1.1/bpel-api/src/main/java/org/apche/ode/bpel/evar/IncompleteKeyException.java
      - copied unchanged from r594676, ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/evar/IncompleteKeyException.java
    ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtVarKeyMapping.java
      - copied unchanged from r594674, ode/branches/extvar/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtVarKeyMapping.java
    ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OExtVar.java
      - copied unchanged from r594653, ode/branches/extvar/bpel-obj/src/main/java/org/apache/ode/bpel/o/OExtVar.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/extvar/
      - copied from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/extvar/
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/extvar/ExternalVariableConf.java
      - copied unchanged from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/extvar/ExternalVariableConf.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/extvar/ExternalVariableKeyMapSerializer.java
      - copied unchanged from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/extvar/ExternalVariableKeyMapSerializer.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/extvar/ExternalVariableManager.java
      - copied unchanged from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/extvar/ExternalVariableManager.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/evar/
      - copied from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/evar/
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/evar/jdbc/
      - copied from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/evar/jdbc/
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/evar/jdbc/DbExternalVariable.java
      - copied unchanged from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/evar/jdbc/DbExternalVariable.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/evar/jdbc/EVarId.java
      - copied unchanged from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/evar/jdbc/EVarId.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/evar/jdbc/GenType.java
      - copied unchanged from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/evar/jdbc/GenType.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/evar/jdbc/InitType.java
      - copied unchanged from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/evar/jdbc/InitType.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/evar/jdbc/JdbcExternalVariableEngine.java
      - copied unchanged from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/evar/jdbc/JdbcExternalVariableEngine.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/extvar/
      - copied from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/extvar/
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/extvar/jdbc/
      - copied from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/extvar/jdbc/
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/extvar/jdbc/DbExternalVariable.java
      - copied unchanged from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/extvar/jdbc/DbExternalVariable.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/extvar/jdbc/EVarId.java
      - copied unchanged from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/extvar/jdbc/EVarId.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/extvar/jdbc/GenType.java
      - copied unchanged from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/extvar/jdbc/GenType.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/extvar/jdbc/InitType.java
      - copied unchanged from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/extvar/jdbc/InitType.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/extvar/jdbc/JdbcExternalVariableModule.java
      - copied unchanged from r594653, ode/branches/extvar/bpel-runtime/src/main/java/org/apache/ode/bpel/extvar/jdbc/JdbcExternalVariableModule.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/test/java/org/apache/ode/bpel/extvar/
      - copied from r594653, ode/branches/extvar/bpel-runtime/src/test/java/org/apache/ode/bpel/extvar/
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/test/java/org/apache/ode/bpel/extvar/jdbc/
      - copied from r594653, ode/branches/extvar/bpel-runtime/src/test/java/org/apache/ode/bpel/extvar/jdbc/
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/test/java/org/apache/ode/bpel/extvar/jdbc/JdbcExternalVariableEngineTest.java
      - copied unchanged from r594653, ode/branches/extvar/bpel-runtime/src/test/java/org/apache/ode/bpel/extvar/jdbc/JdbcExternalVariableEngineTest.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/test/resources/org/
      - copied from r594653, ode/branches/extvar/bpel-runtime/src/test/resources/org/
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/test/resources/org/apache/
      - copied from r594653, ode/branches/extvar/bpel-runtime/src/test/resources/org/apache/
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/test/resources/org/apache/ode/
      - copied from r594653, ode/branches/extvar/bpel-runtime/src/test/resources/org/apache/ode/
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/test/resources/org/apache/ode/bpel/
      - copied from r594653, ode/branches/extvar/bpel-runtime/src/test/resources/org/apache/ode/bpel/
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/test/resources/org/apache/ode/bpel/extvar/
      - copied from r594653, ode/branches/extvar/bpel-runtime/src/test/resources/org/apache/ode/bpel/extvar/
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/test/resources/org/apache/ode/bpel/extvar/jdbc/
      - copied from r594653, ode/branches/extvar/bpel-runtime/src/test/resources/org/apache/ode/bpel/extvar/jdbc/
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/test/resources/org/apache/ode/bpel/extvar/jdbc/evardeploy.xml
      - copied unchanged from r594653, ode/branches/extvar/bpel-runtime/src/test/resources/org/apache/ode/bpel/extvar/jdbc/evardeploy.xml
    ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/ExtVar/
      - copied from r594653, ode/branches/extvar/bpel-test/src/test/resources/bpel/2.0/ExtVar/
    ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/ExtVar/ExtVar.xsd
      - copied unchanged from r594653, ode/branches/extvar/bpel-test/src/test/resources/bpel/2.0/ExtVar/ExtVar.xsd
    ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/ExtVar/HelloWorld2.bpel
      - copied unchanged from r594653, ode/branches/extvar/bpel-test/src/test/resources/bpel/2.0/ExtVar/HelloWorld2.bpel
    ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/ExtVar/HelloWorld2.wsdl
      - copied unchanged from r594653, ode/branches/extvar/bpel-test/src/test/resources/bpel/2.0/ExtVar/HelloWorld2.wsdl
    ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/ExtVar/deploy.xml
      - copied unchanged from r594653, ode/branches/extvar/bpel-test/src/test/resources/bpel/2.0/ExtVar/deploy.xml
    ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/ExtVar/test.properties
      - copied unchanged from r594653, ode/branches/extvar/bpel-test/src/test/resources/bpel/2.0/ExtVar/test.properties
Modified:
    ode/branches/APACHE_ODE_1.1/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java
    ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
    ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Bpel20QNames.java
    ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java
    ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensibilityQNames.java
    ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java
    ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OBase.java
    ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OScope.java
    ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OVarType.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java
    ode/branches/APACHE_ODE_1.1/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
    ode/branches/APACHE_ODE_1.1/bpel-test/src/main/java/org/apache/ode/test/BindingContextImpl.java
    ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/DOMUtils.java

Modified: ode/branches/APACHE_ODE_1.1/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java Tue Nov 13 14:46:41 2007
@@ -29,6 +29,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.ode.bpel.evt.BpelEvent;
+import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
 /**
@@ -145,6 +146,13 @@
      * @return map of partner link names and associated enpoints
      */
     Map<String, Endpoint> getInvokeEndpoints();
+    
+    /**
+     * Generic facility to get additional stuff out of the process descriptor. 
+     * @param qname name of the extension element.
+     * @return list of extension elements 
+     */
+    List<Element> getExtensionElement(QName qname);
 
     boolean isEventEnabled(List<String> scopeNames, BpelEvent.TYPE type);
     

Modified: ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java Tue Nov 13 14:46:41 2007
@@ -36,6 +36,7 @@
 import org.apache.ode.bpel.compiler.bom.CorrelationSet;
 import org.apache.ode.bpel.compiler.bom.Expression;
 import org.apache.ode.bpel.compiler.bom.Expression11;
+import org.apache.ode.bpel.compiler.bom.ExtVarKeyMapping;
 import org.apache.ode.bpel.compiler.bom.FaultHandler;
 import org.apache.ode.bpel.compiler.bom.Import;
 import org.apache.ode.bpel.compiler.bom.LinkSource;
@@ -67,6 +68,7 @@
 import org.apache.ode.bpel.o.OEventHandler;
 import org.apache.ode.bpel.o.OExpression;
 import org.apache.ode.bpel.o.OExpressionLanguage;
+import org.apache.ode.bpel.o.OExtVar;
 import org.apache.ode.bpel.o.OFaultHandler;
 import org.apache.ode.bpel.o.OFlow;
 import org.apache.ode.bpel.o.OLValueExpression;
@@ -92,6 +94,7 @@
 import org.apache.ode.utils.stl.MemberOfFunction;
 import org.apache.ode.utils.stl.UnaryFunction;
 import org.apache.xerces.xni.parser.XMLEntityResolver;
+import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
 import javax.wsdl.Definition;
@@ -1346,12 +1349,16 @@
         ovar.name = src.getName();
         ovar.declaringScope = oscope;
         ovar.debugInfo = createDebugInfo(src, null);
+        
+        ovar.extVar = compileExtVar(src);
+
         oscope.addLocalVariable(ovar);
 
         if (__log.isDebugEnabled())
             __log.debug("Compiled variable " + ovar);
     }
 
+
     private void compile(TerminationHandler terminationHandler) {
         OScope oscope = _structureStack.topScope();
         oscope.terminationHandler = new OTerminationHandler(_oprocess, oscope);
@@ -1623,6 +1630,27 @@
         ArrayList<OActivity> rval = new ArrayList<OActivity>(_structureStack._stack);
         Collections.reverse(rval);
         return rval;
+    }
+
+    /**
+     * Compile external variable declaration.
+     * @param src variable object
+     * @return compiled {@link OExtVar} representation. 
+     */
+    private OExtVar compileExtVar(Variable src) {
+        if (!src.isExternal())
+            return null;
+
+        OExtVar oextvar = new OExtVar(_oprocess);
+        oextvar.externalVariableId = src.getExternalId();
+        oextvar.debugInfo = createDebugInfo(src, null);
+        for (ExtVarKeyMapping mapping : src.getExtVarMappings()) {
+            String key = mapping.getKey();
+            OExpression oexpr = compileExpr(mapping.getExpression());
+            oextvar.keyDeclaration.put(key, oexpr);
+        }
+        
+        return oextvar;
     }
 
     private static class StructureStack {

Modified: ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Bpel20QNames.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Bpel20QNames.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Bpel20QNames.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Bpel20QNames.java Tue Nov 13 14:46:41 2007
@@ -187,6 +187,12 @@
     public static final String NS_RDF = "http://www.w3.org/2000/01/rdf-schema#";
     public static final QName RDF_LABEL = new QName(NS_RDF, "label");
 
+
+    
+    //
+    // utility functions
+    //
+    
     private static QName newQName(String localname) {
         return new QName(NS_WSBPEL2_0, localname);
     }

Modified: ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java Tue Nov 13 14:46:41 2007
@@ -255,6 +255,11 @@
         _mappings.put(ExtensibilityQNames.FAILURE_HANDLING_RETRY_FOR, FailureHandling.RetryFor.class);
         _mappings.put(ExtensibilityQNames.FAILURE_HANDLING_RETRY_DELAY, FailureHandling.RetryDelay.class);
         _mappings.put(ExtensibilityQNames.FAILURE_HANDLING_FAULT_ON, FailureHandling.FaultOnFailure.class);
+        
+        //
+        // External Variable Mappings
+        //
+        _mappings.put(ExtensibilityQNames.EXTVAR_MAPPING, ExtVarKeyMapping.class);
     }
 
     public static BpelObjectFactory getInstance() {

Modified: ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensibilityQNames.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensibilityQNames.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensibilityQNames.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensibilityQNames.java Tue Nov 13 14:46:41 2007
@@ -22,7 +22,7 @@
 
 
 public abstract class ExtensibilityQNames {
-    /**
+    /*
      * Activity Recovery extensibility elements.
      */
     public static final String NS_ACTIVITY_RECOVERY         = "http://ode.apache.org/activityRecovery";
@@ -30,6 +30,21 @@
     public static final QName FAILURE_HANDLING_RETRY_FOR    = new QName(NS_ACTIVITY_RECOVERY, "retryFor");
     public static final QName FAILURE_HANDLING_RETRY_DELAY  = new QName(NS_ACTIVITY_RECOVERY, "retryDelay");
     public static final QName FAILURE_HANDLING_FAULT_ON     = new QName(NS_ACTIVITY_RECOVERY, "faultOnFailure");
+
+
+
+    //
+    // External variables 
+    //
+    
+    /** Namespace for external variables. */
+    private static final String EXTVAR_NS = "http://www.apache.org/ode/extensions/externalVariables";
+    
+    /** Attribute name for external variable id. */
+    public static final QName EXTVAR_ATTR = new QName(EXTVAR_NS, "ext-var-id");
+    
+    /** Element name of external variable key mapping. */
+    public static final QName EXTVAR_MAPPING = new QName(EXTVAR_NS, "key-map");
 
 }
 

Modified: ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java Tue Nov 13 14:46:41 2007
@@ -18,6 +18,8 @@
  */
 package org.apache.ode.bpel.compiler.bom;
 
+import java.util.List;
+
 import javax.xml.namespace.QName;
 
 import org.w3c.dom.Element;
@@ -87,4 +89,30 @@
 
     }
 
+    //
+    // Stuff related to external variables.
+    //
+    
+    /**
+     * Get the external variable identifier (each one will be defined in the deployment descriptor)
+     */
+    public String getExternalId() {
+        return getAttribute(ExtensibilityQNames.EXTVAR_ATTR, null);
+    }
+
+    /**
+     * Is this an external variable? It is if it has the above attribute.
+     * @return
+     */
+    public boolean isExternal() {
+        return null != getExternalId();
+    }
+    
+    /**
+     * Get the external variable mappings.
+     * @return
+     */
+    public List<ExtVarKeyMapping> getExtVarMappings() {
+        return getChildren(ExtVarKeyMapping.class);
+    }
 }

Modified: ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OBase.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OBase.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OBase.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OBase.java Tue Nov 13 14:46:41 2007
@@ -18,8 +18,6 @@
  */
 package org.apache.ode.bpel.o;
 
-import org.apache.ode.utils.ObjectPrinter;
-
 import java.io.Serializable;
 
 

Modified: ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OScope.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OScope.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OScope.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OScope.java Tue Nov 13 14:46:41 2007
@@ -21,6 +21,8 @@
 
 import java.util.*;
 
+import org.w3c.dom.Node;
+
 /**
  * Compiled representation of a BPEL scope. Instances of this class
  * are generated by the BPEL compiler.
@@ -165,6 +167,10 @@
         public OScope declaringScope;
         public OVarType type;
 
+        /** If not-null indicates that this variable has an external representation. */
+        public OExtVar extVar;
+        
+        
         public Variable(OProcess owner, OVarType type) {
             super(owner);
             this.type = type;

Modified: ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OVarType.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OVarType.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OVarType.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OVarType.java Tue Nov 13 14:46:41 2007
@@ -36,4 +36,5 @@
      */
     public abstract Node newInstance(Document doc);  
   
+    
 }

Modified: ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java Tue Nov 13 14:46:41 2007
@@ -35,11 +35,17 @@
 import org.apache.ode.bpel.dao.BpelDAOConnection;
 import org.apache.ode.bpel.dao.ProcessDAO;
 import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.apache.ode.bpel.engine.extvar.ExternalVariableConf;
+import org.apache.ode.bpel.engine.extvar.ExternalVariableManager;
 import org.apache.ode.bpel.evt.ProcessInstanceEvent;
-import org.apache.ode.bpel.evt.ScopeEvent;
 import org.apache.ode.bpel.explang.ConfigurationException;
 import org.apache.ode.bpel.explang.EvaluationException;
-import org.apache.ode.bpel.iapi.*;
+import org.apache.ode.bpel.iapi.BpelEngineException;
+import org.apache.ode.bpel.iapi.Endpoint;
+import org.apache.ode.bpel.iapi.EndpointReference;
+import org.apache.ode.bpel.iapi.MessageExchange;
+import org.apache.ode.bpel.iapi.PartnerRoleChannel;
+import org.apache.ode.bpel.iapi.ProcessConf;
 import org.apache.ode.bpel.intercept.InterceptorInvoker;
 import org.apache.ode.bpel.intercept.MessageExchangeInterceptor;
 import org.apache.ode.bpel.o.OElementVarType;
@@ -103,16 +109,37 @@
     /** Latch-like thing to control hydration/dehydration. */
     private HydrationLatch _hydrationLatch;
 
+    /** Deploy-time configuraton for external variables. */
+    private ExternalVariableConf _extVarConf;
+    
+    private ExternalVariableManager _evm;
+    
     public BpelProcess(ProcessConf conf) {
         _pid = conf.getProcessId();
         _pconf = conf;
         _hydrationLatch = new HydrationLatch();
     }
 
+    /**
+     * Intiialize the external variable configuration/engine manager. This is called from hydration logic, so it 
+     * is possible to change the external variable configuration at runtime.
+     * 
+     */
+    void initExternalVariables() {
+        List<Element> conf = _pconf.getExtensionElement(ExternalVariableConf.EXTVARCONF_ELEMENT);
+        _extVarConf = new ExternalVariableConf(conf);
+        _evm = new ExternalVariableManager(_pid, _extVarConf, _engine._contexts.externalVariableEngines, _oprocess);
+    }
+    
+
     public String toString() {
         return "BpelProcess[" + _pid + "]";
     }
-
+ 
+    public ExternalVariableManager getEVM() {
+        return _evm;
+    }
+   
     public void recoverActivity(ProcessInstanceDAO instanceDAO, String channel, long activityId, String action, FaultData fault) {
         if (__log.isDebugEnabled())
             __log.debug("Recovering activity in process " + instanceDAO.getInstanceId() + " with action " + action);
@@ -728,7 +755,8 @@
             _expLangRuntimeRegistry = elangRegistry;
 
             setRoles(_oprocess);
-
+    		initExternalVariables();
+    
             if (!_hydratedOnce) {
                 for (PartnerLinkPartnerRoleImpl prole : _partnerRoles.values()) {
                     // Null for initializePartnerRole = false

Modified: ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java Tue Nov 13 14:46:41 2007
@@ -33,6 +33,7 @@
 import org.apache.ode.bpel.dao.ProcessInstanceDAO;
 import org.apache.ode.bpel.dao.ScopeDAO;
 import org.apache.ode.bpel.dao.XmlDataDAO;
+import org.apache.ode.bpel.engine.extvar.ExternalVariableKeyMapSerializer;
 import org.apache.ode.bpel.evt.*;
 import org.apache.ode.bpel.iapi.BpelEngineException;
 import org.apache.ode.bpel.iapi.ContextException;
@@ -67,6 +68,8 @@
 import org.apache.ode.utils.GUID;
 import org.apache.ode.utils.Namespaces;
 import org.apache.ode.utils.ObjectPrinter;
+import org.apche.ode.bpel.evar.ExternalVariableModuleException;
+import org.apche.ode.bpel.evar.IncompleteKeyException;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.Document;
@@ -78,7 +81,9 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 class BpelRuntimeContextImpl implements BpelRuntimeContext {
 
@@ -387,7 +392,22 @@
         CorrelationSetDAO cs = scopeDAO.getCorrelationSet(cset.declaration.name);
         return cs.getValue();
     }
-
+    
+    /**
+     * Save the external variable keys that are evaluated at the time of scope instantiation.
+     */
+    public void initializeExternalVariable(VariableInstance variable, HashMap<String, String> keys) {
+        // Important to note here that the collection of keys that we are saving may not be
+        // the whole set required to retrieve the object. If that's the case then the variable
+        // will need to be assigned to before it can be read, at which point the keys will be
+        // updated. However if the key set is complete, then the variable can be read even if it
+        // was never written to in the process.
+        Element el = ExternalVariableKeyMapSerializer.toXML(keys);
+        ScopeDAO scopeDAO = _dao.getScope(variable.scopeInstance);
+        XmlDataDAO dataDAO = scopeDAO.getVariable(variable.declaration.name);
+        dataDAO.set(el);
+    }
+    
     public Node fetchVariableData(VariableInstance variable, boolean forWriting) throws FaultException {
     	
     	// Special case of messageType variables with no part
@@ -409,7 +429,35 @@
                     "The variable " + variable.declaration.name + " isn't properly initialized.");
         }
 
-        return dataDAO.get();
+        
+        if (variable.declaration.extVar != null) {
+            // Note, that when using external variables, the database will contain not the actual value of the 
+            // variable, but a name-value map used to uniquely identify the external variable instance.  
+            Map<String, String> keys = ExternalVariableKeyMapSerializer.toMap((Element)dataDAO.get());
+            try {
+                Node ret = _bpelProcess.getEVM().read(variable.declaration.extVar.externalVariableId, keys ,_iid);
+                if (ret == null) {
+                    throw new FaultException(_bpelProcess.getOProcess().constants.qnUninitializedVariable, 
+                            "The external variable \"" + variable.declaration.name + "\" has not been initialized.");
+                    
+                }
+                return ret;
+            } catch (IncompleteKeyException ike) {
+                // This indicates that the external variable needed to be written do, put has not been.
+                __log.error("External variable could not be read due to incomplete key; the following key " +
+                        "components were missing: " + ike.getMissing());
+                throw new FaultException(_bpelProcess.getOProcess().constants.qnUninitializedVariable, 
+                        "The extenral variable \"" + variable.declaration.name + "\" has not been properly initialized;" +
+                                "the following key compoenents were missing:" + ike.getMissing());
+            } catch (ExternalVariableModuleException e) {
+                __log.error("Unexpected EVM error.", e);
+                throw new BpelEngineException(e);
+            }
+
+        } else /* not external */ {
+            return dataDAO.get();
+        }
+
     }
 
     public Node fetchVariableData(VariableInstance var, OMessageVarType.Part part, boolean forWriting)
@@ -480,9 +528,36 @@
         ScopeDAO scopeDAO = _dao.getScope(variable.scopeInstance);
         XmlDataDAO dataDAO = scopeDAO.getVariable(variable.declaration.name);
 
-        dataDAO.set(initData);
-        writeProperties(variable, initData, dataDAO);        
-        return dataDAO.get();
+
+        Node ret;
+        
+        if (variable.declaration.extVar != null) /*external variable */ {
+            // Note, that when using external variables, the database will contain not the actual value of the 
+            // variable, but a name-value map used to uniquely identify the external variable instance. When 
+            // initializing the external variable, we need to:
+            // 1) call the ext-var subystem to initialize the variable
+            // 3) save the computed keys (modified by 1 above) in the database. 
+
+            Map<String, String> keys = ExternalVariableKeyMapSerializer.toMap((Element)dataDAO.get());
+            // Note that keys gets modified by initExternalVariable
+            try {
+                ret = _bpelProcess.getEVM().write(variable.declaration.extVar.externalVariableId, keys, initData, _iid);
+            } catch (ExternalVariableModuleException e) {
+                __log.error("External variable initialization error.", e);
+                // TODO: need to report this
+                throw new BpelEngineException("External varaible initialization error", e);
+            }
+            Element xmlkey = ExternalVariableKeyMapSerializer.toXML(keys);
+            dataDAO.set(xmlkey);
+                        
+        } else /* normal variable */ {
+            dataDAO.set(initData);
+            ret = dataDAO.get();
+        }
+        
+        writeProperties(variable, ret, dataDAO);        
+        
+        return ret;
     }
 
     public void writeEndpointReference(PartnerLinkInstance variable, Element data) throws FaultException {

Modified: ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java Tue Nov 13 14:46:41 2007
@@ -51,6 +51,7 @@
 import org.apache.ode.utils.msg.MessageBundle;
 import org.apache.ode.utils.stl.CollectionsX;
 import org.apache.ode.utils.stl.MemberOfFunction;
+import org.apche.ode.bpel.evar.ExternalVariableModule;
 
 /**
  * <p>
@@ -83,6 +84,7 @@
      */
     private final Set<BpelProcess> _registeredProcesses = new HashSet<BpelProcess>();
 
+
     private State _state = State.SHUTDOWN;
     private Contexts _contexts = new Contexts();
     private DehydrationPolicy _dehydrationPolicy;
@@ -140,6 +142,11 @@
             _mngmtLock.writeLock().unlock();
         }
     }
+    
+    
+    public void registerExternalVariableEngine(ExternalVariableModule eve) {
+        _contexts.externalVariableEngines.put(eve.getName(), eve);
+    }
 
     /**
      * Register a global listener to receive {@link BpelEvent}s froom all
@@ -337,7 +344,8 @@
             return true;
         if (_state == j)
             return false;
-        throw new IllegalStateException("Unexpected state: " + i);
+        return false;
+//        throw new IllegalStateException("Unexpected state: " + i);
     }
 
     /* TODO: We need to have a method of cleaning up old deployment data. */

Modified: ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java Tue Nov 13 14:46:41 2007
@@ -26,10 +26,14 @@
 import org.apache.ode.bpel.iapi.MessageExchangeContext;
 import org.apache.ode.bpel.iapi.Scheduler;
 import org.apache.ode.bpel.intercept.MessageExchangeInterceptor;
+import org.apche.ode.bpel.evar.ExternalVariableModule;
 
+import java.util.HashMap;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
 
+import javax.xml.namespace.QName;
+
 /**
  * Aggregation of all the contexts provided to the BPEL engine by the
  * integration layer.
@@ -53,5 +57,7 @@
     /** Global event listeners. Must be copy-on-write!!! */
     final List<BpelEventListener> eventListeners = new CopyOnWriteArrayList<BpelEventListener>();
 
+    /** Mapping from external variable engine identifier to the engine implementation. */
+    final HashMap<QName, ExternalVariableModule> externalVariableEngines = new HashMap<QName, ExternalVariableModule>();
 
 }

Modified: ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java Tue Nov 13 14:46:41 2007
@@ -37,6 +37,7 @@
 import javax.wsdl.Operation;
 import java.util.Collection;
 import java.util.Date;
+import java.util.HashMap;
 
 import javax.xml.namespace.QName;
 
@@ -140,7 +141,7 @@
     String readProperty(VariableInstance var, OProcess.OProperty property)
             throws FaultException;
 
-    Node initializeVariable(VariableInstance var, Node initData);
+    Node initializeVariable(VariableInstance var, Node initData) ;
 
     /**
      * Writes a partner EPR.
@@ -255,4 +256,6 @@
     String getSourceSessionId(String mexId);
 
     void releasePartnerMex(String mexId);
+
+    void initializeExternalVariable(VariableInstance instance, HashMap<String, String> keymap);
 }

Modified: ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java Tue Nov 13 14:46:41 2007
@@ -33,6 +33,7 @@
 import org.apache.ode.bpel.runtime.channels.TerminationChannelListener;
 import org.apache.ode.bpel.evt.ScopeEvent;
 import org.apache.ode.bpel.evt.VariableModificationEvent;
+import org.apache.ode.bpel.iapi.BpelEngineException;
 import org.apache.ode.jacob.ChannelListener;
 import org.apache.ode.jacob.SynchChannel;
 import org.apache.ode.utils.DOMUtils;
@@ -211,6 +212,7 @@
                 _oforEach.innerScope), _scopeFrame, null);
         VariableInstance vinst = newFrame.resolve(_oforEach.counterVariable);
         getBpelRuntimeContext().initializeVariable(vinst, counterNode);
+
         // Generating event
         ScopeEvent se = new VariableModificationEvent(vinst.declaration.name);
         if (_oforEach.debugInfo != null)

Modified: ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java Tue Nov 13 14:46:41 2007
@@ -20,10 +20,12 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.common.FaultException;
 import org.apache.ode.bpel.evt.ScopeFaultEvent;
 import org.apache.ode.bpel.evt.ScopeStartEvent;
 import org.apache.ode.bpel.evt.ScopeEvent;
 import org.apache.ode.bpel.evt.VariableModificationEvent;
+import org.apache.ode.bpel.explang.EvaluationContext;
 import org.apache.ode.bpel.o.*;
 import org.apache.ode.bpel.runtime.channels.*;
 import org.apache.ode.jacob.ChannelListener;
@@ -54,6 +56,30 @@
     }
 
     public void run() {
+
+
+        for (OScope.Variable var : _oscope.variables.values()) {
+            if (var.extVar == null)
+                continue;
+            
+            HashMap<String,String> keymap = new HashMap<String,String>();
+            for (Map.Entry<String, OExpression> mapping : var.extVar.keyDeclaration.entrySet()) {
+                String val;
+                try {
+                    val = getBpelRuntimeContext().getExpLangRuntime().evaluateAsString(mapping.getValue(), getEvaluationContext());
+                } catch (FaultException e) {
+                    __log.error("Unable to initialize external variable key.", e);
+                    FaultData fd = createFault(e.getQName(), var.extVar, "Unable to initialize external variable key: " + e.getMessage());
+                    _self.parent.completed(fd,null);
+                    return;
+                }
+                keymap.put(mapping.getKey(),val);
+            }
+                            
+            getBpelRuntimeContext().initializeExternalVariable(_scopeFrame.resolve(var), keymap);
+        }
+        
+        
         // Start the child activity.
         _child = new ActivityInfo(genMonotonic(),
             _oscope.activity,

Modified: ode/branches/APACHE_ODE_1.1/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java Tue Nov 13 14:46:41 2007
@@ -49,6 +49,7 @@
 import java.io.ByteArrayOutputStream;
 import java.util.Collection;
 import java.util.Date;
+import java.util.HashMap;
 
 /**
  * Test core BPEL processing capabilities.
@@ -405,6 +406,11 @@
     }
 
     public void releasePartnerMex(String mexId) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void initializeExternalVariable(VariableInstance instance, HashMap<String, String> keymap) {
         // TODO Auto-generated method stub
         
     }

Modified: ode/branches/APACHE_ODE_1.1/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java Tue Nov 13 14:46:41 2007
@@ -18,6 +18,24 @@
  */
 package org.apache.ode.store;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ode.bpel.dd.TDeployment;
@@ -33,26 +51,11 @@
 import org.apache.ode.bpel.iapi.ProcessConf;
 import org.apache.ode.bpel.iapi.ProcessState;
 import org.apache.ode.store.DeploymentUnitDir.CBPInfo;
+import org.apache.ode.utils.DOMUtils;
 import org.apache.ode.utils.msg.MessageBundle;
+import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
-import javax.wsdl.Definition;
-import javax.xml.namespace.QName;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 /**
  * Implementation of the {@link org.apache.ode.bpel.iapi.ProcessConf} interface.
  * Provides configuration information for a process. Note that this class should
@@ -341,6 +344,14 @@
         String relative = cbpPath.substring(basePath.length());
         if (relative.startsWith(File.separator)) relative = relative.substring(1);
         return relative;
+    }
+
+    public List<Element> getExtensionElement(QName qname) {
+        try {
+            return DOMUtils.findChildrenByName(DOMUtils.stringToDOM(_pinfo.toString()), qname);
+        } catch (Exception e) {
+            return Collections.emptyList();
+        }
     }
 
 }

Modified: ode/branches/APACHE_ODE_1.1/bpel-test/src/main/java/org/apache/ode/test/BindingContextImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-test/src/main/java/org/apache/ode/test/BindingContextImpl.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-test/src/main/java/org/apache/ode/test/BindingContextImpl.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-test/src/main/java/org/apache/ode/test/BindingContextImpl.java Tue Nov 13 14:46:41 2007
@@ -37,6 +37,9 @@
  */
 package org.apache.ode.test;
 
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
 import org.apache.ode.bpel.iapi.BindingContext;
 import org.apache.ode.bpel.iapi.Endpoint;
 import org.apache.ode.bpel.iapi.EndpointReference;
@@ -44,9 +47,6 @@
 import org.apache.ode.utils.DOMUtils;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
 
 public class BindingContextImpl implements BindingContext {
 	

Modified: ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/DOMUtils.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/DOMUtils.java?rev=594685&r1=594684&r2=594685&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/DOMUtils.java (original)
+++ ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/DOMUtils.java Tue Nov 13 14:46:41 2007
@@ -26,6 +26,8 @@
 import java.io.StringWriter;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
@@ -335,26 +337,24 @@
         HashMap<String,String> pref = new HashMap<String,String>();
         Map<String,String> mine = getMyNamespaces(el);
         Node n = el.getParentNode();
-        if (n != null) {
-	        do {
-	            if (n instanceof Element) {
-	                Element l = (Element) n;
-	                NamedNodeMap nnm = l.getAttributes();
-	                int len = nnm.getLength();
-	                for (int i = 0; i < len; ++i) {
-	                    Attr a = (Attr) nnm.item(i);
-	                    if (isNSAttribute(a)) {
-	                        String key = getNSPrefixFromNSAttr(a);
-	                        String uri = a.getValue();
-	                        // prefer prefix bindings that are lower down in the tree.
-	                        if (pref.containsKey(key) || mine.containsKey(key)) continue;
-	                        pref.put(key, uri);
-	                    }
-	                }
-	            }
-	            n = n.getParentNode();
-	        } while (n != null && n.getNodeType() != Node.DOCUMENT_NODE);
-        }
+        while (n != null && n.getNodeType() != Node.DOCUMENT_NODE) {
+            if (n instanceof Element) {
+                Element l = (Element) n;
+                NamedNodeMap nnm = l.getAttributes();
+                int len = nnm.getLength();
+                for (int i = 0; i < len; ++i) {
+                    Attr a = (Attr) nnm.item(i);
+                    if (isNSAttribute(a)) {
+                        String key = getNSPrefixFromNSAttr(a);
+                        String uri = a.getValue();
+                        // prefer prefix bindings that are lower down in the tree.
+                        if (pref.containsKey(key) || mine.containsKey(key)) continue;
+                        pref.put(key, uri);
+                    }
+                }
+            }
+            n = n.getParentNode();
+        } 
         return pref;
     }
 
@@ -996,6 +996,29 @@
             __builders.set(builder);
         }
         return builder;
+    }
+
+    public static List<Element> findChildrenByName(Element parent, QName name) {
+        if (parent == null)
+            throw new IllegalArgumentException("null parent");
+        if (name == null)
+            throw new IllegalArgumentException("null name");
+
+        LinkedList<Element> ret = new LinkedList<Element>();
+        NodeList nl = parent.getChildNodes();
+        for (int i = 0; i < nl.getLength(); ++i) {
+            Node c = nl.item(i);
+            if(c.getNodeType() != Node.ELEMENT_NODE)
+                continue;
+            // For a reason that I can't fathom, when using in-mem DAO we actually get elements with
+            // no localname.
+            String nodeName = c.getLocalName() != null ? c.getLocalName() : c.getNodeName();
+            if (new QName(c.getNamespaceURI(),nodeName).equals(name))
+                ret.add((Element)c);
+        }
+
+        
+        return ret;
     }
 
 }