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 [29/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/ExtensibilityArtifacts.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/ExtensibilityArtifacts.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/ExtensibilityArtifacts.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/ExtensibilityArtifacts.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,878 @@
+/*
+* 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 9, 2004
+ * Author waterman
+ *
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Import;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.PortType;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+
+import org.apache.xmlbeans.SchemaLocalAttribute;
+import org.apache.xmlbeans.SchemaProperty;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlException;
+import org.xml.sax.InputSource;
+
+
+import com.sybase.bpe.binding.bpe.BPEBindingDocument;
+import com.sybase.bpe.binding.bpe.TActivityBinding;
+import com.sybase.bpe.binding.bpe.TActivityBindings;
+import com.sybase.bpe.binding.bpe.TBinding;
+import com.sybase.bpe.binding.bpe.TOperation;
+import com.sybase.bpe.binding.bpe.TSchema;
+import com.sybase.bpe.wsdl.extensions.BPEAction;
+import com.sybase.bpe.wsdl.extensions.BPEActionSerializer;
+import com.sybase.bpe.wsdl.extensions.BPEFault;
+import com.sybase.bpe.wsdl.extensions.BPEFaultSerializer;
+import com.sybase.bpe.wsdl.extensions.BPEInput;
+import com.sybase.bpe.wsdl.extensions.BPEInputSerializer;
+import com.sybase.bpe.wsdl.extensions.BPELProperty;
+import com.sybase.bpe.wsdl.extensions.BPELPropertyAlias;
+import com.sybase.bpe.wsdl.extensions.BPELPropertyAliasSerializer;
+import com.sybase.bpe.wsdl.extensions.BPELPropertySerializer;
+import com.sybase.bpe.wsdl.extensions.BPEOutput;
+import com.sybase.bpe.wsdl.extensions.BPEOutputSerializer;
+import com.sybase.bpe.wsdl.extensions.BPEVariableMap;
+import com.sybase.bpe.wsdl.extensions.BPEVariableMapSerializer;
+import com.sybase.bpe.wsdl.extensions.ExtentionConstants;
+
+/**
+ * @author waterman
+ *
+ * This object holds artifacts/documents ( i.e. WSDL, XML, XSLT ) that support the
+ * BPEL process definition. It also provides helper functions to navigate and search
+ * for objects within the extensibility artifacts.
+ *
+ */
+public class ExtensibilityArtifacts {
+
+ private static final Logger logger = Logger.getLogger(ExtensibilityArtifacts.class.getName());
+
+ private static final Pattern wsdlPattern = Pattern.compile(".*\\.wsdl");
+
+
+ // If BPE bindings are not found in extensibility artifacts then these defaults
+ // will be used:
+ // The perferred data type for BPEL variables and for params passed across
+ // an IExternalAction interface.
+ private static final String DEFAULT_TYPE = "";
+ // A default implementation of IExternalAction;
+ private static final String DEFAULT_IMPL = "com.sybase.bpe.action.bpel.external.WSIFAction";
+
+ // The process holds namespace prefixes used in the BPEL document.
+ private BPELProcess process;
+
+ // The WSDL document that defines the interface for the BPEL process
+ private Definition rootDef;
+
+ // A normalized list of imported WSDL documents
+ private List wsdlDefs;
+
+ // A normalized list of non-wsdl documents to be added into the BPE runtime
+ // metadata repository ( i.e. XSLT documents )
+ private HashMap repos = new HashMap();
+
+ // The BPE binding document.
+ private TSchema bpeBinding;
+ private HashMap activityBindingMap;
+
+
+ public ExtensibilityArtifacts( String bpelDocName, HashMap artifacts ) throws DeploymentException {
+ rootDef = getRootWSDL(bpelDocName, artifacts);
+ bpeBinding = getBPEBindings(bpelDocName, artifacts);
+
+ Pattern bindingPattern = Pattern.compile(bpelDocName+".xml");
+
+
+ wsdlDefs = BPELUtil.getDefinitionList(rootDef,new ArrayList());
+
+ // iterate over supporting docs and add to repos
+ for ( Iterator itr = artifacts.entrySet().iterator(); itr.hasNext(); ) {
+ Map.Entry me = (Map.Entry)itr.next();
+
+ Matcher m1 = wsdlPattern.matcher((String)me.getKey());
+ Matcher m2 = bindingPattern.matcher((String)me.getKey());
+
+ if ( !m1.matches() && !m2.matches() ) {
+ repos.put((String)me.getKey(),new String((byte[])me.getValue()));
+ }
+ }
+ }
+
+
+ /**
+ * Build a map of activity ID's to activity bindings.
+ */
+ private void buildActivityBindingMap()
+ {
+ activityBindingMap = new HashMap();
+ TActivityBindings abs = bpeBinding.getActivityBindings();
+ if ( abs != null )
+ {
+ TActivityBinding[] activityBindingList = abs.getActivityBindingArray();
+
+ if ( activityBindingList.length > 0 )
+ {
+ for ( int iter=0; iter < activityBindingList.length; iter++ )
+ {
+ TActivityBinding ab = (TActivityBinding) activityBindingList[iter];
+ if ( ab != null )
+ {
+ String activityName = ab.getActivityName();
+ activityBindingMap.put(activityName, ab );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Get the interpretation of an activity if the activity
+ * has associated bindings. Return null if no bindings
+ * are associated with the activites.
+ * @param activityID
+ * @return
+ */
+ public String getActivityInterpretation( String activityID )
+ {
+ if ( bpeBinding == null )
+ {
+ return null;
+ }
+ if ( activityBindingMap == null )
+ {
+ buildActivityBindingMap();
+ }
+
+ TActivityBinding ab =
+ ( TActivityBinding )( activityBindingMap.get(activityID) );
+
+ if ( ab != null )
+ {
+ return ab.getInterpretation();
+ }
+
+ return null;
+
+ }
+
+
+ /**
+ * A helper method for building a BPEL Catch variable
+ *
+ * @param faultName
+ * @param faultVariable
+ * @param faultMap
+ * @return
+ * @throws DeploymentException
+ */
+ public BPELVariable getFaultVariable(QName faultName, String faultVariable, HashMap faultMap) throws DeploymentException {
+
+ BPELVariable retVal = null;
+
+ // Iterate over the definitions looking for a matching fault name
+ all:for ( Iterator defIter = wsdlDefs.iterator(); defIter.hasNext(); ) {
+ Definition defCur = (Definition)defIter.next();
+ if ( defCur.getTargetNamespace().equals(faultName.getNamespaceURI())) {
+ // In the namespace ballpark - look for fault
+ for ( Iterator portItr = defCur.getPortTypes().values().iterator(); portItr.hasNext(); ) {
+ PortType pt = (PortType)portItr.next();
+ for ( Iterator operItr = pt.getOperations().iterator(); operItr.hasNext(); ) {
+ Operation oper = (Operation)operItr.next();
+ Fault wsdlFault = oper.getFault(faultName.getLocalPart());
+ if ( wsdlFault != null ) {
+ BPELAttributes wsdlVarAttrs = new BPELAttributes();
+ wsdlVarAttrs.setName(faultVariable);
+ QName msgName = wsdlFault.getMessage().getQName();
+ wsdlVarAttrs.setMessageType(defCur.getPrefix(msgName.getNamespaceURI())+":"+msgName.getLocalPart());
+ retVal = new BPELWSDLVariable(wsdlVarAttrs,getContainerMap(faultVariable),wsdlFault.getMessage());
+ getBPEFault(oper,pt,faultName.getLocalPart(),faultMap);
+ break all;
+ }
+ }
+ }
+ }
+ }
+
+ return retVal;
+
+ }
+
+ /**
+ * Deprecated: maps a BPEL variable to a data container factory.
+ *
+ * @param varName
+ * @return
+ *
+ */
+ public HashMap getContainerMap(String varName) {
+ HashMap retVal = new HashMap();
+ boolean found = false;
+
+ defs:for ( Iterator defsItr = wsdlDefs.iterator(); defsItr.hasNext(); ) {
+
+ Definition wsdlDef = (Definition)defsItr.next();
+
+ // find the container to variable mapping
+ Collection elems = wsdlDef.getExtensibilityElements();
+ ExtensibilityElement extElem = null;
+ BPEVariableMap varMap = null;
+ for ( Iterator elem = elems.iterator(); elem.hasNext(); ) {
+ extElem = (ExtensibilityElement)elem.next();
+ if ( extElem instanceof BPEVariableMap ) {
+ varMap = (BPEVariableMap)extElem;
+ if ( varMap.getName().getLocalPart().equals(varName)) {
+ if ( varMap.getPart() != null ) {
+ retVal.put(varMap.getPart(),varMap);
+ found = true;
+ } else {
+ retVal.put(varMap.getName().getLocalPart(),varMap);
+ found = true;
+ }
+ }
+ }
+ }
+ if ( found ) break defs;
+ }
+
+ return retVal;
+ }
+
+ /**
+ * Deprecated: maps a BPEL fault variable to a data container factory.
+ *
+ */
+ private HashMap getBPEFault(Operation opr, PortType pt, String faultName, HashMap faultHM) {
+
+ // Set a default binding
+ for ( Iterator partItr = opr.getFault(faultName).getMessage().getParts().keySet().iterator(); partItr.hasNext(); ) {
+ String partName = (String)partItr.next();
+ BPEFault bpeFault = new BPEFault();
+ bpeFault.setPart(partName);
+ bpeFault.setType(DEFAULT_TYPE);
+ faultHM.put(partName,bpeFault);
+ }
+
+
+ // If a binding has been supplied use the defined binding
+ Binding binding = null;
+ all: for (Iterator defItr = wsdlDefs.iterator(); defItr.hasNext(); ) {
+ Definition id = (Definition)defItr.next();
+ for (Iterator bindingItr = id.getBindings().values().iterator(); bindingItr.hasNext(); ) {
+ binding = (Binding)bindingItr.next();
+ if ( binding.getPortType() == pt ) {
+ List opers = binding.getBindingOperations();
+ for(Iterator operIter=opers.iterator(); operIter.hasNext(); ) {
+ BindingOperation bopr = (BindingOperation)operIter.next();
+ if ( isOperationMatch(opr, bopr) ) {
+ // Assumption: The first binding found will be used.
+ // Found the required operation on a binding
+ BindingFault bf = bopr.getBindingFault(faultName);
+ if ( bf != null ) {
+ List bfexts = bf.getExtensibilityElements();
+ for ( Iterator bfextsItr = bfexts.iterator(); bfextsItr.hasNext(); ) {
+ Object bpeFault = bfextsItr.next();
+ if ( bpeFault instanceof BPEFault ) {
+ if ( faultHM.containsKey(((BPEFault)bpeFault).getPart())) {
+ faultHM.put(((BPEFault)bpeFault).getPart(),bpeFault);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return faultHM;
+ }
+
+ private BPELProcess getProcess() {
+ return process;
+ }
+
+ public void setProcess(BPELProcess process) {
+ this.process = process;
+ for ( Iterator itr = repos.entrySet().iterator(); itr.hasNext(); ) {
+ Map.Entry me = (Map.Entry)itr.next();
+ process.addSupportingDocument((String)me.getKey(),(String)me.getValue());
+ }
+ }
+
+ public Message getMessage(String msgName, BPELNode node) throws DeploymentException {
+
+ return rootDef.getMessage(node.getQName(msgName));
+
+ }
+
+ /**
+ * Constructs a bpel:Property element
+ *
+ * @return
+ * @throws DeploymentException
+ */
+ public HashMap buildProperties() throws DeploymentException {
+
+ HashMap retVal = new HashMap();
+
+ for ( Iterator wsdlItr = wsdlDefs.iterator(); wsdlItr.hasNext(); ) {
+
+ Definition wsdlDef = (Definition)wsdlItr.next();
+
+ // Iterate over the ExtensibilityElements and extract any BPELProperty nodes
+ List el = wsdlDef.getExtensibilityElements();
+ BPELProperty prop = null;
+
+ for ( Iterator itr = el.iterator(); itr.hasNext(); ) {
+ Object eo = itr.next();
+ if ( eo instanceof BPELProperty ) {
+ prop = (BPELProperty)eo;
+ retVal.put(new QName(wsdlDef.getTargetNamespace(),prop.getName()),new BPELPropertyDefinition(prop));
+ }
+ }
+ }
+
+ buildPropertyAliases(retVal);
+
+ return retVal;
+ }
+
+ /**
+ * Constructs a bpel:PropertyAlias
+ *
+ * @param props
+ * @throws DeploymentException
+ */
+ private void buildPropertyAliases(HashMap props) throws DeploymentException {
+
+ BPELPropertyAlias alias = null;
+ BPELPropertyDefinition propDef = null;
+
+ for ( Iterator wsdlItr = wsdlDefs.iterator(); wsdlItr.hasNext(); ) {
+
+ Definition wsdlDef = (Definition)wsdlItr.next();
+
+ // Iterate over the ExtensibilityElements and extract any BPELProperty nodes
+ List el = wsdlDef.getExtensibilityElements();
+// BPELProperty prop = null;
+
+ for ( Iterator itr = el.iterator(); itr.hasNext(); ) {
+ Object eo = itr.next();
+ if ( eo instanceof BPELPropertyAlias) {
+ alias = (BPELPropertyAlias)eo;
+ propDef = (BPELPropertyDefinition)props.get(alias.getPropertyName());
+ if ( propDef == null ) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_PROPERTY_NOTFOUND", new Object[] {getProcess().getAttributes().getName(),alias.getPropertyName().toString()},null);
+ }
+ propDef.addAlias(alias);
+ }
+ }
+ }
+ }
+
+ /**
+ * Binds the bpel:invoke to an IExternalAction
+ */
+
+ public BPELAction getBindingInvokeAction(String portType,
+ String operationName, String invokeName,
+ BPELVariable input, BPELVariable output,
+ BPELNode node) throws DeploymentException {
+
+ BPELAction retVal = new BPELAction();
+ BPEAction bpeAction = null;
+
+ QName qnPort = node.getQName(portType);
+
+ PortType pt = rootDef.getPortType(qnPort);
+ if ( pt == null ) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_PT_NOTFOUND",new Object[] {getProcess().getAttributes().getName(), portType},null);
+ }
+
+ // find the matching operation on the port and input/output param names
+ Operation opr = matchOperation(pt, input, output, invokeName, operationName);
+ if ( opr == null ) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_OPR_NOTFOUND",new Object[] {getProcess().getAttributes().getName(), portType},null);
+ }
+
+
+ WSDLOperationKey sk = new WSDLOperationKey(qnPort.getNamespaceURI(),qnPort.getLocalPart(),opr.getName(),(opr.getInput() == null) ? "default" : opr.getInput().getName(), (opr.getOutput() == null ) ? "default" : opr.getOutput().getName());
+
+ // Create a default list of input/output parts
+ HashMap inputHM = new HashMap();
+ HashMap outputHM = new HashMap();
+
+ if ( opr.getInput() != null ) {
+ for ( Iterator inpItr = opr.getInput().getMessage().getParts().keySet().iterator(); inpItr.hasNext(); ) {
+ String partName = (String)inpItr.next();
+ BPEInput bpeInput = new BPEInput();
+ bpeInput.setPart(partName);
+ bpeInput.setType(DEFAULT_TYPE);
+ inputHM.put(partName,bpeInput);
+ }
+ }
+
+ if ( opr.getOutput() != null ) {
+ for ( Iterator outItr = opr.getOutput().getMessage().getParts().keySet().iterator(); outItr.hasNext(); ) {
+ String partName = (String)outItr.next();
+ BPEOutput bpeOutput = new BPEOutput();
+ bpeOutput.setPart(partName);
+ bpeOutput.setType(DEFAULT_TYPE);
+ outputHM.put(partName,bpeOutput);
+ }
+ }
+
+ // See if any bpe bindings can be found in a bpe:binding file.
+ bpeAction = getBPEActionBPEBinding(pt,opr);
+
+ // Check to see if action binding is available from WSDL
+ if ( bpeAction == null ) bpeAction = getBPEActionWSDL(pt,opr,inputHM,outputHM);
+
+ if ( bpeAction == null ) {
+
+ // create a default action
+ bpeAction = new BPEAction();
+ bpeAction.setImplementation(DEFAULT_IMPL);
+
+ // Temp fix for rob madden.
+ throw new RuntimeException("Could not find action binding for: pt = "
+ + pt.getQName() + ", oper = " + opr.getName());
+ }
+
+ retVal.setAction(bpeAction);
+ retVal.setOk(sk);
+ retVal.setInput(new Vector(inputHM.values()));
+ retVal.setOutput(new Vector(outputHM.values()));
+
+ return retVal;
+ }
+
+ /**
+ * Acquires a bpe IExternalAction binding from a binding .xml
+ */
+
+ private BPEAction getBPEActionBPEBinding(PortType pt, Operation opr) throws DeploymentException {
+ BPEAction bpeAction = null;
+
+ if ( bpeBinding != null ) {
+ TBinding[] bindingArray = bpeBinding.getActionBindings().getBindingArray();
+ all:for ( int bdItr = 0; bdItr < bindingArray.length; bdItr++ ) {
+ TBinding b = bindingArray[bdItr];
+ QName tPort = new QName(b.getNameSpace(),b.getPortType());
+ if ( tPort.equals(pt.getQName())) {
+ TOperation[] operationArray = b.getOperationArray();
+ for ( int opItr = 0; opItr < operationArray.length; opItr++ ) {
+ TOperation tOp = operationArray[opItr];
+ if ( tOp.getName().equals(opr.getName())) {
+ bpeAction = new BPEAction();
+ bpeAction.setImplementation(tOp.getAction().getImplementation());
+ if ( tOp.getAction().getBpeImplementation() != null ) {
+ bpeAction.setBPEImplementation(tOp.getAction().getBpeImplementation());
+ }
+ XmlCursor cur = tOp.getAction().newCursor();
+ boolean hasAttr = cur.toFirstAttribute();
+
+ String bpeNS = tOp.getAction().schemaType().getName().getNamespaceURI();
+
+ while ( hasAttr ) {
+
+ if ( ! bpeNS.equals(cur.getName().getNamespaceURI()) && cur.getName().getNamespaceURI().length() != 0) {
+
+ bpeAction.addProp(cur.getName().getLocalPart(),cur.getTextValue());
+ }
+
+ hasAttr = cur.toNextAttribute();
+ }
+
+ break all;
+ }
+ }
+ }
+ }
+ }
+
+ return bpeAction;
+ }
+
+ /**
+ * Acquires a bpe IExternalAction binding from a .wsdl binding
+ *
+ * Should be deprecated at some point.
+ *
+ */
+ private BPEAction getBPEActionWSDL(PortType pt, Operation opr, HashMap inputHM, HashMap outputHM) throws DeploymentException {
+
+ List defs = new Vector();
+
+ // all BPE bindings should be in the root BP WSDL
+ defs.add(rootDef);
+
+ // or in a WSDL of the same namespace
+ List impList = rootDef.getImports(rootDef.getTargetNamespace());
+ if ( impList != null ) {
+ for ( Iterator impItr = impList.iterator(); impItr.hasNext(); ) {
+ Import imp = (Import)impItr.next();
+ defs.add(imp.getDefinition());
+ }
+ }
+
+ // or they may be in the service WSDL
+ defs.addAll(wsdlDefs);
+
+
+ // Find the binding
+ Binding binding = null;
+ BPEAction bpeAction = null;
+ all: for (Iterator defItr = defs.iterator(); defItr.hasNext(); ) {
+ Definition id = (Definition)defItr.next();
+ for (Iterator bindingItr = id.getBindings().values().iterator(); bindingItr.hasNext(); ) {
+ binding = (Binding)bindingItr.next();
+ if ( binding.getPortType().getQName().equals(pt.getQName()) ) {
+ List opers = binding.getBindingOperations();
+ for(Iterator operIter=opers.iterator(); operIter.hasNext(); ) {
+ BindingOperation bopr = (BindingOperation)operIter.next();
+ if ( isOperationMatch(opr, bopr) ) {
+ // Assumption: The first binding found will be used.
+ // Found the required operation on a binding
+
+ List exts = bopr.getExtensibilityElements();
+ for ( Iterator extItr = exts.iterator(); extItr.hasNext(); ) {
+ Object ext = extItr.next();
+ if ( ext instanceof BPEAction ) {
+ bpeAction = (BPEAction)ext;
+ if ( bpeAction.getImplementation() == null ) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_IMPL_REQ",new Object[] {getProcess().getAttributes().getName()},null);
+ }
+ }
+ }
+
+ BindingInput bi = bopr.getBindingInput();
+ if ( bi != null ) {
+ List biexts = bi.getExtensibilityElements();
+ for ( Iterator biextsItr = biexts.iterator(); biextsItr.hasNext(); ) {
+ Object bpeInput = biextsItr.next();
+ if ( bpeInput instanceof BPEInput ) {
+ if ( inputHM.containsKey(((BPEInput)bpeInput).getPart())) {
+ inputHM.put(((BPEInput)bpeInput).getPart(),bpeInput);
+ }
+ }
+ }
+ }
+
+ BindingOutput bo = bopr.getBindingOutput();
+ if ( bo != null ) {
+ List boexts = bo.getExtensibilityElements();
+ for ( Iterator boextsItr = boexts.iterator(); boextsItr.hasNext(); ) {
+ Object bpeOutput = boextsItr.next();
+ if ( bpeOutput instanceof BPEOutput ) {
+ if ( outputHM.containsKey(((BPEOutput)bpeOutput).getPart())) {
+ outputHM.put(((BPEOutput)bpeOutput).getPart(),bpeOutput);
+ }
+ }
+ }
+ }
+ break all;
+ }
+ }
+ }
+ }
+ }
+ return bpeAction;
+ }
+
+ private Operation matchOperation(PortType pt, BPELVariable inputVar, BPELVariable outputVar, String invokeName, String operationName) throws DeploymentException {
+
+ QName inputMsg = null;
+ QName outputMsg = null;
+
+ // BPEL does not hold the name attribute of a WSDL operation input/output.
+ // Therefore we must iterate over the operations and find a match based on
+ // input/output type rather than name.
+
+ if ( inputVar != null ) {
+ if ( inputVar instanceof BPELWSDLVariable ) {
+ inputMsg = ((BPELWSDLVariable)inputVar).getMessageName();
+ } else {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_VAR_NOTWSDL",new Object[] {getProcess().getAttributes().getName(), invokeName, inputVar.getName()},null);
+ }
+ }
+
+ if ( outputVar != null ) {
+ if ( outputVar instanceof BPELWSDLVariable ) {
+ outputMsg = ((BPELWSDLVariable)outputVar).getMessageName();
+ } else {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_VAR_NOTWSDL",new Object[] {getProcess().getAttributes().getName(), invokeName, outputVar.getName()},null);
+ }
+ }
+
+ Operation retop = null;
+ boolean inputMatch = false, outputMatch = false;
+
+ for ( Iterator opItr = pt.getOperations().iterator(); opItr.hasNext(); ) {
+ Operation opr = (Operation)opItr.next();
+
+ Input inp = opr.getInput();
+ Output outp = opr.getOutput();
+
+ if ( opr.getName().equals(operationName)) {
+
+ if ( inp != null && inputMsg != null ) {
+ if ( inp.getMessage().getQName().equals(inputMsg) ) inputMatch = true;
+ } else {
+ if ( inp == null && inputMsg == null ) inputMatch = true;
+ }
+
+ if ( outp != null && outputMsg != null ) {
+ if ( outp.getMessage().getQName().equals(outputMsg) ) outputMatch = true;
+ } else {
+ if ( outp == null && outputMsg == null ) outputMatch = true;
+ }
+ }
+
+ if ( inputMatch && outputMatch ) {
+ retop = opr;
+ break;
+ }
+
+ }
+
+
+ return retop;
+
+ }
+
+ private static boolean isOperationMatch(Operation ptOper, BindingOperation bOper ) {
+
+ boolean input = false, output = false;
+
+ if ( ptOper.getName().equals(bOper.getName()) ) {
+ input = true;
+ output = true;
+
+ if ( ptOper.getInput() != null && bOper.getBindingInput() != null ) {
+ if ( ptOper.getInput().getName() != null && bOper.getBindingInput().getName() != null ) {
+ input = ptOper.getInput().getName().equals(bOper.getBindingInput().getName());
+ }
+ }
+
+ if ( ptOper.getOutput() != null && bOper.getBindingOutput() != null ) {
+ if ( ptOper.getOutput().getName() != null && bOper.getBindingOutput().getName() != null ) {
+ output = ptOper.getOutput().getName().equals(bOper.getBindingOutput().getName());
+ }
+ }
+ }
+
+ return input && output ;
+ }
+
+ private Definition getRootWSDL(String bpelName, HashMap artifacts) throws DeploymentException {
+ Definition ret = null;
+ InputSource is = null;
+
+ // Finds the root wsdl document that defines the BPEL definition
+ byte[] data = (byte[])artifacts.get(bpelName+".wsdl");
+
+ if ( data != null ) {
+
+ try {
+ // Create a SAX InputSource from the raw document byte array
+ ByteArrayInputStream bais = new ByteArrayInputStream(data);
+
+ is = new InputSource(bais);
+ bais.close();
+ } catch (IOException e1) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_IOERR",new Object[] {bpelName,bpelName+".wsdl"},e1);
+ }
+ }
+
+ if ( is == null ) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"DEPLOY_WSDL_NOTFOUND",new Object[] {bpelName,bpelName+".wsdl"},null);
+ }
+
+ try {
+ WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+
+ reader.setFeature("javax.wsdl.verbose",true);
+ reader.setFeature("javax.wsdl.importDocuments",true);
+
+ reader.setExtensionRegistry(getExtentionRegistry());
+
+ // Parse the document and include any imported WSDL documents
+ ret = reader.readWSDL(new BPELWSDLLocator(bpelName,is, artifacts));
+
+ } catch (WSDLException e) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_WSDLREADER",new Object[] {bpelName,bpelName+".wsdl",e.getMessage()},e);
+ }
+
+ return ret;
+ }
+
+ private TSchema getBPEBindings(String bpelName, HashMap artifacts) throws DeploymentException {
+ TSchema ret = null;
+
+ // Finds the root wsdl document that defines the BPEL definition
+ byte[] data = (byte[])artifacts.get(bpelName+".xml");
+
+ if ( data != null ) {
+
+ ByteArrayInputStream bpeBinding = new ByteArrayInputStream(data);
+
+ BPEBindingDocument bbd = null;
+ try {
+ bbd = BPEBindingDocument.Factory.parse(bpeBinding);
+ } catch (XmlException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ ret = bbd.getBPEBinding();
+ }
+
+ return ret;
+ }
+
+ private ExtensionRegistry getExtentionRegistry() {
+
+ // Use IBM's implementation as a base registry. They have implemented
+ // extensibility objects for SOAP,HTTP,MIME and we should not
+ // loose these functions.
+ ExtensionRegistry er = new com.ibm.wsdl.extensions.PopulatedExtensionRegistry();
+
+ BPELPropertySerializer bpelPropSerializer = new BPELPropertySerializer();
+ BPELPropertyAliasSerializer bpelPropAliasSerializer = new BPELPropertyAliasSerializer();
+ BPEActionSerializer bpeActionSerializer = new BPEActionSerializer();
+ BPEInputSerializer bpeInputSerializer = new BPEInputSerializer();
+ BPEOutputSerializer bpeOutputSerializer = new BPEOutputSerializer();
+ BPEFaultSerializer bpeFaultSerializer = new BPEFaultSerializer();
+ BPEVariableMapSerializer bpeVariableSerializer = new BPEVariableMapSerializer();
+
+ // Register the BPEL extension points
+ er.registerSerializer(Definition.class,
+ ExtentionConstants.Q_ELEM_BPEL_PROPERTY,
+ bpelPropSerializer);
+ er.registerDeserializer(Definition.class,
+ ExtentionConstants.Q_ELEM_BPEL_PROPERTY,
+ bpelPropSerializer);
+ er.mapExtensionTypes(Definition.class,
+ ExtentionConstants.Q_ELEM_BPEL_PROPERTY,
+ BPELProperty.class);
+ er.registerSerializer(Definition.class,
+ ExtentionConstants.Q_ELEM_BPEL_PROPERTY_ALIAS,
+ bpelPropAliasSerializer);
+ er.registerDeserializer(Definition.class,
+ ExtentionConstants.Q_ELEM_BPEL_PROPERTY_ALIAS,
+ bpelPropAliasSerializer);
+ er.mapExtensionTypes(Definition.class,
+ ExtentionConstants.Q_ELEM_BPEL_PROPERTY_ALIAS,
+ BPELPropertyAlias.class);
+
+ // register the BPE extension points
+ er.registerSerializer(BindingOperation.class,
+ ExtentionConstants.Q_ELEM_BPE_ACTION,
+ bpeActionSerializer);
+ er.registerDeserializer(BindingOperation.class,
+ ExtentionConstants.Q_ELEM_BPE_ACTION,
+ bpeActionSerializer);
+ er.mapExtensionTypes(BindingOperation.class,
+ ExtentionConstants.Q_ELEM_BPE_ACTION,
+ BPEAction.class);
+ er.registerSerializer(BindingInput.class,
+ ExtentionConstants.Q_ELEM_BPE_INPUT,
+ bpeInputSerializer);
+ er.registerDeserializer(BindingInput.class,
+ ExtentionConstants.Q_ELEM_BPE_INPUT,
+ bpeInputSerializer);
+ er.mapExtensionTypes(BindingInput.class,
+ ExtentionConstants.Q_ELEM_BPE_INPUT,
+ BPEInput.class);
+ er.registerSerializer(BindingOutput.class,
+ ExtentionConstants.Q_ELEM_BPE_OUTPUT,
+ bpeOutputSerializer);
+ er.registerDeserializer(BindingOutput.class,
+ ExtentionConstants.Q_ELEM_BPE_OUTPUT,
+ bpeOutputSerializer);
+ er.mapExtensionTypes(BindingOutput.class,
+ ExtentionConstants.Q_ELEM_BPE_OUTPUT,
+ BPEOutput.class);
+
+ er.registerSerializer(BindingFault.class,
+ ExtentionConstants.Q_ELEM_BPE_FAULT,
+ bpeFaultSerializer);
+ er.registerDeserializer(BindingFault.class,
+ ExtentionConstants.Q_ELEM_BPE_FAULT,
+ bpeFaultSerializer);
+ er.mapExtensionTypes(BindingFault.class,
+ ExtentionConstants.Q_ELEM_BPE_FAULT,
+ BPEFault.class);
+
+ er.registerSerializer(Definition.class,
+ ExtentionConstants.Q_ELEM_BPE_VAR,
+ bpeVariableSerializer);
+ er.registerDeserializer(Definition.class,
+ ExtentionConstants.Q_ELEM_BPE_VAR,
+ bpeVariableSerializer);
+ er.mapExtensionTypes(Definition.class,
+ ExtentionConstants.Q_ELEM_BPE_VAR,
+ BPEVariableMap.class);
+
+ return er;
+ }
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/WSDLOperationKey.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/WSDLOperationKey.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/WSDLOperationKey.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/deployment/bpel/WSDLOperationKey.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,163 @@
+/*
+* 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: Feb 21, 2004
+ * Project: BPEELocal
+ * Package: com.sybase.bpe.deployment.bpel
+ * Author: waterman
+ */
+package com.sybase.bpe.deployment.bpel;
+
+import java.io.Serializable;
+
+/**
+ *
+ *
+ * @author waterman
+ */
+public class WSDLOperationKey implements Serializable{
+
+ static final long serialVersionUID = -2350251988688898355L;
+
+ private String nameSpace;
+ private String portType;
+ private String operationName;
+ private String inputName;
+ private String outputName;
+
+ /**
+ *
+ */
+ public WSDLOperationKey() {
+ }
+
+ /**
+ *
+ */
+ public WSDLOperationKey(String ns, String pt, String op, String inputN, String outputN) {
+ super();
+ nameSpace = ns;
+ portType = pt;
+ operationName = op;
+ inputName = ( inputN == null ) ? "default" : inputN;
+ outputName = ( outputN == null ) ? "default" : outputN;
+ }
+
+ /**
+ * @return
+ */
+ public String getInputName() {
+ return inputName;
+ }
+
+ /**
+ * @return
+ */
+ public String getNameSpace() {
+ return nameSpace;
+ }
+
+ /**
+ * @return
+ */
+ public String getOperationName() {
+ return operationName;
+ }
+
+ /**
+ * @return
+ */
+ public String getOutputName() {
+ return outputName;
+ }
+
+ /**
+ * @return
+ */
+ public String getPortType() {
+ return portType;
+ }
+
+ /**
+ * @param string
+ */
+ public void setInputName(String string) {
+ inputName = string;
+ }
+
+ /**
+ * @param string
+ */
+ public void setNameSpace(String string) {
+ nameSpace = string;
+ }
+
+ /**
+ * @param string
+ */
+ public void setOperationName(String string) {
+ operationName = string;
+ }
+
+ /**
+ * @param string
+ */
+ public void setOutputName(String string) {
+ outputName = string;
+ }
+
+ /**
+ * @param string
+ */
+ public void setPortType(String string) {
+ portType = string;
+ }
+
+
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ boolean retVal = false;
+
+ if ( obj instanceof WSDLOperationKey ) {
+ WSDLOperationKey tst = (WSDLOperationKey)obj;
+ retVal = nameSpace.equals(tst.nameSpace) &&
+ portType.equals(tst.portType) &&
+ operationName.equals(tst.operationName) &&
+ outputName.equals(tst.outputName) &&
+ inputName.equals(tst.inputName);
+ }
+
+ return retVal;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ String hsh = nameSpace + portType + operationName + outputName + inputName;
+ return hsh.hashCode();
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/CleanUpEnum.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/CleanUpEnum.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/CleanUpEnum.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/CleanUpEnum.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,101 @@
+/*
+* 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.engine;
+
+import java.io.Serializable;
+//import java.util.logging.Logger;
+
+/** An enumeration of the possible process states:
+ * <P>
+ * UNSTARTED,STARTED,PAUSED,FINISHED,TERMINATED */
+public class CleanUpEnum implements Serializable
+{
+
+ static final long serialVersionUID = -778045774298504755L;
+
+// private static Logger logger =
+// Logger.getLogger(CleanUpEnum.class.getName());
+ private java.lang.String stringValue;
+ private int intValue;
+ private static final java.lang.String CLEANUP_VALUE = "CLEANUP";
+ private static final java.lang.String NOCLEANUP_VALUE = "NOCLEANUP";
+
+ private static final int CLEANUP_INT = 1;
+ private static final int NOCLEANUP_INT = 2;
+
+ private CleanUpEnum()
+ {
+ // Prevent non-class create
+ }
+
+ /** @param oldStateEnum */
+ private CleanUpEnum(java.lang.String stateString, int stateInt)
+ {
+ this.stringValue = stateString;
+ this.intValue = stateInt;
+ }
+
+ public static final CleanUpEnum CLEANUP = new CleanUpEnum(CLEANUP_VALUE,CLEANUP_INT);
+ public static final CleanUpEnum NOCLEANUP = new CleanUpEnum(NOCLEANUP_VALUE,NOCLEANUP_INT);
+
+ public java.lang.String getStringValue()
+ {
+ return stringValue;
+ }
+
+ public int getIntValue()
+ {
+ return intValue;
+ }
+
+ /** Because this object will be used over a remote interface the default implementation based on object reference will be over written. */
+ public int hashCode()
+ {
+ return intValue;
+ }
+
+ /** Because this object will be used over a remote interface the default implementation based on object reference will be over written.
+ *
+ * @param obj */
+ public boolean equals(Object obj)
+ {
+ if ( obj instanceof CleanUpEnum ) {
+ return intValue == ((CleanUpEnum)obj).intValue;
+ }
+ return false;
+ }
+
+ public static CleanUpEnum getState(String state) {
+ if ( state.equals(CLEANUP_VALUE) ) return CLEANUP;
+ if ( state.equals(NOCLEANUP_VALUE) ) return NOCLEANUP;
+ return null;
+ }
+
+ public static CleanUpEnum getState(int state) {
+ switch ( state ) {
+ case CLEANUP_INT: return CLEANUP;
+ case NOCLEANUP_INT: return NOCLEANUP;
+ default: return null;
+ }
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/IEvaluationContext.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/IEvaluationContext.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/IEvaluationContext.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/IEvaluationContext.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,87 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Jul 31, 2003
+ */
+package com.sybase.bpe.engine;
+
+/**
+ * @author charper
+ * An implementation must provide access to engine services.
+ */
+public interface IEvaluationContext {
+
+ /**
+ * Get the ProcessService.
+ * @return ProcessService
+ */
+ public ProcessService getProcessService();
+
+ /**
+ * Add a Process Instance to the evaluation context.
+ *
+ * @param pi - a process instance
+ */
+ public void addProcessInstance(ProcessInstance pi);
+
+ /**
+ * Get next process Instance for evaluation. The engine will
+ * continue to ask the evaluation context for a process instance.
+ * When the evaluation context returns null the engine halts
+ * processing.
+ *
+ */
+ public ProcessInstance getNextProcessInstance();
+
+ /**
+ * The engine will notify the evaluation context when to
+ * initialize it's process instance collection
+ *
+ */
+ public void initProcessInstanceCollection();
+
+ /**
+ * If the process instance collection is empty return false
+ *
+ */
+ public boolean processInstanceCollectionIsEmpty();
+
+ /**
+ * Release the resources associated with this EvaluationContext.
+ *
+ */
+ public void release();
+
+ /**
+ * Mark this process as a dead process. These will
+ * get cleaned up when a process blocks and the registraion
+ * the process jumps back to is a defintion and not a
+ * live process thread.
+ *
+ */
+ public void setDeadProcess(boolean mark);
+ public boolean isDeadProcess();
+
+
+
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/IProcessCallBack.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/IProcessCallBack.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/IProcessCallBack.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/IProcessCallBack.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,123 @@
+/*
+* 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.engine;
+
+import com.sybase.bpe.bped.ISendEvent;
+import com.sybase.bpe.correlation.CorrelationService;
+import com.sybase.bpe.locking.LockingService;
+import com.sybase.bpe.event.IRequestMessageEvent;
+import com.sybase.bpe.util.BPEProperties;
+import com.sybase.bpe.util.BPException;
+import com.sybase.bpe.uuid.UUIDService;
+
+/**
+ * The event director is responsible for routing web service event messages
+ * to a process that is registered to recievce the event. Events can be sent
+ * syncronously or asyncronoulsy to the process engine. If a syncronous
+ * message is sent an EventResult will be returned.
+ */
+public interface IProcessCallBack extends ISendEvent
+{
+
+ /**
+ * Activate a process.
+ * @param procKey The process key.
+ * @return An event result.
+ * @throws EventDirectorException If and error occurs while
+ * processing the Event. Note that the method can complete with out
+ * error, but the returned EventResult can contain fault messages.
+ */
+ public void activate(String rootKey, java.lang.String procKey) throws BPException;
+
+ /**
+ * Terminate a process.
+ * @param procKey The process key.
+ * @return An event result.
+ * @throws EventDirectorException If and error occurs while
+ * processing the Event. Note that the method can complete with out
+ * error, but the returned EventResult can contain fault messages.
+ */
+ public void terminate(String rootKey, java.lang.String procKey) throws BPException;
+
+ /**
+ * Pause a process.
+ * @param procKey The process key.
+ * @return An event result.
+ * @throws EventDirectorException If and error occurs while
+ * processing the Event. Note that the method can complete with out
+ * error, but the returned EventResult can contain fault messages.
+ */
+ public void pause(String rootKey, java.lang.String procKey) throws BPException;
+
+ /**
+ * Initialize the EventDirector.
+ * @param props Initialization properties.
+ * @param cs A correlation service for this EventDirector to use.
+ */
+ public void init ( BPEProperties props, ProcessService ps, CorrelationService cs, UUIDService us, LockingService ls) throws BPException;
+
+ /**
+ * Get the CorrelationService associated with this EventDirector.
+ * @return CorrelationService
+ */
+ public CorrelationService getCorrelationService();
+
+ /**
+ * Get the LockingService associated with this EventDirector.
+ * @return LockingService
+ */
+ public LockingService getLockingService();
+
+ /**
+ * Get the ProcessService associated with this EventDirector.
+ * @return ProcessService
+ */
+ public ProcessService getProcessService();
+
+ /**
+ * Get the return message metadata.
+ * @return
+ */
+ public ReturnMessageLocatorHolder getReturnMessageMetadata();
+
+ /**
+ * Set the return message metadata.
+ * @param c
+ */
+ public void setReturnMessageMetadata(ReturnMessageLocatorHolder rmlh);
+
+
+ /**
+ * Get the current message event.
+ * @return
+ */
+ public IRequestMessageEvent getMessageEvent();
+
+ /**
+ * Set the currentmessage event.
+ * @param me
+ */
+ public void setMessageEvent(IRequestMessageEvent rmlh);
+
+
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/InactiveDefinitionException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/InactiveDefinitionException.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/InactiveDefinitionException.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/InactiveDefinitionException.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
+*/
+
+package com.sybase.bpe.engine;
+
+import com.sybase.bpe.util.BPException;
+
+
+public class InactiveDefinitionException extends BPException
+{
+ static final long serialVersionUID = -9091131013904428583L;
+
+
+ private String m_businessProcessName;
+ private String m_rootID;
+
+ public InactiveDefinitionException(
+ String businessProcessName, String rootId )
+ {
+ super( businessProcessName );
+ m_businessProcessName = businessProcessName;
+ m_rootID = rootId;
+ }
+
+ public String getProcessName()
+ {
+ return m_businessProcessName;
+ }
+
+ public String getRootDefinitionID()
+ {
+ return m_rootID;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessDefinitionKey.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessDefinitionKey.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessDefinitionKey.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessDefinitionKey.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,50 @@
+/*
+* 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.engine;
+
+//import java.util.logging.Logger;
+
+import com.sybase.bpe.uuid.UUIDService;
+
+/** A unique identifier for a process definition.
+ * <P>
+ * This is a type safe ProcessKey class. */
+public class ProcessDefinitionKey extends ProcessKey
+{
+
+ static final long serialVersionUID = -8053977175828292343L;
+
+// private static Logger logger =
+// Logger.getLogger(ProcessDefinitionKey.class.getName());
+
+ public ProcessDefinitionKey(){}
+
+ public ProcessDefinitionKey(UUIDService us)
+ {
+ super(us);
+ }
+
+ /** @param value */
+ public ProcessDefinitionKey(java.lang.String value)
+ { super(value); }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessDefinitionQuery.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessDefinitionQuery.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessDefinitionQuery.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessDefinitionQuery.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,56 @@
+/*
+* 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.engine;
+
+//import java.util.logging.Logger;
+
+/** The class is used to build params on which to query for process definitions.
+ * <P>
+ * This is a type safe ProcessQuery class. */
+public class ProcessDefinitionQuery extends ProcessQuery
+{
+
+// private static Logger logger =
+// Logger.getLogger(ProcessDefinitionQuery.class.getName());
+
+ private ProcessDefinitionQuery()
+ {
+ // Not a valid constructor
+ super();
+ }
+
+ public ProcessDefinitionKey getDefinitionKey()
+ {
+ return (ProcessDefinitionKey)getKey();
+ }
+
+ /** @param key */
+ public void setDefinitionKey(ProcessDefinitionKey key)
+ {
+ setKey(key);
+ }
+
+ /** @param processKey */
+ public ProcessDefinitionQuery(ProcessKey processKey)
+ { super(processKey); }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessInstance.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessInstance.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessInstance.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessInstance.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,583 @@
+/*
+* 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.engine;
+
+//import java.util.Collection;
+import java.util.Iterator;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.internal.IInternalAction;
+import com.sybase.bpe.condition.Conditional;
+import com.sybase.bpe.context.IContextService;
+import com.sybase.bpe.context.resolver.ContextResolvedObject;
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.definition.IPMDAction;
+import com.sybase.bpe.definition.IPMDChangeCondition;
+import com.sybase.bpe.definition.IPMDLocator;
+import com.sybase.bpe.definition.IPMDLocatorHolder;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.event.IEvent;
+import com.sybase.bpe.event.IInternalEvent;
+import com.sybase.bpe.event.StateEvent;
+import com.sybase.bpe.instance.IPMIProcess;
+import com.sybase.bpe.instance.service.InstanceService;
+import com.sybase.bpe.interaction.spiadapter.SPIAdapterInteraction;
+import com.sybase.bpe.lang.ResourceGetter;
+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 waterman
+ *
+ * This is <B>THE</B> interface used by clients of the business process engine. From
+ * this interface client code can introspect a running process or send events/messages
+ * to a running process.
+ *
+ * @see ProcessService
+ *
+ */
+public class ProcessInstance {
+
+ private static Logger logger =
+ Logger.getLogger(ProcessInstance.class.getName());
+
+ private IPMIProcess process;
+ private ProcessService ps;
+ // if user does not define the VARIABLE_LOGGING_SIZE_PROP in
+ // through LogManager, we will log full value of the variable
+ private int debugVariableLogSize = Integer.MAX_VALUE;
+
+ private final static String LINE_SEPERATOR = System.getProperty("line.separator");
+ private final static String VARIABLE_LOGGING_SIZE_PROP = "VARIABLE_LOGGING_SIZE";
+
+ protected ProcessInstance(IPMIProcess process, ProcessService ps) {
+ this.process = process;
+ this.ps = ps;
+ }
+
+ /** Returns the unique persistent identifier of the process intance. This
+ * identifier is suitable for re-acquiring a ProcessInstance through the
+ * ProcessService interface.
+ *
+ * @see ProcessService
+ *
+ * @return a unique process instance identifier
+ */
+ public String getKey() {
+ return process.getKey();
+ }
+
+ /**
+ *
+ * @return the process root key
+ */
+ public String getRootKey () {
+ return process.getRootKey();
+ }
+
+ public InstanceService getInstanceService () {
+ return ps.getInstanceService();
+ }
+
+ public IScopeService getScopeService() throws BPException{
+ return ps.getScopeService(process);
+ }
+
+ /** Returns the data ContextService for the process instance
+ *
+ * @see ContextSerivce
+ */
+ public IContextService getContextService() throws BPException {
+
+ return ps.getContextService(process);
+
+ }
+
+ /** Returns subprocesses of the process instance.
+ *
+ *
+ * @param scope - allows filtering of the sub-processes to return
+ * @return a collection of ProcessInstance */
+ public java.util.Collection getSubProcess(ScopeEnum scope) {
+ // WAIT: waiting fro IO process management requirements
+ return null;
+ }
+
+ /** Returns the state of the process instance */
+ public StateEnum getState() {
+ return StateEnum.getState(process.getState());
+ }
+ public void setState(StateEnum state) {
+ process.setState(state.getIntValue());
+ }
+
+ public ScopePath getScopePath() {
+ return process.getScopePath();
+ }
+
+ public void setScopePath(ScopePath scopePath) {
+ process.setScopePath(scopePath);
+ }
+
+ /** Returns the human readable label of the process instance */
+ public java.lang.String getLabel() throws BPException {
+ return process.getDefinition().getLabel();
+ }
+
+ /** Returns a verbose description of the process instance */
+ public java.lang.String getDescription()
+ throws BPException {
+ return process.getDefinition().getDescription();
+ }
+
+ /** Returns the process instance version */
+ public java.lang.String getVersion() throws BPException {
+ return process.getDefinition().getVersion();
+ }
+
+ /** Pause the process instance */
+ public void pause() {
+ // WAIT: waiting for IO process management requirements
+ }
+
+ /** Re-Activate a paused process instance */
+ public void activiate() {
+ // WAIT: waiting for IO process management requirements
+ }
+
+ /** Terminate the process instance
+ * @throws BPException*/
+ public void terminate(IEvaluationContext ec, IProcessCallBack pcb) throws BPException {
+
+ IScopeService ss = getScopeService();
+ ss.getRootScope().terminate(this.process,ec,pcb);
+
+ }
+
+ private boolean isRootProcessPaused() throws BPException
+ {
+ IPMIProcess rootInstance
+ = getInstanceService().getRootInstance( getRootKey() );
+
+ return rootInstance.isPaused();
+
+ }
+
+ /**
+ * Executes the process definition instruction set.
+ * @param ed The EventDirector.
+ * @param event The event to process.
+ * @return An EventResult indicating failure status.
+ * @throws BPException If an error occurs while processing.
+ */
+ public void processEvent(IEvent event, IEvaluationContext ec, IProcessCallBack pcb)
+ throws BPException {
+
+ if ( !( event instanceof IInternalEvent ))
+ {
+ if( isRootProcessPaused() )
+ {
+ throw new ProcessInstancePausedException( this.getRootKey());
+ }
+ }
+
+ ec.initProcessInstanceCollection();
+
+ processInternalEvent(event,ec,pcb);
+
+ while ( !ec.processInstanceCollectionIsEmpty() ) {
+ ProcessInstance pi = ec.getNextProcessInstance();
+
+ // Send a Start event to the process instance
+ pi.processInternalEvent(
+ new StateEvent(pi.getRootKey(),pi.getKey(), StateEnum.STARTED),
+ ec, pcb);
+ }
+
+
+ }
+
+ private void processInternalEvent(IEvent event, IEvaluationContext ec, IProcessCallBack pcb)
+ throws BPException {
+
+// Collection outputContainers = null;
+ ec.setDeadProcess(false);
+
+ logProcessStatus(" * Engine Begins Executing->");
+
+ if ( event instanceof IInternalEvent ) {
+ ((IInternalEvent)event).apply(this,ec,pcb);
+ }
+
+ // we need this to do clean up, this object may be overwritten by
+ // the reply object
+ ReturnMessageLocatorHolder rmlh = pcb.getReturnMessageMetadata();
+ if ( rmlh == null ) {
+ rmlh = new ReturnMessageLocatorHolder();
+ rmlh.setRootProcessID(getRootKey());
+ pcb.setReturnMessageMetadata(rmlh);
+ }
+
+ // If the process is not in a started state then log the fact and return
+ // a message as to such.
+ if (process.getState() != StateEnum.STARTED.getIntValue()) {
+ // WAIT: waiting for IO process management requirements
+ if ( process.getState() == StateEnum.TERMINATED.getIntValue() ) {
+ return;
+ }
+ String s = ResourceGetter.getFormatted("ENG_PI_PNS",
+ new Object[] {process.getKey(),
+ String.valueOf(process.getState())});
+ logger.severe(s);
+ }
+
+
+ try {
+ // process change conditions
+ if (evaluate(process.getDefinition().getChangeConditions(),
+ process.getDefinition(),
+ ec,pcb)) {
+
+ // if all change conditions successfully complete set state to finished
+ process.setState(StateEnum.FINISHED.getIntValue());
+
+ // process observing pre-conditions
+ Iterator iOPC = process.getDefinition().getObserverProcessPC();
+ while (iOPC.hasNext()) {
+ IPMDProcess pDef = (IPMDProcess) iOPC.next();
+ evaluate(
+ pDef.getPrecondition(),
+ pDef, ec,
+ pcb);
+ }
+
+ logProcessStatus(" * Engine Ends Executing->");
+
+ // remove this process now that it is finished
+ //
+ // dead processes are kept around to store the
+ // scope path for onMessages
+ if ( ! ec.isDeadProcess() ) {
+ process.remove();
+ }
+ }
+
+ // push all errors through the fault handling
+ } catch (Throwable t) {
+
+ IScopeService ss = getScopeService();
+ IFCScopeInstance scope = ss.getScope(getScopePath());
+ scope.handleFault(t,this.process,ec,pcb);
+ process.remove();
+ }
+ }
+
+ // An engine convenience method
+ private boolean evaluate( IPMDChangeCondition dCC,
+ IPMDProcess pDef, IEvaluationContext ec, IProcessCallBack pcb)
+ throws BPException {
+
+ boolean result = true;
+
+ if (dCC == null ) {
+ if ( logger.isLoggable(Level.FINE)) {
+ logger.fine(pDef.getLabel() +" has no conditions.");
+ }
+ return result;
+ }
+
+ // Acquire a Conditional implementation from the definition
+ Conditional cond = dCC.getConditionalImpl();
+
+ // create a context resolver to pass to the evaluate
+ ContextResolver resolver=new ContextResolver(process,
+ (IPMDLocatorHolder)dCC,this.getContextService(),this.getScopeService());
+
+ // Evaluate the ruleset
+ boolean bln = cond.evaluate(resolver);
+ if ( bln ) {
+
+ logConditionEvaluation( true, dCC, pDef );
+
+ // NOTE: the conditional evaluation returns true or false. This indicates
+ // where the action should fire. It does not indicate that the engine should
+ // terminate
+
+ Iterator iAction = dCC.getActions();
+
+ result = executeActions(iAction,pDef,ec,pcb);
+ }
+ else
+ {
+ logConditionEvaluation( false, dCC, pDef );
+
+ Iterator iAction = dCC.getFalseActions();
+
+ result = executeActions(iAction,pDef,ec,pcb);
+ }
+
+ return result;
+ }
+
+ private boolean executeActions(Iterator iAction, IPMDProcess pDef,
+ IEvaluationContext ec, IProcessCallBack pcb) throws BPException {
+ // NOTE: if any action implementation returns false the processing
+ // cycle is halted. It is assumed that an action that halts processing
+ // is waiting for a piece of data and has notified the event director
+ // of this fact.
+
+ boolean result = true;
+
+ while (iAction.hasNext() && result) {
+ IPMDAction actionMD = (IPMDAction) iAction.next();
+
+ // Acquire the Action implementation
+ IInternalAction action = actionMD.getActionImpl();
+
+ //create a context resolver to pass to the evaluate
+ ContextResolver resolver=new ContextResolver(process,(IPMDLocatorHolder)actionMD,
+ getContextService(),this.getScopeService());
+
+ // execute the action implementation
+ result =
+ action.execute(resolver,
+ ec,
+ pcb, process, pDef);
+
+ logActionExecution(result, action);
+ }
+
+ return result;
+ }
+
+
+
+
+ private void logActionExecution(boolean result,
+ IInternalAction action)
+ {
+ if (logger.isLoggable(Level.FINER))
+ {
+ logger.fine( "\n * Engine executed Action( class = "
+ + action.getClass().getName()
+ + ", retValue = " + result +" )");
+ }
+
+ }
+
+ private void logConditionEvaluation(boolean b,
+ IPMDChangeCondition dcc,
+ IPMDProcess def)
+ {
+ if (logger.isLoggable(Level.FINER))
+ {
+ logger.fine( "\n * Engine condition evaluated to " + b +
+ " for defintion( label = " + def.getLabel() +
+ ", key = " + def.getKey().getValue() + ")");
+
+ }
+
+ }
+
+ // An engine convenience method. Iterates over a collection of ChangeConditions
+ private boolean evaluate(
+ Iterator iCC,
+ IPMDProcess pDef, IEvaluationContext ec,
+ IProcessCallBack pcb)
+ throws BPException {
+ boolean result = true;
+
+ // NOTE: if any action implementation returns false the processing
+ // cycle is halted. It is assumed that an action that halts processing
+ // is waiting for a piece of data and has notified the event director
+ // of this fact.
+
+
+ while (iCC.hasNext() && result) {
+ result = evaluate((IPMDChangeCondition) iCC.next(),
+ pDef, ec, pcb);
+ }
+
+ return result;
+ }
+
+ private void logProcessStatus(String positionIdentifier) throws BPException {
+ if ( logger.isLoggable(Level.FINE)
+ || logger.isLoggable(Level.FINER)){
+ // we get the variable log size here so that runtimely user is able
+ // to change the variable log size
+ String variableLogSize = LogManager.getLogManager().getProperty(VARIABLE_LOGGING_SIZE_PROP);
+
+ if (variableLogSize != null) {
+ // debug log size property is defined
+ // convert the value to integer
+ this.debugVariableLogSize = (new Integer(variableLogSize)).intValue();
+
+ if (this.debugVariableLogSize < 0) {
+ // it is a negative value, treate it as log the full content
+ this.debugVariableLogSize = Integer.MAX_VALUE;
+ }
+ }
+
+ String loggerStr = "*********************************";
+ loggerStr += LINE_SEPERATOR;
+ //loggerStr += " * Engine Is Executing->" + getLabel();
+ loggerStr += positionIdentifier + getLabel();
+ loggerStr += LINE_SEPERATOR;
+ if (getDescription() != null) {
+ loggerStr += " * Detail Metadata Description->" + getDescription();
+ loggerStr += LINE_SEPERATOR;
+ }
+
+ if (logger.isLoggable(Level.FINER)) {
+ // need to log variables
+ loggerStr += " * Variable(s):";
+ loggerStr += LINE_SEPERATOR;
+
+ // get the initial iterator for the changed connections
+ Iterator changeConditionsIterator = process.getDefinition().getChangeConditions();
+ if (changeConditionsIterator != null) {
+ // has changed connections
+ // go through all changed conditions
+ while (changeConditionsIterator.hasNext()) {
+ // get the changed condition
+ IPMDChangeCondition changeCondition = (IPMDChangeCondition)(changeConditionsIterator.next());
+ // create a context resolver to pass to the evaluate
+ ContextResolver resolver = new ContextResolver(process,
+ (IPMDLocatorHolder)(changeCondition),this.getContextService(),this.getScopeService());
+ // log the variable for this changed condition
+ loggerStr = logVariables(loggerStr, resolver);
+ // get the initial iterator of the actions for this changed condition
+ Iterator iAction = changeCondition.getActions();
+ if (iAction != null) {
+ // has action
+ while (iAction.hasNext()) {
+ // go through the action
+ // get the action
+ IPMDAction actionMD = (IPMDAction) iAction.next();
+
+ // Acquire the Action implementation
+ actionMD.getActionImpl();
+
+ //create a context resolver to pass to the evaluate
+ ContextResolver actionResolver = new ContextResolver(process,
+ (IPMDLocatorHolder)actionMD,
+ getContextService(),
+ this.getScopeService());
+
+ // log variable for this action
+ loggerStr = logVariables(loggerStr, actionResolver);
+ }
+ }
+ }
+ }
+ }
+
+ loggerStr += " *********************************";
+ logger.fine(loggerStr);
+ }
+ }
+ private String logVariables(String loggerStr,
+ ContextResolver resolver) {
+ // get the locators
+ Iterator it = resolver.getLocatorHolder().getLocators();
+ if (it != null) {
+ // go through the locators
+ while (it.hasNext()) {
+ // get locator
+ IPMDLocator loc = (IPMDLocator) it.next();
+ // get locator name
+ String name = loc.getName();
+ try {
+ // get resolver for the name
+ ContextResolvedObject ro =
+ (ContextResolvedObject) resolver.resolveWithOutInvocation(name);
+ // In the case of experessions the variable name has been replaced with var1 or
+ // var2, etc. This is not very helpful to the user. Replace this name with a
+ // better variable name.
+ name = resolver.getResolvedVariableName(name);
+ if (ro != null) {
+ // resolver is not null
+ // get resulver value
+ Object resolvedValue = ro.getValue();
+ if (resolvedValue != null) {
+ // resolver value is valid
+ // check for size limitation
+ /*if (this.debugVariableLogSize == Integer.MAX_VALUE) {
+ // print full string
+ loggerStr += " * " + name + " = " + ro.getValue().toString();
+ } else {
+ // print string up to some size
+ // get the value string
+ String value = ro.getValue().toString();
+ if (value.length() > this.debugVariableLogSize) {
+ // value string's size is greater than the log size
+ // print out the string up to the log size
+ loggerStr += " * " + name + " = " + ro.getValue().toString().substring(0, this.debugVariableLogSize);
+ } else {
+ // value string's size is not greater than the log size
+ // print out the whole log string
+ loggerStr += " * " + name + " = " + ro.getValue().toString();
+ }
+ }*/
+ if (resolvedValue instanceof SPIAdapterInteraction)
+ {
+ SPIAdapterInteraction spi = (SPIAdapterInteraction) resolvedValue;
+ 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);
+ loggerStr += " * " + name + " = " + str;
+ }
+ else if ( spi.getUserValue().supportsGetValueAs(String.class))
+ {
+ String str = (String) spi.getUserValue().getValueAs(String.class);
+ loggerStr += " * " + name + " = " + str;
+ } else {
+ loggerStr += " * " + name + " = " + spi.getUserValue().toString();
+ }
+ }
+ } else {
+ // resolver value is null
+ loggerStr += " * " + name + " = null";
+ }
+ } else {
+ // resolver is null
+ loggerStr += " * " + name + " = null";
+ }
+ } catch (Exception e) {
+ // log the exception with the variable name
+ loggerStr += " * " + name + "->" + e.getClass().getName() + ":" + e.getLocalizedMessage();
+ }
+ loggerStr += LINE_SEPERATOR;
+ }
+ }
+ return loggerStr;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessInstanceKey.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessInstanceKey.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessInstanceKey.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessInstanceKey.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,48 @@
+/*
+* 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.engine;
+
+import java.io.Serializable;
+//import java.util.logging.Logger;
+
+import com.sybase.bpe.uuid.UUIDService;
+
+/** A unique identifier for a process instance.
+ * <P>
+ * This is a type safe ProcessKey class. */
+public class ProcessInstanceKey extends ProcessKey implements Serializable
+{
+ static final long serialVersionUID = 7060148401730358328L;
+
+// private static Logger logger =
+// Logger.getLogger(ProcessInstanceKey.class.getName());
+
+ public ProcessInstanceKey(UUIDService us)
+ {
+ super(us);
+ }
+
+ /** @param value */
+ public ProcessInstanceKey(java.lang.String value)
+ { super(value); }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessInstancePausedException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessInstancePausedException.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessInstancePausedException.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessInstancePausedException.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,45 @@
+/*
+* 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.engine;
+
+import com.sybase.bpe.util.BPException;
+
+public class ProcessInstancePausedException extends BPException
+{
+ static final long serialVersionUID = -27361981030381730L;
+
+
+ private String m_rootInstanceID;
+
+ public ProcessInstancePausedException( String rootInstanceID )
+ {
+ super( rootInstanceID);
+ m_rootInstanceID = rootInstanceID;
+ }
+
+ public String getRootInstanceID()
+ {
+ return m_rootInstanceID;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessInstanceQuery.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessInstanceQuery.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessInstanceQuery.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessInstanceQuery.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,55 @@
+/*
+* 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.engine;
+
+//import java.util.logging.Logger;
+
+/** The class is used to build params on which to query for process instances.
+ * <P>
+ * This is a type safe ProcessQuery class. */
+public class ProcessInstanceQuery extends ProcessQuery
+{
+
+// private static Logger logger =
+// Logger.getLogger(ProcessInstanceQuery.class.getName());
+ private ProcessInstanceQuery()
+ {
+ // Not a valid constructor
+ super();
+ }
+
+ public ProcessInstanceKey getInstanceKey()
+ {
+ return (ProcessInstanceKey)getKey();
+ }
+
+ /** @param key */
+ public void setInstanceKey(ProcessInstanceKey key)
+ {
+ setKey(key);
+ }
+
+ /** @param processKey */
+ public ProcessInstanceQuery(ProcessKey processKey)
+ { super(processKey); }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessKey.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessKey.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessKey.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessKey.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,80 @@
+/*
+* 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.engine;
+
+import java.io.Serializable;
+//import java.util.logging.Logger;
+
+import com.sybase.bpe.uuid.UUIDService;
+
+/** A unique identifier for a process definition or process instance. */
+public class ProcessKey implements Serializable
+{
+ static final long serialVersionUID = 3912287075455837427L;
+
+// private static Logger logger =
+// Logger.getLogger(ProcessKey.class.getName());
+ private java.lang.String value;
+
+ public ProcessKey() {}
+
+ public java.lang.String getValue()
+ {
+ return value;
+ }
+
+ /** @param newValue */
+ public void setValue(java.lang.String newValue)
+ {
+ value = newValue;
+ }
+
+ /** Generates a new UUID. */
+ public ProcessKey(UUIDService us)
+ {
+ value = us.getUUID();
+ }
+
+ /** @param value */
+ public ProcessKey(java.lang.String value)
+ {
+ this.value = value;
+ }
+
+ /** Object equality if based on it's unique ID value.
+ *
+ * @param obj */
+ public boolean equals(Object obj)
+ {
+ if ( obj instanceof ProcessKey ) {
+ return value.equals(((ProcessKey)obj).value);
+ }
+ return false;
+ }
+
+ /** Return the hashCode of it's unique iD value */
+ public int hashCode()
+ {
+ return value.hashCode();
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessQuery.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessQuery.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessQuery.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessQuery.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,55 @@
+/*
+* 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.engine;
+
+//import java.util.logging.Logger;
+
+public class ProcessQuery
+{
+
+// private static Logger logger =
+// Logger.getLogger(ProcessQuery.class.getName());
+ protected ProcessQuery()
+ {
+ // Not a valid constructor
+ }
+
+ public ProcessKey key;
+
+ public ProcessKey getKey()
+ {
+ return key;
+ }
+
+ /** @param newKey */
+ public void setKey(ProcessKey newKey)
+ {
+ key = newKey;
+ }
+
+ /** @param processKey */
+ public ProcessQuery(ProcessKey processKey)
+ {
+ key = processKey;
+ }
+
+}