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 [27/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/BPELReceive.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELReceive.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELReceive.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELReceive.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,192 @@
+/*
+* 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.ArrayList;
+import java.util.HashSet;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.bpel.RegisterAction;
+import com.sybase.bpe.definition.IPMDAction;
+import com.sybase.bpe.definition.IPMDChangeCondition;
+import com.sybase.bpe.definition.IPMDCorrelation;
+import com.sybase.bpe.definition.IPMDOperation;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.definition.IPMDRoot;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+import com.sybase.bpe.event.BPELStaticKey;
+import com.sybase.bpe.event.IStaticKey;
+//import com.sybase.bpe.lang.ResourceGetter;
+
+
+/**
+ * Implements the BPEL <i>receive</i> node. The receive node holds 
+ * attributes that define the receipt of a WSDL message.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tReceive.
+ *
+ * @author waterman
+ * @see BPELCorrelation
+ */
+class BPELReceive extends BPELIOActivity {
+	
+	private static final Logger logger = Logger.getLogger(BPELReceive.class.getName());
+
+
+	/**
+	 * @param previous the parent schema node
+	 * @param attrs    the schema attributes
+	 * @throws DefinitionServiceException
+	 */
+	BPELReceive(BPELNode previous, BPELAttributes attrs)
+		throws DeploymentException {
+		super(previous, BPELSchema.RECEIVE, attrs, logger);
+	}
+
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#collectThreadBoundries(java.util.HashSet)
+	 */
+	HashSet collectThreadBoundries(HashSet hs) {
+		
+		hs.add(this);
+		
+		return super.collectThreadBoundries(hs);
+	}
+	
+	
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#pop()
+	 */
+	BPELNode pop() throws DeploymentException {
+		
+		try {
+			IPMDAction recact = null;
+			ArrayList ops = new ArrayList();
+			
+			IPMDProcess process = getStartProcess();
+			
+			BPELVariable var = ( getAttributes().getVariable() != null ) ? getVariable(getAttributes().getVariable()) : null;
+			
+			// Create the change condition
+			IPMDChangeCondition cc = 
+				process.createChangeCondition("ChangeCondition: " + getAttributes().getName(),
+				com.sybase.bpe.condition.DefaultConditional.class.getName());
+			
+			
+			if ( BPELBoolean.YES.equals(getAttributes().getCreateInstance())) {
+				// If this receive initiates a process instance add the static
+				// message key metadata to the root process definition. Note:
+				// a BPEL process definition will contain a single initiating 
+				// receive.
+				
+				recact = createReceiveAction(cc,getAttributes().getName());
+				IPMDOperation initOp = getOperation(null,recact,var,BPELPatternValue.IN,true,null);
+				getProcess().addInstanceCreatingStaticKey(initOp.getKey());
+				getProcess().getDefinitionRoot().addInstanceCreatingOperation(initOp);
+				
+				ops.add(initOp);
+				recact.addMetadata(RegisterAction.OPERATIONS,ops);
+				
+				recact.addMetadata(com.sybase.bpe.action.bpel.ReceiveAction.PARTNER_LINK,
+						getAttributes().getPartnerLink());
+				
+			
+				// TODO: Lance - hijack eventHandlers
+				// if the global scope has eventHandlers registered the receive
+				// will need to hijack the eventHandlers and register them here.
+				// TODO: Lance - validation implementation
+				// validate that the receive is the first node in the process
+							
+			} else {
+				// the static key for a non instance creating recieve will end up
+				// in a DB column, this can not be longer that 256 chars
+				BPELStaticKey sk = getStaticKey();
+				if ( sk.toString().length() > 256 ) {
+					throw new DeploymentException("BPEL_STATIC_KEY_TO_LONG", new Object[]{sk.getTargetNamespace(),
+							sk.getPortType(),sk.getOperation()});
+				}
+				
+				IPMDAction regact = createRegisterAction(cc,getAttributes().getName());
+				recact = createReceiveAction(cc,getAttributes().getName());
+				IPMDAction remact = createUnRegisterAction(cc,getAttributes().getName());
+
+				IPMDOperation initOp = getOperation(regact,null,var,BPELPatternValue.IN,false,null);
+				getProcess().addNonInstanceCreatingStaticKey(initOp.getKey());
+
+				ops.add(initOp);
+				regact.addMetadata(RegisterAction.OPERATIONS,ops);
+				remact.addMetadata(RegisterAction.OPERATIONS,ops);
+				
+				recact.addMetadata(com.sybase.bpe.action.bpel.ReceiveAction.PARTNER_LINK,
+						getAttributes().getPartnerLink());
+				
+				getProcess().setIsStateFull();
+			}
+			
+			if ( var != null) {
+				var.createLocator(recact,this,null,BPELInvocationType.SELECT_NODE,true);	
+			}
+		} catch (DefinitionServiceException e) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e);
+		}
+				
+		//recact.setMetadata(getAttributes());
+		
+		return super.pop();
+	}
+
+	IPMDAction createReceiveAction(IPMDChangeCondition cc, String label) throws DeploymentException {
+		IPMDAction ret = null;
+		
+		try {
+			ret = cc.createAction("ReceiveAction:" + label,
+			com.sybase.bpe.action.bpel.ReceiveAction.class.getName());
+		} catch (DefinitionServiceException e) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), label},e);
+		}
+		
+		return ret;
+			
+	}
+	
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+	 */
+	String getActivityDescription() {
+		return "receive is implemented by: " + com.sybase.bpe.action.bpel.ReceiveAction.class.getName() + ". It is used to block the business process until a specific message event arrives.";
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.deployment.bpel.BPELIOActivity#createOperation(com.sybase.bpe.definition.service.IPMDRoot, java.lang.String, com.sybase.bpe.event.IStaticKey, com.sybase.bpe.definition.service.IPMDCorrelation, boolean, java.lang.String)
+	 */
+	protected IPMDOperation createOperation(IPMDRoot defRoot,
+			String operationId, IStaticKey key, IPMDCorrelation corrl,
+			boolean instanceCreating, String defId) {
+		return defRoot.createRecieveOperation(operationId, key, corrl,
+				instanceCreating, defId);
+	}
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELReply.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELReply.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELReply.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELReply.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,126 @@
+/*
+* 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.ArrayList;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.bpel.RegisterAction;
+import com.sybase.bpe.action.bpel.ReplyAction;
+import com.sybase.bpe.definition.IPMDAction;
+import com.sybase.bpe.definition.IPMDChangeCondition;
+import com.sybase.bpe.definition.IPMDOperation;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+
+/**
+ * Implements the BPEL <i>reply</i> node. The reply node holds 
+ * attributes that define the transmission of a WSDL message.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tReply.
+ *
+ * @author waterman
+ * @see BPELCorrelation
+ */
+class BPELReply extends BPELIOActivity {
+
+	private static final Logger logger = Logger.getLogger(BPELReply.class.getName());
+	//private Vector correlations = new Vector();
+
+	/**
+	 * @param previous the parent schema node
+	 * @param attrs    the schema attributes
+	 * @throws DefinitionServiceException
+	 */
+	BPELReply(BPELNode previous, BPELAttributes attrs)
+		throws DeploymentException {
+		super(previous, BPELSchema.REPLY, attrs, logger);
+	}
+
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#addCorrelation(com.sybase.bpe.deployment.bpel.BPELCorrelation)
+	 */
+//	void addCorrelation(BPELCorrelation correlation){
+//		correlations.add(correlation);
+//	}
+	
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#pop()
+	 */
+	BPELNode pop() throws DeploymentException {
+		
+		ArrayList ops = new ArrayList();
+		IPMDOperation op = null;
+		
+		IPMDProcess process = getStartProcess();
+			
+		try {
+			// Create the change condition
+			IPMDChangeCondition cc = 
+				process.createChangeCondition("ChangeCondition: " + getAttributes().getName(),
+				com.sybase.bpe.condition.DefaultConditional.class.getName());
+				
+			// Create the change action 
+			IPMDAction ccact = 
+				cc.createAction("ChangeAction:" + getAttributes().getName(),
+				com.sybase.bpe.action.bpel.ReplyAction.class.getName());
+			
+			// The BPEL application can reply with a fault or it can
+			// reply with data. Reply with fault does not cause an
+			// application exception.
+			
+			BPELVariable var = ( getAttributes().getVariable() != null ) ? getVariable(getAttributes().getVariable()) : null;
+			
+			if ( var != null) {
+				var.createLocator(ccact,this,null,BPELInvocationType.SELECT_NODE,true);
+				op = getOperation(null,ccact,var,BPELPatternValue.IN,false,null);
+				if ( op != null ) ops.add(op);
+			}
+					
+			// Add the attributes of the Reply tag as metadata to the Reply Action
+			// ccact.setMetadata(getAttributes());
+			if ( getAttributes().getFaultName() != null ) {
+				ccact.addMetadata(ReplyAction.REPLY_FAULT_NAME,getAttributes().getFaultName());
+				ccact.addMetadata(ReplyAction.REPLY_NAMESPACE,getTargetNamespace());
+			}
+			
+			if ( !ops.isEmpty() ) ccact.addMetadata(RegisterAction.OPERATIONS,ops);
+		} 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 "reply is implemented by: " + com.sybase.bpe.action.bpel.ReplyAction.class.getName() + ". It is used to return a message from a business process.";
+	}
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELReplyVariable.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELReplyVariable.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELReplyVariable.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELReplyVariable.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,87 @@
+/*
+* 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 1, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.Iterator;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.definition.IPMDLocatorHolder;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+
+/**
+ * @author waterman
+ *
+ */
+public class BPELReplyVariable extends BPELVariable {
+	private static final Logger logger = Logger.getLogger(BPELReplyVariable.class.getName());
+
+	private static final String REPLY_LOCATION = "BPEL_REPLY_LOCATION";
+	private Vector parts = new Vector();
+	
+
+	/**
+	 * @param attrs
+	 */
+	public BPELReplyVariable() {
+		super(new BPELAttributes(),logger);
+		
+		m_attributes.setName(REPLY_LOCATION);
+	}
+	
+	public void addPart(String name) {
+		parts.add(name);
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.deployment.bpel.BPELVariable#createLocator(com.sybase.bpe.definition.service.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 {
+			
+			String part=null;
+			
+			try {
+				for ( Iterator itr = parts.iterator(); itr.hasNext();) {
+					part = (String)itr.next();
+					node.createLocator(true,locator,getName()+":"+part, 
+						m_attributes.getName()+BPELScopePath.PATH_DELIMITER+part, 
+						null, null, 0, forOutPut, false);
+				}
+			} catch (DefinitionServiceException e) {
+				BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATELOCATOR",new Object[] {node.getProcess().getAttributes().getName(), getName()+":"+part,m_attributes.getName()+BPELScopePath.PATH_DELIMITER+part},e);
+			}
+		return null;
+	}
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELRepositoryHandler.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELRepositoryHandler.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELRepositoryHandler.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELRepositoryHandler.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,535 @@
+/*
+* 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 13, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.HashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+//import java.util.regex.Pattern;
+
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.definition.IPMDRoot;
+import com.sybase.bpe.definition.service.DefinitionService;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+import com.sybase.bpe.definition.service.DefinitionServiceFactory;
+import com.sybase.bpe.util.BPEProperties;
+import com.sybase.bpe.util.BPException;
+import com.sybase.bpe.uuid.UUIDService;
+import com.sybase.bpe.uuid.UUIDServiceException;
+import com.sybase.bpe.uuid.UUIDServiceFactory;
+
+
+/**
+ * @author waterman
+ * 
+ * Maps BPEL documents into the runtime metadata repository. It is called by BPELSAXHandler.
+ * <p>
+ * Uses WSDL4J to parse WSDL documents.
+ * <p>
+ * Note the BPERepositoryHandler assumes that the input BPEL document is a valid
+ * BPEL as defined by the BPEL.xsd
+ * <p>
+ * @see BPELSAXHandler
+ */
+class BPELRepositoryHandler {
+	
+	private static final Logger logger = Logger.getLogger(BPELRepositoryHandler.class.getName());
+//	private static final Pattern wsdlPattern = Pattern.compile(".*\\.wsdl");
+
+	
+	private DefinitionService m_ds;
+	private BPEProperties m_props;
+	
+	private String m_bpelName;		  			// the name of the current BPEL document being parsed
+	
+	private BPELNode m_context;					// A placeholder within the current process graph
+	
+	private BPELDefinitionKey m_defKey;			// The UUID of the root process definition
+	
+	private IPMDRoot m_dRoot;					// the root business process
+	
+	private ExtensibilityArtifacts m_artifacts; // holds extension documents
+	
+    private boolean m_insidePruneAssign = false;
+    private boolean m_insideGraftAssign = false;
+    private boolean m_insideGraftChildrenAssign = false;
+	
+	
+
+	BPELRepositoryHandler(String docName, HashMap supportDoc, DefinitionService ds) throws DeploymentException {
+		m_bpelName = docName;
+		m_props = new BPEProperties();
+		
+		try {
+			if ( ds == null ) {
+				m_props.setDefinitionServiceClass("com.sybase.bpe.definition.serialimpl.DefinitionService_SerImpl");
+				UUIDService us = UUIDServiceFactory.createUUIDService(m_props);
+				m_ds = DefinitionServiceFactory.createDefinitionService(m_props,us);
+			} else {
+				m_ds = ds;
+			}
+			
+			// Create the object that manages the list of supporting documents
+			m_artifacts = new ExtensibilityArtifacts(docName, supportDoc);
+			
+		} catch (UUIDServiceException e) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_UUIDINVALID",null,e);
+		} catch (DefinitionServiceException e) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_DEFINVALID",null,e);
+		}
+
+	}
+	
+	public void buildPruneAssign( BPELAttributes attributes ) 
+	   throws DeploymentException
+	{
+	    m_insidePruneAssign = true;
+	    buildAssign( attributes );
+	}
+	
+	public void buildGraftAssign( BPELAttributes attributes )
+	   throws DeploymentException
+	{
+		m_insideGraftAssign = true;
+		buildAssign( attributes );
+	}
+	
+	public void buildGraftChildrenAssign( BPELAttributes attributes )
+	   throws DeploymentException
+	{
+		m_insideGraftChildrenAssign = true;
+		buildAssign( attributes );
+	}
+	
+	public String getInterpretation( String activityID )
+	{
+	    if ( m_artifacts != null )
+	    {
+	        return m_artifacts.getActivityInterpretation(activityID);
+	    }
+	    return null;
+	}
+	
+	public void buildProcess(BPELAttributes attr) throws DeploymentException {
+		
+		// this is the root node of the business process definition
+		// Note: BPEL does not support a version schema. 
+		// WAIT: waiting on IO process definition versioning requirements
+		IPMDProcess bProcess=null;
+		
+		try {
+			m_dRoot = m_ds.createRootDefinition(
+					(attr.getName() == null) ? "process" : attr.getName(),
+					"v1",false);
+			bProcess = m_dRoot.createProcess("Process: "+attr.getName());
+			m_defKey = new BPELDefinitionKey(attr.getName(),bProcess.getKey().getValue());
+		} catch (BPException e) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEPROCESSROOT",new Object[] {m_bpelName, attr.getName()},e);
+		}
+		
+		push(new BPELProcess(m_dRoot,bProcess,attr,m_artifacts));
+
+	}
+	
+	public void closeProcess() throws DeploymentException {
+		
+		if ( m_context instanceof BPELScope ) {
+			// the parser stack may hold an implied scope
+			pop();
+		}
+
+		m_dRoot.setIsStateless(((BPELProcess)m_context).getStateFlag());
+		m_dRoot.setProtectedInstantiation(((BPELProcess)m_context).getIsProtectedInstantiation());
+		
+		pop();
+		
+		if ( m_ds instanceof com.sybase.bpe.definition.service.unmanaged.DefinitionServiceProxy ) {
+			try {
+				((com.sybase.bpe.definition.service.unmanaged.DefinitionServiceProxy)m_ds).update();
+			} catch (DefinitionServiceException e) {
+				BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_UPDATE",new Object[] {m_bpelName},e);
+			}
+		}
+	}
+	
+	public void buildCatch(BPELAttributes attr) throws DeploymentException {
+		// A catch node can only be held by a scope or an invoke.
+		// The builder assumes the xml parser will enforce this constraint
+		// using the BPEL XMLSchema.
+
+		testInvoke();
+		push(new BPELCatch(m_context,attr,m_artifacts));
+	}
+	public void closeCatch() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildCatchAll(BPELAttributes attr) throws DeploymentException {
+		// A catchAll node can only be held by a scope or an invoke.
+		// The builder assumes the xml parser will enforce this constraint
+		// using the BPEL XMLSchema.
+
+		testInvoke();
+		push(new BPELCatchAll(m_context,attr,m_artifacts));
+	}
+	public void closeCatchAll() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildCompensationHandler(BPELAttributes attr) throws DeploymentException {
+		// A compensation handler can only be held by a scope or an invoke.
+		// The builder assumes the xml parser will enforce this constraint
+		// using the BPEL XMLSchema.
+
+		testInvoke();
+		push(new BPELCompensationHandler(m_context,attr));
+	}
+	public void closeCompensationHandler() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildOnMessage(BPELAttributes attr) throws DeploymentException {
+		// A message event can only be held by a scope. The builder assumes the xml
+		// parser will enforce this constraint using the BPEL XMLSchema.
+
+		if ( m_context instanceof BPELPick ) {
+			push(new BPELOnMessage(m_context,attr));
+		} else {
+			testScope();  // make sure the current context is a scope
+			push(new BPELOnMessage(m_context,attr));
+		}
+	}
+	public void closeOnMessage() throws DeploymentException {
+		pop();
+	}
+
+	public void buildOnAlarm(BPELAttributes attr) throws DeploymentException {
+		// An alarm can only be held by a scope. The builder assumes the xml
+		// parser will enforce this constraint using the BPEL XMLSchema.
+
+		testScope(); // make sure the current context is a scope
+		push( new BPELOnAlarm(m_context,attr) );
+	}
+	public void closeOnAlarm() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildData(String data) {
+		m_context.addData(data);
+	}
+	
+	public void buildSwitch(BPELAttributes attr) throws DeploymentException {
+		push( new BPELSwitch(m_context,attr) );
+	}
+	public void closeSwitch() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildOtherwise(BPELAttributes attr) throws DeploymentException {
+		push( new BPELOtherwise(m_context,attr) );
+	}
+	public void closeOtherwise() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildCase(BPELAttributes attr) throws DeploymentException {
+		push( new BPELCase(m_context,attr) );
+	}
+	public void closeCase() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildWhile(BPELAttributes attr) throws DeploymentException {
+		push( new BPELWhile(m_context,attr) );
+	}
+	public void closeWhile() throws DeploymentException {
+		pop();
+	}	
+	
+	public void buildScope(BPELAttributes attr) throws DeploymentException {
+		push( new BPELScope(m_context,attr) );
+	}
+	public void closeScope() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildFlow(BPELAttributes attr) throws DeploymentException {
+		push( new BPELFlow(m_context,attr) );
+		
+	}
+	public void closeFlow() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildPick(BPELAttributes attr) throws DeploymentException {
+		push( new BPELPick(m_context,attr) );
+	}
+	public void closePick() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildVariable(BPELAttributes attr) throws DeploymentException {
+		// A variable can only be held by a scope. The builder assumes the xml
+		// parser will enforce this constraint using the BPEL XMLSchema.
+
+		testScope(); // make sure the current context is a scope
+		
+		
+		if ( attr.getMessageType() != null ) {
+			((BPELScope)m_context).addVariable(new BPELWSDLVariable(attr,m_artifacts,m_context));
+		} else {
+			((BPELScope)m_context).addVariable(new BPELXMLSchemaVariable(attr,m_artifacts,m_context));
+		}
+	}
+	
+	public void buildCorrelationSet(BPELAttributes attr) throws DeploymentException {
+		// A correlationSet can only be held by a scope. The builder assumes the xml
+		// parser will enforce this constraint using the BPEL XMLSchema.
+		
+		testScope(); // make sure the current context is a scope
+		((BPELScope)m_context).addCorrelationSet(new BPELCorrelationSet(attr,(BPELScope)m_context));
+	}
+	
+	public void buildCorrelation(BPELAttributes attr) throws DeploymentException {
+		
+		// find the correlation set
+		BPELCorrelationSet cs = m_context.getCorrelationSet(attr.getSet());
+		
+		if ( cs == null ) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CORRSET",new Object[] {m_bpelName,attr.getSet()},null);
+		}
+		
+		m_context.addCorrelation(new BPELCorrelation(cs,attr.getInitiate(),attr.getPattern()));
+	}
+	
+	public void buildPartners(BPELAttributes attr) {
+	}
+	
+	// Creates a new BPEL Linking object and adds it into the link collection
+	public void buildLink(BPELAttributes attr) throws DeploymentException {
+		
+		// Note - the link name is a required field in the BPEL schema
+		((BPELFlow)m_context).addLinkTag(new BPELLink(attr.getName()));
+	}
+	
+	public void buildSequence(BPELAttributes attr) throws DeploymentException {
+		push( new BPELSequence(m_context,attr) );
+	}
+	public void closeSequence() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildSource(BPELAttributes attr) throws DeploymentException {
+		m_context.setLink(attr.getLinkName(),m_context,BPELLinkType.SOURCE,attr.getTransitionCondition());
+	}
+	
+	public void buildTarget(BPELAttributes attr) throws DeploymentException {
+		m_context.setLink(attr.getLinkName(),m_context,BPELLinkType.TARGET,null);
+	}
+	
+	/**
+	 * Invoke is a BPEL activity node, and supports the 
+	 * @param attr
+	 */
+	public void buildInvoke(BPELAttributes attr) throws DeploymentException {	
+		push( new BPELInvoke(m_context,attr,m_artifacts) );
+	}
+	public void closeInvoke() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildFrom(BPELAttributes attr) {
+		push( new BPELFrom(m_context,attr) );
+	}
+	public void closeFrom() throws DeploymentException {
+		pop();
+	}
+	public void buildTo(BPELAttributes attr) {
+		push( new BPELTo(m_context,attr) );
+	}
+	public void closeTo() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildCopy(BPELAttributes attr) {
+	    if ( m_insidePruneAssign == true )
+	    {
+	        push( new BPELPrune( m_context, attr ) );
+	    }else if(m_insideGraftAssign == true)
+	    {
+	    	push( new BPELGraft(m_context,attr) );
+	    }
+	    else if (m_insideGraftChildrenAssign == true)
+	    {
+	    	push( new BPELGraftChildren(m_context,attr) );
+	    }else
+	    {
+	        push( new BPELCopyValue(m_context,attr) );
+	    }
+	}
+	
+	public void closeCopy() throws DeploymentException {
+	    if ( m_insidePruneAssign == true )
+	    {
+	        closePrune();
+	    }
+	    else
+	    {
+	        pop();
+	    }
+	}
+		
+	public void buildPrune(BPELAttributes attr) {
+	    push( new BPELPrune(m_context, attr));
+	}
+	
+	public void closePrune() throws DeploymentException{
+	    pop();
+	}
+	
+	public void buildAssign(BPELAttributes attr) throws DeploymentException {
+		push( new BPELAssign(m_context,BPELSchema.ASSIGN,attr,logger) );
+	}
+	public void closeAssign() throws DeploymentException {
+		pop();
+		if ( m_insidePruneAssign == true )
+		{
+		    m_insidePruneAssign = false;
+		}
+		if ( m_insideGraftAssign == true)
+			m_insideGraftAssign = false;
+		if (m_insideGraftChildrenAssign == true)
+			m_insideGraftChildrenAssign = false;
+	}
+	
+	public void buildReceive(BPELAttributes attr) throws DeploymentException {
+		push( new BPELReceive(m_context,attr) );
+	}
+	public void closeReceive() throws DeploymentException {
+		pop();
+	}
+
+	public void buildReply(BPELAttributes attr) throws DeploymentException {
+		push( new BPELReply(m_context,attr) );
+	}
+	public void closeReply() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildCompensate(BPELAttributes attr) throws DeploymentException {
+		// A compenstate node can only be held by a catch, catchAll or
+		// compensationHandler node. The builder assumes the xml
+		// parser will enforce this constraint using the BPEL XMLSchema.
+		
+		push( new BPELCompensate(m_context,attr) );
+	}
+	public void closeCompensate() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildThrow(BPELAttributes attr) throws DeploymentException {
+		push(new BPELThrow(m_context,attr));
+	}
+	public void closeThrow() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildTerminate(BPELAttributes attr) throws DeploymentException {
+		push(new BPELTerminate(m_context,attr));
+	}
+	public void closeTerminate() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildEmpty(BPELAttributes attr) throws DeploymentException {
+		push(new BPELEmpty(m_context,attr));
+	}
+	public void closeEmpty() throws DeploymentException {
+		pop();
+	}
+	
+	public void buildWait(BPELAttributes attr) throws DeploymentException {
+		push(new BPELWait(m_context,attr));
+	}
+	public void closeWait() throws DeploymentException {
+		pop();
+	}
+	
+	
+	/**
+	 * BPEL does not require an explicit scope. If (partners,variables,
+	 * correlationSets, faultHandlers, compensationHandler, eventHandlers)
+	 * are defined outside an explicit scope an implicit scope is created.
+	 * 
+	 * @throws DefinitionServiceException
+	 */
+	private void testScope() throws DeploymentException {
+		if ( !(m_context instanceof BPELScope) ) {
+			buildScope(new BPELAttributes());
+		}
+	}
+	
+	/** The BPEL Invoke allows for a short cut syntax where catch,catchAll
+	 * and compensationHandler may be applied directly to the Invoke rather
+	 * than declaring them on a scope. In this case the translator will
+	 * create an implied scope.
+	 * 
+	 * @throws DefinitionServiceException
+	 */
+	private void testInvoke() throws DeploymentException {
+		if ( !(m_context instanceof BPELScope ) ) {
+			if ( m_context instanceof BPELInvoke ) {
+				BPELNode parentContext = m_context.m_parserStack;
+				if ( parentContext instanceof BPELScope ) {
+					// The Invoke has an associated scope - just pop the stack
+					m_context = m_context.pop();
+				} else {
+					// Create the implied scope and pop the invoke
+					BPELNode currentInvoke = m_context;
+					m_context = new BPELScope(parentContext,new BPELAttributes());
+					currentInvoke.m_parserStack = m_context;
+					currentInvoke.pop();
+				}
+			} else {
+				buildScope(new BPELAttributes());
+			}
+		}
+	}
+	
+	// Pop a BPEL node from the parser stack
+	private void pop() throws DeploymentException {
+		m_context = m_context.pop();
+	}
+	// Push a BPEL node to the parser stack
+	private void push(BPELNode node) {
+		m_context = node;
+	}
+	
+	BPELDefinitionKey getDefKey() {
+		return m_defKey;
+	}
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSAXHandler.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSAXHandler.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSAXHandler.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSAXHandler.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,217 @@
+/*
+* 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 13, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import com.sybase.bpe.definition.service.DefinitionService;
+import com.sybase.bpe.lang.ResourceGetter;
+
+
+
+/**
+ * @author waterman
+ *
+ * Adds BPEL specific methods to the SAX DefaultHandler. Tags in the BPEL document
+ * are used to generate methods on BPELRepositoryHandler.
+ *
+ * @see BPELRespositoryHandler
+ *
+ */
+class BPELSAXHandler extends DefaultHandler {
+
+	private static final Logger logger = Logger.getLogger(BPELSAXHandler.class.getName());
+
+	private BPELRepositoryHandler m_rh; // Marshalls the BPEL doc into the runtime repository
+
+	private Class[] m_paramType = new Class[] {BPELAttributes.class};
+
+	private static final String BUILD_PREFIX = "build";
+	private static final String CLOSE_PREFIX = "close";
+
+	/**
+	 *
+	 */
+	BPELSAXHandler(String documentName, HashMap supportDoc, DefinitionService ds) throws DeploymentException {
+		super();
+		m_rh = new BPELRepositoryHandler(documentName, supportDoc, ds);
+	}
+
+
+	/**
+	 * @see org.xml.sax.ContentHandler#startDocument()
+	 */
+	public void startDocument() throws SAXException {
+		super.startDocument();
+	}
+	/**
+	 * @see org.xml.sax.ContentHandler#endDocument()
+	 */
+	public void endDocument() throws SAXException {
+		super.endDocument();
+	}
+
+
+	/**
+	 * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+	 */
+	public void startElement(
+		String uri,
+		String localName,
+		String qName,
+		Attributes attributes)
+		throws SAXException {
+		super.startElement(uri, localName, qName, attributes);
+
+		try {
+			logger.fine("Start Element: " + localName);
+			BPELAttributes ba = new BPELAttributes(attributes);
+			String methodSuffix = localName;
+			String activityName = ba.getName();
+			String interpretation = m_rh.getInterpretation( activityName );
+			if ( interpretation != null )
+			{
+			    logger.fine("Interpretation found: " + interpretation);
+			    methodSuffix = interpretation;
+			}
+			Method m = m_rh.getClass().getMethod(getMethodName(methodSuffix,
+			        BUILD_PREFIX),m_paramType);
+			m.invoke(m_rh,new Object[] {ba});
+		} catch (SecurityException e) {
+			logger.log(Level.SEVERE,"",e);
+			throw new SAXException(e);
+		} catch (NoSuchMethodException e) {
+			logger.log(Level.FINE,ResourceGetter.getFormatted("DEPLOY_UNHANDLED_TAG",new Object[] {localName}));
+		} catch (IllegalArgumentException e) {
+			logger.log(Level.SEVERE,"",e);
+			throw new SAXException(e);
+		} catch (IllegalAccessException e) {
+			logger.log(Level.SEVERE,"",e);
+			throw new SAXException(e);
+		} catch (InvocationTargetException e) {
+			Throwable t = e.getTargetException();
+			if (Exception.class.isAssignableFrom( t.getClass() ))
+				throw new SAXException( (Exception) t );
+			else
+				throw new SAXException( t.getLocalizedMessage() );
+		}
+
+	}
+	/**
+	 * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
+	 */
+	public void endElement(String uri, String localName, String qName)
+		throws SAXException {
+		super.endElement(uri, localName, qName);
+
+		try {
+			logger.fine("End Element: " + localName);
+			Method m = m_rh.getClass().getMethod(getMethodName(localName,CLOSE_PREFIX),new Class[]{});
+			m.invoke(m_rh,new Object[]{});
+		} catch (SecurityException e) {
+			logger.log(Level.SEVERE,"",e);
+			throw new SAXException(e);
+		} catch (NoSuchMethodException e) {
+			logger.log(Level.FINE,ResourceGetter.getFormatted("DEPLOY_UNHANDLED_TAG",new Object[] {qName}));
+		} catch (IllegalArgumentException e) {
+			logger.log(Level.SEVERE,"",e);
+			throw new SAXException(e);
+		} catch (IllegalAccessException e) {
+			logger.log(Level.SEVERE,"",e);
+			throw new SAXException(e);
+		} catch (InvocationTargetException e) {
+			Throwable t = e.getTargetException();
+			if (Exception.class.isAssignableFrom( t.getClass() ))
+				throw new SAXException( (Exception) t );
+			else
+				throw new SAXException( t.getLocalizedMessage() );
+		}
+	}
+
+
+
+	/**
+	 * Uses a tag from the BPEL document to generate a BPELRepositoryHandler
+	 * method name. Note all BPEL tags will not generate valid methods.
+	 * ( i.e. collections like <variables>, <partners> )
+	 *
+	 * @param tag
+	 * @return
+	 */
+	private String getMethodName(String tag,String prefix) {
+		char chars[] = tag.toCharArray();
+		chars[0] = Character.toUpperCase(chars[0]);
+		StringBuffer buff = new StringBuffer(prefix);
+		buff.append(chars);
+		return buff.toString();
+	}
+
+
+	/* (non-Javadoc)
+	 * @see org.xml.sax.ContentHandler#characters(char[], int, int)
+	 */
+	public void characters(char[] ch, int start, int length)
+		throws SAXException {
+		m_rh.buildData(new String(ch,start,length));
+	}
+
+	/* (non-Javadoc)
+	 * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
+	 */
+	public void fatalError(SAXParseException e) throws SAXException {
+		logger.log(Level.SEVERE,"SAXParser Error",e);
+		throw e;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException)
+	 */
+	public void error(SAXParseException e) throws SAXException {
+		logger.log(Level.SEVERE,"SAXParser Error",e);
+		throw e;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException)
+	 */
+	public void warning(SAXParseException e) throws SAXException {
+		logger.log(Level.WARNING,"SAXParser Warning",e);
+	}
+
+	public BPELDefinitionKey getDefKey() {
+		return m_rh.getDefKey();
+	}
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSchema.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSchema.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSchema.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSchema.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,198 @@
+/*
+* 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 27, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+
+/**
+ * @author waterman
+ *
+ *	Enumerates the BPEL schema identifiers.
+ *
+ */
+public class BPELSchema {
+
+	private java.lang.String m_value;
+	
+	public static final String BPEL_URI="http://schemas.xmlsoap.org/ws/2003/03/business-process/";
+	public static final String XMLSCHEMA2001_NS = "http://www.w3.org/2001/XMLSchema";
+	public static final String XMLSCHEMA1999_NS = "http://www.w3.org/1999/XMLSchema";
+	public static final String SOAPSCHEMA_NS = "http://schemas.xmlsoap.org/soap/encoding/";
+
+	// Elements
+	private static final String REPLY_VALUE = "reply";
+
+    public static final String PRUNE_VALUE = "prune";
+	private static final String FLOW_VALUE = "flow";
+	private static final String PROCESS_VALUE = "process";
+	private static final String SEQUENCE_VALUE = "sequence";
+	private static final String INVOKE_VALUE = "invoke";
+	private static final String ASSIGN_VALUE = "assign";
+	private static final String RECEIVE_VALUE = "receive";
+	private static final String SCOPE_VALUE = "scope";
+	private static final String COPY_VALUE = "copy";
+	private static final String WHILE_VALUE = "while";
+	private static final String SWITCH_VALUE = "switch";
+	private static final String CASE_VALUE = "case";
+	private static final String OTHERWISE_VALUE = "otherwise";
+	private static final String FROM_VALUE = "from";
+	private static final String TO_VALUE = "to";
+	private static final String CORRELATIONSET_VALUE = "correlationSet";
+	private static final String CORRELATION_VALUE = "correlation";
+	private static final String CATCH_VALUE = "catch";
+	private static final String CATCHALL_VALUE = "catchAll";
+	private static final String ONMESSAGE_VALUE = "onMessage";
+	private static final String ONALARM_VALUE = "onAlarm";
+	private static final String COMPENSATION_VALUE = "compensationHandler";
+	private static final String PICK_VALUE = "pick";
+	private static final String COMPENSATE_VALUE = "compensate";
+	private static final String THROW_VALUE = "throw";
+	private static final String TERMINATE_VALUE = "terminate";
+	private static final String EMPTY_VALUE = "empty";
+	private static final String WAIT_VALUE = "wait";
+	
+	// Attributes
+	private static final String NAME_ATTR_VALUE = "name";
+	private static final String LINKNAME_ATTR_VALUE = "linkName";
+	private static final String MESSAGE_TYPE_VALUE = "messageType";
+	private static final String VARIABLE_VALUE = "variable";
+	private static final String INPUT_VARIABLE_VALUE = "inputVariable";
+	private static final String OUTPUT_VARIABLE_VALUE = "outputVariable";
+	private static final String PART_VALUE = "part";
+	private static final String TRANSITIONCONDITION_VALUE = "transitionCondition";
+	private static final String JOINCONDITION_VALUE = "joinCondition";
+	private static final String SUPPRESS_JOIN_VALUE = "suppressJoinFailure";
+	private static final String CONDITION_VALUE ="condition";
+	private static final String EXPRESSION_VALUE = "expression";
+	private static final String PARTNERLINK_VALUE = "partnerLink";
+	private static final String PROPERTIES_VALUE = "properties";
+	private static final String FAULTNAME_VALUE = "faultName";
+	private static final String FAULTVAR_VALUE = "faultVariable";
+	private static final String SET_VALUE = "set";
+	private static final String INITIATE_VALUE = "initiate";
+	private static final String CREATEINSTANCE_VALUE = "createInstance";
+	private static final String PORTTYPE_VALUE = "portType";
+	private static final String OPERATION_VALUE = "operation";
+	private static final String QUERY_VALUE = "query";
+	private static final String PROPERTY_VALUE = "property";
+	private static final String TYPE_VALUE = "type";
+	private static final String FOR_VALUE = "for";
+	private static final String UNTIL_VALUE = "until";
+	private static final String PATTERN_VALUE = "pattern";
+	private static final String QUERY_LANG_VALUE = "queryLanguage";
+	private static final String EXPR_LANG_VALUE = "expressionLanguage";
+	
+	// XML 
+	public static final String PREFIX_SEPERATOR = ":";
+	public static final String NAMESPACE_KEY = "xmlns";
+	
+	// Faults
+	public static final String FAULT_SELECTION_FAILURE = "selectionFailure";
+	public static final String FAULT_CONFILICTING_RECEIVE = "confilictingReceive";
+	public static final String FAULT_CONFILICTING_REQUEST = "confilictingRequest";
+	public static final String FAULT_MMAF = "mismatchedAssignmentFailure";
+	public static final String FAULT_JOIN_FAILURE = "joinFailure";
+	public static final String FAULT_FORCED_TERMINATION = "forcedTermination";
+	public static final String FAULT_CORRELATION_VIOLATION = "correlationViolation";
+	public static final String FAULT_UNINIT_VAR = "uninitializedVariable";
+	public static final String FAULT_REPEAT_COMP = "repeatedCompensation";
+	public static final String FAULT_INVALID_REPLY = "invalidReply";
+	
+	private BPELSchema() {}
+	private BPELSchema(String value){
+		m_value = value;
+	}
+	
+	// Elements
+	static final BPELSchema PRUNE = new BPELSchema(PRUNE_VALUE);
+	static final BPELSchema REPLY = new BPELSchema(REPLY_VALUE);
+	static final BPELSchema FLOW = new BPELSchema(FLOW_VALUE);
+	static final BPELSchema PROCESS = new BPELSchema(PROCESS_VALUE);
+	static final BPELSchema SEQUENCE = new BPELSchema(SEQUENCE_VALUE);
+	static final BPELSchema INVOKE = new BPELSchema(INVOKE_VALUE);
+	static final BPELSchema ASSIGN = new BPELSchema(ASSIGN_VALUE);
+	static final BPELSchema RECEIVE = new BPELSchema(RECEIVE_VALUE);
+	static final BPELSchema SCOPE = new BPELSchema(SCOPE_VALUE);
+	static final BPELSchema COPY = new BPELSchema(COPY_VALUE);
+	static final BPELSchema WHILE = new BPELSchema(WHILE_VALUE);
+	static final BPELSchema SWITCH = new BPELSchema(SWITCH_VALUE);
+	static final BPELSchema CASE = new BPELSchema(CASE_VALUE);
+	static final BPELSchema OTHERWISE = new BPELSchema(OTHERWISE_VALUE);
+	static final BPELSchema FROM = new BPELSchema(FROM_VALUE);
+	static final BPELSchema TO = new BPELSchema(TO_VALUE);
+	static final BPELSchema CORRELATIONSET = new BPELSchema(CORRELATIONSET_VALUE);
+	static final BPELSchema CORRELATION = new BPELSchema(CORRELATION_VALUE);
+	static final BPELSchema CATCH = new BPELSchema(CATCH_VALUE);
+	static final BPELSchema CATCHALL = new BPELSchema(CATCHALL_VALUE);
+	static final BPELSchema ONMESSAGE = new BPELSchema(ONMESSAGE_VALUE);
+	static final BPELSchema ONALARM = new BPELSchema(ONALARM_VALUE);
+	static final BPELSchema COMPENSATION = new BPELSchema(COMPENSATION_VALUE);
+	static final BPELSchema PICK = new BPELSchema(PICK_VALUE);
+	static final BPELSchema COMPENSATE = new BPELSchema(COMPENSATE_VALUE);
+	static final BPELSchema THROW = new BPELSchema(THROW_VALUE);
+	static final BPELSchema TERMINATE = new BPELSchema(TERMINATE_VALUE);
+	static final BPELSchema EMPTY = new BPELSchema(EMPTY_VALUE);
+	static final BPELSchema WAIT = new BPELSchema(WAIT_VALUE);
+	
+	// Attributes
+	static final BPELSchema NAME_ATTR = new BPELSchema(NAME_ATTR_VALUE);
+	static final BPELSchema LINKNAME_ATTR = new BPELSchema(LINKNAME_ATTR_VALUE);
+    static final BPELSchema MESSAGE_TYPE_ATTR = new BPELSchema(MESSAGE_TYPE_VALUE);
+    static final BPELSchema VARIABLE_ATTR = new BPELSchema(VARIABLE_VALUE);
+    static final BPELSchema INPUT_VARIABLE_ATTR = new BPELSchema(INPUT_VARIABLE_VALUE);
+
+	
+    static final BPELSchema OUTPUT_VARIABLE_ATTR = new BPELSchema(OUTPUT_VARIABLE_VALUE);
+    static final BPELSchema PART_ATTR = new BPELSchema(PART_VALUE);
+    static final BPELSchema TRANSITIONCONDITION_ATTR = new BPELSchema(TRANSITIONCONDITION_VALUE);
+    static final BPELSchema JOINCONDITION_ATTR = new BPELSchema(JOINCONDITION_VALUE);
+    static final BPELSchema SUPPRESS_JOIN_ATTR = new BPELSchema(SUPPRESS_JOIN_VALUE);
+    static final BPELSchema CONDITION_ATTR = new BPELSchema(CONDITION_VALUE);
+    static final BPELSchema EXPRESSION_ATTR = new BPELSchema(EXPRESSION_VALUE);
+    static final BPELSchema PARTNERLINK_ATTR = new BPELSchema(PARTNERLINK_VALUE);
+    static final BPELSchema PROPERTIES_ATTR = new BPELSchema(PROPERTIES_VALUE);
+    static final BPELSchema FAULTNAME_ATTR = new BPELSchema(FAULTNAME_VALUE);
+    static final BPELSchema FAULTVAR_ATTR = new BPELSchema(FAULTVAR_VALUE);
+    static final BPELSchema SET_ATTR = new BPELSchema(SET_VALUE);
+    static final BPELSchema INITIATE_ATTR = new BPELSchema(INITIATE_VALUE);
+    static final BPELSchema SCOPE_ATTR = new BPELSchema(SCOPE_VALUE);
+    static final BPELSchema CREATEINSTANCE_ATTR = new BPELSchema(CREATEINSTANCE_VALUE);
+    static final BPELSchema PORTTYPE_ATTR = new BPELSchema(PORTTYPE_VALUE);
+    static final BPELSchema OPERATION_ATTR = new BPELSchema(OPERATION_VALUE);
+    static final BPELSchema QUERY_ATTR = new BPELSchema(QUERY_VALUE);
+    static final BPELSchema PROPERTY_ATTR = new BPELSchema(PROPERTY_VALUE);
+    static final BPELSchema TYPE_ATTR = new BPELSchema(TYPE_VALUE);
+    static final BPELSchema FOR_ATTR = new BPELSchema(FOR_VALUE);
+    static final BPELSchema UNITL_ATTR = new BPELSchema(UNTIL_VALUE);
+    static final BPELSchema PATTERN_ATTR = new BPELSchema( PATTERN_VALUE );
+    static final BPELSchema QUERY_LANG_ATTR = new BPELSchema( QUERY_LANG_VALUE );
+    static final BPELSchema EXPR_LANG_ATTR = new BPELSchema( EXPR_LANG_VALUE );
+    
+	public java.lang.String getValue()
+	{
+	   return m_value;
+	}
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELScope.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELScope.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELScope.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELScope.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,356 @@
+/*
+* 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 19, 2003
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+//import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.bpel.EndScopeAction;
+import com.sybase.bpe.action.bpel.RegisterAction;
+import com.sybase.bpe.action.bpel.StartScopeAction;
+import com.sybase.bpe.definition.IPMDAction;
+import com.sybase.bpe.definition.IPMDChangeCondition;
+import com.sybase.bpe.definition.IPMDLocator;
+import com.sybase.bpe.definition.IPMDOperation;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+
+
+/**
+ * Implements the BPEL <i>scope</i> node. The scope node holds a collections of
+ * events, variables, correlation sets, faults and compensation handler.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tScope.
+ *
+ * @author waterman
+ */
+class BPELScope extends BPELStructuredActivity {
+
+	private static final Logger logger = Logger.getLogger(BPELScope.class.getName());
+
+	
+	private HashMap m_variables = new HashMap();		// BPELVariable objects
+	private HashMap m_correlationSets = new HashMap();	// BPELCorrelationSet objects
+	private HashMap m_faultHandlers = new HashMap();	// BPELCatch objects
+	private Vector m_eventHandlers = new Vector();		// BPELEvent objects
+	private ArrayList m_compLocators = new ArrayList();	// BPELVariables used within the scopes compensation handler
+	private BPELCompensationHandler m_compHandler;		// BPELCompensationHandler
+	private String name;								// scope name
+	private BPELNode m_activity;								
+	
+	// note - the BPEL name attribute for scope is not required. Therefore it is
+	// important that scope name be maintained for a unique runtime handle
+	
+	/**
+	 * @param previous the parent schema node
+	 * @param attrs    the schema attributes
+	 */	
+	BPELScope(BPELNode node, BPELAttributes attrs) throws DeploymentException {
+		super(node, BPELSchema.SCOPE,attrs,logger);
+		
+		createProcessSequence(getAttributes(),getEndProcess());
+		
+		name = attrs.getName() + "_" + getScopeCounter(); 
+	}
+
+	void setCompensationHandler(BPELCompensationHandler handler) {
+		m_compHandler = handler;
+	}
+	
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#addVariable(com.sybase.bpe.deployment.bpel.BPELVariable)
+	 */
+	void addVariable(BPELVariable var) {
+		m_variables.put(var.getName(),var);
+		var.setScope(this);		
+	}
+	
+	void addCorrelationSet(BPELCorrelationSet corr) {
+		m_correlationSets.put(corr.getName(),corr);
+	}
+	
+	void addFaultHandler(BPELCatch fault) throws DeploymentException {
+		m_faultHandlers.put(fault.getName(),fault);
+	}
+	
+	void addEventHandler(BPELEvent event) {
+		m_eventHandlers.add(event);
+	}
+	
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#getVariable(java.lang.String)
+	 */
+	BPELVariable getVariable(String varName) throws DeploymentException {
+		BPELVariable ret = null;
+		
+		if ( (ret = (BPELVariable)m_variables.get(varName)) == null ) {
+			ret = m_parserStack.getVariable(varName);
+		}
+		
+		return ret;
+	}
+	
+
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#addActivity(com.sybase.bpe.deployment.bpel.BPELNode)
+	 */
+	void addActivity(BPELNode activity) throws DeploymentException {
+		
+		createProcessSequence(activity.getAttributes(),activity.getStartProcess());
+		
+		linkProcess(BPELProcessType.START,(BPELLinkedActivity)activity,BPELProcessType.START,true);
+		
+		((BPELLinkedActivity)activity).linkProcess(BPELProcessType.END,this,BPELProcessType.END,false);	
+		
+		m_activity = activity;
+	}
+	
+	String getScopeName() {
+		return name;
+	}
+	
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#getScopePath(com.sybase.bpe.deployment.bpel.BPELScopePath)
+	 */
+	BPELScopePath getScopePath(BPELScopePath path) {
+		
+		path.pushScope(this);
+		
+		return m_parserStack.getScopePath(path);
+
+	}
+	
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#getCorrelationSet(java.lang.String)
+	 */
+	BPELCorrelationSet getCorrelationSet(String name) {
+		BPELCorrelationSet ret = (BPELCorrelationSet)m_correlationSets.get(name);
+		if ( ret == null ) ret = m_parserStack.getCorrelationSet(name);
+		return ret;
+	}
+
+
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#pop()
+	 */
+	BPELNode pop() throws DeploymentException {
+		
+		// Create the start scope action
+		try {
+			IPMDChangeCondition ccB = getStartProcess().createChangeCondition("Start Scope: "+getScopeName(),
+				com.sybase.bpe.condition.DefaultConditional.class.getName());
+
+			IPMDAction ss = ccB.createAction("Start Scope: "+getScopeName(),
+				com.sybase.bpe.action.bpel.StartScopeAction.class.getName());
+			ss.addMetadata(StartScopeAction.SCOPE_NAME,getScopeName());
+			
+		
+			// Create the end scope action
+			IPMDChangeCondition ccE = getEndProcess().createChangeCondition("End Scope: "+getScopeName(),
+				com.sybase.bpe.condition.DefaultConditional.class.getName());
+			IPMDAction es = ccE.createAction("End Scope: "+getScopeName(),
+				com.sybase.bpe.action.bpel.EndScopeAction.class.getName());
+			
+				
+			// register event handlers
+			setEventHandlers(ccB, ccE);
+			
+			// mark contentious variables
+			//setVariableThreadBoundries();
+			
+			// register fault handlers
+			setFaultHandlers(ss);
+			
+			// register the compensation handler
+			setCompensationHandler(es);
+		} catch (DefinitionServiceException e) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getScopeName()},e);
+		}
+				
+		return super.pop();
+	}
+	
+	/**
+	 * If a scope variable is used in the Scopes compensation handler, the end
+	 * scope needs to identify variables that require a snapshot.
+	 * 
+	 * @param loc - the variable locator
+	 * 
+	 */
+	
+	void setCompLocatorCapture(IPMDLocator loc) {
+		m_compLocators.add(loc);
+	}
+	
+	/**
+	 * Identifies variables that cross thread boundries
+	 *
+	 */
+//	private void setVariableThreadBoundries() {
+//		// Iterate over the scope variables and determine if any of them
+//		// cross a thread boundry. If so mark the locator as contentious
+//		
+//		for ( Iterator varItr = m_variables.values().iterator(); varItr.hasNext(); ) {
+//			BPELVariable var = (BPELVariable)varItr.next();
+//			
+//			if ( var.getUsedInActivities().size() > 1 ) {
+//				// Get the nodes where the variable is used
+//				Iterator nodeItr = var.getUsedInActivities().iterator();
+//				HashSet basis = ((BPELNode)nodeItr.next()).collectThreadBoundries(new HashSet());
+//				
+//				// Compare the remaining nodes - if the hashsets don't equal then
+//				// the variable has crossed a thread boundry
+//				while ( nodeItr.hasNext() ) {
+//					
+//					HashSet derive = ((BPELNode)nodeItr.next()).collectThreadBoundries(new HashSet());
+//					
+//					if ( !derive.equals(basis) ) {
+//						for ( Iterator locatorItr = var.getUsedInLocators().iterator(); locatorItr.hasNext(); ) {
+//							((IPMDLocator)locatorItr.next()).setContentious(true);
+//						}
+//						break; // No reason to check the remaining activities
+//					}
+//				}
+//			}
+//			
+//		}		
+//	}
+	
+	/**
+	 * Creates the scoped fault handlers
+	 *
+	 * @param ssa the start scope action
+	 */
+	private void setFaultHandlers(IPMDAction ssa) throws DeploymentException {
+		
+		HashMap faultHandlers = new HashMap();
+		
+		for ( Iterator itr = m_faultHandlers.entrySet().iterator(); itr.hasNext();){
+			Map.Entry me = (Map.Entry)itr.next();
+			
+			BPELCatch bpelCatch = (BPELCatch)me.getValue();
+			
+			faultHandlers.put(me.getKey(),
+				bpelCatch.getStartProcess().getKey().getValue());
+			// add the scopes end process as an observer of the fault
+			try {
+				bpelCatch.getEndProcess().addObserverProcessPC(getEndProcess());
+			} catch (DefinitionServiceException e) {
+				BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_ADDOBSERVER",new Object[] {getProcess().getAttributes().getName()},e);
+			}
+		}
+		
+		try {
+			ssa.addMetadata(StartScopeAction.FAULT_HANDLERS,faultHandlers);
+		} catch (DefinitionServiceException e) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEPROP",new Object[] {getProcess().getAttributes().getName(), StartScopeAction.FAULT_HANDLERS},e);
+		}
+
+	}
+	
+	/**
+	 * Creates the scope's compensation handler
+	 * @param esa the end scope action
+	 */
+	private void setCompensationHandler(IPMDAction esa) throws DeploymentException {
+		if ( m_compHandler != null ) {
+			try {
+				esa.addMetadata(EndScopeAction.COMP_HANLDER, m_compHandler.getStartProcess().getKey().getValue());
+				esa.addMetadata(EndScopeAction.LOCATORS,m_compLocators);
+			} catch (DefinitionServiceException e) {
+				BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEPROP",new Object[] {getProcess().getAttributes().getName(), EndScopeAction.COMP_HANLDER},e);
+			}
+			
+		}
+	}
+	
+	private void setEventHandlers(IPMDChangeCondition ccB , IPMDChangeCondition ccE ) throws DeploymentException {
+		
+		ArrayList ops = new ArrayList();
+		IPMDOperation op = null;
+		
+		IPMDAction regAct = null;
+		IPMDAction unRegAct = null;
+		
+		if ( !m_eventHandlers.isEmpty() ) {
+			//register action
+			regAct = createRegisterAction(ccB,getScopeName());
+			//unregister action
+			unRegAct = createUnRegisterAction(ccE,getScopeName());
+		}
+		
+		for ( Iterator itr = m_eventHandlers.iterator(); itr.hasNext(); ) {
+			
+			op = ((BPELEvent)itr.next()).getOperation(regAct,ccB);
+			if ( op != null ) {
+				getProcess().addNonInstanceCreatingStaticKey(op.getKey());
+			}
+			if ( op != null ) ops.add( op );
+		}
+		
+		if ( regAct != null && unRegAct != null ) {
+			try {
+				regAct.addMetadata(RegisterAction.OPERATIONS,ops);
+				regAct.addMetadata(RegisterAction.BLOCK,new Boolean("false"));
+				unRegAct.addMetadata(RegisterAction.OPERATIONS,ops);
+			} catch (DefinitionServiceException e) {
+				BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e);
+			}
+		}
+	}
+	
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#getScope()
+	 */
+	BPELScope getScope() {
+		if ( this.inCompensationHandler() ) return m_parserStack.getScope();
+		return this;
+	}
+	
+	Vector getEventHandlers() {
+		return m_eventHandlers;
+	}
+	
+	void addJoinCondtion(BPELVariable var) throws DeploymentException {
+
+		super.addJoinCondtion(var);
+
+		m_activity.addJoinCondtion(var);		
+		
+	}
+
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+	 */
+	String getActivityDescription() {
+		return "scope is implemented by: " + com.sybase.bpe.action.bpel.StartScopeAction.class.getName() + ". It is used to initailize/destroy a container which holds a named execution context.";
+	}	
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELScopePath.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELScopePath.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELScopePath.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELScopePath.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,78 @@
+/*
+* 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 20, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.Stack;
+
+/**
+ * Holds a path to a BPELVariable
+ * 
+ * @author waterman
+ * @see BPELScope
+ */
+class BPELScopePath {
+	
+	static final String PATH_DELIMITER = "/";
+	
+	boolean m_absolutePath;
+	Stack m_path = new Stack();
+	
+	BPELScopePath(boolean inCompensationHandler) {
+		//m_absolutePath = !inCompensationHandler;
+		// make all paths absolute for now
+		m_absolutePath=true;
+	}
+
+	void pushScope(BPELNode scope) {
+		m_path.push(scope);
+	}
+
+	public String toString() {
+		
+		StringBuffer buf = ( m_absolutePath ) ? new StringBuffer(PATH_DELIMITER + ((BPELScope)m_path.pop()).getScopeName()) : new StringBuffer(((BPELScope)m_path.pop()).getScopeName());
+
+			
+		int size = m_path.size();
+		
+		for (int i = 0; i < size; i++ ) {
+			BPELNode node = (BPELNode)m_path.pop();
+			if ( node instanceof BPELScope ) {	
+				buf.append( PATH_DELIMITER + ((BPELScope)node).getScopeName() );
+			} else {
+				if ( node instanceof BPELCatch ) {
+					try {
+						buf.append( PATH_DELIMITER + ((BPELCatch)node).getName() );
+					} catch (DeploymentException e) {
+						e.printStackTrace();
+					}
+				}
+			}
+		}
+		
+		return buf.toString();
+	}
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSequence.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSequence.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSequence.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSequence.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,214 @@
+/*
+* 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 3, 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.StartSequenceAction;
+import com.sybase.bpe.action.bpel.UnInitVariableMetaData;
+import com.sybase.bpe.action.internal.IInternalAction;
+import com.sybase.bpe.definition.IPMDAction;
+import com.sybase.bpe.definition.IPMDChangeCondition;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+import com.sybase.bpe.util.BPException;
+
+/**
+ * Implements the BPEL <i>sequence</i> node. The sequence node holds 
+ * a collection of activities that are to be executed in sequence.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tSequence.
+ *
+ * @author waterman
+ */
+class BPELSequence extends BPELStructuredActivity {
+	private static final Logger logger = Logger.getLogger(BPELSequence.class.getName());
+
+	
+	private Vector m_activities = new Vector();
+	private Vector m_links = new Vector();
+	private IPMDAction m_ss;
+	private Properties m_ssProps = new Properties();
+
+	BPELSequence(BPELNode node, BPELAttributes attrs) throws DeploymentException {
+		super(node,BPELSchema.SEQUENCE,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 {
+		m_activities.add(activity);
+	}
+	
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#pop()
+	 */
+	BPELNode pop() throws DeploymentException {
+
+		BPELLinkedActivity current = this;
+		BPELLinkedActivity la = null;
+		
+//		BPELNode proxy = null;
+		
+//		if ( current.getLinkCounter(BPELLinkType.SOURCE) > 0 ) {
+//			for ( Iterator linkItr = current.getLinks(BPELLinkType.SOURCE); linkItr.hasNext(); ) {
+//				BPELLink link = (BPELLink)linkItr.next();
+//				BPELNode linkOwner = current.getLinkOwner(link);
+//				proxy = current.getProxy(linkOwner);
+//				if ( proxy != null ) break;
+//			}
+//		}
+		
+		createSeqStart();
+		
+		for (Iterator itr = m_activities.iterator(); itr.hasNext(); ) {
+			la = (BPELLinkedActivity)itr.next();
+			
+			
+			if ( la.getLinkCounter(BPELLinkType.TARGET) == 0 ) {
+				createProcessSequence(la.getAttributes(),la.getStartProcess());
+			} else {
+				la.incrementLink(BPELLinkType.TARGET);
+				createProcessSync(la.getStartProcess(),la.getAttributes().getName(),String.valueOf(la.getLinkCounter(BPELLinkType.TARGET)));
+			}
+			
+			if ( current == this ) {
+				this.linkStartProcess(la); 
+			} else {
+				current.linkProcess(BPELProcessType.END,la,BPELProcessType.START,true);
+			}
+			
+			if ( la.getLinkCounter(BPELLinkType.SOURCE) > 0 ) {
+				la.incrementLink(BPELLinkType.SOURCE);
+			}
+			current = la;
+		}
+		
+		current.linkProcess(BPELProcessType.END,this,BPELProcessType.END,false);
+		
+		createSeqEnd();
+		
+		m_ss.setMetadata(m_ssProps);
+		
+		return super.pop();
+	}
+	
+	void addJoinCondtion(BPELVariable var) throws DeploymentException {
+		
+		m_ssProps.put(StartSequenceAction.JOIN_EXPRESSION_KEY,var.createLocator(m_ss,this,null,null,false));
+		m_ssProps.put(StartSequenceAction.SUPPRESS_KEY,(BPELBoolean.NO.equals(getAttributes().getSuppressJoin())) ? BPELBoolean.NO.getBooleanValue() : getSuppressJoinFailure().getBooleanValue());
+		
+		try {
+			IInternalAction tmp = m_ss.getActionImpl();
+			if ( tmp != null ) tmp.init(m_ssProps);
+		} catch (BPException e) {
+		}
+		
+//		super.addJoinCondtion(var);
+
+//		for ( Iterator itr = m_activities.iterator(); itr.hasNext(); ) {
+//			
+//			((BPELNode)itr.next()).addJoinCondtion(var);		
+//		}		
+		
+	}
+	
+	BPELLink notifyLink(BPELLink link, BPELFlow node) throws DeploymentException {
+		// the link has crossed the sequence boundry so capture it here
+		if ( link.getSource() != this && link.getTarget() != this ) {
+			m_links.add(link);
+		}
+		if ( m_parserStack != null ) return m_parserStack.notifyLink(link, node);
+		return null;
+	}
+	
+	private void createSeqEnd() throws DeploymentException {
+		
+		Vector linkLocators = new Vector();
+		
+		IPMDChangeCondition ccE = null;
+		IPMDAction es = null;
+
+		// Create the end switch action
+		try {
+			ccE = getEndProcess().createChangeCondition("End Sequence: "+getAttributes().getName(),
+				com.sybase.bpe.condition.DefaultConditional.class.getName());
+			es = ccE.createAction("End Sequence: "+getAttributes().getName(),
+				com.sybase.bpe.action.bpel.EndSequenceAction.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 = m_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);
+		
+		// link end process
+		m_ssProps.put(StartSequenceAction.END_DEF_KEY,this.getEndProcess().getKey());
+		
+	}
+	
+	private void createSeqStart() throws DeploymentException {
+		
+		try {
+			IPMDChangeCondition ccB = getStartProcess().createChangeCondition("ChangeCondition: " + getAttributes().getName(),
+					com.sybase.bpe.condition.DefaultConditional.class.getName());
+			m_ss = ccB.createAction("Start Sequence: "+getAttributes().getName(),
+					com.sybase.bpe.action.bpel.StartSequenceAction.class.getName());
+		} catch (DefinitionServiceException e) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e);
+		}
+	}
+	
+	private void linkStartProcess(BPELLinkedActivity la) {
+		m_ssProps.put(com.sybase.bpe.action.bpel.StartSequenceAction.START_DEF_KEY,la.getStartProcess().getKey());
+		m_ssProps.put(StartSequenceAction.UNINITVAR_KEY,new UnInitVariableMetaData(BPELSchema.BPEL_URI,BPELSchema.FAULT_UNINIT_VAR));
+	}
+	
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+	 */
+	String getActivityDescription() {
+		return "sequence is implemented by: " + com.sybase.bpe.action.bpel.SequenceAction.class.getName() + ". It is a container used to execute a series of activites.";
+	}
+	
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSimpleUpdate.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSimpleUpdate.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSimpleUpdate.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELSimpleUpdate.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
+*/
+
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.bpel.SimpleUpdateAction;
+import com.sybase.bpe.definition.IPMDAction;
+import com.sybase.bpe.definition.IPMDChangeCondition;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+import com.sybase.bpe.interaction.IInvocation;
+import com.sybase.bpe.util.BPException;
+
+
+public abstract class BPELSimpleUpdate extends BPELNode
+{
+    private static final Logger logger = 
+        Logger.getLogger(BPELSimpleUpdate.class.getName());
+
+    protected BPELFrom m_from;
+
+    BPELSimpleUpdate(BPELNode previous, BPELSchema tag, BPELAttributes attrs, Logger logger)
+    {
+        super(previous, tag, attrs, logger);
+        // TODO Auto-generated constructor stub
+    }
+    
+    void addActivity(BPELNode activity) throws DeploymentException 
+	{
+		if ( activity instanceof BPELFrom ) m_from = (BPELFrom)activity;
+	}
+    
+	BPELNode pop() throws DeploymentException 
+	{
+		IPMDChangeCondition cc = null;
+		
+		Iterator itr = getStartProcess().getChangeConditions();
+		IPMDAction ccact=null;
+		
+		try 
+		{
+			if ( itr.hasNext() ) {
+				// use the existing change condition
+				cc = (IPMDChangeCondition)itr.next();
+			} 
+			else 
+			{
+				// create a new change condition
+				cc = getStartProcess().createChangeCondition(
+				    "ChangeCondition: " +  getAttributes().getName(),
+				com.sybase.bpe.condition.DefaultConditional.class.getName());
+			}
+				
+			// Create the copy action 
+			ccact = cc.createAction(
+					"ChangeAction: " + getAttributes().getName(),
+					com.sybase.bpe.action.bpel.SimpleUpdateAction.class.getName());
+		} 
+		catch (DefinitionServiceException e) 
+		{
+			BPELUtil.throwNewException(logger,Level.SEVERE,
+			        "BPEL_CREATEACTION",
+			        new Object[] {getProcess().getAttributes().getName(), 
+			        getAttributes().getName()},e);
+		}
+		
+		
+		// TODO: Lance - BPEL v1.next - type checking
+		
+		Properties md = new Properties(); // action metadata properties
+
+		BPELVariable var = getVariable(m_from.getAttributes().getVariable());
+
+		
+		Object locator = var.createLocator(
+		        ccact,this,m_from,m_from.getAttributes(),
+		        BPELInvocationType.NO_INVOCATION,
+		        true);
+
+		md.put(SimpleUpdateAction.TARGET_VARIABLE_KEY, locator );
+		
+		try
+        {
+            md.put(SimpleUpdateAction.INVOCATION_KEY, 
+                    createInvocation(m_from.getAttributes().getQuery()));
+        } catch (BPException e1)
+        {
+            throw new DeploymentException(e1);
+        }
+		
+		ccact.setMetadata(md);
+		
+		return super.pop();
+	}
+	
+	abstract protected IInvocation createInvocation(String invocationString )
+	  throws BPException;
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELStructuredActivity.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELStructuredActivity.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELStructuredActivity.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELStructuredActivity.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,115 @@
+/*
+* 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
+*/
+package com.sybase.bpe.deployment.bpel;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.definition.IPMDAction;
+import com.sybase.bpe.definition.IPMDChangeCondition;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+
+/*
+ * Created on Jun 9, 2003
+ *
+ */
+
+/**
+ * @author waterman
+ * 
+ * The base class for BPLE structured activities (i.e. Flow, Sequence, While )
+ * Structured activities hold a starting process and an ending process definition.
+ *
+ */
+abstract class BPELStructuredActivity extends BPELLinkedActivity {
+	private static final Logger logger = Logger.getLogger(BPELStructuredActivity.class.getName());
+
+	//private static final String LOCATOR="SyncThreadCounterLocator";
+	//private static final String THREAD_COUNT_KEY="SyncThreadCount";
+	protected IPMDProcess m_endProcess;
+	
+
+	void createProcessSync(IPMDProcess target, String name, String numberOfSources ) throws DeploymentException {
+	
+		// Create the Pre Condition
+		IPMDAction preact=null;
+		try {
+			IPMDChangeCondition precc = target.createPrecondition("PreCondition: " + name,
+				com.sybase.bpe.condition.DefaultConditional.class.getName());
+			// Create the pre Action
+			preact =
+				precc.createAction(
+					"MergeAction: " + name,
+					com.sybase.bpe.action.bpel.MergeAction.class.getName());
+		} catch (DefinitionServiceException e) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), name},e);
+		}
+	
+		BPELVariable var = new BPELSystemVariable(com.sybase.bpe.action.bpel.MergeAction.LOCATOR,target.getKey().getValue()+":mergeCount",this);
+		var.createLocator(preact,this,null,null,true);
+		
+		Properties md = new Properties();
+		
+		md.put(com.sybase.bpe.action.bpel.MergeAction.THREAD_COUNT_KEY,numberOfSources);
+		//preact.addMetadata(THREAD_COUNT_KEY,numberOfSources);
+		md.putAll(getAttributes());
+		
+		preact.setMetadata(md);
+		
+	}
+
+	/**
+	 * @param previous the parent schema node
+	 * @param attrs    the schema attributes
+	 * @throws DefinitionServiceException
+	 */
+	BPELStructuredActivity(
+		BPELNode previous,
+		BPELSchema tag,
+		BPELAttributes attrs, Logger logger)
+		throws DeploymentException {
+		super(previous, tag, attrs, logger);
+		
+		if ( m_parserStack != null ) {
+			m_endProcess = createProcess((m_attributes.getName() == null)? "end: " + tag.getValue() : "end: " + m_attributes.getName());
+			m_endProcess.setDescription(getActivityDescription());
+		}
+	}
+	
+	/**
+	 * @see com.sybase.bpe.deployment.bpel.BPELNode#getEndProcess()
+	 */
+	IPMDProcess getEndProcess() {
+		return m_endProcess;
+	}
+	
+	void linkProcess(BPELProcessType parent_type, BPELLinkedActivity child, BPELProcessType child_type, boolean linkNodes) throws DeploymentException {
+		try {
+			(( parent_type == BPELProcessType.START ) ? m_process : m_endProcess).addObserverProcessPC(( child_type == BPELProcessType.START ) ? child.getStartProcess() : child.getEndProcess());
+		} catch (DefinitionServiceException e) {
+			BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_ADDOBSERVER",new Object[] {getProcess().getAttributes().getName()},e);
+		}
+		if ( linkNodes ) child.addParent(this);	
+	}
+
+}