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 [25/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/BPELCopyType.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELCopyType.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELCopyType.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELCopyType.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,75 @@
+/*
+* 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 12, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+/**
+ * @author waterman
+ *
+ */
+public class BPELCopyType {
+
+ private String m_value;
+ private int m_switch;
+
+ private BPELCopyType(String value, int value_switch) {
+ m_value = value;
+ m_switch = value_switch;
+ }
+
+ private static final String VARIABLE_VALUE = "variable";
+ static final int VARIABLE_SWITCH = 1;
+ private static final String PROPERTY_VALUE = "property";
+ static final int PROPERTY_SWITCH = 2;
+ private static final String EXPRESSION_VALUE = "expression";
+ static final int EXPRESSION_SWITCH = 3;
+ private static final String PARTNERLINK_VALUE = "partnerLink";
+ static final int PARTNERLINK_SWITCH = 4;
+
+ static final BPELCopyType VARIABLE = new BPELCopyType(VARIABLE_VALUE,VARIABLE_SWITCH);
+ static final BPELCopyType PROPERTY = new BPELCopyType(PROPERTY_VALUE,PROPERTY_SWITCH);
+ static final BPELCopyType EXPRESSION = new BPELCopyType(EXPRESSION_VALUE,EXPRESSION_SWITCH);
+ static final BPELCopyType PARTNERLINK = new BPELCopyType(PARTNERLINK_VALUE,PARTNERLINK_SWITCH);
+
+
+ String getValue() {
+ return m_value;
+ }
+
+ int getSwitch() {
+ return m_switch;
+ }
+
+ static BPELCopyType getCopyType(BPELAttributes attr) {
+
+ if ( attr.getBPWSProperty() != null ) return PROPERTY;
+ if ( attr.getVariable() != null ) return VARIABLE;
+ if ( attr.getExpression() != null ) return EXPRESSION;
+ if ( attr.getPartnerLink() != null ) return PARTNERLINK;
+
+ return null;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELCopyValue.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELCopyValue.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELCopyValue.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELCopyValue.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,102 @@
+/*
+* 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 Apr 13, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.Properties;
+
+import com.sybase.bpe.action.bpel.CopyAction;
+import com.sybase.bpe.definition.IPMDAction;
+
+/**
+ * @author tcampbel
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class BPELCopyValue extends BPELCopy {
+
+ public BPELCopyValue(BPELNode node, BPELAttributes attr)
+ {
+ super(node, attr);
+ }
+
+ protected void buildToVariable(Properties md, IPMDAction ccact, BPELInvocationType fromType) throws DeploymentException {
+ BPELVariable var = getVariable(getToAttributes().getVariable());
+
+ m_hasToQuery = ( getToAttributes().getQuery() != null ) ? true : false;
+
+ BPELInvocationType toType = null;
+
+ if ( !m_hasFromQuery && !m_hasToQuery ) {
+ // This is a variable to variable copy
+ ccact.setActionClass(com.sybase.bpe.action.bpel.CopyContextNodeAction.class.getName());
+ }
+
+ //if ( fromType == BPELInvocationType.SELECT_NODE){
+ // toType = BPELInvocationType.GRAFT_BENEATH_NODE;
+ //} else {
+ if ( getToAttributes().getQuery() != null ) {
+ toType = BPELInvocationType.UPDATE_VALUE;
+ } else {
+ toType = BPELInvocationType.UPDATE_OBJECT;
+ }
+ //}
+ md.put(CopyAction.TO_VARIABLE_KEY,var.createLocator(ccact,this,m_to,getToAttributes(),toType,true));
+
+ }
+
+ protected void buildFromVariable(Properties md, IPMDAction ccact) throws DeploymentException {
+ BPELVariable var = getVariable(getFromAttributes().getVariable());
+
+ m_hasFromQuery = ( getFromAttributes().getQuery() != null ) ? true : false;
+
+ BPELInvocationType fromType = BPELInvocationType.SELECT_VALUE;
+
+ //fromType = BPELInvocationType.SELECT_VALUE;
+
+ if ( getFromAttributes().getQuery() != null ) {
+ //if ( isToSimpleType() ) {
+ fromType = BPELInvocationType.SELECT_VALUE;
+ //}
+ } else {
+ if ( getFromAttributes().getPart() != null ) {
+ if ( var.isPartSimpleType(getFromAttributes().getPart())) {
+ fromType = BPELInvocationType.SELECT_OBJECT;
+ }
+ } else {
+ if ( var.isSimpleType() ) {
+ fromType = BPELInvocationType.SELECT_OBJECT;
+ }
+ }
+ }
+
+ md.put(CopyAction.FROM_VARIABLE_KEY,var.createLocator(ccact,this,m_from,getFromAttributes(),fromType,false));
+
+ buildTo(md,ccact,fromType);
+ }
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELCorrelation.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELCorrelation.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELCorrelation.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELCorrelation.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,79 @@
+/*
+* 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 12, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.StringTokenizer;
+
+/**
+ * Implements the BPEL <i>correlation</i> node. The correlation node holds
+ * the name of a <i>correlationSet</i> node.
+ * <p>
+ * The correlation node is held by a <i>invoke</i>, <i>reply</i>, <i>receive</i>, <i>onMessage</i>.
+ * <p>
+ * A correlation is used to route a message to a specific process instance.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tCorrelation.
+ *
+ * @author waterman
+ * @see BPELInvoke, BPELReply, BPELReceive, BPELOnMessage
+ *
+ */
+class BPELCorrelation {
+
+ private BPELCorrelationSet m_set; // The correlation set defines the correlation key
+ private String m_initiate; // The associated activity will generate the correlation key
+ private String m_pattern;
+
+ /**
+ *
+ */
+ BPELCorrelation(BPELCorrelationSet set, String initiate, String pattern) {
+ m_set = set;
+ m_initiate = initiate;
+ m_pattern = pattern;
+ }
+
+ StringTokenizer getProperties() {
+ return m_set.getProperties();
+ }
+
+ String getName() {
+ return m_set.getName();
+ }
+
+ String getPattern() {
+ return m_pattern;
+ }
+
+ boolean isInitializing() {
+ return BPELBoolean.YES.equals(m_initiate);
+ }
+
+ BPELCorrelationSet getCorrelationSet() {
+ return m_set;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELCorrelationSet.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELCorrelationSet.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELCorrelationSet.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELCorrelationSet.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,75 @@
+/*
+* 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 12, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.StringTokenizer;
+
+
+/**
+ * Implements the BPEL <i>correlationSet</i> node. The correlationSet node holds
+ * the attributes that define a <i>correlationSet</i>.
+ * <p>
+ * The correlationSet node is held by a <i>scope</i>.
+ * <p>
+ * A correlationSet is used to route a message to a specific process instance.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tCorrelationSet.
+ *
+ * @author waterman
+ * @see BPELScope, BPELCorrelation
+ *
+ */
+class BPELCorrelationSet {
+
+ private BPELAttributes m_attributes;
+ private BPELScope m_ownedBy;
+
+ /**
+ * @param previous
+ * @param tag
+ * @param attrs
+ */
+ BPELCorrelationSet(BPELAttributes attrs, BPELScope myScope) {
+ m_attributes = attrs;
+
+ // Create the runtime definition correlation sets
+ m_ownedBy = myScope;
+
+ }
+
+ String getName() {
+ return m_attributes.getName();
+ }
+
+ StringTokenizer getProperties() {
+ return new StringTokenizer(m_attributes.getBPWSProperties());
+ }
+
+ BPELScopePath getScopePath(BPELScopePath path) {
+ return m_ownedBy.getScopePath(path);
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELDefinitionKey.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELDefinitionKey.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELDefinitionKey.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELDefinitionKey.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,66 @@
+/*
+* 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 16, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.io.Serializable;
+
+import com.sybase.bpe.deployment.DefinitionKey;
+
+/**
+ * A unique key that identifies a business process definition within the BPEngine's
+ * runtime metadata repositry. It is returned from the deployment interface.
+ *
+ * @see Deploy
+ *
+ * @author waterman
+ */
+
+public class BPELDefinitionKey implements DefinitionKey, Serializable {
+
+ static final long serialVersionUID = -407791291301454421L;
+
+ private String m_label;
+ private String m_key;
+
+ BPELDefinitionKey(String label, String key) {
+ m_label = label;
+ m_key = key;
+ }
+
+ /**
+ * @return the name of the business process as found in the deployment package
+ */
+ public String getLabel() {
+ return m_label;
+ }
+
+ /**
+ * @return the unique key assigned to the business process definition on deployment into the engine
+ */
+ public String getKey() {
+ return m_key;
+ }
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELDeploy.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELDeploy.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELDeploy.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELDeploy.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,213 @@
+/*
+* 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
+ *
+ * Note: the BPELDeploy is void of any parser specifics it's main job is to unpack the
+ * deployment jar
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Vector;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.sybase.bpe.definition.service.DefinitionService;
+import com.sybase.bpe.deployment.Deploy;
+import com.sybase.bpe.lang.ResourceGetter;
+import com.sybase.bpe.util.BPException;
+
+
+/**
+ * @author waterman
+ *
+ * The BPELDeploy class consumes a jar/zip file, inflates the documents found within,
+ * instantiates a parser and validates the BPEL documents, loads the BPE runtime repository.
+ * <P>
+ * The runtime metadata model is a more generic model than the BPEL model, its
+ * goal is to abstract the business process execution engine from BPEL specfic
+ * definitions ( i.e. invoke, receive, switch ). The runtime metadata model
+ * can be thought of as a compiled instance of BPEL.
+ * <P>
+ * The deploy tooling makes use of a few standard interfaces. Namely, the SAX API and
+ * the WSDL API ( JSR110 ).
+ *
+ */
+public class BPELDeploy implements Deploy {
+
+ private static final int BUFFER = 2048;
+ private static final Logger logger = Logger.getLogger(BPELDeploy.class.getName());
+ private static final Pattern bpelPattern = Pattern.compile(".*\\.bpel");
+
+ private final HashMap bpelDoc = new HashMap();
+ private final HashMap supportDoc = new HashMap();
+ private DefinitionService ds;
+
+ public BPELDeploy(DefinitionService ds) {
+ this.ds = ds;
+ }
+
+
+ /**
+ * Opens the .jar/.zip file located at the input URI location and loads the
+ * documents into the BPE runtime metadata repository. Expects .bpel/.wsdl documents.
+ *
+ * @param fileURI a zip/jar file containing .bpel/.wsdl docs
+ * @param ds the runtime metadata definition service. If null a default definition service is created
+ * @param validating creates a validating parser if set to true
+ * @param schemaPath the path of the validating BPEL XMLSchema - a null value will use the default "BPEL4WS.XSD"
+ * @throws DeploymentException
+ */
+// public void deployJar(String fileURI, DefinitionService ds, boolean validating, String schemaPath) throws DeploymentException {
+//
+// try {
+// FileInputStream fis = new FileInputStream(fileURI);
+// deployJar(fis,ds,validating,schemaPath);
+// } catch (FileNotFoundException fnfe) {
+// throw new DeploymentException(fnfe);
+// }
+// }
+
+ /**
+ * Loads the documents found in the compressed inputstream into the BPE runtime metadata
+ * repository. Expects .bpel/.wsdl documents.
+ *
+ * @param is an inputstream containing .bpel/.wsdl docs
+ * @param ds the runtime metadata definition service. If null a default definition service is created
+ * @param validating creates a validating parser if set to true
+ * @param schemaPath the path of the validating BPEL XMLSchema - a null value will use the default "BPEL4WS.XSD"
+ * @throws DeploymentException
+ */
+ public Collection deployJar(InputStream is, boolean validating, String schemaPath) throws BPException {
+
+ // validating schema
+ String schemaFileName = schemaPath;
+
+ // Source
+ JarInputStream jis = null;
+
+ // Destination
+ BufferedOutputStream dest = null;
+ ByteArrayOutputStream baos = null;
+
+ JarEntry entry = null;
+
+ // if the schema file name has not been specified by the client
+ // use the default schema from the BPEProperties object
+ if ( schemaFileName == null ) schemaFileName = ds.getBPEProperties().getDefinitionSchema();
+
+ try {
+
+ jis = ( is instanceof BufferedInputStream ) ?
+ new JarInputStream(is) :
+ new JarInputStream(new BufferedInputStream(is));
+
+ int count; // buffer counter
+ byte data[] = new byte[BUFFER];
+
+ while((entry = jis.getNextJarEntry()) != null) {
+ logger.log(Level.FINE,ResourceGetter.getFormatted("DEPLOY_EXTRACT", new Object[] {entry.getName()}));
+
+ // Copy data from jar file into byte array
+ baos = new ByteArrayOutputStream();
+ dest = new BufferedOutputStream(baos, BUFFER);
+ while ((count = jis.read(data, 0, BUFFER))!= -1) {
+ dest.write(data, 0, count);
+ }
+ dest.close();
+
+
+ // push document into collection
+ mapDocument(entry.getName(), baos.toByteArray());
+
+ dest = null;
+
+ }
+
+ } catch (IOException e) {
+ DeploymentException bpx = new DeploymentException("NATIVE_EXCEPTION",new Object[] {"IOException"},e);
+ bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ } finally {
+ if ( jis != null ) try {
+ jis.close();
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ if ( dest != null ) try {
+ dest.close();
+ } catch (IOException e2) {
+ e2.printStackTrace();
+ }
+ }
+
+ // Iterate over the BPEL documents found in the jar file and create the appropriate
+ // runtime artifacts.
+ Iterator itr = bpelDoc.keySet().iterator();
+ Vector ret = new Vector();
+ while ( itr.hasNext() ) {
+ String documentName = (String)itr.next();
+ byte[] data = (byte[])bpelDoc.get(documentName);
+ ret.add(BPELParser.parseBPEL(documentName,data,supportDoc,ds,validating,schemaFileName));
+ }
+
+ return ret;
+ }
+
+ /**
+ * Routes documents into the appropriate collections. BPEL documents drive
+ * the deployment and therefore are separated from their supporting WSDL
+ * documents.
+ *
+ * @param key
+ * @param document
+ */
+ private void mapDocument(String key, byte[] document) {
+
+ Matcher m = bpelPattern.matcher(key);
+
+ // put all BPEL documents into the BPEL map
+ // and put all supporting documents into the supporting doc map.
+ if ( m.matches() ) {
+ // we know these are all bpel docs so let's strip off the .bpel
+ // suffix.
+ bpelDoc.put(key.substring(0,key.lastIndexOf(".")).toLowerCase(),document);
+ } else {
+ supportDoc.put(key.toLowerCase(),document);
+ }
+
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELEmpty.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELEmpty.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELEmpty.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELEmpty.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,60 @@
+/*
+* 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.Logger;
+
+
+/**
+ * Implements the BPEL <i>empty</i> node. The empty node is a place holder
+ * to do things like merge.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tEmpty.
+ *
+ * @author waterman
+ *
+ */
+public class BPELEmpty extends BPELLinkedActivity {
+ private static final Logger logger = Logger.getLogger(BPELEmpty.class.getName());
+
+
+ /**
+ * @param previous the parent schema node
+ * @param attrs the schema attributes
+ */
+ public BPELEmpty(BPELNode previous, BPELAttributes attrs)
+ throws DeploymentException {
+ super(previous, BPELSchema.EMPTY, attrs, logger);
+ }
+
+ /**
+ * @see com.sybase.bpe.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+ */
+ String getActivityDescription() {
+ return "The empty activity is used as a merge node or split node within a business process. It is usually associated with 1..n source/target nodes. It does not have an action implementation.";
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELEvent.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELEvent.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELEvent.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,83 @@
+/*
+* 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 12, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.logging.Logger;
+
+
+/**
+ * A base class for BPEL events. Events are held by <i>scopes</i>.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A>
+ *
+ * @author waterman
+ *
+ */
+abstract class BPELEvent extends BPELIOActivity {
+
+ // an event executes a single activity upon receipt of the the event message
+ private BPELLinkedActivity m_activity;
+
+ /**
+ * @param previous the parent schema node
+ * @param tag the schema tag name
+ * @param attrs the schema attributes
+ */
+ BPELEvent(BPELNode previous, BPELSchema tag, BPELAttributes attrs, Logger logger) throws DeploymentException {
+ super(previous, tag, attrs, logger);
+
+ createProcessSequence(attrs, getStartProcess());
+ }
+
+ /**
+ * @see com.sybase.bpe.deployment.bpel.BPELNode#addActivity(com.sybase.bpe.deployment.bpel.BPELNode)
+ */
+ void addActivity(BPELNode activity) throws DeploymentException {
+ m_activity = (BPELLinkedActivity)activity;
+
+ createProcessSequence(activity.getAttributes(),activity.getStartProcess());
+
+ linkProcess(BPELProcessType.START,(BPELLinkedActivity)activity,BPELProcessType.START,true);
+
+ }
+
+ BPELLinkedActivity getActivity() {
+ return m_activity;
+ }
+
+ /**
+ * @see com.sybase.bpe.deployment.bpel.BPELNode#pop()
+ */
+ BPELNode pop() throws DeploymentException {
+
+ // When an event node is closed it is added to the event handler
+ // collection of the enclosing scope. This class assumes the
+ // BPEL instance has passed schema validation.
+ m_parserStack.addEventHandler(this);
+ return m_parserStack;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELExpressionTuple.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELExpressionTuple.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELExpressionTuple.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELExpressionTuple.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,54 @@
+/*
+* 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 25, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+/**
+ *
+ * This is a very simple class that maps BPEL expressions to an expression type.
+ *
+ * @author waterman
+ * @see BPELExpressionType
+ *
+ */
+class BPELExpressionTuple {
+
+ private String m_expression; // A BPEL Expression
+ private BPELExpressionType m_type; // the type of BPEL expression
+
+ BPELExpressionTuple(BPELExpressionType type, String expression) {
+ m_expression = expression;
+ m_type = type;
+ }
+
+ String getExpression() {
+ return m_expression;
+ }
+
+ BPELExpressionType getType() {
+ return m_type;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELExpressionType.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELExpressionType.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELExpressionType.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELExpressionType.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,68 @@
+/*
+* 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 25, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+/**
+ *
+ * By default BPEL uses XPATH notation as its data handling expression language.
+ * To that end BPEL as defined a few data extraction funtions that are specific
+ * to the BPEL namespace. This class enumerates those data extraction functions
+ * that are imbedded with BPEL XPATH notation.
+ *
+ * @author waterman
+ */
+class BPELExpressionType {
+
+ private String m_value;
+ private int m_switch;
+
+ private static final String VARIABLEDATA_VALUE = "getVariableData";
+ private static final int VARIABLEDATA_SWITCH = 1;
+ private static final String VARIABLEPROPERTY_VALUE = "getVariableProperty";
+ private static final int VARIABLEPROPERTY_SWITCH = 2;
+ private static final String LINKSTATUS_VALUE = "getLinkStatus";
+ private static final int LINKSTATUS_SWITCH = 3;
+
+ static final BPELExpressionType VARIABLE_DATA = new BPELExpressionType(VARIABLEDATA_VALUE,VARIABLEDATA_SWITCH);
+ static final BPELExpressionType VARIABLE_PROPERTY = new BPELExpressionType(VARIABLEPROPERTY_VALUE,VARIABLEPROPERTY_SWITCH);
+ static final BPELExpressionType LINK_STATUS = new BPELExpressionType(LINKSTATUS_VALUE,LINKSTATUS_SWITCH);
+
+ private BPELExpressionType() {}
+
+ private BPELExpressionType(String value, int intValue) {
+ m_value = value;
+ m_switch = intValue;
+ }
+
+ String getValue() {
+ return m_value;
+ }
+
+ int getSwitch() {
+ return m_switch;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELExpressionVariable.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELExpressionVariable.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELExpressionVariable.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELExpressionVariable.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,405 @@
+/*
+* 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 25, 2003
+ */
+package com.sybase.bpe.deployment.bpel;
+
+//import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.jaxen.JaxenException;
+import org.jaxen.dom.DOMXPath;
+
+import com.sybase.bpe.action.bpel.XPathJaxenExpression;
+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.lang.ResourceGetter;
+
+/**
+ *
+ * Parses BPEL expression syntax using pattern matching. Generates BPE process context locators
+ * for BPEL expression variables.
+ *
+ * @author waterman
+ */
+class BPELExpressionVariable extends BPELVariable {
+
+ private static final Logger logger = Logger.getLogger(BPELCopy.class.getName());
+
+
+ // The runtime engine has a locator resolver that expects variables
+ // within XPATH notation to adhear to the following format.
+// private static final MessageFormat bpeFormat = new MessageFormat("\\${0}");
+// private Object bpeVar[] = new Object[1];
+ private static final String LOCATOR_NAME = "var";
+
+ //private static final Pattern variableDataPattern = Pattern.compile("getVariableData\\(.*?\\)");
+ //private static final Pattern variablePropertyPattern = Pattern.compile("getVariableProperty\\(.*?\\)");
+ //private static final Pattern linkStatusPattern = Pattern.compile("getLinkStatus\\(.*?\\)");
+
+ 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 String m_bpelExpression; // The native BPEL Expression
+ private String m_bpeExpression; // The natvie BPEL Expression as a BPE runtime expression
+ private int m_varCounter; // Keeps track of the number of variables within a locator
+
+ private HashMap varMap; // A map of BPE variable to the BEPL expression its used in
+
+ BPELExpressionVariable( String bpelExpression ) {
+ super(new BPELAttributes(),logger);
+ m_bpelExpression = bpelExpression;
+
+ }
+
+ /**
+ * Parses out the BPEL params from a BPEL data access function and generates
+ * a BPE locator name for the BPEL params.
+ *
+ * @param p
+ * @param type
+ */
+// private void extentionMatcher(Pattern p, BPELExpressionType type) {
+//
+// Matcher m = p.matcher(m_bpeExpression);
+//
+// StringBuffer buff = new StringBuffer();
+// while ( m.find() ) {
+//
+// bpeVar[0] = LOCATOR_NAME + m_varCounter;
+// m.appendReplacement(buff,bpeFormat.format(bpeVar));
+// String temp = m_bpeExpression.substring(m.start(),m.end());
+//
+// varMap.put(String.valueOf(m_varCounter),new BPELExpressionTuple(type,m_bpeExpression.substring(m.start(),m.end())));
+//
+// m_varCounter++;
+// }
+// m.appendTail(buff);
+//
+// m_bpeExpression = buff.toString();
+// }
+
+ private void parseBpelFunctionCalls()
+ {
+ int openGetVariableData = m_bpeExpression.lastIndexOf("getVariableData(");
+ int openGetVariableProperty = m_bpeExpression.lastIndexOf("getVariableProperty(");
+ int openGetLinkStatus = m_bpeExpression.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 = m_bpeExpression.indexOf(")", open+1);
+ //int nextcall = m_bpeExpression.indexOf("(", open+16);
+ int nextcall = m_bpeExpression.indexOf("(", endOpen);
+ while ((nextcall > -1) && (nextcall < close))
+ {
+ close = m_bpeExpression.indexOf(")", close+1);
+ nextcall= m_bpeExpression.indexOf("(", nextcall+1);
+ }
+ String temp = m_bpeExpression.substring(open,close+1);
+ varMap.put(String.valueOf(m_varCounter),new BPELExpressionTuple(type,
+ temp));
+ m_bpeExpression = m_bpeExpression.substring(0, open) +
+ "$var" + String.valueOf(m_varCounter) +
+ m_bpeExpression.substring(close+1, m_bpeExpression.length());
+
+ m_varCounter++;
+
+ openGetVariableData = m_bpeExpression.lastIndexOf("getVariableData(");
+ openGetVariableProperty = m_bpeExpression.lastIndexOf("getVariableProperty(");
+ openGetLinkStatus = m_bpeExpression.lastIndexOf("getLinkStatus(");
+
+ }
+ }
+
+// private void tomsMatcher(BPELExpressionType type)
+// {
+// String local = m_bpeExpression;
+// String something = "getVariableData('counter')";
+// varMap.put(String.valueOf(m_varCounter),new BPELExpressionTuple(type,something));
+// m_varCounter++;
+// something="getVariableData('operation1Request','newParameter1','/ns1:TibRVMsg/ns1:Fields/ns1:Field[$var1]/ns1:Name')";
+// varMap.put(String.valueOf(m_varCounter),new BPELExpressionTuple(type,something));
+// m_varCounter++;
+//
+// m_bpeExpression = "$var2";
+// }
+
+ /**
+ * Determines how many params have been defined within a BPEL data
+ * access function. Params can be optional for some data access functions.
+ * See BPEL spec on data access for more detail on BPEL data access functions.
+ *
+ * @param expression
+ * @return
+ */
+ 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;
+ }
+
+ /**
+ * Generates a BPE locator for the BPEL getVariableData() function
+ *
+ * @param m
+ * @param expression
+ * @param locatorName
+ * @param node
+ * @param locator
+ * @throws DefinitionServiceException
+ */
+ 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(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
+ 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);
+ } catch (Exception e) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATELOCATOR",new Object[] {node.getProcess().getAttributes().getName(), locatorName,bpePath.toString(),locationPath},e);
+ }
+ }
+
+ /**
+ * Generates a BPE locator for the BPEL getVariableProperty() function
+ *
+ * @param m
+ * @param expression
+ * @param locatorName
+ * @param node
+ * @param locator
+ */
+ private void handleProperty(Matcher m, String expression, String locatorName, BPELNode node, BPELNode tagNode, IPMDLocatorHolder locator, BPELInvocationType type) throws DeploymentException {
+
+ if ( m.groupCount() != 2 ) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_PROPIVALID",new Object[] {node.getProcess().getAttributes().getName(), expression},null);
+ }
+
+ String processName = node.getProcess().getAttributes().getName();
+ String locationPath = null;
+ String variableName = expression.substring(m.start(1),m.end(1));
+
+ BPELVariable var = node.getVariable(variableName);
+
+ StringBuffer bpePath = new StringBuffer(var.getScopePath(new BPELScopePath(node.inCompensationHandler())).toString());
+ bpePath.append(BPELScopePath.PATH_DELIMITER + variableName);
+
+ BPELAttributes attr = node.getPropertyAttributes(node.getQName(expression.substring(m.start(2),m.end(2))),node.getQName(var.getAttributes().getMessageType()));
+
+ IInvocationFactory invFactory = null;
+ if ( attr.getPart() != null ) {
+ bpePath.append(BPELScopePath.PATH_DELIMITER + attr.getPart());
+ invFactory = var.getInvFactory(processName,attr.getPart());
+ } else {
+ invFactory = var.getInvFactory(processName);
+ }
+ locationPath = attr.getQuery();
+
+ addUsedInActivity(node);
+
+ try {
+ IPMDLocator loc = node.createLocator(true,locator,locatorName,
+ bpePath.toString(),
+ getInvocation(locationPath,tagNode,type,invFactory),
+ null, 0, false, false);
+ addUsedInLocator(loc);
+ } catch (DefinitionServiceException e) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATELOCATOR",new Object[] {node.getProcess().getAttributes().getName(), locatorName,bpePath.toString(),locationPath},e);
+ }
+
+ }
+
+ /**
+ *
+ * Generates a BPE locator for the BPEL bpws:getLinkStatus() function
+ *
+ * @param m
+ * @param expression
+ * @param locatorName
+ * @param node
+ * @param locator
+ * @throws DefinitionServiceException
+ */
+ private void handleLinkStatus(Matcher m, String expression, String locatorName, BPELNode node, IPMDLocatorHolder locator) throws DeploymentException {
+ if ( m.groupCount() != 1 ) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_LINKINVALID",new Object[] {node.getProcess().getAttributes().getName(), expression},null);
+ }
+
+ addUsedInActivity(node);
+
+ try {
+ IPMDLocator loc = node.createLocator(true,locator,locatorName,
+ expression.substring(m.start(1),m.end(1)), null, null,
+ 0, false, false);
+ addUsedInLocator(loc);
+ } catch (DefinitionServiceException e) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATELOCATOR",new Object[] {node.getProcess().getAttributes().getName(), locatorName,expression.substring(m.start(1),m.end(1)),"no query specified"},e);
+ }
+
+ }
+
+ /**
+ * @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 {
+
+ m_varCounter = locator.getLocatorSize() + 1;
+ m_bpeExpression = m_bpelExpression;
+ XPathJaxenExpression retVal = null;
+ varMap = new HashMap();
+
+ // parse out the BPEL variable locator expression and add in the BPEngine locator expression
+ //extentionMatcher(variableDataPattern, BPELExpressionType.VARIABLE_DATA);
+ //extentionMatcher(variablePropertyPattern, BPELExpressionType.VARIABLE_PROPERTY);
+ //extentionMatcher(linkStatusPattern, BPELExpressionType.LINK_STATUS);
+ parseBpelFunctionCalls();
+
+ // Use Jaxen to validate the expression
+ try {
+ new DOMXPath(m_bpeExpression);
+ } catch (JaxenException je) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_XPATH_INVALID",new Object[] {node.getProcess().getAttributes().getName(), m_bpelExpression, m_bpeExpression},je);
+ }
+
+ // iterate over the expression variables and build the BPE Locator
+ Matcher m = null;
+ retVal = new XPathJaxenExpression(m_bpeExpression,m_bpelExpression);
+ String locatorName = null;
+ for (Iterator mapItr = varMap.entrySet().iterator(); mapItr.hasNext(); ) {
+ Map.Entry me = (Map.Entry)mapItr.next();
+ BPELExpressionTuple et = (BPELExpressionTuple)me.getValue();
+ m = matchParamPatterns(et.getExpression());
+ locatorName = LOCATOR_NAME+(String)me.getKey();
+ retVal.addVariableMap(locatorName,et.getExpression());
+
+ if ( et.getType() == BPELExpressionType.LINK_STATUS ) {
+ handleLinkStatus(m, et.getExpression(), locatorName, node, locator);
+ }
+
+ if ( et.getType() == BPELExpressionType.VARIABLE_DATA ) {
+ handleData(m, et.getExpression(), locatorName, node, tagNode, locator, type);
+ }
+
+ if ( et.getType() == BPELExpressionType.VARIABLE_PROPERTY ) {
+ handleProperty(m, et.getExpression(), locatorName, node, tagNode, locator, type);
+ }
+
+ }
+ return retVal;
+
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELFlow.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELFlow.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELFlow.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELFlow.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,414 @@
+/*
+* 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.text.MessageFormat;
+import java.util.HashMap;
+import java.util.HashSet;
+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.condition.XPathJoinConditional;
+import com.sybase.bpe.condition.XPathTransitionConditional;
+import com.sybase.bpe.definition.IPMDChangeCondition;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+
+
+/**
+ * Implements the BPEL <i>flow</i> node. The flow construct provides concurrency and synchronization for parallel
+ * activity execution.
+ * <p>
+ * The catch node is held by a <i>scope</i> node.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tFlow.
+ *
+ * @author waterman
+ *
+ */
+class BPELFlow extends BPELStructuredActivity {
+ private static final Logger logger = Logger.getLogger(BPELFlow.class.getName());
+
+ private static final MessageFormat linkStatusFormat = new MessageFormat("getLinkStatus({0})");
+ private static final String OR = " or ";
+ private Object m_linkNameVar[] = new Object[1];
+
+ // These vars are used to create the transition and join conditions
+ protected static final String XPATH_JOIN_COND_CLASS = com.sybase.bpe.condition.XPathJoinConditional.class.getName();
+ private static final String XPATH_TRAN_COND_CLASS = com.sybase.bpe.condition.XPathTransitionConditional.class.getName();
+ protected static final String UNINITVAR_KEY = XPathJoinConditional.UNINITVAR_KEY;
+ protected static final String JOIN_EXPRESSION_KEY = XPathJoinConditional.JOIN_EXPRESSION_KEY;
+ private static final String TRAN_EXPRESSION_KEY = XPathTransitionConditional.TRAN_EXPRESSION_KEY;
+ protected static final String SUPPRESS_KEY = XPathJoinConditional.SUPPRESS_KEY;
+ private static final String DEFAULT_CONDITION = XPathTransitionConditional.DEFAULT_CONDITION;
+
+ private HashMap m_links = new HashMap(); // BPEL links
+ private HashSet m_activities = new HashSet(); // Activities of the flow
+
+ BPELFlow(BPELNode node, BPELAttributes attrs) throws DeploymentException {
+ super(node,BPELSchema.FLOW,attrs, logger);
+ }
+
+ /**
+ * A flow defines links that are used to synchronize concurrent
+ * activites. Adds a new link into the flows link definition
+ * collection.
+ *
+ * @param link
+ */
+ void addLinkTag(BPELLink link) {
+ m_links.put(link.getName(),link);
+ }
+
+ /**
+ * When a Flow is popped from the BPEL stack the flow's
+ * logical links must be physically set within the process
+ * definition object.
+ * <BR>
+ * The BPEL spec does not do a very good job in defining the full behavior
+ * of links. The following questions are not answered by the spec.
+ * <BR>
+ * The spec states that a link can cross a structured activity however
+ * it is not clear whether a structured link must cross an activity boundry.<BR>
+ * For example if a flow contains a sequence and the sequence contains both
+ * the source and target nodes of a flow link. What is the behavior? What
+ * is the flow supposed to do with this.
+ * <P>
+ * Currently the deploy tool will throw an exception if a link does not cross
+ * an activity boundry.
+ *
+ *
+ */
+ BPELNode pop() throws DeploymentException {
+
+
+ // TODO: Lance - cycle detection.
+
+ validateLinks();
+
+ createLinks();
+
+ setConditionals();
+
+ return super.pop();
+ }
+
+ /**
+ * Called by the Repostitory Handler when a Source or Target tag is found
+ * on a Flow activity.
+ *
+ * @param name
+ * @return
+ * @throws DefinitionServiceException
+ */
+ BPELLink setLink(String name, BPELNode node, BPELLinkType linkType, String tCondition) throws DeploymentException {
+ BPELLink ret = null;
+
+ if ( (ret = (BPELLink)m_links.get(name)) == null ) {
+ // This Flow does not own the Link so pass the request to
+ // the parser stack to see if an enclosing Flow owns the link.
+ ret = m_parserStack.setLink(name, node, linkType, tCondition);
+ } else {
+ if ( node instanceof BPELLinkedActivity) {
+ // Notify all objects that the activity is using a link
+ if ( linkType == BPELLinkType.TARGET ) ret.setTarget((BPELLinkedActivity)node); else ret.setSource((BPELLinkedActivity)node);
+ if ( tCondition != null ) ret.setTransitionCondition(tCondition);
+ ((BPELLinkedActivity)node).addLink(ret,linkType);
+ node.notifyLink(ret,this);
+ }
+ }
+
+ return ret;
+ }
+
+ BPELLink notifyLink(BPELLink link, BPELFlow node) throws DeploymentException {
+ if ( this == node ) return link;
+ if ( m_parserStack != null ) return m_parserStack.notifyLink(link, node);
+ return null;
+ }
+
+
+ void addActivity(BPELNode activity) throws DeploymentException {
+ m_activities.add(activity);
+ }
+
+
+ private void createRTLink(BPELLinkedActivity source, BPELLinkedActivity target, BPELProcessType sourceType) throws DeploymentException {
+
+ createProcessSequence(target.getAttributes(),target.getStartProcess());
+
+ // Link the process into the flow
+ source.linkProcess(sourceType,target,BPELProcessType.START,true);
+ }
+
+ private void createMerge(BPELLinkedActivity la) throws DeploymentException {
+
+ createProcessSync(la.getStartProcess(),la.getAttributes().getName(),String.valueOf(la.getLinkCounter(BPELLinkType.TARGET)));
+ // iterate over the set of target links
+
+
+ for ( Iterator itr = la.getLinks(BPELLinkType.TARGET); itr.hasNext(); ) {
+ BPELLink link = (BPELLink)itr.next();
+ link.consumed(true);
+ BPELLinkedActivity proxySource = (BPELLinkedActivity)link.getSource().getProxy(this,link.getSource());
+
+ proxySource.linkProcess(BPELProcessType.END,la,BPELProcessType.START,true);
+ }
+ }
+
+ private void buildTransitionCondition(BPELLinkedActivity la, BPELExpressionVariable joinExp) throws DeploymentException {
+
+ // condLinks is a map of BPEL link name to transitionCondition expression
+ // the map is passed to the conditional implementation as a property.
+ // Each link name in the condLinks map has an out-bound status associated
+ // with it. By default the out-bound status is set to true, if a transitionCondition
+ // is supplied on the source of the link the transitionCondition is evaluated
+ // and this becomes the out-bound status. The out-bound status is placed into the
+ // process context by the conditional impl.
+ // Note: this is all laid out in the BPEL spec under the
+ // <flow> definition.
+
+ HashMap condLinks = new HashMap();
+ IPMDChangeCondition cc=null;
+ try {
+ cc = la.getEndProcess().createChangeCondition(
+ "BPEL transitionCondition", XPATH_TRAN_COND_CLASS);
+ } catch (DefinitionServiceException e) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e);
+ }
+
+ for ( Iterator linkItr = la.getLinks(BPELLinkType.SOURCE); linkItr.hasNext(); ) {
+ BPELLink link = (BPELLink)linkItr.next();
+
+ if ( link.getTransitionCondition() != null ) {
+ // Add the XPATH expression as a property to the conditional impl
+ condLinks.put(link.getName(),link.getTransitionCondition().createLocator(cc,la,link.getSource(),null,BPELInvocationType.SELECT_VALUE,false));
+ } else {
+ // Let the conditional implementation know it should use the
+ // default transitionCondition for this link. The default will
+ // set the outgoing link status to true;
+ condLinks.put(link.getName(),DEFAULT_CONDITION);
+ }
+
+ // The conditional implementation will add the out-bound link status
+ // into the process context, therefore it needs the locators for
+ // the out-bound link status variable.
+ //addLinkStatusSystemVariable(link,cc,la);
+ link.getTransitionCondVar().createLocator(cc,la,null,null,true);
+ link.consumed(true);
+ }
+
+ Properties md = new Properties();
+ md.put(BPELFlow.UNINITVAR_KEY,new UnInitVariableMetaData(BPELSchema.BPEL_URI,BPELSchema.FAULT_UNINIT_VAR));
+ md.put(TRAN_EXPRESSION_KEY,condLinks);
+
+ // If the activity is also a target it may have a joinCondition
+ if ( joinExp != null ) {
+ md.put(JOIN_EXPRESSION_KEY,joinExp.createLocator(cc,la,null,BPELInvocationType.SELECT_VALUE,false));
+ md.put(SUPPRESS_KEY,(BPELBoolean.NO.equals(la.getAttributes().getSuppressJoin())) ? BPELBoolean.NO.getBooleanValue() : la.getSuppressJoinFailure().getBooleanValue());
+ }
+ cc.setMetadata(md);
+ }
+
+
+ private BPELExpressionVariable buildJoinCondition(BPELLinkedActivity la) throws DeploymentException {
+
+ // All activities of a flow that are the target of a link will have
+ // a joinCondition. The joinCondition may be implicit
+ // ( i.e. getLinkStatus('link1') or getLinkStatus('link2') )
+ // If the joinCondition evaluates to false and the suppressJoinFailure
+ // is set to false the engine will throw a bpws:joinFailure.
+ // If suppressJoinFailure is set to true the joinCondition evaluates to
+ // false the engine will not fire the associated action impl and
+ // if the activity is also a source activity all out-bound link status
+ // are set to false.
+ // Note: this is all laid out in the BPEL spec under the
+ // <flow> definition.
+
+
+ String joinCondition = la.getAttributes().getJoinCondition();
+
+ if ( joinCondition == null ) {
+ // create the implicit joinCondition
+ int cntr = 0;
+ StringBuffer buff = new StringBuffer();
+ for (Iterator linkItr = la.getLinks(BPELLinkType.TARGET); linkItr.hasNext(); cntr++ ) {
+ if ( cntr != 0 ) buff.append(OR);
+ m_linkNameVar[0] = "'"+((BPELLink)linkItr.next()).getName()+"'";
+ buff.append(linkStatusFormat.format(m_linkNameVar));
+ }
+ joinCondition = buff.toString();
+ }
+
+ BPELExpressionVariable expVar = new BPELExpressionVariable(joinCondition);
+
+ // Iterate over the change conditions currently found on the process
+ // and change the conditional implementation to the join conditional.
+ // Note: this is ok to do since the BPEL deployment always creates
+ // a new process with the default change condition.
+
+ la.addJoinCondtion(expVar);
+
+ return expVar;
+
+ }
+
+ void addJoinCondtion(BPELVariable var) throws DeploymentException {
+
+ super.addJoinCondtion(var);
+
+// for ( Iterator itr = m_activities.iterator(); itr.hasNext(); ) {
+// ((BPELNode)itr.next()).addJoinCondtion(var);
+// }
+
+ }
+
+ /**
+ * @see com.sybase.bpe.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+ */
+ String getActivityDescription() {
+ return "The flow activity starts logical threads of execution within a business process. It is a container for executing other activities and thus it does not have an action implementation." ;
+ }
+
+ private void validateLinks() throws DeploymentException {
+ // Validate the Links
+ Iterator linksItr = m_links.values().iterator();
+ while ( linksItr.hasNext() ) {
+ BPELLink link = (BPELLink)linksItr.next();
+ if ( link.getSource() == link.getTarget() ) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_LINKREF",new Object[] {getProcess().getAttributes().getName(), link.getName()},null);
+ }
+ if ( link.getSource() == null || link.getTarget() == null ){
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_NULLLINKREF",new Object[] {getProcess().getAttributes().getName(), link.getName()},null);
+ }
+ }
+
+ }
+
+ private void createLinks() throws DeploymentException {
+
+ Vector mergeNodes = new Vector(); // nodes to be merged on flow end
+
+ // iterate over the activities of the flow and link them together
+ Iterator activitiesItr = m_activities.iterator();
+ while ( activitiesItr.hasNext() ) {
+ BPELLinkedActivity la = (BPELLinkedActivity)activitiesItr.next();
+
+ if ( la.getLinkCounter(BPELLinkType.TARGET) == 0 ) {
+ // This activity node is not the target of a BPEL link
+ createRTLink(this,la,BPELProcessType.START);
+
+ // If this is not a source activity then merge on flow end activity
+ if ( la.getLinkCounter(BPELLinkType.SOURCE) == 0 ) {
+ // The activity is not part of a link
+ mergeNodes.add(la);
+ }
+ } else {
+ // the activity is the target of a link
+ if ( la.getLinkCounter(BPELLinkType.TARGET) == 1 ) {
+ // This is a potential sequence target
+ BPELLink tLink = (BPELLink)la.getLinks(BPELLinkType.TARGET).next();
+ tLink.consumed(true);
+ BPELLinkedActivity proxySource = (BPELLinkedActivity)tLink.getSource().getProxy(this,tLink.getSource());
+ createRTLink(proxySource,la, BPELProcessType.END);
+ } else {
+ // This is a merge target
+ createMerge(la);
+ }
+
+ // merge on flow end
+ if ( la.getLinkCounter(BPELLinkType.SOURCE) == 0 ) {
+ mergeNodes.add(la);
+ }
+
+ }
+
+ }
+
+ // iterate over all the nodes that merge on the end of the flow
+ createProcessSync(getEndProcess(),getAttributes().getName(),String.valueOf(mergeNodes.size()));
+ for (Iterator mergeNodeItr = mergeNodes.iterator(); mergeNodeItr.hasNext(); ) {
+ ((BPELLinkedActivity)mergeNodeItr.next()).linkProcess(BPELProcessType.END,this,BPELProcessType.END,false);
+ }
+
+ }
+
+ private void setConditionals() throws DeploymentException {
+
+
+ // once all the linkages between source and target nodes have been
+ // created, iterate over the flow activites once again to set the
+ // transitionConditions and joinConditions
+ HashMap linkMap = new HashMap();
+
+ for (Iterator condItr = m_activities.iterator(); condItr.hasNext();){
+ BPELLinkedActivity condActivity = (BPELLinkedActivity)condItr.next();
+
+ BPELExpressionVariable joinExp = null;
+
+ if (condActivity.getLinkCounter(BPELLinkType.TARGET) > 0) {
+ joinExp = buildJoinCondition(condActivity);
+ if (condActivity.getLinkCounter(BPELLinkType.SOURCE) > 0){
+ for (Iterator iter = condActivity.getLinks(BPELLinkType.SOURCE); iter.hasNext(); )
+ {
+ BPELLink link = (BPELLink)iter.next();
+ linkMap.put(link.getName(), joinExp);
+ }
+ }
+ }
+
+ }
+
+ // after the conditionals have been set iterate over the links and set links
+ // that have not been set. Note - links may be located on
+ // activities that are not owned by the flow ( i.e. a sequence, switch )
+ for (Iterator linkItr = m_links.values().iterator(); linkItr.hasNext(); ) {
+ BPELLink link = (BPELLink)linkItr.next();
+
+
+ // if the link is within a conditional then proxy the link to the
+ // end of the conditional
+ //buildTransitionCondition(link.getSource(),null);
+ BPELExpressionVariable joinExp = (BPELExpressionVariable) linkMap.get(link.getName());
+ buildTransitionCondition(link.getSource(),joinExp);
+
+
+ // Link source to target
+ if ( !link.isConsumed()) {
+ ((BPELLinkedActivity)link.getSource().getProxy(this,link.getSource())).linkProcess(BPELProcessType.END,link.getTarget(),BPELProcessType.START,true);
+ }
+ }
+ }
+
+ BPELNode getProxy(BPELFlow linkOwner, BPELNode source) {
+ if ( linkOwner == this ) return source;
+ if ( m_parserStack != null ) return m_parserStack.getProxy(linkOwner,source);
+ return source;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELFrom.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELFrom.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELFrom.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELFrom.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,76 @@
+/*
+* 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>from</i> node. The from node holds a
+ * attributes that define the from values of a <i>copy</i> node
+ * <p>
+ * The from node is held by a <i>copy</i> node.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tFrom.
+ *
+ * @author waterman
+ * @see BPELCopy
+ *
+ */
+class BPELFrom extends BPELNode {
+ private static final Logger logger = Logger.getLogger(BPELFrom.class.getName());
+
+ private String literalData;
+
+ /**
+ * @param previous the parent schema node
+ * @param attrs the schema attributes
+ */
+ BPELFrom(BPELNode previous, BPELAttributes attrs) {
+ super(previous, BPELSchema.FROM, attrs, logger);
+ }
+
+ /**
+ * @see com.sybase.bpe.deployment.bpel.BPELNode#pop()
+ */
+ BPELNode pop() throws DeploymentException {
+ m_parserStack.addActivity(this);
+ return m_parserStack;
+ }
+
+ /**
+ * @see com.sybase.bpe.deployment.bpel.BPELNode#addData(java.lang.String)
+ */
+ void addData(String data) {
+ // a from node may contain xml literals
+ literalData = data;
+ }
+
+ String getData() {
+ return literalData;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELGraft.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELGraft.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELGraft.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELGraft.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,99 @@
+/*
+* 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 Apr 12, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.Properties;
+
+import com.sybase.bpe.action.bpel.CopyAction;
+import com.sybase.bpe.definition.IPMDAction;
+
+/**
+ * @author tcampbel
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class BPELGraft extends BPELCopy {
+
+ public BPELGraft(BPELNode node, BPELAttributes attr)
+ {
+ super(node, attr);
+ }
+
+ protected void buildToProperty(Properties md, IPMDAction ccact, BPELInvocationType fromType) throws DeploymentException {
+ BPELVariable var = getVariable(getToAttributes().getVariable());
+ BPELAttributes attr = getPropertyAttributes(getQName(getToAttributes().getBPWSProperty()),getQName(var.getAttributes().getMessageType()));
+
+ //m_hasToQuery = ( attr.getQuery() != null ) ? true : false;
+
+ BPELInvocationType toType = BPELInvocationType.GRAFT_BENEATH_NODE;
+
+ //if ( !m_hasFromQuery && !m_hasToQuery ) {
+ // This is a variable to variable copy
+ // ccact.setActionClass(com.sybase.bpe.action.bpel.CopyContextNodeAction.class.getName());
+ //}
+
+ //if ( fromType == BPELInvocationType.SELECT_NODE){
+ // toType = BPELInvocationType.GRAFT_BENEATH_NODE;
+ //} else {
+ // if ( attr.getQuery() != null ) {
+ // toType = BPELInvocationType.UPDATE_VALUE;
+ // } else {
+ // toType = BPELInvocationType.UPDATE_OBJECT;
+ // }
+ //}
+
+ md.put(CopyAction.TO_VARIABLE_KEY,var.createLocator(ccact,this,m_to,attr,toType,true));
+ }
+
+ protected void buildToVariable(Properties md, IPMDAction ccact, BPELInvocationType fromType) throws DeploymentException {
+ BPELVariable var = getVariable(getToAttributes().getVariable());
+
+ //m_hasToQuery = ( getToAttributes().getQuery() != null ) ? true : false;
+
+ BPELInvocationType toType = BPELInvocationType.GRAFT_BENEATH_NODE;
+
+ //if ( !m_hasFromQuery && !m_hasToQuery ) {
+ // This is a variable to variable copy
+ // ccact.setActionClass(com.sybase.bpe.action.bpel.CopyContextNodeAction.class.getName());
+ //}
+
+ //if ( fromType == BPELInvocationType.SELECT_NODE){
+ // toType = BPELInvocationType.GRAFT_BENEATH_NODE;
+ //} else {
+ // if ( getToAttributes().getQuery() != null ) {
+ // toType = BPELInvocationType.UPDATE_VALUE;
+ // } else {
+ // toType = BPELInvocationType.UPDATE_OBJECT;
+ // }
+ //}
+ md.put(CopyAction.TO_VARIABLE_KEY,var.createLocator(ccact,this,m_to,getToAttributes(),toType,true));
+
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELGraftChildren.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELGraftChildren.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELGraftChildren.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELGraftChildren.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,100 @@
+/*
+* 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 Apr 15, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.Properties;
+
+import com.sybase.bpe.action.bpel.CopyAction;
+import com.sybase.bpe.definition.IPMDAction;
+
+/**
+ * @author tcampbel
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class BPELGraftChildren extends BPELCopy
+{
+ public BPELGraftChildren(BPELNode node, BPELAttributes attr)
+ {
+ super(node, attr);
+ }
+
+ protected void buildToProperty(Properties md, IPMDAction ccact, BPELInvocationType fromType) throws DeploymentException {
+ BPELVariable var = getVariable(getToAttributes().getVariable());
+ BPELAttributes attr = getPropertyAttributes(getQName(getToAttributes().getBPWSProperty()),getQName(var.getAttributes().getMessageType()));
+
+ //m_hasToQuery = ( attr.getQuery() != null ) ? true : false;
+
+ BPELInvocationType toType = BPELInvocationType.GRAFT_CHILDREN_BENEATH_NODE;
+
+ //if ( !m_hasFromQuery && !m_hasToQuery ) {
+ // This is a variable to variable copy
+ // ccact.setActionClass(com.sybase.bpe.action.bpel.CopyContextNodeAction.class.getName());
+ //}
+
+ //if ( fromType == BPELInvocationType.SELECT_NODE){
+ // toType = BPELInvocationType.GRAFT_BENEATH_NODE;
+ //} else {
+ // if ( attr.getQuery() != null ) {
+ // toType = BPELInvocationType.UPDATE_VALUE;
+ // } else {
+ // toType = BPELInvocationType.UPDATE_OBJECT;
+ // }
+ //}
+
+ md.put(CopyAction.TO_VARIABLE_KEY,var.createLocator(ccact,this,m_to,attr,toType,true));
+ }
+
+ protected void buildToVariable(Properties md, IPMDAction ccact, BPELInvocationType fromType) throws DeploymentException {
+ BPELVariable var = getVariable(getToAttributes().getVariable());
+
+ //m_hasToQuery = ( getToAttributes().getQuery() != null ) ? true : false;
+
+ BPELInvocationType toType = BPELInvocationType.GRAFT_CHILDREN_BENEATH_NODE;
+
+ //if ( !m_hasFromQuery && !m_hasToQuery ) {
+ // This is a variable to variable copy
+ // ccact.setActionClass(com.sybase.bpe.action.bpel.CopyContextNodeAction.class.getName());
+ //}
+
+ //if ( fromType == BPELInvocationType.SELECT_NODE){
+ // toType = BPELInvocationType.GRAFT_BENEATH_NODE;
+ //} else {
+ // if ( getToAttributes().getQuery() != null ) {
+ // toType = BPELInvocationType.UPDATE_VALUE;
+ // } else {
+ // toType = BPELInvocationType.UPDATE_OBJECT;
+ // }
+ //}
+ md.put(CopyAction.TO_VARIABLE_KEY,var.createLocator(ccact,this,m_to,getToAttributes(),toType,true));
+
+ }
+
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELIOActivity.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELIOActivity.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELIOActivity.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELIOActivity.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,212 @@
+/*
+* 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 16, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.StringTokenizer;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import com.sybase.bpe.correlation.PartQuery;
+import com.sybase.bpe.definition.IPMDAction;
+import com.sybase.bpe.definition.IPMDChangeCondition;
+import com.sybase.bpe.definition.IPMDCorrelation;
+import com.sybase.bpe.definition.IPMDCorrelationSetDef;
+import com.sybase.bpe.definition.IPMDOperation;
+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;
+
+/**
+ * @author waterman
+ *
+ */
+abstract class BPELIOActivity extends BPELLinkedActivity {
+
+ protected Vector m_correlations = new Vector();
+
+ /**
+ * @param previous
+ * @param tag
+ * @param attrs
+ * @throws DeploymentException
+ */
+ public BPELIOActivity(
+ BPELNode previous,
+ BPELSchema tag,
+ BPELAttributes attrs,
+ Logger logger)
+ throws DeploymentException {
+ super(previous, tag, attrs, logger);
+ }
+
+
+ /**
+ * A receive action is identified by its PortType the NameSpace of the PortType
+ * and the operation name.
+ *
+ * @return
+ */
+ BPELStaticKey getStaticKey() throws DeploymentException {
+
+ QName ptName = getQName(getAttributes().getPortType());
+
+ if ( ptName == null ) return null;
+
+ BPELStaticKey bsk = new BPELStaticKey();
+ bsk.setTargetNamespace(ptName.getNamespaceURI());
+ bsk.setPortType(ptName.getLocalPart());
+ bsk.setOperation(getAttributes().getOperation());
+
+ return bsk;
+ }
+
+ /**
+ * @see com.sybase.bpe.deployment.bpel.BPELNode#addCorrelation(com.sybase.bpe.deployment.bpel.BPELCorrelation)
+ */
+ void addCorrelation(BPELCorrelation correlation){
+ m_correlations.add(correlation);
+ }
+
+ // Registers OnMessage
+ protected IPMDOperation getOperation(IPMDAction regAct, IPMDChangeCondition ccB) throws DeploymentException {
+
+ String defID = null;
+
+ defID = getStartProcess().getKey().getValue();
+
+ BPELVariable var = ( getAttributes().getVariable() != null ) ? getVariable(getAttributes().getVariable()) : null;
+
+ return getOperation(regAct,null,var,BPELPatternValue.IN,true,defID);
+
+ }
+
+
+ protected IPMDOperation getOperation(IPMDAction regAct, IPMDAction act, BPELVariable var, BPELPatternValue pattern, boolean isInstantiating, String defID) throws DeploymentException {
+ IPMDCorrelation initCorrelation = null;
+
+ ArrayList pqs = null;
+ IPMDRoot defRoot = getProcess().getDefinitionRoot();
+
+ int varCount = 0;
+ if ( m_correlations.size() > 0 ) {
+
+ if ( var == null ) {
+ BPELUtil.throwNewException(m_logger,Level.SEVERE,"BPEL_CORRVAR", new Object[] {getProcess().getAttributes().getName(), getAttributes().getName() }, null);
+ }
+
+ initCorrelation = defRoot.createCorrelation(getStartProcess().getKey().getValue());
+
+ BPELAttributes pProp = null;
+ for ( Iterator itr = m_correlations.iterator(); itr.hasNext(); ) {
+ BPELCorrelation corr = (BPELCorrelation)itr.next();
+
+ if ( corr.getPattern() == null || pattern.equals(corr.getPattern()) || BPELPatternValue.OUTIN.equals(corr.getPattern())) {
+
+ if (isInstantiating && defID == null && !corr.isInitializing()) {
+ BPELUtil.throwNewException(m_logger,Level.SEVERE,"BPEL_CORR_NONINIT",new Object[] {getProcess().getAttributes().getName()},null);
+ }
+
+ pqs = new ArrayList();
+
+ // BPEL defines correlations as a token list of bpws:properties
+ StringTokenizer st = corr.getProperties();
+ while ( st.hasMoreTokens()) {
+ String prop = st.nextToken();
+ pProp = getPropertyAttributes(getQName(prop),getQName(var.getAttributes().getMessageType()));
+ varCount++;
+
+ String corrLoc = corr.getName()+ ":" + prop;
+ pqs.add(new PartQuery(pProp.getPart(),pProp.getQuery(),corrLoc, buildNsHashMap(pProp.getProperty("NSMAP"))));
+ try {
+ if ( act != null ) {
+ createLocator(true,act,
+ corrLoc,corr.getCorrelationSet().
+ getScopePath(new BPELScopePath(
+ inCompensationHandler())).
+ toString()+BPELScopePath.
+ PATH_DELIMITER+corr.getName()+
+ BPELScopePath.PATH_DELIMITER+prop,
+ null,null,0,corr.isInitializing(),false);
+ }
+ if ( regAct != null ) {
+ createLocator(true,regAct,
+ corrLoc,corr.getCorrelationSet().
+ getScopePath(new BPELScopePath(
+ inCompensationHandler())).toString()+
+ BPELScopePath.PATH_DELIMITER+corr.
+ getName()+BPELScopePath.PATH_DELIMITER+
+ prop,
+ null,null,0,corr.isInitializing(),false);
+ }
+ } catch (DefinitionServiceException e) {
+ BPELUtil.throwNewException(m_logger,Level.SEVERE,"BPEL_CREATELOCATOR",new Object[] {getProcess().getAttributes().getName(), "dynamicVar:"+String.valueOf(varCount),getScopePath(new BPELScopePath(inCompensationHandler())).toString()+BPELScopePath.PATH_DELIMITER+corr.getName()+BPELScopePath.PATH_DELIMITER+prop,"no query specified"},e);
+ }
+ }
+
+ if ( !pqs.isEmpty() ) {
+ IPMDCorrelationSetDef corrlSetDef = defRoot.createCorrelationSet(getStartProcess().getKey().getValue()+":"+corr.getName(),pqs);
+ initCorrelation.addCorrelationSet(corrlSetDef,corr.isInitializing(),pattern.getValue());
+ }
+
+ }
+ }
+ }
+
+ return createOperation(defRoot,getStartProcess().getKey().getValue()+
+ ":"+getAttributes().getOperation(),getStaticKey(),
+ initCorrelation,isInstantiating,defID);
+
+ }
+
+ protected IPMDOperation createOperation(IPMDRoot defRoot, String operationId,
+ IStaticKey key, IPMDCorrelation corrl,boolean instanceCreating, String defId) {
+ return defRoot.createOperation(operationId,key,corrl,instanceCreating,defId);
+ }
+
+ private HashMap buildNsHashMap(String nsMap)
+ {
+ HashMap rtn = new HashMap();
+ if (nsMap != null)
+ {
+ StringTokenizer st = new StringTokenizer(nsMap, "|");
+ while (st.hasMoreTokens())
+ {
+ String prefix = st.nextToken();
+ String ns = st.nextToken();
+ rtn.put(prefix, ns);
+ }
+ }
+ return rtn;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELInvocationType.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELInvocationType.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELInvocationType.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/BPELInvocationType.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,77 @@
+/*
+* 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 Sep 2, 2003
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+/**
+ * @author waterman
+ *
+ */
+public class BPELInvocationType {
+
+ private static final String S_VALUE = "s_value";
+ private static final String S_NODE = "s_node";
+ private static final String S_OBJECT = "s_object";
+ private static final String U_VALUE = "u_value";
+ private static final String U_NODE = "u_node";
+ private static final String U_CHILDREN_NODE = "u_children_node";
+ private static final String U_OBJECT = "u_object";
+ private static final String NONE = "none";
+
+ private String m_value;
+
+
+ private BPELInvocationType() {
+ }
+
+ private BPELInvocationType(String value) {
+ m_value = value;
+ }
+
+ static final BPELInvocationType SELECT_VALUE = new BPELInvocationType(S_VALUE);
+ static final BPELInvocationType SELECT_NODE = new BPELInvocationType(S_NODE);
+ static final BPELInvocationType SELECT_OBJECT = new BPELInvocationType(S_OBJECT);
+ static final BPELInvocationType UPDATE_VALUE = new BPELInvocationType(U_VALUE);
+ static final BPELInvocationType GRAFT_BENEATH_NODE = new BPELInvocationType(U_NODE);
+ static final BPELInvocationType GRAFT_CHILDREN_BENEATH_NODE = new BPELInvocationType(U_CHILDREN_NODE);
+ static final BPELInvocationType UPDATE_OBJECT = new BPELInvocationType(U_OBJECT);
+ public static final BPELInvocationType NO_INVOCATION = new BPELInvocationType(NONE);
+
+ public boolean equals(Object obj)
+ {
+ if ( obj instanceof BPELInvocationType ) {
+ return m_value.equals(((BPELInvocationType)obj).m_value);
+ }
+ if ( obj instanceof String ) {
+ return m_value.equals((String)obj);
+ }
+ return false;
+ }
+
+ public int hashCode()
+ {
+ return m_value.hashCode();
+ }
+}