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 [9/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/t...
Added: incubator/ode/scratch/bpe/pom.xml
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/pom.xml?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/pom.xml (added)
+++ incubator/ode/scratch/bpe/pom.xml Tue Feb 28 08:02:48 2006
@@ -0,0 +1,203 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.sybase.bpe</groupId>
+ <artifactId>bpe</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0</version>
+ <name>BPEL Engine</name>
+ <url>http://www.sybase.com</url>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis</artifactId>
+ <version>1.2-RC2</version>
+ </dependency>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis-wsdl4j</artifactId>
+ <version>1.5.1</version>
+ </dependency>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis-saaj</artifactId>
+ <version>1.2-RC2</version>
+ </dependency>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis-jaxrpc</artifactId>
+ <version>1.2-RC2</version>
+ </dependency>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis-jaxrpc</artifactId>
+ <version>1.2-RC2</version>
+ </dependency>
+ <dependency>
+ <groupId>quartz</groupId>
+ <artifactId>quartz</artifactId>
+ <version>1.4.5</version>
+ </dependency>
+ <dependency>
+ <groupId>xpp3</groupId>
+ <artifactId>xpp3</artifactId>
+ <version>1.1.3.4-RC8</version>
+ </dependency>
+ <dependency>
+ <groupId>xstream</groupId>
+ <artifactId>xstream</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>jaxen</groupId>
+ <artifactId>jaxen</artifactId>
+ <version>1.1-beta-6</version>
+ </dependency>
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <version>2.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ <version>1.0.b2</version>
+ </dependency>
+ <dependency>
+ <groupId>msv</groupId>
+ <artifactId>msv</artifactId>
+ <version>20050913</version>
+ </dependency>
+ <dependency>
+ <groupId>msv</groupId>
+ <artifactId>relaxngDatatype</artifactId>
+ <version>20050913</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xmlbeans</groupId>
+ <artifactId>xbean</artifactId>
+ <version>2.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-discovery</groupId>
+ <artifactId>commons-discovery</artifactId>
+ <version>0.2</version>
+ </dependency>
+
+
+ <!-- The j2ee jars are not in the Maven central repository because of Sun Licensing issues
+ You need to put this into your local repository directly see - http://maven.apache.org/guides/mini/guide-coping-with-sun-jars.html
+ -->
+ <dependency>
+ <groupId>javax.j2ee</groupId>
+ <artifactId>j2ee</artifactId>
+ <version>1.4</version>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <sourceDirectory>src/main</sourceDirectory>
+ <plugins>
+ <plugin>
+ <artifactId>xdoclet-maven-plugin</artifactId>
+ <groupId>org.codehaus.mojo</groupId>
+ <version>1.0-alpha-2</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>xdoclet</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ejbdoclet destdir="${basedir}/src/main/xdoclet"
+ excludedtags="@version,@author" ejbspec="2.0" force="${xdoclet.force}">
+ <fileset dir="${basedir}/src/main/java" includes="**/*Bean.java"
+ excludes="**/BPE_CMPObjectBean.java" />
+ <remoteinterface />
+ <homeinterface />
+ <localinterface />
+ <localhomeinterface />
+ </ejbdoclet>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- the BPE XMLBeans binding -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>xmlbeans-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>xmlbeans</goal>
+ </goals>
+ </execution>
+ </executions>
+ <inherited>true</inherited>
+ <configuration>
+ <schemaDirectory>src/main/xsd</schemaDirectory>
+ <sourceGenerationDirectory>src/main/xmlBean</sourceGenerationDirectory>
+ </configuration>
+ </plugin>
+
+ <!-- the bpel tests -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>BPEL_TESTS_DIR</name>
+ <value>${basedir}/bpelTests</value>
+ </property>
+ <property>
+ <name>java.naming.factory.initial</name>
+ <value>com.sybase.bpe.inmemory.jndi.IMContextFactory</value>
+ </property>
+ <property>
+ <name>java.naming.factory.url</name>
+ <value>com.sybase.bpe.inmemory.jndi</value>
+ </property>
+ </systemProperties>
+ <includes>
+ <include implementation="java.lang.String">**/BPELClientTests.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+
+ <!-- build the bpelTests.jar -->
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>process-test-resources</phase>
+ <configuration>
+ <tasks>
+ <ant dir="${basedir}/bpelTests" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/BlockingAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/BlockingAction.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/BlockingAction.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/BlockingAction.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 Sep 2, 2003
+ *
+ */
+package com.sybase.bpe.action.bpel;
+
+import java.util.Properties;
+
+import com.sybase.bpe.action.internal.ActionException;
+import com.sybase.bpe.action.internal.IInternalAction;
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.engine.IEvaluationContext;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.instance.IPMIProcess;
+
+/**
+ *
+ * A very simple action that causes the process engine to block.
+ *
+ * @author waterman
+ *
+ */
+public class BlockingAction implements IInternalAction {
+
+ /**
+ *
+ */
+ public BlockingAction() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.Action#init(java.util.Properties)
+ */
+ public void init(Properties properties) throws ActionException {
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.Action#execute(com.sybase.bpe.context.resolver.ContextResolver, com.sybase.bpe.engine.IEvaluationContext, com.sybase.bpe.engine.IProcessCallBack, com.sybase.bpe.instance.service.IPMIProcess, com.sybase.bpe.definition.service.IPMDProcess)
+ */
+ public boolean execute(
+ ContextResolver resolver,
+ IEvaluationContext ec,
+ IProcessCallBack pcb,
+ IPMIProcess processInstance,
+ IPMDProcess processDefinition)
+ throws ActionException {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.Action#release()
+ */
+ public void release() {
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/CompensateAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/CompensateAction.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/CompensateAction.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/CompensateAction.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,117 @@
+/*
+* 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.action.bpel;
+
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.internal.ActionException;
+import com.sybase.bpe.action.internal.IInternalAction;
+import com.sybase.bpe.bped.EventDirector;
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.engine.IEvaluationContext;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.instance.IPMIProcess;
+import com.sybase.bpe.scope.service.BPRuntimeException;
+import com.sybase.bpe.scope.service.IFCScopeInstance;
+import com.sybase.bpe.scope.service.IScopeService;
+import com.sybase.bpe.util.BPException;
+
+/**
+ * @author charper
+ *
+ */
+public class CompensateAction implements IInternalAction {
+
+ private static Logger logger =
+ Logger.getLogger(CompensateAction.class.getName());
+
+ private Properties props;
+
+ public static final String COMP_NAME = "compensate";
+
+
+ public CompensateAction() {
+
+ }
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#init(Properties)
+ */
+ public void init(Properties properties) throws ActionException {
+ props = properties;
+ }
+
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#execute(Iterator, Iterator, EventDirector, IPMIProcess)
+ */
+ public boolean execute(
+ ContextResolver resolver,
+ IEvaluationContext ec,
+ IProcessCallBack pcb,
+ IPMIProcess processInstance, IPMDProcess processDefinition)
+ throws BPException {
+
+ if ( logger.isLoggable(Level.FINE)) {
+ Enumeration e = props.elements();
+ StringBuffer sb = new StringBuffer();
+ while (e.hasMoreElements()) {
+ sb.append((String) e.nextElement());
+ sb.append(" ");
+ }
+ logger.fine("Compensate Props:"+sb.toString());
+ }
+
+ try {
+ IScopeService ss = resolver.getScopeService();
+ String compScope = props.getProperty(COMP_NAME);
+ // compensate enclosing scope
+ if ( compScope == null ) {
+ IFCScopeInstance scope = ss.getScope(
+ processInstance.getScopePath());//.getEnclosingScopePath());
+ scope.compensate(processInstance,ec,pcb);
+ // compensate based on a named scope
+ } else {
+ ss.compensate(compScope,processInstance,ec,pcb);
+ }
+ } catch ( BPException bpe ) {
+ if ( bpe.getCause() instanceof BPRuntimeException ){
+ throw (BPRuntimeException)bpe.getCause();
+ }
+ throw bpe;
+ }
+
+ return true;
+
+ }
+
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#release()
+ */
+ public void release() {
+ props = null;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/CopyAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/CopyAction.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/CopyAction.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/CopyAction.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,188 @@
+/*
+* 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.action.bpel;
+
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.internal.ActionException;
+import com.sybase.bpe.action.internal.IInternalAction;
+import com.sybase.bpe.context.resolver.ContextResolvedObject;
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.context.test.SerializationContext;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.engine.IEvaluationContext;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.instance.IPMIProcess;
+import com.sybase.bpe.scope.service.BPRuntimeException;
+import com.sybase.bpe.util.BPException;
+
+/**
+ * @author charper
+ *
+ *This action assing a value to a varaible base on an XPath expression.
+ */
+public class CopyAction implements IInternalAction {
+
+ public static final String FROM_VARIABLE_KEY="from_variable";
+ public static final String TO_VARIABLE_KEY="to_variable";
+ public static final String EXPRESSION_VARIABLE_KEY="expression_variable";
+ public static final String LITERAL_VARIABLE_KEY="literal_variable";
+
+ // The Jaxen resolver throws a runtime exception when an expression
+ // variable can not be resolved. The namespace of the variable
+ // locator language is used to identify a potential runtime exception.
+ // ( i.e. bpws:getVariable("foo","foor") may throw a
+ // bpws:unitializedVariable ) - bpws: requires a uri.
+ public static final String UNINITVAR_KEY="UNITVAR";
+
+ protected static Logger logger =
+ Logger.getLogger(CopyAction.class.getName());
+
+ private XPathJaxenExpression expressionTree;
+ protected String fromVar, toVar;
+ private UnInitVariableMetaData varMetadata;
+ private String literal;
+
+
+ public CopyAction() {
+
+ }
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#init(Properties)
+ */
+ public void init(Properties properties) throws BPException {
+
+ if ( properties.get(EXPRESSION_VARIABLE_KEY) != null ) {
+ expressionTree = (XPathJaxenExpression)(properties.get(EXPRESSION_VARIABLE_KEY));
+ expressionTree.getExpressionTree();
+ }
+
+ varMetadata = (UnInitVariableMetaData)properties.get(UNINITVAR_KEY);
+
+ if ( varMetadata == null ) {
+ throw new ActionException("NULL_PROP",new Object[] {UNINITVAR_KEY,CopyAction.class.getName()},null);
+ }
+
+ literal = properties.getProperty(LITERAL_VARIABLE_KEY);
+ fromVar = properties.getProperty(FROM_VARIABLE_KEY);
+ toVar = properties.getProperty(TO_VARIABLE_KEY);
+ }
+
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#execute(Iterator, Iterator, EventDirector, IPMIProcess)
+ */
+ public boolean execute(
+ ContextResolver resolver,
+ IEvaluationContext ec,
+ IProcessCallBack pcb,
+ IPMIProcess processInstance, IPMDProcess processDefinition)
+ throws BPException {
+
+ try
+ {
+
+ ContextResolvedObject to =
+ (ContextResolvedObject) resolver.resolveForUpdateBPContext(toVar);
+
+ if ( fromVar != null ) {
+ // get the def locator object
+ ContextResolvedObject from =
+ (ContextResolvedObject) resolver.resolveBPContext(fromVar);
+
+ if ( from.getValue() == null ) {
+ throw new BPRuntimeException("uninitializedVariable","BPEL_RT_uninitializedVariable",new Object[] {fromVar});
+ }
+
+ // set the value
+ to.setObject(from.getValue());
+ } else {
+
+ if ( expressionTree != null ) {
+ to.setObject(JaxenUtil.evalString(resolver,expressionTree,varMetadata));
+ } else {
+
+ if ( literal != null ) {
+ to.setObject(literal);
+ }
+ }
+
+ }
+ }
+ catch(Exception e)
+ {
+ logger.log(Level.SEVERE,e.getLocalizedMessage(),e);
+ // The source may be an expression.
+ String sourceStr = "undefined";
+ if (fromVar != null)
+ sourceStr = fromVar;
+ else
+ {
+ if (expressionTree != null)
+ sourceStr = expressionTree.getSourceExpression();
+ }
+ throw new BPException("ASSIGN_ERROR", new Object[] {
+ processDefinition.getRoot().getLabel(),
+ processDefinition.getRoot().getKey().getValue(),
+ processDefinition.getLabel(),
+ sourceStr,
+ toVar}
+ , e);
+ }
+
+
+ // Some debugging code that dumps the
+ // process context.
+ if ( logger.isLoggable(Level.FINE)) {
+ SerializationContext sc = new SerializationContext( System.out );
+
+ resolver.getContextService();
+
+ try
+ {
+ sc.printComment( "Copy Action Context:");
+ sc.serialize( resolver.getContextService() );
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ // End of debugging code.
+ }
+
+ return true;
+
+ }
+
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#release()
+ */
+ public void release() {
+ expressionTree = null;
+ fromVar = null;
+ toVar = null;
+ varMetadata = null;
+ literal = null;
+ }
+
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/CopyContextNodeAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/CopyContextNodeAction.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/CopyContextNodeAction.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/CopyContextNodeAction.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,67 @@
+/*
+* 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.action.bpel;
+
+import com.sybase.bpe.context.INode;
+import com.sybase.bpe.context.resolver.ContextResolvedObject;
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.engine.IEvaluationContext;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.instance.IPMIProcess;
+import com.sybase.bpe.util.BPException;
+
+public class CopyContextNodeAction extends CopyAction
+{
+ public boolean execute(
+ ContextResolver resolver,
+ IEvaluationContext ec,
+ IProcessCallBack pcb,
+ IPMIProcess processInstance,
+ IPMDProcess processDefinition)
+ throws BPException
+ {
+ ContextResolvedObject to =
+ (ContextResolvedObject) resolver.resolveForUpdateBPContext(toVar);
+
+ ContextResolvedObject from =
+ (ContextResolvedObject) resolver.resolveBPContext(fromVar);
+
+ if (from.getValue() == null)
+ {
+ // Need to throw an exception here.
+ throw new BPException("UNINITIALIZED_ASSIGN_ERROR",
+ new Object[] {
+ processDefinition.getRoot().getLabel(),
+ processDefinition.getRoot().getKey().getValue(),
+ processInstance.getDefinition().getLabel(),
+ fromVar,
+ toVar});
+
+ }
+
+ INode sourceNode = from.getContextNode();
+ to.copyContextNode(sourceNode);
+ return true;
+
+ }
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/DeployAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/DeployAction.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/DeployAction.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/DeployAction.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,174 @@
+/*
+* 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 22, 2004
+ * Author waterman
+ *
+ */
+package com.sybase.bpe.action.bpel;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.internal.IInternalAction;
+import com.sybase.bpe.action.param.ActionParamFactory;
+import com.sybase.bpe.action.param.IActionParam;
+import com.sybase.bpe.client.IFormattableValue;
+import com.sybase.bpe.context.resolver.ContextResolvedObject;
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.definition.service.DefinitionService;
+import com.sybase.bpe.deployment.DefinitionKey;
+import com.sybase.bpe.deployment.Deploy;
+import com.sybase.bpe.deployment.bpel.BPELDeploy;
+import com.sybase.bpe.engine.IEvaluationContext;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.engine.ProcessDefinitionKey;
+import com.sybase.bpe.instance.IPMIProcess;
+import com.sybase.bpe.scope.service.BPRuntimeException;
+import com.sybase.bpe.util.BPException;
+import com.sybase.bpe.wsdl.extensions.BPEInput;
+
+/**
+ * @author waterman
+ *
+ */
+public class DeployAction implements IInternalAction {
+ private static final String LOCATION = "location";
+ private static final String FAULT_NAME = "deployFault";
+ private static final String SCHEMA_LOCATION = "schemaLocation";
+ private static final String ISVALIDATING = "validating";
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.external.IExternalAction#init(java.util.Properties)
+ */
+ protected static Logger logger =
+ Logger.getLogger(DeployAction.class.getName());
+
+ private boolean isValidating;
+ private String schemaLocation;
+ private String defaultLocation;
+// private boolean remote = false;
+ private Collection m_inputMap;
+ private String m_inputVar;
+ private HashMap m_input = new HashMap();
+
+ public void init(Properties props) throws BPRuntimeException {
+
+ m_inputMap = (Collection)props.get(ExternalServiceAction.INPUT_MAP_KEY);
+ m_inputVar = props.getProperty(INPUT_LOCATOR);
+
+ Properties extProps = (Properties)props.get(ExternalServiceAction.EXT_ACTION_PROPS);
+ schemaLocation = extProps.getProperty(SCHEMA_LOCATION);
+ isValidating = (extProps.getProperty(ISVALIDATING) == "true" ) ? true : false;
+ defaultLocation = extProps.getProperty(LOCATION);
+
+
+ }
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.external.IExternalAction#execute(java.util.HashMap, java.util.HashMap, com.sybase.bpe.action.bpel.external.IURIResolver)
+ */
+ public boolean execute(ContextResolver resolver, IEvaluationContext ec, IProcessCallBack pcb, IPMIProcess processInstance, IPMDProcess processDefinition) throws BPException {
+
+ buildInput(resolver);
+
+ IFormattableValue locationObj = (IFormattableValue)m_input.get(LOCATION);
+ String location = locationObj.toString();
+ if ( location == null || location.length() == 0 ) {
+ location = defaultLocation;
+ if ( location == null || location.length() == 0 ) {
+ BPRuntimeException rte = new BPRuntimeException(FAULT_NAME,null,null);
+ rte.addPartMessage("message","Input location is null");
+ throw rte;
+ }
+ }
+
+ InputStream bpelStream =
+ Thread.currentThread().getContextClassLoader().getResourceAsStream(location);
+ if ( bpelStream == null ) {
+ try {
+ bpelStream = new FileInputStream(location);
+ } catch (FileNotFoundException e1) {
+ }
+ if ( bpelStream == null ){
+ BPRuntimeException rte = new BPRuntimeException(FAULT_NAME,null,null);
+ rte.addPartMessage("message","BPE Deployer could not open location:" + location);
+ throw rte;
+ }
+ }
+
+ try {
+ Deploy d = new BPELDeploy(ec.getProcessService().getInstanceService().getDefinitionService());
+ Collection keys = d.deployJar(bpelStream,isValidating,schemaLocation);
+ Iterator it = keys.iterator();
+ while ( it.hasNext() ) {
+
+ DefinitionKey defkey = (DefinitionKey)it.next();
+ DefinitionService ds =
+ pcb.getProcessService().getInstanceService().getDefinitionService();
+ ds.loadDefintion(new ProcessDefinitionKey(defkey.getKey()),pcb);
+ }
+ } catch (BPException e) {
+ e.log(logger, Level.SEVERE);
+ BPRuntimeException rte = new BPRuntimeException(FAULT_NAME,null,null);
+ rte.addPartMessage("message",e.getMessage());
+ throw rte;
+ }
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.external.IExternalAction#release()
+ */
+ public void release() {
+ }
+
+ private void buildInput(ContextResolver resolver) throws BPException {
+
+ // get input from process context
+ ContextResolvedObject data = null;
+ BPEInput inputNode = null;
+ IActionParam param = null;
+ String partName = null;
+ for ( Iterator inputItr = m_inputMap.iterator(); inputItr.hasNext(); ) {
+ inputNode = (BPEInput)inputItr.next();
+ partName = (inputNode.getPart() == null ) ? m_inputVar : inputNode.getPart();
+
+ data = (ContextResolvedObject)resolver.resolveBPContext(m_inputVar+":"+partName);
+ if ( data == null ) {
+ // May want to throw an exception here
+ } else {
+ param = ActionParamFactory.createActionParam(data,inputNode.getType());
+ m_input.put(partName,param.getParam());
+ }
+ }
+
+ }
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/EndConditionalFlowAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/EndConditionalFlowAction.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/EndConditionalFlowAction.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/EndConditionalFlowAction.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,95 @@
+/*
+* 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 Jan 4, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package com.sybase.bpe.action.bpel;
+
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Vector;
+
+import com.sybase.bpe.action.internal.IInternalAction;
+import com.sybase.bpe.context.resolver.ContextResolvedObject;
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.engine.IEvaluationContext;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.instance.IPMIProcess;
+import com.sybase.bpe.util.BPException;
+import com.sybase.bpe.util.xpath.XPathBoolean;
+
+/**
+ * @author waterman
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class EndConditionalFlowAction implements IInternalAction {
+
+ public static final String LINKS="links";
+ private Vector links;
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.Action#init(java.util.Properties)
+ */
+ public void init(Properties properties) throws BPException {
+ links = (Vector)properties.get(LINKS);
+
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.Action#execute(com.sybase.bpe.context.resolver.ContextResolver, com.sybase.bpe.engine.IEvaluationContext, com.sybase.bpe.engine.IProcessCallBack, com.sybase.bpe.instance.service.IPMIProcess, com.sybase.bpe.definition.service.IPMDProcess)
+ */
+ public boolean execute(ContextResolver resolver, IEvaluationContext ec,
+ IProcessCallBack pcb, IPMIProcess processInstance,
+ IPMDProcess processDefinition) throws BPException {
+ // Iterate over the transition links and set any unset links to false. These
+ // would be links found in branches of the switch.
+
+ for ( Iterator itr = links.iterator(); itr.hasNext();) {
+ String loc = (String)itr.next();
+ // get the locator object
+ ContextResolvedObject ro =
+ (ContextResolvedObject) resolver.resolveBPContext(loc);
+ if ( ro != null ) {
+ if ( ro.getValue() == null) {
+ ro.setObject(new XPathBoolean(false));
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.Action#release()
+ */
+ public void release() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/EndProcessAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/EndProcessAction.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/EndProcessAction.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/EndProcessAction.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 Aug 15, 2003
+ *
+ */
+package com.sybase.bpe.action.bpel;
+
+import java.util.Properties;
+
+import com.sybase.bpe.action.internal.ActionException;
+import com.sybase.bpe.action.internal.IInternalAction;
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.engine.IEvaluationContext;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.instance.IPMIProcess;
+import com.sybase.bpe.util.BPException;
+
+/**
+ * @author waterman
+ *
+ */
+public class EndProcessAction implements IInternalAction {
+
+ /**
+ *
+ */
+ public EndProcessAction() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.Action#init(java.util.Properties)
+ */
+ public void init(Properties properties) throws ActionException {
+
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.Action#execute(com.sybase.bpe.context.resolver.ContextResolver, com.sybase.bpe.engine.IEvaluationContext, com.sybase.bpe.engine.IProcessCallBack, com.sybase.bpe.instance.service.IPMIProcess, com.sybase.bpe.definition.service.IPMDProcess)
+ */
+ public boolean execute(
+ ContextResolver resolver,
+ IEvaluationContext ec,
+ IProcessCallBack pcb,
+ IPMIProcess processInstance,
+ IPMDProcess processDefinition)
+ throws BPException {
+
+
+ ec.getProcessService().getInstanceService().getInstance(processInstance.getRootKey(),processInstance.getRootKey()).setMarkedForCleanUp(true);
+
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.Action#release()
+ */
+ public void release() {
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/EndScopeAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/EndScopeAction.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/EndScopeAction.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/EndScopeAction.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,121 @@
+/*
+* 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.action.bpel;
+
+//import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.internal.ActionException;
+import com.sybase.bpe.action.internal.IInternalAction;
+import com.sybase.bpe.bped.EventDirector;
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.engine.IEvaluationContext;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.instance.IPMIProcess;
+import com.sybase.bpe.scope.service.IFCScopeInstance;
+import com.sybase.bpe.scope.service.IScopeService;
+import com.sybase.bpe.scope.service.ScopePath;
+import com.sybase.bpe.util.BPException;
+
+/**
+ * @author charper
+ *
+ */
+public class EndScopeAction implements IInternalAction {
+
+ private static Logger logger =
+ Logger.getLogger(EndScopeAction.class.getName());
+
+ public static final String COMP_HANLDER = "compHandler";
+ public static final String LOCATORS = "end_scope_locators";
+
+ private Properties props;
+// private ArrayList registrations;
+
+
+ public EndScopeAction() {
+
+ }
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#init(Properties)
+ */
+ public void init(Properties properties) throws ActionException {
+ props = properties;
+ }
+
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#execute(Iterator, Iterator, EventDirector, IPMIProcess)
+ */
+ public boolean execute(
+ ContextResolver resolver,
+ IEvaluationContext ec,
+ IProcessCallBack pcb,
+ IPMIProcess processInstance, IPMDProcess processDefinition)
+ throws BPException {
+
+
+
+ IScopeService ss = resolver.getScopeService();
+ IFCScopeInstance scope = ss.getScope(processInstance.getScopePath());
+
+ String compHandler = props.getProperty(COMP_HANLDER);
+ // if there is a compensation handler, install it and a snap shot
+ if ( compHandler != null ) {
+ if ( logger.isLoggable(Level.FINE)){
+ logger.fine("Installing compensation handler:"+compHandler);
+ }
+ // set the compenstation handler
+ List locators = (List)props.get(LOCATORS);
+ scope.setCompensationHandler(compHandler,locators,resolver,
+ processInstance.getKey());
+
+ }
+
+ // deactivate completing scope
+ scope.setInactive(processInstance,ec,pcb);
+
+ ScopePath sp = processInstance.getScopePath();
+ if ( logger.isLoggable(Level.FINE)) {
+ logger.fine("Changing scope from " +
+ processInstance.getScopePath() +
+ " to " + sp.getEnclosingScopePath());
+ }
+ processInstance.setScopePath(sp.getEnclosingScopePath());
+
+
+ return true;
+
+ }
+
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#release()
+ */
+ public void release() {
+ props = null;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/EndSequenceAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/EndSequenceAction.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/EndSequenceAction.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/EndSequenceAction.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,95 @@
+/*
+* 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 Jan 4, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package com.sybase.bpe.action.bpel;
+
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Vector;
+
+import com.sybase.bpe.action.internal.IInternalAction;
+import com.sybase.bpe.context.resolver.ContextResolvedObject;
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.engine.IEvaluationContext;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.instance.IPMIProcess;
+import com.sybase.bpe.util.BPException;
+import com.sybase.bpe.util.xpath.XPathBoolean;
+
+/**
+ * @author waterman
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class EndSequenceAction implements IInternalAction {
+
+ public static final String LINKS="links";
+ private Vector links;
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.Action#init(java.util.Properties)
+ */
+ public void init(Properties properties) throws BPException {
+ links = (Vector)properties.get(LINKS);
+
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.Action#execute(com.sybase.bpe.context.resolver.ContextResolver, com.sybase.bpe.engine.IEvaluationContext, com.sybase.bpe.engine.IProcessCallBack, com.sybase.bpe.instance.service.IPMIProcess, com.sybase.bpe.definition.service.IPMDProcess)
+ */
+ public boolean execute(ContextResolver resolver, IEvaluationContext ec,
+ IProcessCallBack pcb, IPMIProcess processInstance,
+ IPMDProcess processDefinition) throws BPException {
+ // Iterate over the transition links and set any unset links to false. These
+ // would be links found in branches of the switch.
+
+ for ( Iterator itr = links.iterator(); itr.hasNext();) {
+ String loc = (String)itr.next();
+ // get the locator object
+ ContextResolvedObject ro =
+ (ContextResolvedObject) resolver.resolveBPContext(loc);
+ if ( ro != null ) {
+ if ( ro.getValue() == null) {
+ ro.setObject(new XPathBoolean(false));
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.Action#release()
+ */
+ public void release() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/ExclusiveChoiceEvaluator.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/ExclusiveChoiceEvaluator.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/ExclusiveChoiceEvaluator.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/ExclusiveChoiceEvaluator.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,62 @@
+/*
+* 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.action.bpel;
+
+import java.util.Properties;
+
+import com.sybase.bpe.action.internal.ActionException;
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.engine.IEvaluationContext;
+import com.sybase.bpe.instance.IPMIProcess;
+import com.sybase.bpe.util.BPException;
+
+/**
+ * @author charper
+ *
+ * The ExclusiveChoiceAction uses an ExlusiveChoiceEvaluator for flow control.
+ */
+public interface ExclusiveChoiceEvaluator {
+
+ /**
+ *
+ * @param eventDirector
+ * @param processInstance the action's associated parent process intance
+ * @param processDefinition the process definition the action is acting apon
+ * @param cs the context service
+ * @param props the action properties
+ * @return the evaluation result
+ */
+ boolean evaluate(ContextResolver resolver,
+ IEvaluationContext ec, IPMIProcess processInstance,
+ IPMDProcess processDefinition)
+ throws BPException;
+
+ /**
+ * Init the evaluator
+ * @param props
+ * @throws ActionException
+ */
+ void init(Properties props) throws BPException;
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/ExternalServiceAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/ExternalServiceAction.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/ExternalServiceAction.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/ExternalServiceAction.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,346 @@
+/*
+* 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: Oct 31, 2003
+ * Project: BPEELocal
+ * Package: com.sybase.bpe.action.bpel
+ * Author: waterman
+ */
+package com.sybase.bpe.action.bpel;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.external.IExternalAction;
+import com.sybase.bpe.action.external.IURIResolver;
+import com.sybase.bpe.action.param.ActionParamFactory;
+import com.sybase.bpe.action.param.IActionParam;
+import com.sybase.bpe.context.IContainer;
+import com.sybase.bpe.context.IContextService;
+import com.sybase.bpe.context.IPart;
+import com.sybase.bpe.context.resolver.ContextResolvedObject;
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.correlation.keys.CorrelationKeysUtil;
+import com.sybase.bpe.definition.IPMDAction;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.definition.IPMDRoot;
+import com.sybase.bpe.definition.service.DefinitionURIResolver;
+import com.sybase.bpe.engine.IEvaluationContext;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.instance.IPMIProcess;
+import com.sybase.bpe.interaction.IInteraction;
+import com.sybase.bpe.scope.service.BPRuntimeException;
+import com.sybase.bpe.util.BPException;
+import com.sybase.bpe.wsdl.extensions.BPEInput;
+import com.sybase.bpe.wsdl.extensions.BPEOutput;
+import com.sybase.bpe.action.external.ActionSystemException;
+import com.sybase.bpe.action.internal.ActionException;
+import com.sybase.bpe.action.internal.IInternalAction;
+import com.sybase.bpe.interaction.spiadapter.SPIAdapterInteraction;
+
+/**
+ *
+ *
+ * @author waterman
+ */
+public class ExternalServiceAction implements IInternalAction {
+
+ private static Logger logger =
+ Logger.getLogger(ExternalServiceAction.class.getName());
+
+ public static final String IMPL_KEY="implementation";
+ public static final String INPUT_MAP_KEY="input_map";
+ public static final String OUTPUT_MAP_KEY="output_map";
+ public static final String NAMESPACE="namespace";
+ public static final String EXT_ACTION_PROPS = "external_action_properties";
+ public static final String OPERATION_KEY ="operation_key";
+ public static final String PARTNER_LINK = "partner_link";
+
+ private IExternalAction action;
+ private IURIResolver m_uriResolver;
+ private String m_inputVar, m_outputVar;
+ private Collection m_inputMap, m_outputMap;
+ private String m_nameSpace;
+ private String m_partnerLink;
+ private ArrayList operations;
+ private String m_operation;
+ private String m_service;
+ private String m_portType;
+ private String m_portTypeNamespace;
+
+
+ /**
+ *
+ */
+ public ExternalServiceAction() {
+ }
+
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#init(java.util.Properties)
+ */
+ public void init(Properties properties) throws BPException {
+
+ operations = (ArrayList) properties.get(RegisterAction.OPERATIONS);
+
+ // get the process definition
+ Object operationKey = properties.get(OPERATION_KEY);
+ IPMDRoot defRoot = null;
+ IPMDAction defAction = (IPMDAction)properties.get(ACTION_DEF_KEY);
+ if ( defAction != null ) {
+ defRoot = defAction.getRoot();
+ if ( operationKey != null && defRoot != null ) {
+ action = defRoot.getExternalAction(operationKey);
+ }
+ }
+ // Capture information that is needed to log
+ Properties props = (Properties)properties.get(EXT_ACTION_PROPS);
+ m_operation = props.getProperty("OperationName");
+ m_service = props.getProperty("ServiceName");
+ m_portType = props.getProperty("PortTypeName");
+ m_portTypeNamespace = props.getProperty("PortTypeNameSpace");
+
+ if ( action == null ) {
+ try {
+ Class instClass = java.lang.Class.forName(properties.getProperty(IMPL_KEY));
+ // try to instantiate the subclass
+ action = (IExternalAction)instClass.newInstance();
+ action.init((Properties)properties.get(EXT_ACTION_PROPS));
+ if ( defRoot != null && operationKey != null ) {
+ defRoot.putExternalAction(operationKey,action);
+ }
+ } catch (ClassNotFoundException e) {
+ ActionException bpx = new ActionException("CLASS_NOT_FOUND",new Object[] {properties.getProperty(IMPL_KEY)});
+ bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ } catch (InstantiationException e) {
+ ActionException bpx = new ActionException("NATIVE_EXCEPTION",new Object[] {"InstantiationException"},e);
+ bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ } catch (IllegalAccessException e) {
+ ActionException bpx = new ActionException("NATIVE_EXCEPTION",new Object[] {"IllegalAccessException"},e);
+ bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ }
+ }
+
+ // The BPEL input/output variable names
+ m_inputVar = properties.getProperty(INPUT_LOCATOR);
+ m_outputVar = properties.getProperty(OUTPUT_LOCATOR);
+
+ // The list of input/output param maps
+ m_inputMap = (Collection)properties.get(INPUT_MAP_KEY);
+ m_outputMap = (Collection)properties.get(OUTPUT_MAP_KEY);
+
+ // The namespace of the external service
+ m_nameSpace = properties.getProperty(NAMESPACE);
+
+ m_partnerLink = properties.getProperty(PARTNER_LINK);
+ }
+
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#execute(com.sybase.bpe.context.resolver.ContextResolver, com.sybase.bpe.engine.IEvaluationContext, com.sybase.bpe.engine.IProcessCallBack, com.sybase.bpe.instance.IPMIProcess, com.sybase.bpe.definition.IPMDProcess)
+ */
+ public boolean execute(
+ ContextResolver resolver,
+ IEvaluationContext ec,
+ IProcessCallBack pcb,
+ IPMIProcess processInstance,
+ IPMDProcess processDefinition)
+ throws BPException {
+
+ //Don't make these member variables. Doing so causes instances of the
+ //same process to step on each other.
+ HashMap input = new HashMap();
+ HashMap output = new HashMap();
+
+ HashMap inputForCorrl = new HashMap();
+
+ if ( m_uriResolver == null ) {
+
+ m_uriResolver = new DefinitionURIResolver(ec.getProcessService().getInstanceService().getDefinitionService().getRootDefinition(processDefinition.getRootKey()));
+
+ }
+
+ // get input from process context
+ ContextResolvedObject data = null;
+ BPEInput inputNode = null;
+ IActionParam param = null;
+ String partName = null;
+ for ( Iterator inputItr = m_inputMap.iterator(); inputItr.hasNext(); ) {
+ inputNode = (BPEInput)inputItr.next();
+ partName = (inputNode.getPart() == null ) ? m_inputVar : inputNode.getPart();
+
+ data = (ContextResolvedObject)resolver.resolveBPContext(m_inputVar+":"+partName);
+ if ( data.getValue() == null )
+ {
+ // The input variable is uninitialized in this case.
+ throw new BPException("UNINITIALIZED_INVOKE_ERROR",
+ new Object[] {
+ processDefinition.getRoot().getLabel(),
+ processDefinition.getRoot().getKey().getValue(),
+ processDefinition.getLabel(),
+ m_operation,
+ m_service,
+ m_portType,
+ m_portTypeNamespace ,
+ m_inputVar+":"+partName});
+
+ } else {
+ param = ActionParamFactory.createActionParam(data,inputNode.getType());
+ input.put(partName,param.getParam());
+ inputForCorrl.put(partName,data.getValue());
+ }
+ }
+
+ // set input correlation keys
+ if (operations != null && CorrelationKeysUtil.hasCorrelationSets(operations))
+ CorrelationKeysUtil.setCorrelationKeys(resolver,inputForCorrl,operations,"out");
+
+ // add the partnerLink out of band data if it exists
+ IContextService cs = resolver.getContextService();
+ IContainer root = cs.getRoot();
+ IContainer procroot = (IContainer)root.findChild(processInstance.getRootKey());
+ IPart partnerLinkPart = (IPart)procroot.findChild(m_partnerLink);
+ if ( partnerLinkPart != null ) {
+ Object obj = partnerLinkPart.getObjectForRead();
+ input.put(ReceiveAction.OOB_DATA,obj);
+ }
+
+
+ try {
+ action.execute(input,output,m_uriResolver);
+ } catch (BPRuntimeException rte) {
+ // Tack the namespace of the external exception
+ rte.setNameSpace(m_nameSpace);
+ // TODO: Lance - add the fault data
+
+ throw rte;
+ } catch (ActionSystemException ase)
+ {
+ //if (logger.isLoggable(Level.WARNING))
+ //{
+ // An error has occurred that is not defined on the invoked service interface.
+ //
+ String variables = "";
+ for ( Iterator inputItr = m_inputMap.iterator(); inputItr.hasNext(); )
+ {
+ inputNode = (BPEInput)inputItr.next();
+ partName = (inputNode.getPart() == null ) ? m_inputVar : inputNode.getPart();
+
+ String varName = m_inputVar+":"+partName;
+ data = (ContextResolvedObject)resolver.resolveBPContext(varName);
+ Object obj = data.getValue();
+ if (obj instanceof SPIAdapterInteraction)
+ {
+ SPIAdapterInteraction spi = (SPIAdapterInteraction) obj;
+ if (spi.getUserValue().supportsGetValueAs(byte[].class))
+ {
+ byte[] ba = (byte[]) spi.getUserValue().getValueAs( byte[].class );
+ String str = new String(ba);
+ if (str.length() > 500)
+ str = str.substring(0, 499);
+ variables += "Variable: " + varName + " Value: " + str + "\n";
+ }
+ else
+ {
+ String str = (String) spi.getUserValue().getValueAs(String.class);
+ variables += "Variable: " + varName + " Value: " + str + "\n";
+ }
+
+ }
+
+ }
+
+ BPException bpe = new BPException( "INVOKE_ERROR",
+ new Object[] {
+ processDefinition.getRoot().getLabel(),
+ processDefinition.getRoot().getKey().getValue(),
+ processDefinition.getLabel(),
+ m_operation,
+ m_service,
+ m_portType,
+ m_portTypeNamespace ,
+ variables});
+
+ logger.severe(bpe.getLocalizedMessage());
+ //}
+
+ // Rethrow the original exception
+ throw ase;
+ }
+
+ HashMap outputForCorrl = new HashMap();
+
+ // push the return data into the context
+ Object ret = null;
+ for ( Iterator outputItr = m_outputMap.iterator(); outputItr.hasNext(); ) {
+ BPEOutput outputNode = (BPEOutput)outputItr.next();
+ partName = (outputNode.getPart() == null ) ? m_outputVar : outputNode.getPart();
+ ret = output.get(partName);
+
+ if ( ret != null ) {
+ ContextResolvedObject to = (ContextResolvedObject)
+ resolver.resolveBPContext(m_outputVar+":"+partName);
+
+
+ IInteraction interaction = null;
+ if ( ret instanceof IInteraction )
+ {
+ // Use the interaction object returned
+ // from the external service.
+ interaction = ( IInteraction )( ret );
+ }
+ else
+ {
+ // Create an interaction object to contain the output value.
+ interaction = to.getInteractionFactory().createInteraction();
+ param = ActionParamFactory.createActionParam(null,outputNode.getType());
+ param.setParam(ret,interaction);
+ }
+
+ to.setObject(interaction);
+ outputForCorrl.put(partName,interaction);
+ }
+ }
+
+ // set output correlation keys
+ if (operations != null && CorrelationKeysUtil.hasCorrelationSets(operations))
+ CorrelationKeysUtil.setCorrelationKeys(resolver,outputForCorrl,operations,"in");
+
+ return true;
+ }
+
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#release()
+ */
+ public void release() {
+ action.release();
+ }
+
+
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/JaxenUtil.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/JaxenUtil.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/JaxenUtil.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/JaxenUtil.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,176 @@
+/*
+* 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.action.bpel;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.jaxen.JaxenException;
+import org.jaxen.UnresolvableException;
+import org.jaxen.dom.DOMXPath;
+
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.context.resolver.ResolverVariableContext;
+import com.sybase.bpe.scope.service.BPRuntimeException;
+import com.sybase.bpe.util.BPException;
+import com.sybase.bpe.deployment.bpel.BPELSchema;
+
+/**
+ * @author charper
+ * Utility class to evaluat xpath expressions while grabing stuff from the context service
+ * using "bpe:getContextData(locator)".
+ */
+public class JaxenUtil {
+
+ private static Logger logger =
+ Logger.getLogger(JaxenUtil.class.getName());
+
+
+ /**
+ * Evaluate to a boolean.
+ * @param resolver the resolver
+ * @param expression the expression to evaluate
+ * @return boolean evaluation
+ * @throws ResolverException
+ */
+ public static boolean evalBool(ContextResolver resolver, XPathJaxenExpression expression, UnInitVariableMetaData varException) throws
+ BPException {
+
+ ResolverVariableContext rvc = new ResolverVariableContext(resolver);
+ expression.getExpressionTree().setVariableContext(rvc);
+ try {
+ boolean ret = expression.getExpressionTree().booleanValueOf(null);
+ expression.getExpressionTree().setVariableContext(null);
+ return ret;
+ } catch (UnresolvableException e) {
+ String[] msg = e.getMessage().split(":");
+ BPException bpe = null;
+ if ( msg[0].equals(ResolverVariableContext.NULLVALUE_EXCEPTION)) {
+ String varLookup = null;
+ UnInitVariableMetaData varData = ( varException == null ) ? new UnInitVariableMetaData() : varException;
+ if ( msg.length > 1 ) {
+ varLookup = expression.getVariableExpression(msg[1]);
+ }
+ bpe = new BPRuntimeException(varData.getExceptionName(),"RT_XPATH",new Object[] {varLookup,expression.getSourceExpression()},e);
+ ((BPRuntimeException)bpe).setNameSpace(varData.getNameSpace());
+ } else {
+ bpe = new BPException("NATIVE_EXCEPTION",new Object[] {"JaxenException"},e);
+ }
+
+ bpe.log(logger,Level.SEVERE);
+ throw bpe;
+ } catch (JaxenException e) {
+ BPException bpx = new BPException("NATIVE_EXCEPTION",new Object[] {"JaxenException"},e);
+ bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ }
+
+ }
+
+ /**
+ * Evaluates to a String
+ * @param resolver the resolver
+ * @param expression the expression to evaluate
+ * @return the String evaluation
+ * @throws ResolverException
+ */
+ public static String evalString(ContextResolver resolver, XPathJaxenExpression expression, UnInitVariableMetaData varException) throws
+ BPException{
+ ResolverVariableContext rvc = new ResolverVariableContext(resolver);
+ expression.getExpressionTree().setVariableContext(rvc);
+ try {
+ String ret = expression.getExpressionTree().stringValueOf(null);
+ expression.getExpressionTree().setVariableContext(null);
+ return ret;
+ } catch (UnresolvableException e) {
+ String[] msg = e.getMessage().split(":");
+ BPException bpe = null;
+ if ( msg[0].equals(BPELSchema.FAULT_UNINIT_VAR)) {
+ String varLookup = null;
+ UnInitVariableMetaData varData = ( varException == null ) ? new UnInitVariableMetaData() : varException;
+ if ( msg.length > 1 ) {
+ varLookup = expression.getVariableExpression(msg[1]);
+ }
+ bpe = new BPRuntimeException(varData.getExceptionName(),"RT_XPATH",new Object[] {varLookup,expression.getSourceExpression()},e);
+ ((BPRuntimeException)bpe).setNameSpace(varData.getNameSpace());
+ } else {
+ bpe = new BPException("NATIVE_EXCEPTION",new Object[] {"JaxenException"},e);
+ }
+
+ throw bpe;
+ } catch (JaxenException e) {
+ BPException bpx = new BPException("NATIVE_EXCEPTION",new Object[] {"JaxenException"},e);
+ throw bpx;
+ }
+ }
+
+ /**
+ * Evaluates to a number (double)
+ * @param resolver the resolver
+ * @param expression the expression to evaluate
+ * @return the double evlauation
+ * @throws ResolverException
+ */
+ public static double evalNum(ContextResolver resolver, XPathJaxenExpression expression, UnInitVariableMetaData varException) throws
+ BPException{
+ ResolverVariableContext rvc = new ResolverVariableContext(resolver);
+ expression.getExpressionTree().setVariableContext(rvc);
+ try {
+ double ret = expression.getExpressionTree().numberValueOf(null).doubleValue();
+ expression.getExpressionTree().setVariableContext(rvc);
+ return ret;
+ } catch (UnresolvableException e) {
+ String[] msg = e.getMessage().split(":");
+ BPException bpe = null;
+ if ( msg[0].equals(BPELSchema.FAULT_UNINIT_VAR)) {
+ String varLookup = null;
+ UnInitVariableMetaData varData = ( varException == null ) ? new UnInitVariableMetaData() : varException;
+ if ( msg.length > 1 ) {
+ varLookup = expression.getVariableExpression(msg[1]);
+ }
+ bpe = new BPRuntimeException(varData.getExceptionName(),"RT_XPATH",new Object[] {varLookup,expression.getSourceExpression()},e);
+ ((BPRuntimeException)bpe).setNameSpace(varData.getNameSpace());
+ } else {
+ bpe = new BPException("NATIVE_EXCEPTION",new Object[] {"JaxenException"},e);
+ }
+
+ bpe.log(logger,Level.SEVERE);
+ throw bpe;
+ } catch (JaxenException e) {
+ BPException bpx = new BPException("NATIVE_EXCEPTION",new Object[] {"JaxenException"},e);
+ bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ }
+ }
+
+
+ public static void main ( String args[] ){
+ try {
+ DOMXPath dxp1 = new DOMXPath(args[0]);
+ System.out.println("Result:"+dxp1.stringValueOf(null));
+ } catch ( JaxenException je ) {
+ logger.log(Level.SEVERE,"",je);
+ }
+
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/MergeAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/MergeAction.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/MergeAction.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/MergeAction.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,160 @@
+/*
+* 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.action.bpel;
+
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.internal.ActionException;
+import com.sybase.bpe.action.internal.IInternalAction;
+import com.sybase.bpe.bped.IInternalEventDirector;
+import com.sybase.bpe.context.resolver.ContextResolvedObject;
+import com.sybase.bpe.context.resolver.ContextResolver;
+//import com.sybase.bpe.definition.service.DefinitionService;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.engine.IEvaluationContext;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.engine.ProcessInstance;
+import com.sybase.bpe.engine.StateEnum;
+import com.sybase.bpe.event.StateEvent;
+import com.sybase.bpe.instance.IPMIProcess;
+import com.sybase.bpe.util.BPException;
+
+/**
+ * @author waterman
+ *
+ * Implements the Sequence Pattern [REQ BP-PAT-1.3]
+ *
+ * To implement this action add this to the precondition of the merge to process.
+ * The needed properties are SyncThreadCount and WithNewThread. A locator is
+ * needed for the thread counter. If the WithNewThread is not specified then a new
+ * thread is not spawned when the merge happens. A locator is with the name
+ * SyncThreadCounterLocator is required.
+ *
+ */
+public class MergeAction implements IInternalAction {
+
+ private static Logger logger =
+ Logger.getLogger(MergeAction.class.getName());
+
+ public static final String LOCATOR="SyncThreadCounterLocator";
+ public static final String THREAD_COUNT_KEY="SyncThreadCount";
+
+
+ private Properties props;
+
+ public MergeAction() {
+
+ }
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#init(Properties)
+ */
+ public void init(Properties properties) throws ActionException {
+ props = properties;
+ }
+
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#execute(Iterator, Iterator, EventDirector, IPMIProcess)
+ */
+ public boolean execute(ContextResolver resolver,
+ IEvaluationContext ec,
+ IProcessCallBack pcb,
+ IPMIProcess processInstance, IPMDProcess processDefinition)
+ throws BPException {
+
+ if ( logger.isLoggable(Level.FINE)) {
+ Enumeration e = props.elements();
+ StringBuffer sb = new StringBuffer();
+ while (e.hasMoreElements()) {
+ sb.append((String) e.nextElement());
+ sb.append(" ");
+ }
+ logger.fine("Merge Props:" + sb.toString());
+ }
+
+
+
+ // get the locator object
+ ContextResolvedObject ro =
+ (ContextResolvedObject) resolver.resolveBPContext(LOCATOR);
+ // initialize or increment the thread count
+ int threadCount = 1;
+ if ( ro.getValue()==null ) {
+ ro.setObject(new Integer(threadCount));
+ } else {
+ threadCount = ((Integer)ro.getValue()).intValue();
+ threadCount++;
+ ro.setObject(new Integer(threadCount));
+ }
+
+
+ if ( logger.isLoggable(Level.FINE)){
+ logger.fine("Threads counted: "+threadCount+" Num to sync: "+props.getProperty("SyncThreadCount"));
+ }
+
+ int syncCount =
+ Integer.valueOf(props.getProperty(THREAD_COUNT_KEY)).intValue();
+ if ( syncCount == threadCount ) {
+
+ // get the definition service
+// DefinitionService ds =
+// ec.getProcessService().
+// getInstanceService().getDefinitionService();
+
+ // From the processDefinition create a new process instance
+ // Note: a parent process instance creates a child process instance
+ ProcessInstance pi = ec.getProcessService().createSubProcess(
+ processInstance,processDefinition);
+
+ if ( props.getProperty("WithNewThread") != null ) {
+ // Send a Start event to the process instance via an
+ // asyncronous call to the event director, the event director
+ // is responsible for creating a new thread
+ ((IInternalEventDirector)pcb).sendEvent(
+ new StateEvent(pi.getRootKey(),pi.getKey(), StateEnum.STARTED),false);
+ } else {
+ // Send a Start event to the process instance
+ //pi.processEvent(
+ // new StateEvent(pi.getRootKey(),pi.getKey(), StateEnum.STARTED),
+ // ec, pcb);
+ ec.addProcessInstance(pi);
+ }
+
+ //Clear the merge count
+ ro.setObject(new Integer(0));
+ }
+
+
+ return true;
+
+ }
+
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#release()
+ */
+ public void release() {
+ props = null;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/PickAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/PickAction.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/PickAction.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/PickAction.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,136 @@
+/*
+* 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 22, 2003
+ *
+ */
+package com.sybase.bpe.action.bpel;
+
+import java.util.Map;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.internal.ActionException;
+import com.sybase.bpe.action.internal.IInternalAction;
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.definition.service.DefinitionService;
+import com.sybase.bpe.engine.IEvaluationContext;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.engine.ProcessDefinitionKey;
+import com.sybase.bpe.engine.ProcessInstance;
+//import com.sybase.bpe.event.BPELStaticKey;
+import com.sybase.bpe.event.IRequestMessageEvent;
+import com.sybase.bpe.event.IStaticKey;
+import com.sybase.bpe.instance.IPMIProcess;
+import com.sybase.bpe.util.BPException;
+
+/**
+ * @author waterman
+ *
+ * Used by a BPEL instantiating Pick.
+ */
+public class PickAction implements IInternalAction {
+
+ private static Logger logger = Logger.getLogger(PickAction.class.getName());
+
+ private Properties m_staticKeys;
+
+ /**
+ *
+ */
+ public PickAction() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.Action#init(java.util.Properties)
+ */
+ public void init(Properties properties) throws ActionException {
+ m_staticKeys = properties;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.Action#execute(com.sybase.bpe.context.resolver.ContextResolver, com.sybase.bpe.engine.IEvaluationContext, com.sybase.bpe.engine.IProcessCallBack, com.sybase.bpe.instance.service.IPMIProcess, com.sybase.bpe.definition.service.IPMDProcess)
+ */
+ public boolean execute(
+ ContextResolver resolver,
+ IEvaluationContext ec,
+ IProcessCallBack pcb,
+ IPMIProcess processInstance,
+ IPMDProcess processDefinition)
+ throws BPException {
+
+ // route the message to the appropriate receive port
+ IRequestMessageEvent me = pcb.getMessageEvent();
+ if (me == null) {
+ ActionException bpx = new ActionException("ACT_NO_ME",null);
+ bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ }
+
+ IStaticKey key;
+ key = me.getStaticKey();
+
+ for ( Iterator itr = m_staticKeys.entrySet().iterator(); itr.hasNext(); ) {
+ Map.Entry ke = (Map.Entry)itr.next();
+// BPELStaticKey mp = (BPELStaticKey)ke.getValue();
+ if ( ke.getValue().equals(key) ) {
+
+ // get the definition service
+ DefinitionService ds =
+ ec.getProcessService().
+ getInstanceService().getDefinitionService();
+
+ //IPMDProcess startProcDef = null;
+ IPMDProcess startProcDef = ds.getProcessDefintion(
+ new ProcessDefinitionKey((String)ke.getKey()),
+ processDefinition.getRootKey());
+
+ // From the processDefinition create a new process instance
+ // Note: a parent process instance creates a child process instance
+ ProcessInstance pi = ec.getProcessService().createSubProcess(
+ processInstance,startProcDef);
+
+ // Send a Start event to the process instance
+ //pi.processEvent(
+ // new StateEvent(pi.getRootKey(),pi.getKey(), StateEnum.STARTED),
+ // ec, pcb);
+ ec.addProcessInstance(pi);
+ break;
+
+ }
+ }
+
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.action.bpel.Action#release()
+ */
+ public void release() {
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/ReceiveAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/ReceiveAction.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/ReceiveAction.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/action/bpel/ReceiveAction.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,166 @@
+/*
+* 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.action.bpel;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.internal.ActionException;
+import com.sybase.bpe.action.internal.IInternalAction;
+import com.sybase.bpe.bped.EventDirector;
+import com.sybase.bpe.context.IContainer;
+import com.sybase.bpe.context.IContextService;
+import com.sybase.bpe.context.IPart;
+import com.sybase.bpe.context.resolver.ContextResolvedObject;
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.correlation.keys.CorrelationKeysUtil;
+import com.sybase.bpe.definition.IPMDLocator;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.engine.IEvaluationContext;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.event.IRequestMessageEvent;
+import com.sybase.bpe.instance.IPMIProcess;
+import com.sybase.bpe.interaction.IInteraction;
+import com.sybase.bpe.lang.ResourceGetter;
+import com.sybase.bpe.scope.service.IFCScopeInstance;
+import com.sybase.bpe.scope.service.IScopeService;
+import com.sybase.bpe.util.BPException;
+
+/**
+ * @author charper
+ *
+ *
+ *
+ */
+public class ReceiveAction implements IInternalAction {
+
+ private static Logger logger =
+ Logger.getLogger(ReceiveAction.class.getName());
+
+ public static final String PARTNER_LINK = "partner_link";
+ public static final String OOB_DATA = "<OOB";
+
+ private Properties props;
+ private ArrayList operations;
+ private String partnerLink;
+
+
+ public ReceiveAction() {
+
+ }
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#init(Properties)
+ */
+ public void init(Properties properties) throws ActionException {
+ props = properties;
+
+ operations = (ArrayList) props.get(RegisterAction.OPERATIONS);
+ partnerLink = props.getProperty(PARTNER_LINK);
+ }
+
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#execute(Iterator, Iterator, EventDirector, IPMIProcess)
+ */
+ public boolean execute(
+ ContextResolver resolver,
+ IEvaluationContext ec,
+ IProcessCallBack pcb,
+ IPMIProcess processInstance,
+ IPMDProcess processDefinition)
+ throws BPException {
+
+ IRequestMessageEvent me = pcb.getMessageEvent();
+ if (me == null) {
+ ActionException bpx = new ActionException("ACT_NO_ME",null);
+ bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ }
+
+ // look for the special out of band data
+ Object obj = me.getPart(OOB_DATA);
+ if ( obj != null ) {
+ IContextService cs = resolver.getContextService();
+ IContainer root = cs.getRoot();
+ IContainer procroot = (IContainer)root.findChild(processInstance.getRootKey());
+ IPart partnerLinkPart = (IPart)procroot.findChild(partnerLink);
+ if ( partnerLinkPart == null ){
+ partnerLinkPart = procroot.createPart(partnerLink);
+ }
+ partnerLinkPart.setObject(obj);
+ }
+
+
+
+ Iterator it = resolver.getLocatorHolder().getLocators();
+ while (it.hasNext()) {
+ IPMDLocator loc = (IPMDLocator) it.next();
+ String name = loc.getName();
+ String[] name_split = name.split(":");
+
+ if (name_split.length > 1) {
+
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine(
+ "Adding message part:"
+ + name_split[1]
+ + " to "
+ + loc.getPath());
+ }
+
+
+ ContextResolvedObject ro =
+ (ContextResolvedObject) resolver.resolveBPContext(name);
+ IInteraction part = me.getPart(name_split[1]);
+ if (part == null && !( name_split[1].compareTo("tns") == 0 )) {
+ logger.warning(
+ ResourceGetter.getFormatted(
+ "ACT_NO_ME_PART",
+ new Object[] { name_split[1] }));
+ }
+ ro.setObject(part);
+ }
+ }
+
+ if (operations != null)
+ CorrelationKeysUtil.setCorrelationKeys(resolver, pcb.getMessageEvent().getParts(), operations,null);
+
+ // scpecial onAlarm case where an onAlarm at the root
+ // scope uses data from the incoming message
+ IScopeService ss = resolver.getScopeService();
+ IFCScopeInstance scope = ss.getScope(processInstance.getScopePath());
+ scope.executeTimerAction(ec, pcb,processInstance, processDefinition);
+
+
+ return true;
+ }
+
+ /**
+ * @see com.sybase.bpe.action.bpel.internal.IInternalAction#release()
+ */
+ public void release() {
+ props = null;
+ }
+
+}