You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ad...@apache.org on 2006/02/28 17:35:26 UTC

svn commit: r381694 [27/38] - in /incubator/ode/scratch: bpe/ ode/ ode/bpelTests/ ode/bpelTests/probeService/ ode/bpelTests/test1/ ode/bpelTests/test10/ ode/bpelTests/test12/ ode/bpelTests/test13/ ode/bpelTests/test14/ ode/bpelTests/test15/ ode/bpelTes...

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELUtil.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELUtil.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELUtil.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELUtil.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on Aug 14, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+
+
+/**
+ * @author waterman
+ *
+ */
+class BPELUtil {
+
+	/**
+	 * 
+	 */
+	private BPELUtil() {
+	}
+	
+	static 	void throwNewException(Logger logger, Level logLevel, String msg, Object[] substitution, Throwable ex) throws DeploymentException { 
+		DeploymentException de = new DeploymentException(msg,substitution,ex);
+		de.log(logger,logLevel);
+		throw de;
+	}
+
+
+	
+	/**
+	 * This function will normalize definition import statements into a single
+	 * List data structure.
+	 * 
+	 * @param def - a root definition
+	 * @param defList - a normalized list of definitions
+	 * @return
+	 */
+	static List getDefinitionList(Definition def, List defList) {
+
+		// WSDL imports can be cyclical, the defList will guard against
+		// an infinite recursive call stack		
+		if ( defList.contains(def) ) return defList;
+		
+		defList.add(def);
+
+		Map m = def.getImports();
+		if ( m != null ) {
+			for ( Iterator itr = m.entrySet().iterator(); itr.hasNext(); ) {
+				Map.Entry me = (Map.Entry)itr.next();
+				List wsdlImports = (List)me.getValue();
+				for ( Iterator impItr = wsdlImports.iterator(); impItr.hasNext(); ) {
+					Definition impDef = ((Import)impItr.next()).getDefinition();
+					if ( impDef != null ) getDefinitionList(impDef, defList);
+				}
+			}
+		}
+		
+		return defList;
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELVariable.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELVariable.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELVariable.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELVariable.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,468 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on Jun 21, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ode.definition.IPMDLocator;
+import org.apache.ode.definition.IPMDLocatorHolder;
+import org.apache.ode.definition.service.DefinitionServiceException;
+import org.apache.ode.interaction.IInvocation;
+import org.apache.ode.interaction.IInvocationFactory;
+import org.apache.ode.interaction.InteractionException;
+import org.apache.ode.interaction.InvocationFactory;
+import org.apache.ode.interaction.builders.DefaultInteractionBuilder;
+import org.apache.ode.interaction.builders.IInteractionBuilder;
+import org.apache.ode.lang.ResourceGetter;
+
+
+/**
+ * 
+ * The base class for all BPE variable types. Does does record keeping about
+ * where a variable is used. This information is used to determine where 
+ * variables cross thread boundries.
+ *
+ * @author waterman
+ */
+abstract class BPELVariable {
+	
+	BPELAttributes m_attributes;
+	HashSet usedInActivity = new HashSet();
+	HashSet usedInLocator = new HashSet();
+	HashMap containerMap;
+	
+	BPELNode m_ownedBy;
+	Logger m_logger;
+	private static int _varCtr = 1;
+	private HashMap _varMap;
+	private static final Pattern oneParamPattern = Pattern.compile(".*?\\(\\s*'(.*?)'\\s*\\).*");
+	private static final Pattern twoParamPattern = Pattern.compile(".*?\\(\\s*'(.*?)'\\s*,\\s*'(.*?)'\\s*\\).*");
+	private static final Pattern threeParamPattern = Pattern.compile(".*?\\(\\s*'(.*?)'\\s*,\\s*'(.*?)'\\s*,\\s*'(.*?)'\\s*\\).*");
+	
+	private static String[] simpleSoapTypes = {
+
+			"string",
+			"boolean",
+			"base64Binary",
+			"hexBinary",
+			"float",
+			"double",
+			"normalizedString",
+			"decimal",
+			"integer",
+			"nonPositiveInteger",
+			"negativeInteger",
+			"long",
+			"int",
+			"short",
+			"byte",
+			"nonNegativeInteger",
+			"unsignedLong",
+			"unsignedInt",
+			"unsignedShort",
+			"unsignedByte",
+			"positiveInteger"
+	};
+	
+	BPELVariable(BPELAttributes attrs, Logger logger) {
+		m_attributes = attrs;
+		m_logger = logger;
+		if (_varCtr > 100)
+		{
+			// Figure it is ok to start over numbering
+			_varCtr = 1;
+		}
+	}
+
+	BPELVariable(BPELAttributes attrs, HashMap containerMap, Logger logger) {
+		this(attrs,logger);
+		
+		this.containerMap = containerMap;
+		if (_varCtr > 100)
+		{
+			// Figure it is ok to start over numbering
+			_varCtr = 1;
+		}
+
+	}	
+	
+
+	void addUsedInActivity(BPELNode node) {
+		usedInActivity.add(node);
+	}
+	
+	void addUsedInLocator(IPMDLocator locator) {
+		usedInLocator.add(locator);
+	}
+	
+	Collection getUsedInActivities() {
+		return usedInActivity;
+	}
+	
+	Collection getUsedInLocators() {
+		return usedInLocator;
+	}
+	
+	String getName() {
+		return m_attributes.getName();
+	}
+	
+	void setName(String name) {
+		m_attributes.setName(name);
+	}
+	
+	void setScope(BPELNode scope) {
+		m_ownedBy = scope;
+	}
+	
+	BPELScopePath getScopePath(BPELScopePath path) {
+		return m_ownedBy.getScopePath(path);
+	}
+	
+	BPELAttributes getAttributes() {
+		return m_attributes;
+	}
+	
+	
+	
+	IInvocation getInvocation(String locationPath, BPELNode node,
+            BPELInvocationType type, IInvocationFactory factory)
+            throws DeploymentException
+    {
+        IInvocation inv = null;
+        if ( type == BPELInvocationType.NO_INVOCATION)
+        {
+            return null;
+        }
+
+        try
+        {
+
+            if (locationPath != null)
+            {
+                HashMap locationNS = new HashMap();
+                if ( node != null )
+                {
+                    locationNS = node.getNamespaceMap(locationPath);
+                }
+
+                // TODO: Lance - BPEL v1.next
+                // not only do we need to check type but we also need
+                // to query up the parse stack for the query language
+                // add a getQueryLanguage() method to BPELNode
+
+                if (type == BPELInvocationType.SELECT_VALUE)
+                {
+                    inv = factory.createXPathQueryNodeValueInvocation(
+                            locationPath, locationNS);
+                } else
+                {
+                    if (type == BPELInvocationType.SELECT_NODE)
+                    {
+                        inv = factory.createXPathSelectTreeInvocation(
+                                (locationPath == null) ? "/" : locationPath,
+                                locationNS);
+                    } else
+                    {
+                        if (type == BPELInvocationType.GRAFT_BENEATH_NODE)
+                        {
+                            inv = factory.createXPathCopyTreeInvocation(                                   
+                                            (locationPath == null) ? "/"
+                                                    : locationPath, locationNS);
+                        } else
+                        {
+                            if (type == BPELInvocationType.UPDATE_VALUE)
+                            {
+                                inv = factory
+                                        .createXPathSetNodeValueInvocation(
+                                                locationPath, locationNS);
+                            } else
+                            {
+                            	if (type == BPELInvocationType.GRAFT_CHILDREN_BENEATH_NODE)
+                            	{
+                            		inv = factory.createXPathCopyChildrenInvocation
+												(locationPath, locationNS);
+                            	}
+                            }
+                        }
+                    }
+                }
+            } else
+            {
+                if (type == BPELInvocationType.UPDATE_OBJECT)
+                {
+                    inv = factory.createSetObjectInvocation();
+                } else
+                {
+                    if (type == BPELInvocationType.SELECT_OBJECT)
+                    {
+                        inv = factory.createGetObjectInvocation();
+                    }
+                }
+            }
+        } catch (InteractionException e)
+        {
+            BPELUtil.throwNewException(m_logger, Level.SEVERE,
+                    "DEPLOY_INVOCATION_CREATE", null, e);
+        }
+
+        return inv;
+    }
+
+	boolean isPartSimpleType(String partName) {
+		return true;
+	}
+	boolean isSimpleType() {
+		return true;
+	}
+	
+	/**
+	 * The method creates a BPE locator for a BPEL variable name. 
+	 * 
+	 * @param locator the runtime metadata definition object
+	 * @param node the BPEL activity using the variable
+	 * @param node the BPEL tag using the variable
+	 * @param attrs variable attributes
+	 * @param forOutPut the variable is writable
+	 * @return the name of the created BPE locator
+	 * @throws DefinitionServiceException
+	 */
+	abstract Object createLocator(IPMDLocatorHolder locator, BPELNode node, BPELNode tagNode, BPELAttributes attrs, BPELInvocationType type, boolean forOutPut) throws DeploymentException;
+
+	Object createLocator(
+		IPMDLocatorHolder locator,
+		BPELNode node,
+		BPELAttributes attrs,
+		BPELInvocationType type,
+		boolean forOutPut)
+		throws DeploymentException {
+			return createLocator(locator,node,node,attrs,type,forOutPut);	
+		}
+		
+	protected IInteractionBuilder getIntBuilder(String processName) throws DeploymentException {
+		return getIntBuilder(processName, m_attributes.getName());
+	}
+		
+	protected IInteractionBuilder getIntBuilder(String processName, String key) throws DeploymentException {
+	
+		return new DefaultInteractionBuilder();
+	}
+
+	protected IInvocationFactory getInvFactory(String processName) throws DeploymentException {
+		return getInvFactory(processName, m_attributes.getName());
+	}
+
+	
+	protected IInvocationFactory getInvFactory(String processName, String key) throws DeploymentException 
+	{
+		return new InvocationFactory();
+	}
+	
+	public static boolean IsSimpleType(QName dataType)
+	{
+		if (dataType.getNamespaceURI().equals(BPELSchema.XMLSCHEMA2001_NS) || dataType.getNamespaceURI().equals(BPELSchema.XMLSCHEMA1999_NS))
+		{
+			return true;
+		}
+		if (dataType.getNamespaceURI().equals(BPELSchema.SOAPSCHEMA_NS))
+		{
+			for( int i = 0; i < simpleSoapTypes.length; i++ )
+			{
+				if ( dataType.getLocalPart().equalsIgnoreCase(simpleSoapTypes[i]) )
+				{
+					return true;
+				}
+			}
+		}
+		return false;
+	}
+	
+	protected String parseBpelFunctionCalls(String xpath)
+	{
+		// Initialize the variable counter and the variable map
+		//_varCtr = 1;
+		_varMap = new HashMap();
+		
+		if (xpath == null)
+			return null;
+		
+		int openGetVariableData = xpath.lastIndexOf("getVariableData(");
+		int openGetVariableProperty = xpath.lastIndexOf("getVariableProperty(");
+		int openGetLinkStatus = xpath.lastIndexOf("getLinkStatus(");
+
+		while ((openGetVariableData > -1) ||
+				(openGetVariableProperty > -1) ||
+				(openGetLinkStatus > -1))
+		{
+			int open = -1;
+			int endOpen = -1;
+			BPELExpressionType type;
+			if ((openGetVariableData > openGetVariableProperty)&&(openGetVariableData > openGetLinkStatus))
+			{
+				open = openGetVariableData;
+				type = BPELExpressionType.VARIABLE_DATA;
+				endOpen = open + 16;
+			}else if ((openGetVariableProperty > openGetVariableData)&&(openGetVariableProperty > openGetLinkStatus))
+			{
+				open = openGetVariableProperty;
+				type = BPELExpressionType.VARIABLE_PROPERTY;
+				endOpen = open + 20;
+			}else 
+			{
+				open = openGetLinkStatus;
+				type = BPELExpressionType.LINK_STATUS;
+				endOpen = open + 14;
+			}
+			
+			int close = xpath.indexOf(")", open+1);
+			//int nextcall = m_bpeExpression.indexOf("(", open+16);
+			int nextcall = xpath.indexOf("(", endOpen);
+			while ((nextcall > -1) && (nextcall < close))
+			{
+				close = xpath.indexOf(")", close+1);
+				nextcall= xpath.indexOf("(", nextcall+1);
+			}
+			String temp = xpath.substring(open,close+1);
+			_varMap.put(String.valueOf(_varCtr),new BPELExpressionTuple(type,
+					temp));
+			xpath = xpath.substring(0, open) + 
+				"$var" + String.valueOf(_varCtr) +
+				xpath.substring(close+1, xpath.length());
+			
+			_varCtr++;
+			
+			openGetVariableData = xpath.lastIndexOf("getVariableData(");
+			openGetVariableProperty = xpath.lastIndexOf("getVariableProperty(");
+			openGetLinkStatus = xpath.lastIndexOf("getLinkStatus(");
+
+		}
+		
+		return xpath;
+	}
+	
+	protected void handleNestedVariables(BPELNode node, BPELNode tagNode, IPMDLocatorHolder locator, BPELInvocationType type)throws DeploymentException
+	{
+		String varLocatorName = null;
+		for (Iterator mapItr = _varMap.entrySet().iterator(); mapItr.hasNext(); ) {
+			Map.Entry me = (Map.Entry)mapItr.next();
+			BPELExpressionTuple et = (BPELExpressionTuple)me.getValue();
+			Matcher m = matchParamPatterns(et.getExpression());
+			varLocatorName = "var"+(String)me.getKey();
+			//retVal.addVariableMap(varLocatorName,et.getExpression());
+						
+			if ( et.getType() == BPELExpressionType.LINK_STATUS ) {
+				//handleLinkStatus(m, et.getExpression(), varLocatorName, node, locator);
+			}
+		
+			if ( et.getType() == BPELExpressionType.VARIABLE_DATA ) {
+				handleData(m, et.getExpression(), varLocatorName, node, tagNode, locator, type);
+			}
+		
+			if ( et.getType() == BPELExpressionType.VARIABLE_PROPERTY ) {
+				//handleProperty(m, et.getExpression(), varLocatorName, node, tagNode, locator, type);
+			}
+	
+		}
+	}
+	
+	private Matcher matchParamPatterns(String expression) {
+		Matcher m = null;
+
+		m = threeParamPattern.matcher(expression);
+		if ( m.matches() ) return m;				
+			
+		m = twoParamPattern.matcher(expression);
+		if ( m.matches() ) return m;				
+			
+		m = oneParamPattern.matcher(expression);
+		if ( m.matches() ) return m;
+		
+		return null;
+	}
+	
+	private void handleData(Matcher m, String expression, String locatorName, BPELNode node, BPELNode tagNode, IPMDLocatorHolder locator, BPELInvocationType type) throws DeploymentException {
+		
+		String locationPath = null;
+		String processName = node.getProcess().getAttributes().getName();
+		String variableName = null;
+		String partName = null;
+		IInvocationFactory invFactory = null;
+		
+		try {
+			variableName = expression.substring(m.start(1),m.end(1));
+		} catch ( Exception e ) {
+			variableName = null;
+		}
+		
+		if ( variableName == null ) {
+			BPELUtil.throwNewException(m_logger,Level.SEVERE,"BPEL_NULLVARPARM",new Object[] {node.getProcess().getAttributes().getName(), expression},null);
+		}
+		
+		BPELVariable var = node.getVariable(variableName);
+		
+		StringBuffer bpePath = new StringBuffer(var.getScopePath(new BPELScopePath(node.inCompensationHandler())).toString());
+		bpePath.append(BPELScopePath.PATH_DELIMITER + variableName);
+		
+		if ( m.groupCount() > 2 ) {
+			locationPath = expression.substring(m.start(3),m.end(3));
+		}
+		try {
+
+			if ( m.groupCount() > 1 ) {
+				// append the partName
+				partName = expression.substring(m.start(2),m.end(2));
+				bpePath.append(BPELScopePath.PATH_DELIMITER + partName);
+				invFactory = var.getInvFactory(processName,partName);
+			} else {
+				invFactory = var.getInvFactory(processName);
+			}
+		} catch ( DeploymentException e) {
+			// User may need a little more information
+			m_logger.log(Level.SEVERE,ResourceGetter.getFormatted("BPEL_EXP_INVALID", new Object[] {node.getProcess().getAttributes().getName(),expression}));
+			throw e;
+		}
+
+		addUsedInActivity(node);
+		
+
+		
+		try {
+			IPMDLocator loc = node.createLocator(true,locator,locatorName, 
+				bpePath.toString(),
+				getInvocation(locationPath,tagNode,type,invFactory), 
+				null, 0, false, false);
+			addUsedInLocator(loc);
+			//addUsedInLocator(locator.createLocator(locatorName, bpePath.toString(), getInvocation(locationPath,tagNode,type,invFactory), null, 0, false, false));
+		} catch (Exception e) {
+			BPELUtil.throwNewException(m_logger,Level.SEVERE,"BPEL_CREATELOCATOR",new Object[] {node.getProcess().getAttributes().getName(), locatorName,bpePath.toString(),locationPath},e);
+		}
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELWSDLLocator.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELWSDLLocator.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELWSDLLocator.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELWSDLLocator.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on May 14, 2003
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.wsdl.xml.WSDLLocator;
+
+import org.xml.sax.InputSource;
+
+import org.apache.ode.lang.ResourceGetter;
+
+/**
+ * 
+ * Imported WSDL documents are dereferenced by the WSDL API - JSR110. Because all linked WSDL
+ * documents are found in a jar file a WSDLLocator is required to find documents stored in
+ * an internal document hashmap. Supporting WSDL documents are pulled from the deployment
+ * jar into an internal HashMap.
+ *
+ * @author waterman
+ */
+class BPELWSDLLocator implements WSDLLocator {
+	
+	private static final Logger logger = Logger.getLogger(BPELWSDLLocator.class.getName());
+	
+	private InputSource m_source;
+	private HashMap m_supportDoc;
+	private String m_bpelURI;
+	private String m_latestURI;
+
+	BPELWSDLLocator(String bpelURI, InputSource source, HashMap supportDoc) {
+		m_source = source;
+		m_supportDoc = supportDoc;
+		m_bpelURI = bpelURI;
+	}
+	/**
+	 * @see javax.wsdl.xml.WSDLLocator#getBaseInputSource()
+	 */
+	public InputSource getBaseInputSource() {
+		return m_source;
+	}
+
+	/**
+	 * @see javax.wsdl.xml.WSDLLocator#getBaseURI()
+	 */
+	public String getBaseURI() {
+		return m_bpelURI;
+	}
+
+	/**
+	 * @see javax.wsdl.xml.WSDLLocator#getImportInputSource(java.lang.String, java.lang.String)
+	 */
+	public InputSource getImportInputSource(String arg0, String arg1) {
+		
+		// Strip away any prefix path. May need to come back and revisit this if 
+		// deployment package contains a heirarchy.
+		//m_latestURI = arg1.substring(arg1.lastIndexOf("/")+1);
+		m_latestURI = arg1;
+		
+		InputSource is = null;
+		
+		// lookup the document from the internal map collection
+		byte[] data = (byte[])m_supportDoc.get(m_latestURI.toLowerCase());
+		
+		if ( data != null ) {
+			try {
+
+				// Create a SAX InputSource from the document byte array
+				ByteArrayInputStream bais = new ByteArrayInputStream(data);
+				is = new InputSource(bais);
+			    bais.close();
+			} catch (IOException e) {
+				logger.log(Level.SEVERE,ResourceGetter.getFormatted("BPEL_IOERR",new Object[] {arg0, m_latestURI.toLowerCase()}),e);
+			}
+		}
+		
+
+		if ( is == null ) {
+			logger.log(Level.SEVERE,ResourceGetter.getFormatted("DEPLOY_WSDL_NOTFOUND",new Object[] {m_bpelURI,m_latestURI.toLowerCase()}));
+		}
+		
+		return is;
+	}
+
+	/**
+	 * @see javax.wsdl.xml.WSDLLocator#getLatestImportURI()
+	 */
+	public String getLatestImportURI() {
+		return m_latestURI;
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELWSDLVariable.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELWSDLVariable.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELWSDLVariable.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELWSDLVariable.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,252 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on May 28, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.wsdl.Message;
+import javax.wsdl.Part;
+import javax.xml.namespace.QName;
+
+import org.apache.ode.definition.IPMDLocator;
+import org.apache.ode.definition.IPMDLocatorHolder;
+import org.apache.ode.definition.service.DefinitionServiceException;
+//import org.apache.ode.interaction.IInvocationFactory;
+//import org.apache.ode.interaction.builders.IInteractionBuilder;
+
+
+/**
+ * 
+ * A WSDL based BPEL message variable. Identifies message parts from an imported
+ * WSDL doc.
+ *
+ * @author waterman
+ */
+class BPELWSDLVariable extends BPELVariable {
+
+	private static final Logger logger = Logger.getLogger(BPELWSDLVariable.class.getName());
+	private Message msg; // The WSDL message
+
+	BPELWSDLVariable(BPELAttributes attrs, HashMap containerMap, Message msg) throws DeploymentException {
+		super(attrs, containerMap, logger);
+		this.msg = msg;
+	}
+	
+	BPELWSDLVariable(BPELAttributes attrs, ExtensibilityArtifacts ea, BPELNode node) throws DeploymentException {
+		super(attrs, ea.getContainerMap(attrs.getName()), logger);
+		
+		if ( attrs.getMessageType() != null ) {
+			// This is a WSDL defined variable
+			
+			
+			msg = ea.getMessage(attrs.getMessageType(),node);
+			
+			if ( msg == null ) {
+				BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_MSG_NOTFOUND",new Object[] {node.getProcess().getAttributes().getName(), attrs.getMessageType()},null);
+			}
+			
+		} else {
+			// Could be another namespace defined variable
+			// that is not currently handled
+			BPELUtil.throwNewException(logger,Level.SEVERE,"DEPLOY_UNKNOWN_VARTYPE",null,null);
+		}
+
+	}
+	
+
+	/**
+	 * @see org.apache.ode.deployment.bpel.BPELVariable#createLocator(org.apache.ode.definition.IPMDLocatorHolder, org.apache.ode.deployment.bpel.BPELNode, org.apache.ode.deployment.bpel.BPELAttributes, boolean)
+	 */
+	Object createLocator(IPMDLocatorHolder locator, BPELNode node, BPELNode tagNode, BPELAttributes attrs, BPELInvocationType type, boolean forOutPut) throws DeploymentException {
+		addUsedInActivity(node);
+		
+		String locatorName = null;
+		IPMDLocator loc = null;
+		boolean inCompHandler = node.inCompensationHandler();
+//		IInteractionBuilder intBuilder = null;
+//		IInvocationFactory invFactory = null;
+		
+		String partName = ( attrs != null ) ? attrs.getPart() : null;
+		String query = ( attrs != null ) ? attrs.getQuery() : null;
+		locatorName = ( attrs != null && attrs.getName() != null ) ? attrs.getName() : getName()+":"+partName;
+		String processName = node.getProcess().getAttributes().getName();
+		
+		query = parseBpelFunctionCalls(query);
+		
+		if ( partName != null ) {
+			loc = locator.getLocator(locatorName);
+			if ( loc == null ) {
+				try {
+					loc = node.createLocator(true,locator,locatorName, 
+						this.getScopePath(new BPELScopePath(inCompHandler)).
+							toString()+BPELScopePath.PATH_DELIMITER+getName()+
+							BPELScopePath.PATH_DELIMITER + partName, 
+						getInvocation(query,tagNode,type,
+							getInvFactory(processName,partName)), 
+						getIntBuilder(processName,partName), 
+						0, forOutPut, false);
+				} catch (DefinitionServiceException e) {
+					BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATELOCATOR",new Object[] {processName, locatorName,this.getScopePath(new BPELScopePath(inCompHandler)).toString()+BPELScopePath.PATH_DELIMITER+getName()+BPELScopePath.PATH_DELIMITER + partName,query},e);
+				}
+			} else {
+				loc.setForOutput(forOutPut);
+			}
+			addUsedInLocator(loc);
+		} else {
+			for (Iterator itr = msg.getParts().values().iterator(); itr.hasNext(); ) {
+				Part p = (Part)itr.next();
+				locatorName = getName()+":"+p.getName();
+				loc = locator.getLocator(locatorName);
+				if ( loc == null ) {
+					try {
+						loc = node.createLocator(true,locator,locatorName, 
+							this.getScopePath(new BPELScopePath(inCompHandler)).
+								toString()+BPELScopePath.PATH_DELIMITER+getName()+
+								BPELScopePath.PATH_DELIMITER+p.getName(), 
+							getInvocation(query,node,type,
+								getInvFactory(processName,p.getName())), 
+							getIntBuilder(processName,p.getName()), 0, 
+							forOutPut, false);
+					} catch (DefinitionServiceException e) {
+						BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATELOCATOR",new Object[] {node.getProcess().getAttributes().getName(), locatorName,this.getScopePath(new BPELScopePath(inCompHandler)).toString()+BPELScopePath.PATH_DELIMITER+getName()+BPELScopePath.PATH_DELIMITER + partName,query},e);
+					}
+				} else {
+					loc.setForOutput(forOutPut);
+				}
+				addUsedInLocator(loc);
+			}
+			locatorName = getName();
+		}
+		
+		handleNestedVariables(node, tagNode, locator, type);
+		/////////////////////////////////////////////////////////////////////////////////
+/*		String varLocatorName = null;
+		for (Iterator mapItr = _varMap.entrySet().iterator(); mapItr.hasNext(); ) {
+			Map.Entry me = (Map.Entry)mapItr.next();
+			BPELExpressionTuple et = (BPELExpressionTuple)me.getValue();
+			Matcher m = matchParamPatterns(et.getExpression());
+			varLocatorName = "var"+(String)me.getKey();
+			//retVal.addVariableMap(varLocatorName,et.getExpression());
+						
+			if ( et.getType() == BPELExpressionType.LINK_STATUS ) {
+				//handleLinkStatus(m, et.getExpression(), varLocatorName, node, locator);
+			}
+		
+			if ( et.getType() == BPELExpressionType.VARIABLE_DATA ) {
+				handleData(m, et.getExpression(), varLocatorName, node, tagNode, locator, type);
+			}
+		
+			if ( et.getType() == BPELExpressionType.VARIABLE_PROPERTY ) {
+				//handleProperty(m, et.getExpression(), varLocatorName, node, tagNode, locator, type);
+			}
+
+		}*/
+		////////////////////////////////////////////////////////////////////////////////
+		
+		
+		return locatorName;		
+	}
+	
+	QName getMessageName() {
+		return msg.getQName();
+	}
+	
+	boolean isPartSimpleType(String partName) {
+		
+
+		Part msgPart = msg.getPart(partName);
+		
+		if ( msgPart == null )
+		{
+			return false;
+		}
+		
+		QName type = msgPart.getTypeName();
+		if ( type == null ) type = msgPart.getElementName();
+		return BPELVariable.IsSimpleType( type );
+
+	}
+	
+	/*private String parseBpelFunctionCalls(String xpath)
+	{
+		int openGetVariableData = xpath.lastIndexOf("getVariableData(");
+		int openGetVariableProperty = xpath.lastIndexOf("getVariableProperty(");
+		int openGetLinkStatus = xpath.lastIndexOf("getLinkStatus(");
+
+		_varCtr = 1;
+		while ((openGetVariableData > -1) ||
+				(openGetVariableProperty > -1) ||
+				(openGetLinkStatus > -1))
+		{
+			int open = -1;
+			int endOpen = -1;
+			BPELExpressionType type;
+			if ((openGetVariableData > openGetVariableProperty)&&(openGetVariableData > openGetLinkStatus))
+			{
+				open = openGetVariableData;
+				type = BPELExpressionType.VARIABLE_DATA;
+				endOpen = open + 16;
+			}else if ((openGetVariableProperty > openGetVariableData)&&(openGetVariableProperty > openGetLinkStatus))
+			{
+				open = openGetVariableProperty;
+				type = BPELExpressionType.VARIABLE_PROPERTY;
+				endOpen = open + 20;
+			}else 
+			{
+				open = openGetLinkStatus;
+				type = BPELExpressionType.LINK_STATUS;
+				endOpen = open + 14;
+			}
+			
+			int close = xpath.indexOf(")", open+1);
+			//int nextcall = m_bpeExpression.indexOf("(", open+16);
+			int nextcall = xpath.indexOf("(", endOpen);
+			while ((nextcall > -1) && (nextcall < close))
+			{
+				close = xpath.indexOf(")", close+1);
+				nextcall= xpath.indexOf("(", nextcall+1);
+			}
+			String temp = xpath.substring(open,close+1);
+			_varMap.put(String.valueOf(_varCtr),new BPELExpressionTuple(type,
+					temp));
+			xpath = xpath.substring(0, open) + 
+				"$var" + String.valueOf(_varCtr) +
+				xpath.substring(close+1, xpath.length());
+			
+			_varCtr++;
+			
+			openGetVariableData = xpath.lastIndexOf("getVariableData(");
+			openGetVariableProperty = xpath.lastIndexOf("getVariableProperty(");
+			openGetLinkStatus = xpath.lastIndexOf("getLinkStatus(");
+
+		}
+		
+		return xpath;
+	}*/
+	
+
+	
+
+	
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELWait.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELWait.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELWait.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELWait.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on Jul 16, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.action.bpel.UnInitVariableMetaData;
+import org.apache.ode.definition.IPMDAction;
+import org.apache.ode.definition.IPMDChangeCondition;
+import org.apache.ode.definition.service.DefinitionServiceException;
+
+
+/**
+ * Implements the BPEL <i>wait</i> node. 
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tWait.
+ * 
+ * @author waterman
+ */
+class BPELWait extends BPELLinkedActivity {
+	private static final Logger logger = Logger.getLogger(BPELWait.class.getName());
+
+
+//	private static final String TIMER_KEY = "TIMER_KEY";
+//	private static final String CORRELATION_NAME = "TIMER_CORRELATION";
+
+	/**
+	 * @param previous the parent schema node
+	 * @param attrs    the schema attributes
+	 * @throws DefinitionServiceException
+	 */
+	BPELWait(BPELNode previous, BPELAttributes attrs)
+		throws DeploymentException {
+		super(previous, BPELSchema.WAIT, attrs, logger);
+	}
+	
+	/**
+	 * @see org.apache.ode.deployment.bpel.BPELNode#pop()
+	 */
+	BPELNode pop() throws DeploymentException {
+
+		// Create the change condition
+		//IPMDAction regact=null;
+		//IPMDAction remact=null;
+		IPMDAction recact=null;
+		String timeValue=null;
+		
+		try {
+			
+			IPMDChangeCondition cc = 
+				getStartProcess().createChangeCondition("ChangeCondition: " + getAttributes().getName(),
+				org.apache.ode.condition.DefaultConditional.class.getName());
+			recact = 
+				cc.createAction("TimerAction:" + getAttributes().getName(),
+				org.apache.ode.action.bpel.TimerAction.class.getName());
+				
+			timeValue = getAttributes().getUntil();
+			
+			if ( timeValue != null ) {
+				//recact.addMetadata(org.apache.ode.action.bpel.TimerAction.DEADLINE,timeValue);
+				buildExpression(recact,timeValue,org.apache.ode.action.bpel.TimerAction.DEADLINE);
+			}
+			timeValue = getAttributes().getFor();
+			if ( timeValue != null ) {
+				//recact.addMetadata(org.apache.ode.action.bpel.TimerAction.DURATION,timeValue);
+				buildExpression(recact,timeValue,org.apache.ode.action.bpel.TimerAction.DURATION);
+			}
+			recact.addMetadata(org.apache.ode.action.bpel.CopyAction.UNINITVAR_KEY,new UnInitVariableMetaData(BPELSchema.BPEL_URI,BPELSchema.FAULT_UNINIT_VAR));
+			createLocator(false,recact,
+				org.apache.ode.action.bpel.TimerAction.TIMER_ACTION_LOCATOR_KEY, 
+				getScopePath(new BPELScopePath(inCompensationHandler())).
+					toString()+BPELScopePath.PATH_DELIMITER+getStartProcess().
+					getKey().getValue(), 
+				null, null, 0, true,  false);
+			recact.addMetadata(org.apache.ode.action.bpel.TimerAction.BLOCK,new Boolean(true));
+			
+		} catch (DefinitionServiceException e) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e);
+		}
+		
+		getProcess().setIsStateFull();
+		
+		return super.pop();
+	}
+	
+	private void buildExpression(IPMDAction ccact, String expr, String actprop) throws DefinitionServiceException, DeploymentException {
+		BPELExpressionVariable expVar = new BPELExpressionVariable(expr);
+		ccact.addMetadata(actprop,expVar.createLocator(ccact,this,null,null,BPELInvocationType.SELECT_VALUE,false));
+	}
+
+	/**
+	 * @see org.apache.ode.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+	 */
+	String getActivityDescription() {
+		return "wait is implemented by: " + org.apache.ode.action.bpel.TimerAction.class.getName() + ". It is used to block a business process until the alarm event fires.";
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELWhile.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELWhile.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELWhile.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELWhile.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on Jul 10, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.util.Properties;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.action.bpel.UnInitVariableMetaData;
+import org.apache.ode.action.bpel.XPathJaxenExpression;
+import org.apache.ode.action.bpel.XPathSwitchAction;
+import org.apache.ode.action.bpel.XPathSwitchTuple;
+import org.apache.ode.definition.IPMDAction;
+import org.apache.ode.definition.IPMDChangeCondition;
+import org.apache.ode.definition.service.DefinitionServiceException;
+
+/**
+ * Implements the BPEL <i>while</i> node. 
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tWhile.
+ * 
+ * @author waterman
+ */
+class BPELWhile extends BPELStructuredActivity {
+
+	private static final Logger logger = Logger.getLogger(BPELWhile.class.getName());
+
+	private static final String XPATH_SWITCH_CLASS = org.apache.ode.action.bpel.XPathSwitchAction.class.getName();
+	private static final String DEFAULT_CONDITION_CLASS = org.apache.ode.condition.DefaultConditional.class.getName();
+	private static final String SWITCH_COND_LABEL = "Switch Condition: ";
+	private static final String SWITCH_ACTION_LABEL = "Switch Action : ";
+
+	/**
+	 * @param previous the parent schema node
+	 * @param attrs    the schema attributes
+	 * @throws DefinitionServiceException
+	 */
+	BPELWhile(BPELNode previous, BPELAttributes attrs)
+		throws DeploymentException {
+		super(previous, BPELSchema.WHILE, attrs, logger);
+	}
+	
+	/**
+	 * @see org.apache.ode.deployment.bpel.BPELNode#addActivity(org.apache.ode.deployment.bpel.BPELNode)
+	 */
+	void addActivity(BPELNode activity) throws DeploymentException {
+		
+		// The while condition behaves much like a switch condition and
+		// therefore uses the Swith Action.
+		
+		Vector v = new Vector();
+		BPELLinkedActivity la = (BPELLinkedActivity)activity;
+		
+		// The starting process of the while activity is an observer of the
+		// activity ending process. This is a cyclic goto.
+		try {
+			la.getEndProcess().addObserverProcessPC(getStartProcess());
+		} catch (DefinitionServiceException e) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_ADDOBSERVER",new Object[] {getProcess().getAttributes().getName()},e);
+		}
+		
+		
+		// Create the change condition and action that implement the switch
+		IPMDAction da=null;
+		try {
+			IPMDChangeCondition cc = getStartProcess().createChangeCondition(SWITCH_COND_LABEL + getAttributes().getName(),DEFAULT_CONDITION_CLASS);
+			da = cc.createAction(SWITCH_ACTION_LABEL + getAttributes().getName(),
+					XPATH_SWITCH_CLASS);
+		} catch (DefinitionServiceException e1) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e1);
+		}
+		
+		// parse the condition and create the context locators for all the bpws: extentions
+		BPELExpressionVariable expVar = new BPELExpressionVariable(getAttributes().getCondition());
+		
+		// create the XPathTuple that maps the XPath Expression to a 
+		// definition key. The switch action class will evaluate the XPath 
+		// expression, if true a process instance is created from the definition key
+		// and then started.
+		v.add( new XPathSwitchTuple((XPathJaxenExpression)expVar.createLocator(da,this,null,BPELInvocationType.SELECT_VALUE,false),la.getStartProcess().getKey()));
+		
+		Properties md = new Properties();
+		
+		// Add the condition expression as metadata to the switch action
+		//da.addMetadata(XPathSwitchAction.CASES_KEY,v);
+		md.put(XPathSwitchAction.CASES_KEY,v);
+		md.put(org.apache.ode.action.bpel.XPathSwitchAction.UNINITVAR_KEY,new UnInitVariableMetaData(BPELSchema.BPEL_URI,BPELSchema.FAULT_UNINIT_VAR));
+		
+		// The default value to the switch action will cause the loop to end
+		//da.addMetadata(XPathSwitchAction.DEFAULT_KEY,getEndProcess().getKey());
+		md.put(XPathSwitchAction.DEFAULT_KEY,getEndProcess().getKey());
+		
+		da.setMetadata(md);
+	}
+	
+
+
+	/**
+	 * @see org.apache.ode.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+	 */
+	String getActivityDescription() {
+		return "while is implemented by: " + org.apache.ode.action.bpel.XPathSwitchAction.class.getName() + ". It is used to define the context of a loop pattern.";
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELXMLSchemaVariable.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELXMLSchemaVariable.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELXMLSchemaVariable.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELXMLSchemaVariable.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on May 28, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ode.definition.IPMDLocator;
+import org.apache.ode.definition.IPMDLocatorHolder;
+import org.apache.ode.definition.service.DefinitionServiceException;
+
+
+
+/**
+ * 
+ * A XMLSchema based BPEL message variable.
+ *
+ * @author waterman
+ */
+class BPELXMLSchemaVariable extends BPELVariable {
+
+	private static final Logger logger = Logger.getLogger(BPELXMLSchemaVariable.class.getName());
+	
+	BPELXMLSchemaVariable(BPELAttributes attrs, ExtensibilityArtifacts ea, BPELNode context) throws DeploymentException {
+		super(attrs, ea.getContainerMap(attrs.getName()), logger);
+		
+		attrs.setDataType(context);
+
+	}
+
+	/**
+	 * @see org.apache.ode.deployment.bpel.BPELVariable#createLocator(org.apache.ode.definition.IPMDLocatorHolder, org.apache.ode.deployment.bpel.BPELNode, org.apache.ode.deployment.bpel.BPELAttributes, boolean)
+	 */
+	Object createLocator(IPMDLocatorHolder locator, BPELNode node, BPELNode tagNode, BPELAttributes attrs, BPELInvocationType type, boolean forOutPut) throws DeploymentException {
+		addUsedInActivity(node);
+		
+		String locatorName = null;
+		IPMDLocator loc = null;
+		boolean inCompHandler = node.inCompensationHandler();
+		String processName = node.getProcess().getAttributes().getName();
+		
+		if ( ( attrs != null ) && ( attrs.getPart() != null )) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEXMLLOCATOR",new Object[] {processName,this.getScopePath(new BPELScopePath(inCompHandler)).toString()+BPELScopePath.PATH_DELIMITER+getName()+BPELScopePath.PATH_DELIMITER + attrs.getPart()},null);
+		}
+		String query = ( attrs != null ) ? attrs.getQuery() : null;
+		locatorName = ( attrs != null && attrs.getName() != null ) ? attrs.getName() : getName();
+		
+		query = parseBpelFunctionCalls(query);
+		
+		loc = locator.getLocator(locatorName);
+		if ( loc == null ) {
+			try {
+				loc = node.createLocator(true, locator, locatorName, 
+						this.getScopePath(new BPELScopePath(inCompHandler)).
+							toString()+BPELScopePath.PATH_DELIMITER+getName(), 
+						getInvocation(query,tagNode,type,
+							getInvFactory(processName)), 
+						getIntBuilder(processName), 0, forOutPut, false);
+			} catch (DefinitionServiceException e) {
+				BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATELOCATOR",new Object[] {processName, locatorName,this.getScopePath(new BPELScopePath(inCompHandler)).toString()+BPELScopePath.PATH_DELIMITER+getName(),query},e);
+			}
+		} else {
+			loc.setForOutput(forOutPut);
+		}
+		addUsedInLocator(loc);
+		
+		handleNestedVariables(node, tagNode, locator, type);
+
+		return locatorName;	
+	}
+	
+	boolean isSimpleType() {
+		
+		QName type = getAttributes().getDataType();
+		return BPELVariable.IsSimpleType(type);
+
+	}
+	
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/DeploymentException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/DeploymentException.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/DeploymentException.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/DeploymentException.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on May 12, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+
+import org.apache.ode.util.BPException;
+
+/**
+ * @author waterman
+ *
+ */
+public class DeploymentException extends BPException {
+	
+	static final long serialVersionUID = -2402768393467524455L;
+
+
+    public DeploymentException( Exception cause )
+    {
+        super(cause);
+    }
+    
+	/**
+	 * @param message_id
+	 * @param msgParams
+	 */
+	public DeploymentException(String message_id, Object[] msgParams) {
+		super(message_id, msgParams);
+	}
+
+	/**
+	 * @param message_id
+	 * @param msgParams
+	 * @param cause
+	 */
+	public DeploymentException(
+		String message_id,
+		Object[] msgParams,
+		Throwable cause) {
+		super(message_id, msgParams, cause);
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/ExtensibilityArtifacts.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/ExtensibilityArtifacts.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/ExtensibilityArtifacts.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/ExtensibilityArtifacts.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,872 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on Jun 9, 2004
+ * Author waterman
+ * 
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Import;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.PortType;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+
+import org.apache.xmlbeans.SchemaLocalAttribute;
+import org.apache.xmlbeans.SchemaProperty;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlException;
+import org.xml.sax.InputSource;
+
+
+import org.apache.ode.binding.ode.BPEBindingDocument;
+import org.apache.ode.binding.ode.TActivityBinding;
+import org.apache.ode.binding.ode.TActivityBindings;
+import org.apache.ode.binding.ode.TBinding;
+import org.apache.ode.binding.ode.TOperation;
+import org.apache.ode.binding.ode.TSchema;
+import org.apache.ode.wsdl.extensions.BPEAction;
+import org.apache.ode.wsdl.extensions.BPEActionSerializer;
+import org.apache.ode.wsdl.extensions.BPEFault;
+import org.apache.ode.wsdl.extensions.BPEFaultSerializer;
+import org.apache.ode.wsdl.extensions.BPEInput;
+import org.apache.ode.wsdl.extensions.BPEInputSerializer;
+import org.apache.ode.wsdl.extensions.BPELProperty;
+import org.apache.ode.wsdl.extensions.BPELPropertyAlias;
+import org.apache.ode.wsdl.extensions.BPELPropertyAliasSerializer;
+import org.apache.ode.wsdl.extensions.BPELPropertySerializer;
+import org.apache.ode.wsdl.extensions.BPEOutput;
+import org.apache.ode.wsdl.extensions.BPEOutputSerializer;
+import org.apache.ode.wsdl.extensions.BPEVariableMap;
+import org.apache.ode.wsdl.extensions.BPEVariableMapSerializer;
+import org.apache.ode.wsdl.extensions.ExtentionConstants;
+
+/**
+ * @author waterman
+ *
+ * This object holds artifacts/documents ( i.e. WSDL, XML, XSLT ) that support the
+ * BPEL process definition. It also provides helper functions to navigate and search
+ * for objects within the extensibility artifacts.
+ * 
+ */
+public class ExtensibilityArtifacts {
+	
+	private static final Logger logger = Logger.getLogger(ExtensibilityArtifacts.class.getName());
+
+	private static final Pattern wsdlPattern = Pattern.compile(".*\\.wsdl");
+
+	
+	// If BPE bindings are not found in extensibility artifacts then these defaults
+	// will be used:
+	// The perferred data type for BPEL variables and for params passed across
+	// an IExternalAction interface.
+	private static final String DEFAULT_TYPE = "";
+	// A default implementation of IExternalAction;
+	private static final String DEFAULT_IMPL = "org.apache.ode.action.bpel.external.WSIFAction";
+
+	// The process holds namespace prefixes used in the BPEL document.
+	private BPELProcess process;
+	
+	// The WSDL document that defines the interface for the BPEL process
+	private Definition rootDef;
+	
+	// A normalized list of imported WSDL documents
+	private List wsdlDefs;
+	
+	// A normalized list of non-wsdl documents to be added into the BPE runtime
+	// metadata repository ( i.e. XSLT documents )
+	private HashMap repos = new HashMap();
+	
+	// The BPE binding document. 
+	private TSchema bpeBinding;
+	private HashMap activityBindingMap;
+	
+	
+	public ExtensibilityArtifacts( String bpelDocName, HashMap artifacts ) throws DeploymentException {
+		rootDef = getRootWSDL(bpelDocName, artifacts);
+		bpeBinding = getBPEBindings(bpelDocName, artifacts);
+		
+		Pattern bindingPattern = Pattern.compile(bpelDocName+".xml");
+
+		
+		wsdlDefs = BPELUtil.getDefinitionList(rootDef,new ArrayList());
+		
+		// iterate over supporting docs and add to repos
+		for ( Iterator itr = artifacts.entrySet().iterator(); itr.hasNext(); ) {
+			Map.Entry me = (Map.Entry)itr.next();
+			
+			Matcher m1 = wsdlPattern.matcher((String)me.getKey());
+			Matcher m2 = bindingPattern.matcher((String)me.getKey());
+
+			if ( !m1.matches() && !m2.matches() ) {
+				repos.put((String)me.getKey(),new String((byte[])me.getValue()));
+			}
+		}
+	}
+	
+
+	/**
+	 * Build a map of activity ID's to activity bindings.
+	 */
+	private void buildActivityBindingMap()
+	{
+	    activityBindingMap = new HashMap();
+        TActivityBindings abs = bpeBinding.getActivityBindings();
+        if ( abs != null )
+        {
+            TActivityBinding[] activityBindingList = abs.getActivityBindingArray();
+
+            if ( activityBindingList.length > 0 )
+            {
+                for ( int iter=0; iter < activityBindingList.length; iter++ )
+                {
+                    TActivityBinding ab = (TActivityBinding) activityBindingList[iter];
+                    if ( ab != null )
+                    {
+                        String activityName = ab.getActivityName();
+                        activityBindingMap.put(activityName, ab );
+                    }
+                }       
+            }
+        }
+	}
+	
+	/**
+	 * Get the interpretation of an activity if the activity
+	 * has associated bindings.  Return null if no bindings
+	 * are associated with the activites.
+	 * @param activityID
+	 * @return
+	 */
+	public String getActivityInterpretation( String activityID )
+	{
+	    if ( bpeBinding == null )
+	    {
+	        return null;
+	    }
+	    if ( activityBindingMap == null )
+	    {
+	        buildActivityBindingMap();
+	    }
+	    
+	    TActivityBinding ab = 
+	        ( TActivityBinding )( activityBindingMap.get(activityID) );
+	    
+	    if ( ab != null )
+	    {
+	        return ab.getInterpretation();
+	    }
+	    
+	    return null;
+
+	}
+	
+	
+	/**
+	 * A helper method for building a BPEL Catch variable
+	 * 
+	 * @param faultName
+	 * @param faultVariable
+	 * @param faultMap
+	 * @return
+	 * @throws DeploymentException
+	 */
+	public BPELVariable getFaultVariable(QName faultName, String faultVariable, HashMap faultMap) throws DeploymentException {
+		
+		BPELVariable retVal = null;
+		
+		// Iterate over the definitions looking for a matching fault name
+		all:for ( Iterator defIter = wsdlDefs.iterator(); defIter.hasNext(); ) {
+			Definition defCur = (Definition)defIter.next();
+			if ( defCur.getTargetNamespace().equals(faultName.getNamespaceURI())) {
+				// In the namespace ballpark - look for fault
+				for ( Iterator portItr = defCur.getPortTypes().values().iterator(); portItr.hasNext(); ) {
+					PortType pt = (PortType)portItr.next();
+					for ( Iterator operItr = pt.getOperations().iterator(); operItr.hasNext(); ) {
+						Operation oper = (Operation)operItr.next();
+						Fault wsdlFault = oper.getFault(faultName.getLocalPart());
+						if ( wsdlFault != null ) {
+							BPELAttributes wsdlVarAttrs = new BPELAttributes();
+							wsdlVarAttrs.setName(faultVariable);
+							QName msgName = wsdlFault.getMessage().getQName();
+							wsdlVarAttrs.setMessageType(defCur.getPrefix(msgName.getNamespaceURI())+":"+msgName.getLocalPart());
+							retVal = new BPELWSDLVariable(wsdlVarAttrs,getContainerMap(faultVariable),wsdlFault.getMessage());
+							getBPEFault(oper,pt,faultName.getLocalPart(),faultMap);
+							break all;
+						}
+					}
+				}
+			}
+		}
+		
+		return retVal;
+		
+	}
+	
+	/**
+	 * Deprecated: maps a BPEL variable to a data container factory.
+	 * 
+	 * @param varName
+	 * @return
+	 * 
+	 */
+	public HashMap getContainerMap(String varName) {
+		HashMap retVal = new HashMap();
+		boolean found = false;
+		
+		defs:for ( Iterator defsItr = wsdlDefs.iterator(); defsItr.hasNext();  ) {
+			
+			Definition wsdlDef = (Definition)defsItr.next();
+						
+			// find the container to variable mapping
+			Collection elems = wsdlDef.getExtensibilityElements();
+			ExtensibilityElement extElem = null;
+			BPEVariableMap varMap = null;
+			for ( Iterator elem = elems.iterator(); elem.hasNext(); ) {
+				extElem = (ExtensibilityElement)elem.next();
+				if ( extElem instanceof BPEVariableMap ) {
+					varMap = (BPEVariableMap)extElem;
+					if ( varMap.getName().getLocalPart().equals(varName)) {
+						if ( varMap.getPart() != null ) {
+							retVal.put(varMap.getPart(),varMap);
+							found = true;
+						} else {
+							retVal.put(varMap.getName().getLocalPart(),varMap);
+							found = true;
+						}
+					}
+				}
+			}
+			if ( found ) break defs;
+		}
+		
+		return retVal;
+	}
+
+	/**
+	 * Deprecated: maps a BPEL fault variable to a data container factory.
+	 * 
+	 */
+	private HashMap getBPEFault(Operation opr, PortType pt, String faultName, HashMap faultHM) {
+
+		// Set a default binding
+		for ( Iterator partItr = opr.getFault(faultName).getMessage().getParts().keySet().iterator(); partItr.hasNext(); ) {
+			String partName = (String)partItr.next();
+			BPEFault bpeFault = new BPEFault();
+			bpeFault.setPart(partName);
+			bpeFault.setType(DEFAULT_TYPE);
+			faultHM.put(partName,bpeFault);
+		}		
+		
+	
+		// If a binding has been supplied use the defined binding
+		Binding binding = null;		
+		all: for (Iterator defItr = wsdlDefs.iterator(); defItr.hasNext(); ) {
+			Definition id = (Definition)defItr.next();
+			for (Iterator bindingItr = id.getBindings().values().iterator(); bindingItr.hasNext(); ) {
+				binding = (Binding)bindingItr.next();
+				if ( binding.getPortType() == pt ) {
+					List opers = binding.getBindingOperations();
+					for(Iterator operIter=opers.iterator(); operIter.hasNext(); ) {
+						BindingOperation bopr = (BindingOperation)operIter.next();
+						if ( isOperationMatch(opr, bopr) ) {
+							// Assumption: The first binding found will be used.
+							// Found the required operation on a binding
+							BindingFault bf = bopr.getBindingFault(faultName);
+							if ( bf != null ) {
+								List bfexts = bf.getExtensibilityElements();
+								for ( Iterator bfextsItr = bfexts.iterator(); bfextsItr.hasNext(); ) {
+									Object bpeFault = bfextsItr.next();
+									if ( bpeFault instanceof BPEFault ) {
+										if ( faultHM.containsKey(((BPEFault)bpeFault).getPart())) {
+											faultHM.put(((BPEFault)bpeFault).getPart(),bpeFault);
+										}
+									}				
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+		
+		return faultHM;
+	}
+	
+	private BPELProcess getProcess() {
+		return process;
+	}
+	
+	public void setProcess(BPELProcess process) {
+		this.process = process;
+		for ( Iterator itr = repos.entrySet().iterator(); itr.hasNext(); ) {
+			Map.Entry me = (Map.Entry)itr.next();
+			process.addSupportingDocument((String)me.getKey(),(String)me.getValue());
+		}
+	}
+	
+	public Message getMessage(String msgName, BPELNode node) throws DeploymentException {
+		
+		return rootDef.getMessage(node.getQName(msgName));
+		
+	}
+	
+	/**
+	 * Constructs a bpel:Property element
+	 * 
+	 * @return
+	 * @throws DeploymentException
+	 */
+	public HashMap buildProperties() throws DeploymentException {
+		
+		HashMap retVal = new HashMap();
+
+		for ( Iterator wsdlItr = wsdlDefs.iterator(); wsdlItr.hasNext(); ) {
+
+			Definition wsdlDef = (Definition)wsdlItr.next();
+			
+			// Iterate over the ExtensibilityElements and extract any BPELProperty nodes		
+			List el = wsdlDef.getExtensibilityElements();
+			BPELProperty prop = null;
+	
+			for ( Iterator itr = el.iterator(); itr.hasNext(); ) {
+				Object eo = itr.next();
+				if ( eo instanceof BPELProperty ) {
+					prop = (BPELProperty)eo;
+					retVal.put(new QName(wsdlDef.getTargetNamespace(),prop.getName()),new BPELPropertyDefinition(prop));
+				}
+			}
+		}
+		
+		buildPropertyAliases(retVal);
+		
+		return retVal;
+	}
+
+	/**
+	 * Constructs a bpel:PropertyAlias
+	 * 
+	 * @param props
+	 * @throws DeploymentException
+	 */
+	private void buildPropertyAliases(HashMap props) throws DeploymentException {
+
+		BPELPropertyAlias alias = null;
+		BPELPropertyDefinition propDef = null;
+		
+		for ( Iterator wsdlItr = wsdlDefs.iterator(); wsdlItr.hasNext(); ) {
+
+			Definition wsdlDef = (Definition)wsdlItr.next();
+
+			// Iterate over the ExtensibilityElements and extract any BPELProperty nodes		
+			List el = wsdlDef.getExtensibilityElements();
+//			BPELProperty prop = null;
+	
+			for ( Iterator itr = el.iterator(); itr.hasNext(); ) {
+				Object eo = itr.next();
+				if ( eo instanceof BPELPropertyAlias) {
+					alias = (BPELPropertyAlias)eo;
+					propDef = (BPELPropertyDefinition)props.get(alias.getPropertyName());
+					if ( propDef == null ) {
+						BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_PROPERTY_NOTFOUND", new Object[] {getProcess().getAttributes().getName(),alias.getPropertyName().toString()},null);
+					}
+					propDef.addAlias(alias);
+				}	
+			}
+		}
+	}
+	
+	/**
+	 * Binds the bpel:invoke to an IExternalAction
+	 */
+	
+	public BPELAction getBindingInvokeAction(String portType, 
+	        String operationName, String invokeName, 
+	        BPELVariable input, BPELVariable output, 
+	        BPELNode node) throws DeploymentException {
+		
+		BPELAction retVal = new BPELAction();
+		BPEAction bpeAction = null;
+		
+		QName qnPort = node.getQName(portType);
+
+		PortType pt = rootDef.getPortType(qnPort);
+		if ( pt == null ) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_PT_NOTFOUND",new Object[] {getProcess().getAttributes().getName(), portType},null);
+		}
+		
+		// find the matching operation on the port and input/output param names
+		Operation opr = matchOperation(pt, input, output, invokeName, operationName);
+		if ( opr == null ) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_OPR_NOTFOUND",new Object[] {getProcess().getAttributes().getName(), portType},null);
+		}
+		
+		
+		WSDLOperationKey sk = new WSDLOperationKey(qnPort.getNamespaceURI(),qnPort.getLocalPart(),opr.getName(),(opr.getInput() == null) ? "default" : opr.getInput().getName(), (opr.getOutput() == null ) ? "default" : opr.getOutput().getName());
+		
+		// Create a default list of input/output parts
+		HashMap inputHM = new HashMap();
+		HashMap outputHM = new HashMap();
+		
+		if ( opr.getInput() != null ) {
+			for ( Iterator inpItr = opr.getInput().getMessage().getParts().keySet().iterator(); inpItr.hasNext(); ) {
+				String partName = (String)inpItr.next();
+				BPEInput bpeInput = new BPEInput();
+				bpeInput.setPart(partName);
+				bpeInput.setType(DEFAULT_TYPE);
+				inputHM.put(partName,bpeInput);
+			}
+		}
+		
+		if ( opr.getOutput() != null ) {
+			for ( Iterator outItr = opr.getOutput().getMessage().getParts().keySet().iterator(); outItr.hasNext(); ) {
+				String partName = (String)outItr.next();
+				BPEOutput bpeOutput = new BPEOutput();
+				bpeOutput.setPart(partName);
+				bpeOutput.setType(DEFAULT_TYPE);
+				outputHM.put(partName,bpeOutput);
+			}
+		}
+		
+		// See if any bpe bindings can be found in a bpe:binding file.
+		bpeAction = getBPEActionBPEBinding(pt,opr);
+		
+		// Check to see if action binding is available from WSDL
+		if ( bpeAction == null ) bpeAction = getBPEActionWSDL(pt,opr,inputHM,outputHM);
+
+		if ( bpeAction == null ) {
+		   
+			// create a default action
+			bpeAction = new BPEAction();
+			bpeAction.setImplementation(DEFAULT_IMPL);
+			
+			// Temp fix for rob madden.
+			throw new RuntimeException("Could not find action binding for: pt = " 
+			            + pt.getQName() + ", oper = " + opr.getName());
+		}
+		
+		retVal.setAction(bpeAction);
+		retVal.setOk(sk);
+		retVal.setInput(new Vector(inputHM.values()));
+		retVal.setOutput(new Vector(outputHM.values()));
+		
+		return retVal;
+	}
+	
+	/**
+	 * Acquires a bpe IExternalAction binding from a binding .xml 
+	 */
+	
+	private BPEAction getBPEActionBPEBinding(PortType pt, Operation opr) throws DeploymentException {
+		BPEAction bpeAction = null;
+		
+		if ( bpeBinding != null ) {
+			TBinding[] bindingArray = bpeBinding.getActionBindings().getBindingArray();
+			all:for ( int bdItr = 0; bdItr < bindingArray.length; bdItr++ ) {
+				TBinding b = bindingArray[bdItr];
+				QName tPort = new QName(b.getNameSpace(),b.getPortType());
+				if ( tPort.equals(pt.getQName())) {
+					TOperation[] operationArray = b.getOperationArray();
+					for ( int opItr = 0; opItr < operationArray.length; opItr++ ) {
+						TOperation tOp = operationArray[opItr];
+						if ( tOp.getName().equals(opr.getName())) {
+							bpeAction = new BPEAction();
+							bpeAction.setImplementation(tOp.getAction().getImplementation());
+							if ( tOp.getAction().getBpeImplementation() != null ) {
+								bpeAction.setBPEImplementation(tOp.getAction().getBpeImplementation());
+							}
+							XmlCursor cur = tOp.getAction().newCursor();
+							boolean hasAttr = cur.toFirstAttribute();
+							
+							String bpeNS = tOp.getAction().schemaType().getName().getNamespaceURI();
+							
+							while ( hasAttr ) {
+								
+								if ( ! bpeNS.equals(cur.getName().getNamespaceURI()) && cur.getName().getNamespaceURI().length() != 0) {
+									
+									bpeAction.addProp(cur.getName().getLocalPart(),cur.getTextValue());
+								}
+								
+								hasAttr = cur.toNextAttribute();
+							}
+							
+							break all;
+						}
+					}
+				}
+			}
+		}
+		
+		return bpeAction;
+	}
+
+	/**
+	 * Acquires a bpe IExternalAction binding from a .wsdl binding
+	 * 
+	 * Should be deprecated at some point.
+	 *  
+	 */
+	private BPEAction getBPEActionWSDL(PortType pt, Operation opr, HashMap inputHM, HashMap outputHM) throws DeploymentException {
+		
+		List defs = new Vector();
+		
+		// all BPE bindings should be in the root BP WSDL
+		defs.add(rootDef);
+		
+		// or in a WSDL of the same namespace
+		List impList = rootDef.getImports(rootDef.getTargetNamespace());
+		if ( impList != null ) {
+			for ( Iterator impItr = impList.iterator(); impItr.hasNext(); ) {
+				Import imp = (Import)impItr.next();
+				defs.add(imp.getDefinition());
+			}
+		}
+		
+		// or they may be in the service WSDL
+		defs.addAll(wsdlDefs);
+		
+		
+		// Find the binding
+		Binding binding = null;
+		BPEAction bpeAction = null;
+		all: for (Iterator defItr = defs.iterator(); defItr.hasNext(); ) {
+			Definition id = (Definition)defItr.next();
+			for (Iterator bindingItr = id.getBindings().values().iterator(); bindingItr.hasNext(); ) {
+				binding = (Binding)bindingItr.next();
+				if ( binding.getPortType().getQName().equals(pt.getQName()) ) {
+					List opers = binding.getBindingOperations();
+					for(Iterator operIter=opers.iterator(); operIter.hasNext(); ) {
+						BindingOperation bopr = (BindingOperation)operIter.next();
+						if ( isOperationMatch(opr, bopr) ) {
+							// Assumption: The first binding found will be used.
+							// Found the required operation on a binding
+							
+							List exts = bopr.getExtensibilityElements();
+							for ( Iterator extItr = exts.iterator(); extItr.hasNext(); ) {
+								Object ext = extItr.next();
+								if ( ext instanceof BPEAction ) {
+									bpeAction = (BPEAction)ext;
+									if ( bpeAction.getImplementation() == null ) {
+										BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_IMPL_REQ",new Object[] {getProcess().getAttributes().getName()},null);
+									}
+								}
+							}
+							
+							BindingInput bi = bopr.getBindingInput();
+							if ( bi != null ) {
+								List biexts = bi.getExtensibilityElements();
+								for ( Iterator biextsItr = biexts.iterator(); biextsItr.hasNext(); ) {
+									Object bpeInput = biextsItr.next();
+									if ( bpeInput instanceof BPEInput ) {
+										if ( inputHM.containsKey(((BPEInput)bpeInput).getPart())) {
+											inputHM.put(((BPEInput)bpeInput).getPart(),bpeInput);
+										}
+									}				
+								}
+							}
+							
+							BindingOutput bo = bopr.getBindingOutput();
+							if ( bo != null ) {
+								List boexts = bo.getExtensibilityElements();
+								for ( Iterator boextsItr = boexts.iterator(); boextsItr.hasNext(); ) {
+									Object bpeOutput = boextsItr.next();
+									if ( bpeOutput instanceof BPEOutput ) {
+										if ( outputHM.containsKey(((BPEOutput)bpeOutput).getPart())) {
+											outputHM.put(((BPEOutput)bpeOutput).getPart(),bpeOutput);
+										}
+									}					
+								}
+							}
+							break all;
+						}
+					}
+				}
+			}
+		}
+		return bpeAction;
+	}
+	
+	private Operation matchOperation(PortType pt, BPELVariable inputVar, BPELVariable outputVar, String invokeName, String operationName) throws DeploymentException {
+		
+		QName inputMsg = null;
+		QName outputMsg = null;
+		
+		// BPEL does not hold the name attribute of a WSDL operation input/output. 
+		// Therefore we must iterate over the operations and find a match based on
+		// input/output type rather than name.
+		
+		if ( inputVar != null ) {
+			if ( inputVar instanceof BPELWSDLVariable ) {
+				inputMsg = ((BPELWSDLVariable)inputVar).getMessageName();
+			} else {
+				BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_VAR_NOTWSDL",new Object[] {getProcess().getAttributes().getName(), invokeName, inputVar.getName()},null);
+			}
+		}
+		
+		if ( outputVar != null ) {
+			if ( outputVar instanceof BPELWSDLVariable ) {
+				outputMsg = ((BPELWSDLVariable)outputVar).getMessageName();
+			} else {
+				BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_VAR_NOTWSDL",new Object[] {getProcess().getAttributes().getName(), invokeName, outputVar.getName()},null);
+			}
+		}
+		
+		Operation retop = null;
+		boolean inputMatch = false, outputMatch = false;
+		
+		for ( Iterator opItr = pt.getOperations().iterator(); opItr.hasNext(); ) {
+			Operation opr = (Operation)opItr.next();
+			
+			Input inp = opr.getInput();
+			Output outp = opr.getOutput();
+
+			if ( opr.getName().equals(operationName)) {
+			
+				if ( inp != null && inputMsg != null ) {
+					if ( inp.getMessage().getQName().equals(inputMsg) ) inputMatch = true;
+				} else {
+					if ( inp == null && inputMsg == null ) inputMatch = true;
+				}
+	
+				if ( outp != null && outputMsg != null ) {
+					if ( outp.getMessage().getQName().equals(outputMsg) ) outputMatch = true;
+				} else {
+					if ( outp == null && outputMsg == null ) outputMatch = true;
+				}
+			}
+			
+			if ( inputMatch && outputMatch ) {
+				retop = opr;
+				break;
+			}
+			
+		}
+		
+	
+		return retop;
+		
+	}
+	
+	private static boolean isOperationMatch(Operation ptOper, BindingOperation bOper ) {
+		
+		boolean input = false, output = false;
+		
+		if ( ptOper.getName().equals(bOper.getName()) ) {
+			input = true;
+			output = true;
+			
+			if ( ptOper.getInput() != null && bOper.getBindingInput() != null ) {
+				if ( ptOper.getInput().getName() != null && bOper.getBindingInput().getName() != null ) {
+					input = ptOper.getInput().getName().equals(bOper.getBindingInput().getName()); 
+				}
+			}
+			
+			if ( ptOper.getOutput() != null && bOper.getBindingOutput() != null ) {
+				if ( ptOper.getOutput().getName() != null && bOper.getBindingOutput().getName() != null ) {
+					output = ptOper.getOutput().getName().equals(bOper.getBindingOutput().getName()); 
+				}
+			}
+		}
+		
+		return input && output ;
+	}
+	
+	private Definition getRootWSDL(String bpelName, HashMap artifacts) throws DeploymentException {
+		Definition ret = null;
+		InputSource is = null;
+	
+		// Finds the root wsdl document that defines the BPEL definition
+		byte[] data = (byte[])artifacts.get(bpelName+".wsdl");
+	
+		if ( data != null ) {
+	
+			try {	
+				// Create a SAX InputSource from the raw document byte array
+				ByteArrayInputStream bais = new ByteArrayInputStream(data);
+			
+				is = new InputSource(bais);
+				bais.close();
+			} catch (IOException e1) {
+				BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_IOERR",new Object[] {bpelName,bpelName+".wsdl"},e1);
+			}
+		}
+	
+		if ( is == null ) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"DEPLOY_WSDL_NOTFOUND",new Object[] {bpelName,bpelName+".wsdl"},null);
+		}
+	
+		try {
+			WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+		
+			reader.setFeature("javax.wsdl.verbose",true);
+			reader.setFeature("javax.wsdl.importDocuments",true);
+						
+			reader.setExtensionRegistry(getExtentionRegistry());
+		
+			// Parse the document and include any imported WSDL documents
+			ret = reader.readWSDL(new BPELWSDLLocator(bpelName,is, artifacts));
+		
+		} catch (WSDLException e) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_WSDLREADER",new Object[] {bpelName,bpelName+".wsdl",e.getMessage()},e);
+		}
+	
+		return ret;
+	}
+	
+	private TSchema getBPEBindings(String bpelName, HashMap artifacts) throws DeploymentException {
+		TSchema ret = null;
+	
+		// Finds the root wsdl document that defines the BPEL definition
+		byte[] data = (byte[])artifacts.get(bpelName+".xml");
+	
+		if ( data != null ) {
+			
+			ByteArrayInputStream bpeBinding = new ByteArrayInputStream(data);
+			
+			BPEBindingDocument bbd = null;
+			try {
+				bbd = BPEBindingDocument.Factory.parse(bpeBinding);
+			} catch (XmlException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			} catch (IOException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+			
+			ret = bbd.getBPEBinding();
+		}
+
+		return ret;
+	}
+
+	private ExtensionRegistry getExtentionRegistry() {
+		
+		// Use IBM's implementation as a base registry. They have implemented
+		// extensibility objects for SOAP,HTTP,MIME and we should not
+		// loose these functions.
+		ExtensionRegistry er = new com.ibm.wsdl.extensions.PopulatedExtensionRegistry();
+		
+		BPELPropertySerializer bpelPropSerializer = new BPELPropertySerializer();
+		BPELPropertyAliasSerializer bpelPropAliasSerializer = new BPELPropertyAliasSerializer();
+		BPEActionSerializer bpeActionSerializer = new BPEActionSerializer();
+		BPEInputSerializer bpeInputSerializer = new BPEInputSerializer();
+		BPEOutputSerializer bpeOutputSerializer = new BPEOutputSerializer();
+		BPEFaultSerializer bpeFaultSerializer = new BPEFaultSerializer();
+		BPEVariableMapSerializer bpeVariableSerializer = new BPEVariableMapSerializer();
+
+		// Register the BPEL extension points
+		er.registerSerializer(Definition.class,
+						   ExtentionConstants.Q_ELEM_BPEL_PROPERTY,
+						   bpelPropSerializer);
+		er.registerDeserializer(Definition.class,
+							 ExtentionConstants.Q_ELEM_BPEL_PROPERTY,
+							 bpelPropSerializer);
+		er.mapExtensionTypes(Definition.class,
+						  ExtentionConstants.Q_ELEM_BPEL_PROPERTY,
+							BPELProperty.class);
+		er.registerSerializer(Definition.class,
+						   ExtentionConstants.Q_ELEM_BPEL_PROPERTY_ALIAS,
+						   bpelPropAliasSerializer);
+		er.registerDeserializer(Definition.class,
+							 ExtentionConstants.Q_ELEM_BPEL_PROPERTY_ALIAS,
+							 bpelPropAliasSerializer);
+		er.mapExtensionTypes(Definition.class,
+						  ExtentionConstants.Q_ELEM_BPEL_PROPERTY_ALIAS,
+							BPELPropertyAlias.class);
+							
+		// register the BPE extension points
+		er.registerSerializer(BindingOperation.class,
+							ExtentionConstants.Q_ELEM_BPE_ACTION,
+							bpeActionSerializer);
+		er.registerDeserializer(BindingOperation.class,
+							ExtentionConstants.Q_ELEM_BPE_ACTION,
+							bpeActionSerializer);
+		er.mapExtensionTypes(BindingOperation.class,
+							ExtentionConstants.Q_ELEM_BPE_ACTION,
+							BPEAction.class);
+		er.registerSerializer(BindingInput.class,
+							ExtentionConstants.Q_ELEM_BPE_INPUT,
+							bpeInputSerializer);
+		er.registerDeserializer(BindingInput.class,
+							ExtentionConstants.Q_ELEM_BPE_INPUT,
+							bpeInputSerializer);
+		er.mapExtensionTypes(BindingInput.class,
+							ExtentionConstants.Q_ELEM_BPE_INPUT,
+							BPEInput.class);
+		er.registerSerializer(BindingOutput.class,
+							ExtentionConstants.Q_ELEM_BPE_OUTPUT,
+							bpeOutputSerializer);
+		er.registerDeserializer(BindingOutput.class,
+							ExtentionConstants.Q_ELEM_BPE_OUTPUT,
+							bpeOutputSerializer);
+		er.mapExtensionTypes(BindingOutput.class,
+							ExtentionConstants.Q_ELEM_BPE_OUTPUT,
+							BPEOutput.class);	
+		
+		er.registerSerializer(BindingFault.class,
+							ExtentionConstants.Q_ELEM_BPE_FAULT,
+							bpeFaultSerializer);
+		er.registerDeserializer(BindingFault.class,
+							ExtentionConstants.Q_ELEM_BPE_FAULT,
+							bpeFaultSerializer);
+		er.mapExtensionTypes(BindingFault.class,
+							ExtentionConstants.Q_ELEM_BPE_FAULT,
+							BPEFault.class);						
+		
+		er.registerSerializer(Definition.class,
+							ExtentionConstants.Q_ELEM_BPE_VAR,
+							bpeVariableSerializer);
+		er.registerDeserializer(Definition.class,
+							ExtentionConstants.Q_ELEM_BPE_VAR,
+							bpeVariableSerializer);
+		er.mapExtensionTypes(Definition.class,
+							ExtentionConstants.Q_ELEM_BPE_VAR,
+							BPEVariableMap.class);
+							
+		return er;
+	}
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/WSDLOperationKey.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/WSDLOperationKey.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/WSDLOperationKey.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/WSDLOperationKey.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on:	Feb 21, 2004
+ * Project:		BPEELocal
+ * Package:		org.apache.ode.deployment.bpel 
+ * Author:		waterman	
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.io.Serializable;
+
+/**
+ * 
+ * 
+ * @author waterman
+ */
+public class WSDLOperationKey implements Serializable{
+	
+    static final long serialVersionUID = -2350251988688898355L;
+	
+	private String nameSpace;
+	private String portType;
+	private String operationName;
+	private String inputName;
+	private String outputName;
+
+	/**
+	 * 
+	 */
+	public WSDLOperationKey() {
+	}
+
+	/**
+	 * 
+	 */
+	public WSDLOperationKey(String ns, String pt, String op, String inputN, String outputN) {
+		super();
+		nameSpace = ns;
+		portType = pt;
+		operationName = op;
+		inputName = ( inputN == null ) ? "default" : inputN;
+		outputName = ( outputN == null ) ? "default" : outputN;
+	}
+
+	/**
+	 * @return
+	 */
+	public String getInputName() {
+		return inputName;
+	}
+
+	/**
+	 * @return
+	 */
+	public String getNameSpace() {
+		return nameSpace;
+	}
+
+	/**
+	 * @return
+	 */
+	public String getOperationName() {
+		return operationName;
+	}
+
+	/**
+	 * @return
+	 */
+	public String getOutputName() {
+		return outputName;
+	}
+
+	/**
+	 * @return
+	 */
+	public String getPortType() {
+		return portType;
+	}
+
+	/**
+	 * @param string
+	 */
+	public void setInputName(String string) {
+		inputName = string;
+	}
+
+	/**
+	 * @param string
+	 */
+	public void setNameSpace(String string) {
+		nameSpace = string;
+	}
+
+	/**
+	 * @param string
+	 */
+	public void setOperationName(String string) {
+		operationName = string;
+	}
+
+	/**
+	 * @param string
+	 */
+	public void setOutputName(String string) {
+		outputName = string;
+	}
+
+	/**
+	 * @param string
+	 */
+	public void setPortType(String string) {
+		portType = string;
+	}
+	
+	
+
+	/**
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	public boolean equals(Object obj) {
+		boolean retVal = false;
+		
+		if ( obj instanceof WSDLOperationKey ) {
+			WSDLOperationKey tst = (WSDLOperationKey)obj;
+			retVal = nameSpace.equals(tst.nameSpace) &&
+				 portType.equals(tst.portType) &&
+				 operationName.equals(tst.operationName) &&
+				 outputName.equals(tst.outputName) &&
+				 inputName.equals(tst.inputName);
+		}
+		
+		return retVal;
+	}
+
+	/**
+	 * @see java.lang.Object#hashCode()
+	 */
+	public int hashCode() {
+		String hsh = nameSpace + portType + operationName + outputName + inputName;
+		return hsh.hashCode();
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/CleanUpEnum.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/CleanUpEnum.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/CleanUpEnum.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/CleanUpEnum.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.engine;
+
+import java.io.Serializable;
+//import java.util.logging.Logger;
+
+/** An enumeration of the possible process states:
+  * <P>
+  * UNSTARTED,STARTED,PAUSED,FINISHED,TERMINATED */
+public class CleanUpEnum implements Serializable
+{
+	
+    static final long serialVersionUID = -778045774298504755L;
+    
+//	private static Logger logger = 
+//		Logger.getLogger(CleanUpEnum.class.getName());
+   private java.lang.String stringValue;
+   private int intValue;
+   private static final java.lang.String CLEANUP_VALUE = "CLEANUP";
+   private static final java.lang.String NOCLEANUP_VALUE = "NOCLEANUP";
+   
+   private static final int CLEANUP_INT = 1;
+   private static final int NOCLEANUP_INT = 2;
+   
+   private CleanUpEnum()
+   {
+      // Prevent non-class create
+   }
+   
+   /** @param oldStateEnum */
+   private CleanUpEnum(java.lang.String stateString, int stateInt)
+   {
+      this.stringValue = stateString;
+      this.intValue = stateInt;
+   }
+   
+   public static final CleanUpEnum CLEANUP = new CleanUpEnum(CLEANUP_VALUE,CLEANUP_INT);
+   public static final CleanUpEnum NOCLEANUP = new CleanUpEnum(NOCLEANUP_VALUE,NOCLEANUP_INT);
+   
+   public java.lang.String getStringValue()
+   {
+      return stringValue;
+   }
+   
+   public int getIntValue()
+   {
+   		return intValue;
+   }
+   
+   /** Because this object will be used over a remote interface the default implementation based on object reference will be over written. */
+   public int hashCode()
+   {
+      return intValue;
+   }
+   
+   /** Because this object will be used over a remote interface the default implementation based on object reference will be over written.
+     * 
+     * @param obj */
+   public boolean equals(Object obj)
+   {
+      if ( obj instanceof CleanUpEnum ) {
+         return intValue == ((CleanUpEnum)obj).intValue;
+      }
+      return false;
+   }
+   
+   public static CleanUpEnum getState(String state) {
+   		if ( state.equals(CLEANUP_VALUE) ) return CLEANUP;
+   		if ( state.equals(NOCLEANUP_VALUE) ) return NOCLEANUP;
+   		return null;
+   }
+
+   public static CleanUpEnum getState(int state) {
+		switch ( state ) {
+			case CLEANUP_INT: return CLEANUP;
+			case NOCLEANUP_INT: return NOCLEANUP;
+			default: return null;	
+		}
+   }
+
+}