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:05:47 UTC

svn commit: r381686 [28/40] - in /incubator/ode/scratch/bpe: ./ bpelTests/ bpelTests/probeService/ bpelTests/test1/ bpelTests/test10/ bpelTests/test12/ bpelTests/test13/ bpelTests/test14/ bpelTests/test15/ bpelTests/test16/ bpelTests/test17/ bpelTests/...

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSwitch.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSwitch.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSwitch.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSwitch.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,216 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Jul 10, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.bpel.UnInitVariableMetaData;
+import com.sybase.bpe.action.bpel.XPathJaxenExpression;
+import com.sybase.bpe.action.bpel.XPathSwitchAction;
+import com.sybase.bpe.action.bpel.XPathSwitchTuple;
+import com.sybase.bpe.definition.IPMDAction;
+import com.sybase.bpe.definition.IPMDChangeCondition;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+
+/**
+ * Implements the BPEL <i>switch</i> node. The switch node holds a collection of
+ * cases.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tSwitch.
+ * 
+ * @see BPELCase
+ * @author waterman
+ */
+class BPELSwitch extends BPELStructuredActivity {
+	private static final Logger logger = Logger.getLogger(BPELStructuredActivity.class.getName());
+
+	
+	private static final String XPATH_SWITCH_CLASS = com.sybase.bpe.action.bpel.XPathSwitchAction.class.getName();
+	private static final String DEFAULT_CONDITION_CLASS = com.sybase.bpe.condition.DefaultConditional.class.getName();
+	private static final String UNINITVAR_LABEL = com.sybase.bpe.action.bpel.XPathSwitchAction.UNINITVAR_KEY;
+	private static final String SWITCH_COND_LABEL = "Switch Condition: ";
+	private static final String SWITCH_ACTION_LABEL = "Switch Action : ";
+
+
+	private Vector cases = new Vector();
+	private BPELOtherwise otherwise;
+	
+	private Vector links = new Vector();
+
+	/**
+	 * @param previous the parent schema node
+	 * @param attrs    the schema attributes
+	 * @throws DefinitionServiceException
+	 */
+	BPELSwitch(BPELNode previous, BPELAttributes attrs)
+		throws DeploymentException {
+		super(previous, BPELSchema.SWITCH, attrs,logger);
+		
+		createProcessSequence(getAttributes(),getEndProcess());
+	}
+	
+	
+
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#addActivity(com.sybase.bpe.deployment.bpel.BPELNode)
+	 */
+	void addActivity(BPELNode activity) throws DeploymentException {
+		
+		// Collect case statments and add them into internal collection. 
+		// They will be linked together when the switch tag is closed.
+		
+		// Retain case statement order.
+		if ( activity instanceof BPELOtherwise ) {
+			otherwise = (BPELOtherwise)activity;
+		} else {
+			cases.add(activity);
+		}
+	
+	}
+	
+
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#pop()
+	 */
+	BPELNode pop() throws DeploymentException {
+		
+		createCases();
+		
+		createEnd();
+		
+		return super.pop();
+	}
+
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+	 */
+	String getActivityDescription() {
+		return "switch is implemented by: " + com.sybase.bpe.action.bpel.XPathSwitchAction.class.getName() + ". It is a container used to execute a single activity from a choice of activities.";
+	}
+	
+	void createCases() throws DeploymentException {
+		Vector v = new Vector();
+		
+		// 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 e) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e);
+		}
+		
+		// Iterate over the switch cases and add the case process definition
+		// to the switch action metadata.
+		for ( Iterator itr = cases.iterator(); itr.hasNext(); ) {
+			BPELCase caseActivity = (BPELCase)itr.next();
+		
+			// parse the condition and create the context locators for all the bpws: extentions
+			BPELExpressionVariable expVar = new BPELExpressionVariable(caseActivity.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,caseActivity,null,BPELInvocationType.SELECT_VALUE,false),caseActivity.getActivity().getStartProcess().getKey()));
+			
+			// Link the end of the case activity to the end of the switch activity
+			caseActivity.getActivity().linkProcess(BPELProcessType.END,this,BPELProcessType.END,false);	
+		}
+		
+		Properties md = new Properties();
+		md.put(UNINITVAR_LABEL,new UnInitVariableMetaData(BPELSchema.BPEL_URI,BPELSchema.FAULT_UNINIT_VAR));
+		
+		// Add the case expressions as metadata to the switch action
+		
+		md.put(XPathSwitchAction.CASES_KEY,v);
+		// The default value to the switch action will cause the loop to end
+		if ( otherwise == null ) {
+			md.put(XPathSwitchAction.DEFAULT_KEY,getEndProcess().getKey());
+		} else {
+			md.put(XPathSwitchAction.DEFAULT_KEY,otherwise.getActivity().getStartProcess().getKey());
+			// Link the end of the otherwise activity to the end of the switch activity
+			otherwise.getActivity().linkProcess(BPELProcessType.END,this,BPELProcessType.END,false);
+		}	
+		
+		da.setMetadata(md);		
+	}
+	
+	void createEnd() throws DeploymentException {
+		
+		Vector linkLocators = new Vector();
+		//int inc=0;
+		
+		IPMDChangeCondition ccE = null;
+		IPMDAction es = null;
+		
+		// Create the end switch action
+		try {
+			ccE = getEndProcess().createChangeCondition("End Switch: "+getAttributes().getName(),
+				com.sybase.bpe.condition.DefaultConditional.class.getName());
+			es = ccE.createAction("End Switch: "+getAttributes().getName(),
+				com.sybase.bpe.action.bpel.EndConditionalFlowAction.class.getName());
+		} catch (DefinitionServiceException e1) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e1);
+		}	
+		
+		// iterate over the transition links and add them as metadata
+		// the runtime will set all links at the end of the switch.
+		for ( Iterator linkItr = links.iterator(); linkItr.hasNext(); ) {
+			BPELLink link = (BPELLink)linkItr.next();
+			BPELVariable var = link.getTransitionCondVar();
+			linkLocators.add(var.createLocator(es,this,null,null,true));
+		}
+		
+		Properties md = new Properties();
+		md.put(com.sybase.bpe.action.bpel.EndConditionalFlowAction.LINKS,linkLocators);
+		
+		es.setMetadata(md);
+		
+	}
+	
+	BPELLink notifyLink(BPELLink link, BPELFlow node) throws DeploymentException {
+		// the link has crossed the switch boundry so capture it here
+		if ( link.getSource() != this && link.getTarget() != this ) {
+			links.add(link);
+		}
+		if ( m_parserStack != null ) return m_parserStack.notifyLink(link, node);
+		return null;
+	}
+	
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#getProxy(com.sybase.bpe.deployment.bpel.BPELFlow, com.sybase.bpe.deployment.bpel.BPELNode)
+	 */
+	BPELNode getProxy(BPELFlow linkOwner, BPELNode source) {
+		return this;
+	}
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSystemVariable.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSystemVariable.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSystemVariable.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSystemVariable.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,98 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Jun 21, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.definition.IPMDLocator;
+import com.sybase.bpe.definition.IPMDLocatorHolder;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+
+/**
+ * 
+ * Defines a variable used by a BPE pattern ( i.e. a merge counter )
+ *
+ * @author waterman
+ */
+class BPELSystemVariable extends BPELVariable {
+	private static final Logger logger = Logger.getLogger(BPELSystemVariable.class.getName());
+
+	private String m_part;
+	private String m_locator;
+	private boolean inCompHandler;
+
+//	BPELSystemVariable(String name, String part) {
+//		super(new BPELAttributes(),logger);
+//		
+//		m_attributes.setName(name);
+//		m_part = part;
+//	
+//	}
+	
+	BPELSystemVariable(String name, String part, BPELNode node) {
+		super(new BPELAttributes(),logger);
+		
+		m_attributes.setName(name);
+		m_part = part;
+		
+		inCompHandler = node.inCompensationHandler();
+		
+		node.addVariable(this);
+		
+		m_locator = this.getScopePath(new BPELScopePath(inCompHandler)).toString()
+		+ BPELScopePath.PATH_DELIMITER+ m_part;
+		
+	}
+
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELVariable#createLocator(com.sybase.bpe.definition.IPMDLocatorHolder, com.sybase.bpe.deployment.bpel.BPELNode, com.sybase.bpe.deployment.bpel.BPELAttributes, boolean)
+	 */
+	Object createLocator(
+		IPMDLocatorHolder locator,
+		BPELNode node,
+		BPELNode tagNode,
+		BPELAttributes attrs,
+		BPELInvocationType type,
+		boolean forOutPut)
+		throws DeploymentException {
+			
+			
+			IPMDLocator loc = null;
+
+			try {
+				loc = node.createLocator(false,locator,getName(), m_locator,
+						null,null,0,forOutPut, false);
+			} catch (DefinitionServiceException e) {
+				BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATELOCATOR",new Object[] {node.getProcess().getAttributes().getName(), getName(),this.getScopePath(new BPELScopePath(inCompHandler)).toString()+ BPELScopePath.PATH_DELIMITER+ m_part,"query not specifed"},e);
+			}
+			
+			addUsedInLocator(loc);
+ 			
+			return getName();
+	}
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELTerminate.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELTerminate.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELTerminate.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELTerminate.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,85 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Jul 16, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.bpel.TerminateAction;
+import com.sybase.bpe.definition.IPMDChangeCondition;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+
+
+/**
+ * Implements the BPEL <i>terminate</i> node. 
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tTerminate.
+ * 
+ * @author waterman
+ */
+class BPELTerminate extends BPELLinkedActivity {
+	private static final Logger logger = Logger.getLogger(BPELTerminate.class.getName());
+
+	/**
+	 * @param previous the parent schema node
+	 * @param attrs    the schema attributes
+	 * @throws DefinitionServiceException
+	 */
+	BPELTerminate(
+		BPELNode previous,
+		BPELAttributes attrs)
+		throws DeploymentException {
+		super(previous, BPELSchema.TERMINATE, attrs, logger);
+	}
+	
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#pop()
+	 */
+	BPELNode pop() throws DeploymentException {
+		
+		try {
+			IPMDChangeCondition cc = getStartProcess()
+					.createChangeCondition(
+							"ChangeCondition: " + getAttributes().getName(),
+							com.sybase.bpe.condition.DefaultConditional.class
+									.getName());
+			cc.createAction("TerminateAction:" + getAttributes().getName(),
+					TerminateAction.class.getName());
+		} catch (DefinitionServiceException e) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e);
+		}
+		
+		return super.pop();
+	}
+
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+	 */
+	String getActivityDescription() {
+		return "terminate implements " + TerminateAction.class.getName() + " This action will terminate the process and remove all context.";
+	}
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELThrow.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELThrow.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELThrow.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELThrow.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,88 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Jul 16, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import com.sybase.bpe.action.bpel.ThrowAction;
+import com.sybase.bpe.definition.IPMDAction;
+import com.sybase.bpe.definition.IPMDChangeCondition;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+
+/**
+ * Implements the BPEL <i>throw</i> node. 
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tThrow.
+ * 
+ * @author waterman
+ */
+class BPELThrow extends BPELLinkedActivity {
+	private static final Logger logger = Logger.getLogger(BPELThrow.class.getName());
+
+	/**
+	 * @param previous the parent schema node
+	 * @param attrs    the schema attributes
+	 * @throws DefinitionServiceException
+	 */
+	BPELThrow(BPELNode previous, BPELAttributes attrs)
+		throws DeploymentException {
+		super(previous, BPELSchema.THROW, attrs, logger);
+	}
+
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#pop()
+	 */
+	BPELNode pop() throws DeploymentException {
+		
+		try {
+			IPMDChangeCondition cc = getStartProcess().createChangeCondition("Throw: "+getAttributes().getName(),
+				com.sybase.bpe.condition.DefaultConditional.class.getName());
+			IPMDAction ccact = cc.createAction("Throw: "+getAttributes().getName(),
+				com.sybase.bpe.action.bpel.ThrowAction.class.getName());
+			QName faultName = getQName(getAttributes().getFaultName());
+			if ( faultName != null ) {
+				ccact.addMetadata(ThrowAction.EXCEPTION_NAME,faultName.getLocalPart());
+				ccact.addMetadata(ThrowAction.EXCEPTION_NS,faultName.getNamespaceURI());
+			}
+		} catch (DefinitionServiceException e) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e);
+		}
+
+		
+		return super.pop();
+	}
+	
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+	 */
+	String getActivityDescription() {
+		return "throw is implemented by: " + com.sybase.bpe.action.bpel.ThrowAction.class.getName() + ". It is an exception thrown by the business process.";
+	}
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELTo.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELTo.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELTo.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELTo.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,63 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Jul 10, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.logging.Logger;
+
+
+/**
+ * Implements the BPEL <i>to</i> node. The to node holds 
+ * attributes that define the to values of a <i>copy</i> node
+ * <p>
+ * The to node is held by a <i>copy</i> node.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tTo.
+ *
+ * @author waterman
+ * @see BPELCopy
+ * 
+ */
+class BPELTo extends BPELNode {
+	private static final Logger logger = Logger.getLogger(BPELTo.class.getName());
+
+
+	/**
+	 * @param previous the parent schema node
+	 * @param attrs    the schema attributes
+	 */
+	BPELTo(BPELNode previous, BPELAttributes attrs) {
+		super(previous, BPELSchema.TO, attrs, logger);
+	}
+
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#pop()
+	 */
+	BPELNode pop() throws DeploymentException {
+		m_parserStack.addActivity(this);
+		return m_parserStack;
+	}
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELUtil.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELUtil.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELUtil.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELUtil.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,89 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Aug 14, 2003
+ *
+ */
+package com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELVariable.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELVariable.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELVariable.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELVariable.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,474 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Jun 21, 2003
+ *
+ */
+package com.sybase.bpe.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 com.sybase.bpe.definition.IPMDLocator;
+import com.sybase.bpe.definition.IPMDLocatorHolder;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+import com.sybase.bpe.interaction.IInvocation;
+import com.sybase.bpe.interaction.IInvocationFactory;
+import com.sybase.bpe.interaction.InteractionException;
+import com.sybase.bpe.interaction.InvocationFactory;
+import com.sybase.bpe.interaction.builders.DefaultInteractionBuilder;
+import com.sybase.bpe.interaction.builders.IInteractionBuilder;
+import com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELWSDLLocator.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELWSDLLocator.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELWSDLLocator.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELWSDLLocator.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,118 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on May 14, 2003
+ */
+package com.sybase.bpe.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 com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELWSDLVariable.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELWSDLVariable.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELWSDLVariable.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELWSDLVariable.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,258 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on May 28, 2003
+ *
+ */
+package com.sybase.bpe.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 com.sybase.bpe.definition.IPMDLocator;
+import com.sybase.bpe.definition.IPMDLocatorHolder;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+//import com.sybase.bpe.interaction.IInvocationFactory;
+//import com.sybase.bpe.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 com.sybase.bpe.deployment.bpel.BPELVariable#createLocator(com.sybase.bpe.definition.IPMDLocatorHolder, com.sybase.bpe.deployment.bpel.BPELNode, com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELWait.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELWait.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELWait.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELWait.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,122 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Jul 16, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.bpel.UnInitVariableMetaData;
+import com.sybase.bpe.definition.IPMDAction;
+import com.sybase.bpe.definition.IPMDChangeCondition;
+import com.sybase.bpe.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 com.sybase.bpe.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(),
+				com.sybase.bpe.condition.DefaultConditional.class.getName());
+			recact = 
+				cc.createAction("TimerAction:" + getAttributes().getName(),
+				com.sybase.bpe.action.bpel.TimerAction.class.getName());
+				
+			timeValue = getAttributes().getUntil();
+			
+			if ( timeValue != null ) {
+				//recact.addMetadata(com.sybase.bpe.action.bpel.TimerAction.DEADLINE,timeValue);
+				buildExpression(recact,timeValue,com.sybase.bpe.action.bpel.TimerAction.DEADLINE);
+			}
+			timeValue = getAttributes().getFor();
+			if ( timeValue != null ) {
+				//recact.addMetadata(com.sybase.bpe.action.bpel.TimerAction.DURATION,timeValue);
+				buildExpression(recact,timeValue,com.sybase.bpe.action.bpel.TimerAction.DURATION);
+			}
+			recact.addMetadata(com.sybase.bpe.action.bpel.CopyAction.UNINITVAR_KEY,new UnInitVariableMetaData(BPELSchema.BPEL_URI,BPELSchema.FAULT_UNINIT_VAR));
+			createLocator(false,recact,
+				com.sybase.bpe.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(com.sybase.bpe.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 com.sybase.bpe.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+	 */
+	String getActivityDescription() {
+		return "wait is implemented by: " + com.sybase.bpe.action.bpel.TimerAction.class.getName() + ". It is used to block a business process until the alarm event fires.";
+	}
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELWhile.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELWhile.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELWhile.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELWhile.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,129 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Jul 10, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.Properties;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.bpel.UnInitVariableMetaData;
+import com.sybase.bpe.action.bpel.XPathJaxenExpression;
+import com.sybase.bpe.action.bpel.XPathSwitchAction;
+import com.sybase.bpe.action.bpel.XPathSwitchTuple;
+import com.sybase.bpe.definition.IPMDAction;
+import com.sybase.bpe.definition.IPMDChangeCondition;
+import com.sybase.bpe.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 = com.sybase.bpe.action.bpel.XPathSwitchAction.class.getName();
+	private static final String DEFAULT_CONDITION_CLASS = com.sybase.bpe.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 com.sybase.bpe.deployment.bpel.BPELNode#addActivity(com.sybase.bpe.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(com.sybase.bpe.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 com.sybase.bpe.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+	 */
+	String getActivityDescription() {
+		return "while is implemented by: " + com.sybase.bpe.action.bpel.XPathSwitchAction.class.getName() + ". It is used to define the context of a loop pattern.";
+	}
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELXMLSchemaVariable.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELXMLSchemaVariable.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELXMLSchemaVariable.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELXMLSchemaVariable.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,105 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on May 28, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import com.sybase.bpe.definition.IPMDLocator;
+import com.sybase.bpe.definition.IPMDLocatorHolder;
+import com.sybase.bpe.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 com.sybase.bpe.deployment.bpel.BPELVariable#createLocator(com.sybase.bpe.definition.IPMDLocatorHolder, com.sybase.bpe.deployment.bpel.BPELNode, com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/deployment/bpel/DeploymentException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/DeploymentException.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/DeploymentException.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/DeploymentException.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,65 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on May 12, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+
+import com.sybase.bpe.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);
+	}
+
+}