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:35:26 UTC
svn commit: r381694 [25/38] - in /incubator/ode/scratch: bpe/ ode/
ode/bpelTests/ ode/bpelTests/probeService/ ode/bpelTests/test1/
ode/bpelTests/test10/ ode/bpelTests/test12/ ode/bpelTests/test13/
ode/bpelTests/test14/ ode/bpelTests/test15/ ode/bpelTes...
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELNode.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELNode.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELNode.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELNode.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,515 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on May 15, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ode.definition.IPMDLocator;
+import org.apache.ode.definition.IPMDLocatorHolder;
+import org.apache.ode.definition.IPMDProcess;
+import org.apache.ode.definition.service.DefinitionServiceException;
+import org.apache.ode.interaction.IInvocation;
+import org.apache.ode.interaction.builders.IInteractionBuilder;
+import org.apache.ode.util.NamespaceUtil;
+
+/**
+ * @author Lance
+ *
+ * The base class of all BPEL nodes.
+ *
+ */
+abstract class BPELNode {
+
+ BPELSchema m_tag; // BPEL element name
+ BPELNode m_parserStack; // nested parser stack - tracks the parser location within the BPEL document
+ BPELAttributes m_attributes; // attributes of the BPEL element
+ Vector m_parent = new Vector(); // relationship in the BPEL graph
+ Logger m_logger;
+
+ /**
+ * @param previous the parent schema node
+ * @param tag the schema tag name
+ * @param attrs the schema attributes
+ */
+ BPELNode(BPELNode previous, BPELSchema tag, BPELAttributes attrs, Logger logger) {
+ m_tag = tag;
+ m_attributes = attrs;
+ m_parserStack = previous;
+ m_logger = logger;
+ }
+
+ /**
+ * Returns a reference to the BPE runtime metadata model. The default
+ * behavior is to broadcast down the parsed stack.
+ * <p>
+ * Subclasses that actually hold an IPMDProcess reference will
+ * override this method.
+ * <p>
+ * @return a BPE metadata model process object
+ */
+ IPMDProcess getStartProcess() {
+ if ( m_parserStack != null ) return m_parserStack.getStartProcess();
+ return null;
+ }
+
+ /**
+ * Returns a reference to the BPE runtime metadata model. The default
+ * behavior is to broadcast down the parsed stack.
+ * <p>
+ * Subclasses that actually hold an IPMDProcess reference will
+ * override this method.
+ * <p>
+ * @return a BPE metadata model process object
+ */
+ IPMDProcess getEndProcess() {
+ if ( m_parserStack != null ) return m_parserStack.getEndProcess();
+ return null;
+ }
+
+
+ /**
+ * Pops an activity from the activity stack. When a BPEL element is closed
+ * the object is popped from the parser stack. Most subclasses will override
+ * this method to do work specific to a node. For example the BPELFlow object
+ * will link together source and target nodes when it is popped from the stack.
+ * <p>
+ * @return an enclosing BPELNode
+ * @throws DefinitionServiceException
+ */
+ BPELNode pop() throws DeploymentException {
+ return m_parserStack;
+ }
+
+ /**
+ * Returns a reference to the BPE runtime metadata model. The default
+ * behavior is to broadcast down the parsed stack.
+ * <p>
+ * Subclasses that actually hold an IPMDProcess reference will
+ * override this method.
+ * <p>
+ * @param label the name of runtime process
+ * @return a BPE metadata model process object
+ * @throws DefinitionServiceException
+ */
+ IPMDProcess createProcess(String label) throws DeploymentException {
+ if ( m_parserStack != null ) return m_parserStack.createProcess(label);
+ return null;
+ }
+
+ /**
+ * The attributes of a BPEL element.
+ *
+ * @return the BPEL element attributes
+ */
+ BPELAttributes getAttributes() {
+ return m_attributes;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ StringBuffer buff = new StringBuffer("Tag: " + m_tag.getValue());
+
+ Enumeration e = m_attributes.keys();
+ while (e.hasMoreElements()) {
+ String key = (String)e.nextElement();
+ buff.append("\n\t qname: " + key);
+ buff.append(" ---> " + m_attributes.getProperty(key));
+ }
+
+ return buff.toString();
+ }
+
+ /**
+ * Adds the activity into a structured activity.
+ * <p>
+ * Subclasses ( i.e. BPELFlow, BPELSequence ) override this method to add
+ * activities into their internal data structure and when the element is closed
+ * activities are linked together to form a runtime execution chain.
+ * <p>
+ * The default behavior is to broadcast down the parsed stack.
+ */
+ void addActivity(BPELNode activity) throws DeploymentException {
+ if ( m_parserStack != null ) m_parserStack.addActivity(activity);
+ }
+
+ /**
+ * Returns a variable from the BPEL node stack. Scopes hold a collection
+ * of variables.
+ * <p>
+ * Subclasses (i.e. BPELScope ) override this method to return the
+ * requested variable from their internal data structure.
+ * <p>
+ * The default behavior is to broadcast down the parsed stack.
+ * <p>
+ * @param varName the name of a BPEL variable
+ * @return A BPEL variable
+ */
+ BPELVariable getVariable(String varName) throws DeploymentException {
+ if ( m_parserStack != null ) return m_parserStack.getVariable(varName);
+ return null;
+ }
+
+ /**
+ * Asks the call stack for a bpws:property name.
+ *
+ * @param propertyName
+ * @param var
+ * @return
+ */
+
+ BPELAttributes getPropertyAttributes(QName qn, QName varMsgType) throws DeploymentException {
+ if ( m_parserStack != null ) return m_parserStack.getPropertyAttributes(qn, varMsgType);
+ return null;
+ }
+
+ /**
+ * Adds a variable into the BPEL node stack. This is used to insert system
+ * variables into the process context. For example, the process synchronizer
+ * needs a variable to track thread synchronization.
+ *
+ * <p>
+ * The default behavior is to broadcast down the parsed stack.
+ */
+ void addVariable(BPELVariable var) {
+ if ( m_parserStack != null ) m_parserStack.addVariable(var);
+ }
+
+ /**
+ * Returns a link from the BPEL node stack.
+ * <p>
+ * Subclasses (i.e. BPELFlow ) override this method to return the
+ * requested BPEL link from their internal data structure.
+ * <p>
+ * The default behavior is to broadcast down the parsed stack.
+ * <p>
+ * @param name the name of a BPEL link
+ * @return the link object
+ * @throws DefinitionServiceException
+ */
+ BPELLink setLink(String name, BPELNode node, BPELLinkType linkType, String tCondition) throws DeploymentException {
+ if ( m_parserStack != null ) return m_parserStack.setLink(name, node, linkType, tCondition);
+ return null;
+ }
+
+ BPELLink notifyLink(BPELLink link, BPELFlow node) throws DeploymentException {
+ if ( m_parserStack != null ) return m_parserStack.notifyLink(link, node);
+ return null;
+ }
+
+ /**
+ * Returns the next scope ID. Scope name is not a required attribute of the scope.
+ * Therefore, a scope will need to ask for the next available ID to create a
+ * unique name.
+ * <p>
+ * The default behavior is to broadcast down the parsed stack.
+ * <p>
+ */
+ int getScopeCounter() {
+ if ( m_parserStack != null ) return m_parserStack.getScopeCounter();
+ return 0;
+ }
+
+ /**
+ * Returns the last BPELScope Object found in the parser stack.
+ * <p>
+ * The default behavior is to broadcast down the parsed stack.
+ * <p>
+ * @return the BPLEScope object
+ */
+
+ BPELScope getScope() {
+ if ( m_parserStack != null ) return m_parserStack.getScope();
+ return null;
+ }
+
+
+ /**
+ * Returns the Scope Path. The scope path is used to create a namespace for
+ * a BPEL variable.
+ * <p>
+ * The default behavior is to broadcast down the parsed stack.
+ * <p>
+ */
+ BPELScopePath getScopePath(BPELScopePath path) {
+ if ( m_parserStack != null ) return m_parserStack.getScopePath(path);
+ return null;
+ }
+
+ /**
+ * Adds a correlation name into the object on which the correlation is mapped.
+ * The method is overridden by nodes that hold a correlation (i.e. BPELInvoke,
+ * BPELReply ... )
+ * <p>
+ * The default behavior is to broadcast down the parsed stack.
+ * <p>
+ * @param node
+ */
+ void addCorrelation(BPELCorrelation correlation){
+ if ( m_parserStack != null ) m_parserStack.addCorrelation(correlation);
+ }
+
+ /**
+ * Adds an event handler into the object that holds event handler collections.
+ * The method is overridden by nodes taht hold an event handler ( i.e. BPELScope )
+ * <p>
+ * The default behavior is to broadcast down the parsed stack.
+ * <p>
+ * @param event the BPELEvent object
+ */
+ void addEventHandler(BPELEvent event) {
+ if ( m_parserStack != null ) m_parserStack.addEventHandler(event);
+ }
+
+ /**
+ * Broadcasts a request for a BPELCorrelationSet to the parser stack.
+ * The method is overridden by nodes ( BPELScope ) that hold a
+ * correlationSet collection.
+ * <p>
+ * @param name the name of a BPELCorrelationSet
+ * @return the BPELCorrelationSet object
+ */
+ BPELCorrelationSet getCorrelationSet(String name) {
+ if ( m_parserStack != null ) return m_parserStack.getCorrelationSet(name);
+ return null;
+ }
+
+ /**
+ * Adds a parent into the nodes parent collection.
+ */
+ void addParent(BPELNode node) {
+ m_parent.add(node);
+ }
+
+ /**
+ * Adds BPEL data into a BPEL node. BPEL data is any non-attribute data.
+ * The method is overridden by nodes that actually hold non-attribute data,
+ * (i.e. BPELFrom).
+ * <p>
+ * @param data the literal BPEL data
+ */
+ void addData(String data) {
+ // No-op
+ }
+ String getData() {
+ return null;
+ }
+
+ /**
+ * Allows an object to return itself as a proxy for a link source
+ * <p>
+ * The method is overridden by objects that may cross a thread boundry.
+ * <p>
+ */
+
+ BPELNode getProxy(BPELFlow linkOwner,BPELNode source) {
+ if ( m_parserStack != null ) return m_parserStack.getProxy(linkOwner,source);
+ return source;
+ }
+
+
+ /**
+ * Allows threaded objects to add themselves into a result set. The result
+ * set is used to make decisions about locking constraints on BPELVariables.
+ * <p>
+ * The method is overridden by objects that may cross a thread boundry.
+ * <p>
+ * @param hs a collection of objects that cross thread boundries
+ * @return the collection of threaded objects.
+ */
+ HashSet collectThreadBoundries(HashSet hs) {
+
+ for ( Iterator i = m_parent.iterator(); i.hasNext(); ) {
+ ((BPELNode)i.next()).collectThreadBoundries(hs);
+ }
+ return hs;
+ }
+
+ /**
+ * Broadcasts a request for a suppressJoinFailure attribute to the
+ * parser stack. The method is overridden by nodes ( BPELScope ) that hold a
+ * suppressJoinAttribute.
+ * <p>
+ * Per the BPEL spec: <br>
+ * A value of "yes" of this attribute has the effect of suppressing the
+ * bpws:joinFailure fault for the activity and all nested activities,
+ * except wehre the effect is overridden by using the suppressJoinFailure
+ * attribute with a value of "no" in a nested activity. Suppressing the
+ * bpws:joinFailure is equivalent to the fault being logically caught by a
+ * special default handler attached to an implicit scope that immediately
+ * encloses just the activity with the join condition.
+ * <p>
+ * @return the value of the suppressJoinAttribute
+ */
+ BPELBoolean getSuppressJoinFailure() {
+ if ( BPELBoolean.YES.equals(m_attributes.getSuppressJoin())) return BPELBoolean.YES;
+ if ( m_parserStack != null ) return m_parserStack.getSuppressJoinFailure();
+ return BPELBoolean.NO;
+ }
+
+ /**
+ * Broadcasts a request for a BPELProcess node to the parser stack.
+ * The method is overridden by nodes ( BPELProcess ) that hold a
+ * IPMDRoot object.
+ * <p>
+ * @return the BPELProcess object
+ */
+ BPELProcess getProcess() {
+ return m_parserStack.getProcess();
+ }
+
+ /**
+ * Broadcasts a request for the current path type ( absolute or relative ).
+ * The method is overridden my nodes ( BPELCompensationHandler ) that hold
+ * an type value.
+ *
+ */
+ boolean inCompensationHandler() {
+ if ( m_parserStack != null ) return m_parserStack.inCompensationHandler();
+ return false;
+ }
+
+ /**
+ * Mark the business process as a statefull business process.
+ */
+ void setIsStateFull() {
+ if ( m_parserStack != null ) m_parserStack.setIsStateFull();
+ }
+
+ /**
+ * Broadcasts a request for the URI of a namespace prefix. BPEL nodes are
+ * extensible and can contain the "xmlns" attribute.
+ *
+ * @param prefix - a namespace prefix alias
+ * @return the URI of the namespace prefix alias
+ */
+ String getNamespace(String prefix) throws DeploymentException {
+ String uri = null;
+
+ if ( prefix == null ) {
+ uri = getAttributes().getProperty(BPELSchema.NAMESPACE_KEY);
+ } else {
+ uri = getAttributes().getProperty(BPELSchema.NAMESPACE_KEY+BPELSchema.PREFIX_SEPERATOR+prefix);
+ }
+
+ if ( uri == null ) {
+ if ( m_parserStack != null ) uri = m_parserStack.getNamespace(prefix);
+ }
+ return uri;
+ }
+
+ HashMap getNamespaceMap( String locationPath ) throws DeploymentException
+ {
+ HashMap locationNS = null;
+ if ( locationPath != null ) {
+ Collection prefs = NamespaceUtil.getNamespacePrefixes(locationPath);
+ locationNS = new HashMap();
+ for ( Iterator prefsItr = prefs.iterator(); prefsItr.hasNext();){
+ String prefix = (String)prefsItr.next();
+ String uri = getNamespace(prefix);
+ if ( uri == null )
+ BPELUtil.throwNewException(m_logger,Level.SEVERE,
+ "DEPLOY_UNKNOWN_NS",new Object[]
+ {getProcess().getAttributes().getName(),prefix},null);
+ locationNS.put(prefix,uri);
+ }
+ }
+ return locationNS;
+ }
+
+ /**
+ *
+ * @return the target namespace
+ */
+ String getTargetNamespace() throws DeploymentException {
+ if ( m_parserStack != null ) return m_parserStack.getTargetNamespace();
+ return null;
+ }
+
+ /**
+ * Broadcasts a request for the qualified name of a BPEL value.
+ *
+ * @param qname - a namespace qualified value
+ * @return the QName of the qualified value
+ */
+ QName getQName(String qname) throws DeploymentException {
+ if ( qname == null ) return null;
+
+ String[] qname_split = qname.split(BPELSchema.PREFIX_SEPERATOR);
+ String uri = null;
+ String localName = null;
+
+ switch (qname_split.length) {
+ case 1 :
+ localName = qname_split[0];
+ uri = getNamespace(null);
+ break;
+
+ case 2 :
+ localName = qname_split[1];
+ uri = getNamespace(qname_split[0]);
+ break;
+
+ default :
+ BPELUtil.throwNewException(m_logger,Level.SEVERE,"DEPLOY_UNKNOWN_QN",new Object[] {qname},null);
+ }
+
+ return new QName(uri,localName);
+ }
+
+ void addJoinCondtion(BPELVariable var) throws DeploymentException {
+ //no-op
+ }
+
+ String getQueryLanguage() {
+ return m_parserStack.getQueryLanguage();
+ }
+
+ String getExpressionLanguage() {
+ return m_parserStack.getExpressionLanguage();
+ }
+
+ IPMDLocator createLocator(boolean capture, IPMDLocatorHolder locatorHolder, String name,
+ String path, IInvocation query,
+ IInteractionBuilder interactionBuilder, int type,
+ boolean forOutput, boolean contentious) throws DefinitionServiceException {
+
+
+ IPMDLocator loc = locatorHolder.createLocator(name,
+ path, query, interactionBuilder, type, forOutput, contentious);
+ if ( inCompensationHandler() && capture )
+ getScope().setCompLocatorCapture(loc);
+ return loc;
+
+ }
+
+
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELOnAlarm.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELOnAlarm.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELOnAlarm.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELOnAlarm.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Jul 12, 2003
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.action.bpel.UnInitVariableMetaData;
+import org.apache.ode.definition.IPMDAction;
+import org.apache.ode.definition.IPMDChangeCondition;
+import org.apache.ode.definition.IPMDOperation;
+import org.apache.ode.definition.service.DefinitionServiceException;
+
+
+/**
+ * Implements the BPEL <i>onAlarm</i> node. Alarm events are held by <i>scopes</i>.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tOnAlarm.
+ *
+ * @author waterman
+ * @see BPELScope
+ */
+class BPELOnAlarm extends BPELEvent {
+
+ private static final Logger logger = Logger.getLogger(BPELOnAlarm.class.getName());
+
+ /**
+ * @param previous the parent schema node
+ * @param attrs the schema attributes
+ */
+ BPELOnAlarm(
+ BPELNode previous,
+ BPELAttributes attrs) throws DeploymentException {
+ super(previous, BPELSchema.ONALARM, attrs, logger);
+ }
+
+ // Registers OnMessage
+ protected IPMDOperation getOperation(IPMDAction regAct, IPMDChangeCondition ccB) throws DeploymentException {
+
+ IPMDAction recact=null;
+ String timeValue=null;
+
+ try {
+
+ recact = ccB.createAction("TimerAction:" + getAttributes().getName(),
+ org.apache.ode.action.bpel.TimerAction.class.getName());
+ timeValue = getAttributes().getUntil();
+ if ( timeValue != null ) {
+ //recact.addMetadata(org.apache.ode.action.bpel.TimerAction.DEADLINE,timeValue);
+ buildExpression(recact,timeValue,org.apache.ode.action.bpel.TimerAction.DEADLINE);
+ }
+ timeValue = getAttributes().getFor();
+ if ( timeValue != null ) {
+ //recact.addMetadata(org.apache.ode.action.bpel.TimerAction.DURATION,timeValue);
+ buildExpression(recact,timeValue,org.apache.ode.action.bpel.TimerAction.DURATION);
+ }
+ recact.addMetadata(org.apache.ode.action.bpel.CopyAction.UNINITVAR_KEY,new UnInitVariableMetaData(BPELSchema.BPEL_URI,BPELSchema.FAULT_UNINIT_VAR));
+ createLocator(false,recact,
+ org.apache.ode.action.bpel.TimerAction.TIMER_ACTION_LOCATOR_KEY,
+ getScopePath(new BPELScopePath(inCompensationHandler())).
+ toString()+BPELScopePath.PATH_DELIMITER+
+ getStartProcess().getKey().getValue(),
+ null, null, 0, true, false);
+ recact.addMetadata(org.apache.ode.action.bpel.TimerAction.BLOCK,new Boolean(false));
+ recact.addMetadata(org.apache.ode.action.bpel.TimerAction.DEFINITION,getStartProcess().getKey().getValue());
+
+ } catch (DefinitionServiceException e) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e);
+ }
+
+ return null;
+
+ }
+
+ private void buildExpression(IPMDAction ccact, String expr, String actprop) throws DefinitionServiceException, DeploymentException {
+ BPELExpressionVariable expVar = new BPELExpressionVariable(expr);
+ ccact.addMetadata(actprop,expVar.createLocator(ccact,this,null,null,BPELInvocationType.SELECT_VALUE,false));
+ }
+
+
+ BPELNode pop() throws DeploymentException {
+
+ getProcess().setIsStateFull();
+
+ return super.pop();
+ }
+
+
+ /**
+ * @see org.apache.ode.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+ */
+ String getActivityDescription() {
+ return "onAlarm is implemented by: " + org.apache.ode.action.bpel.TimerAction.class.getName() + ". It is used to trigger an alarm event and is deactivated on scope end.";
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELOnMessage.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELOnMessage.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELOnMessage.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELOnMessage.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Jul 12, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.definition.IPMDAction;
+import org.apache.ode.definition.IPMDChangeCondition;
+import org.apache.ode.definition.IPMDCorrelation;
+import org.apache.ode.definition.IPMDOperation;
+import org.apache.ode.definition.IPMDProcess;
+import org.apache.ode.definition.IPMDRoot;
+import org.apache.ode.definition.service.DefinitionServiceException;
+import org.apache.ode.event.IStaticKey;
+
+/**
+ * Implements the BPEL <i>onMessage</i> node. Message events are held by <i>scopes</i>,
+ * and are similar in function to BPELReceive.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tOnMessage.
+ *
+ * @author waterman
+ * @see BPELScope
+ */
+class BPELOnMessage extends BPELEvent {
+
+ private static final Logger logger = Logger.getLogger(BPELCompensate.class.getName());
+
+ /**
+ * @param previous the parent schema node
+ * @param attrs the schema attributes
+ */
+ BPELOnMessage(
+ BPELNode previous,
+ BPELAttributes attrs) throws DeploymentException {
+ super(previous, BPELSchema.ONMESSAGE, attrs, logger);
+ }
+
+
+ BPELNode pop() throws DeploymentException {
+
+ IPMDProcess process = getStartProcess();
+
+ BPELVariable var = ( getAttributes().getVariable() != null ) ? getVariable(getAttributes().getVariable()) : null;
+
+ // Create the change condition
+ IPMDAction recact=null;
+ try {
+ IPMDChangeCondition cc =
+ process.createChangeCondition("ChangeCondition: " + getAttributes().getName(),
+ org.apache.ode.condition.DefaultConditional.class.getName());
+
+ recact =
+ cc.createAction(
+ "ReceiveAction:" + getAttributes().getName(),
+ org.apache.ode.action.bpel.ReceiveAction.class.getName());
+ recact.addMetadata(org.apache.ode.action.bpel.ReceiveAction.PARTNER_LINK,
+ getAttributes().getPartnerLink());
+ } catch (DefinitionServiceException e) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e);
+ }
+
+ if ( var != null) {
+ var.createLocator(recact,this,null,BPELInvocationType.SELECT_NODE,true);
+ }
+
+ // make this a stateful process only if this on message
+ // doesn't belong to an instantiating pick
+ BPELAttributes attrs = this.m_parserStack.getAttributes();
+ if ( this.m_parserStack instanceof BPELPick &&
+ (! attrs.containsKey(BPELSchema.CREATEINSTANCE_ATTR.getValue()) ||
+ ! attrs.getCreateInstance().equals("yes"))) {
+ getProcess().setIsStateFull();
+ }
+
+ return super.pop();
+ }
+
+ /**
+ * @see org.apache.ode.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+ */
+ String getActivityDescription() {
+ return "onMessage is implemented by: " + org.apache.ode.action.bpel.ReceiveAction.class.getName() + ". It is used to handle a message event and is deactivated on scope end.";
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.deployment.bpel.BPELIOActivity#createOperation(org.apache.ode.definition.service.IPMDRoot, java.lang.String, org.apache.ode.event.IStaticKey, org.apache.ode.definition.service.IPMDCorrelation, boolean, java.lang.String)
+ */
+ protected IPMDOperation createOperation(IPMDRoot defRoot,
+ String operationId, IStaticKey key, IPMDCorrelation corrl,
+ boolean instanceCreating, String defId) {
+ return defRoot.createOnMessageOperation(operationId, key, corrl,
+ instanceCreating, defId);
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELOtherwise.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELOtherwise.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELOtherwise.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELOtherwise.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Jul 10, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+/**
+ * Implements the BPEL <i>otherwise</i> node. The otherwise node is held by <i>swith</i>.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tOtherwise.
+ *
+ * @author waterman
+ * @see BPELSwitch
+ */
+class BPELOtherwise extends BPELCase {
+
+ /**
+ * @param previous the parent schema node
+ * @param attrs the schema attributes
+ */
+ BPELOtherwise(BPELNode previous, BPELAttributes attrs) {
+ super(previous, BPELSchema.OTHERWISE, attrs);
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELParser.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELParser.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELParser.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELParser.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on May 13, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import org.apache.ode.definition.service.DefinitionService;
+import org.apache.ode.util.BPException;
+
+/**
+ * @author waterman
+ *
+ * Initializes the SAX parser used to process the BPEL doc.
+ *
+ */
+class BPELParser {
+
+ private static final Logger logger = Logger.getLogger(BPELParser.class.getName());
+
+
+ private static final String JAXP_NAMESPACE_INCLUDE =
+ "http://xml.org/sax/features/namespace-prefixes";
+ private static final String JAXP_SCHEMA_LANGUAGE =
+ "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ private static final String W3C_XML_SCHEMA =
+ "http://www.w3.org/2001/XMLSchema";
+ private static final String JAXP_SCHEMA_SOURCE =
+ "http://java.sun.com/xml/jaxp/properties/schemaSource";
+ private static final String DEFAULT_BPELSCHEMA_NAME = "BPEL4WS.xsd";
+
+
+ static BPELDefinitionKey parseBPEL(String documentName, byte[] bpelDoc, HashMap supportDoc, DefinitionService ds, boolean validating, String schemaPath) throws BPException {
+
+ try {
+
+ if ( schemaPath == null ) schemaPath = DEFAULT_BPELSCHEMA_NAME;
+
+ // Use JAXP to initialize the parser impl
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ if ( factory == null ) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"JAXP_SAX_FACTORY_NOTFOUND",null,null);
+ }
+
+ factory.setValidating(validating);
+ factory.setNamespaceAware(true);
+ factory.setFeature(JAXP_NAMESPACE_INCLUDE,true);
+
+ SAXParser saxParser = factory.newSAXParser();
+ if ( saxParser == null ) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"JAXP_SAX_PARSER_INVALID",null,null);
+ }
+
+ if ( validating ) {
+ saxParser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
+ saxParser.setProperty(JAXP_SCHEMA_SOURCE, new File(schemaPath));
+ }
+
+ // Create a SAX InputSource from the byte array that is holding the BPEL Doc
+ ByteArrayInputStream bais = new ByteArrayInputStream(bpelDoc);
+ InputSource is = new InputSource(bais);
+ bais.close();
+
+ // Parse the BPEL doc using the overloaded SAX DefaultHandler
+ BPELSAXHandler sh = new BPELSAXHandler(documentName, supportDoc, ds);
+ saxParser.parse(is, sh );
+
+ return sh.getDefKey();
+
+ } catch (ParserConfigurationException e) {
+ DeploymentException bpx = new DeploymentException("NATIVE_EXCEPTION",new Object[] {"ParserConfigurationException"},e);
+ bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ } catch (SAXException e) {
+ if ( e.getException() instanceof BPException ) {
+ throw (BPException)e.getException();
+ } else {
+ DeploymentException bpx = new DeploymentException("NATIVE_EXCEPTION",new Object[] {"SAXException"},e);
+ bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ }
+ } catch (IOException e) {
+ DeploymentException bpx = new DeploymentException("NATIVE_EXCEPTION",new Object[] {"IOException"},e);
+ bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ }
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELPatternValue.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELPatternValue.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELPatternValue.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELPatternValue.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Aug 27, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+/**
+ * @author waterman
+ *
+ */
+public class BPELPatternValue {
+
+ private static final String IN_VALUE = "in";
+ private static final String OUT_VALUE = "out";
+ private static final String OUTIN_VALUE = "out-in";
+
+ private String m_value;
+
+ private BPELPatternValue() {
+ }
+
+ private BPELPatternValue(String value) {
+ m_value = value;
+ }
+
+ static final BPELPatternValue IN = new BPELPatternValue(IN_VALUE);
+ static final BPELPatternValue OUT = new BPELPatternValue(OUT_VALUE);
+ static final BPELPatternValue OUTIN = new BPELPatternValue(OUTIN_VALUE);
+
+ public boolean equals(Object obj)
+ {
+ if ( obj instanceof BPELPatternValue ) {
+ return m_value.equals(((BPELPatternValue)obj).m_value);
+ }
+ if ( obj instanceof String ) {
+ return m_value.equals((String)obj);
+ }
+ return false;
+ }
+
+ public int hashCode()
+ {
+ return m_value.hashCode();
+ }
+
+ public String getValue() {
+ return m_value;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELPick.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELPick.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELPick.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELPick.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,264 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Jul 15, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.action.bpel.RegisterAction;
+import org.apache.ode.definition.IPMDAction;
+import org.apache.ode.definition.IPMDChangeCondition;
+import org.apache.ode.definition.IPMDOperation;
+import org.apache.ode.definition.service.DefinitionServiceException;
+
+
+/**
+ * Implements the BPEL <i>pick</i> node. The pick node holds a collection of
+ * on message events.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tPick.
+ *
+ * @author waterman
+ * @see BPELOnMessage
+ */
+class BPELPick extends BPELStructuredActivity {
+ private static final Logger logger = Logger.getLogger(BPELPick.class.getName());
+
+ private Vector m_eventHandlers = new Vector();
+// private Vector m_scopeEventHandlers;
+
+ private Vector links = new Vector();
+
+ /**
+ * @param previous the parent schema node
+ * @param attrs the schema attributes
+ */
+ BPELPick(BPELNode previous, BPELAttributes attrs)
+ throws DeploymentException {
+ super(previous, BPELSchema.PICK, attrs, logger);
+
+ createProcessSequence(getAttributes(),getEndProcess());
+ }
+
+ /**
+ * @see org.apache.ode.deployment.bpel.BPELNode#addEventHandler(org.apache.ode.deployment.bpel.BPELEvent)
+ */
+ void addEventHandler(BPELEvent event) {
+ m_eventHandlers.add(event);
+ }
+
+ /**
+ * @see org.apache.ode.deployment.bpel.BPELNode#pop()
+ */
+ BPELNode pop() throws DeploymentException {
+
+
+ // Link the end of the eventHandler to the end of the pick activity
+ for ( Iterator itr = m_eventHandlers.iterator(); itr.hasNext(); ) {
+ BPELEvent ev = (BPELEvent)itr.next();
+ ev.getActivity().linkProcess(BPELProcessType.END,this,BPELProcessType.END,false);
+ }
+
+ boolean isInstantiating = BPELBoolean.YES.equals(getAttributes().getCreateInstance());
+
+ if ( isInstantiating ) {
+ // The pick is instantiating so hijack the scopes eventHandlers
+ // to be registered when the pick ends
+ Vector ev = getScope().getEventHandlers();
+ for ( Iterator itr = ev.iterator(); itr.hasNext(); ) {
+
+ // TODO: Lance - register with end pick
+ }
+
+ ev.clear();
+
+ setEventHandlers();
+ } else {
+
+
+ try {
+ IPMDChangeCondition ccB = getStartProcess().createChangeCondition("Start Pick: "+getAttributes().getName(),
+ org.apache.ode.condition.DefaultConditional.class.getName());
+
+ IPMDAction regact = createRegisterAction(ccB,getAttributes().getName());
+
+ // Create the end pick action
+ IPMDChangeCondition ccE = getEndProcess().createChangeCondition("End Pick: "+getAttributes().getName(),
+ org.apache.ode.condition.DefaultConditional.class.getName());
+ IPMDAction remact = createUnRegisterAction(ccE,getAttributes().getName());
+
+ // register event handlers
+ setEventHandlers(regact, remact, ccB, isInstantiating);
+
+ // Create the blocking action
+ ccB.createAction("BlockingAction: " + getAttributes().getName(),
+ org.apache.ode.action.bpel.BlockingAction.class.getName());
+
+ } catch (DefinitionServiceException e) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e);
+ }
+ }
+
+ createEnd();
+
+ return super.pop();
+ }
+
+ private void setEventHandlers(IPMDAction regAct, IPMDAction unRegAct, IPMDChangeCondition ccB, boolean isInstantiating) throws DeploymentException {
+
+ ArrayList ops = new ArrayList();
+ IPMDOperation op = null;
+
+ for ( Iterator itr = m_eventHandlers.iterator(); itr.hasNext(); ) {
+
+ op = ((BPELEvent)itr.next()).getOperation(regAct,ccB);
+ getProcess().addNonInstanceCreatingStaticKey(op.getKey());
+ if ( op != null ) ops.add( op );
+ }
+ try {
+ regAct.addMetadata(RegisterAction.OPERATIONS,ops);
+ regAct.addMetadata(RegisterAction.BLOCK,new Boolean("false"));
+ unRegAct.addMetadata(RegisterAction.OPERATIONS,ops);
+ } catch (DefinitionServiceException e) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e);
+ }
+
+ }
+
+ private void setEventHandlers() throws DeploymentException {
+
+ ArrayList ops = new ArrayList();
+// IPMDOperation op = null;
+ Properties pickProps = new Properties();
+
+ for ( Iterator itr = m_eventHandlers.iterator(); itr.hasNext(); ) {
+
+ BPELEvent be = (BPELEvent)itr.next();
+
+ pickProps.put(be.getStartProcess().getKey().getValue(),be.getStaticKey());
+
+ IPMDAction recact = null;
+
+ // Find the receive action on the Event
+ for (Iterator ccItr = be.getStartProcess().getChangeConditions(); ccItr.hasNext(); ) {
+ IPMDChangeCondition cc = (IPMDChangeCondition)ccItr.next();
+ for (Iterator actItr = cc.getActions(); actItr.hasNext(); ) {
+ recact = (IPMDAction)actItr.next();
+
+ if ( recact.getActionClass().equals(org.apache.ode.action.bpel.ReceiveAction.class.getName())) {
+ break;
+ }
+ recact = null;
+ }
+ }
+
+ if ( recact == null ) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_NORECEIVE_FOUND",null,null);
+ }
+
+ BPELVariable var = ( be.getAttributes().getVariable() != null ) ? getVariable(be.getAttributes().getVariable()) : null;
+
+ IPMDOperation initOp = be.getOperation(null,recact,var,BPELPatternValue.IN,true,null);
+ getProcess().addInstanceCreatingStaticKey(initOp.getKey());
+ getProcess().getDefinitionRoot().addInstanceCreatingOperation(initOp);
+
+ ops.add(initOp);
+
+ try {
+ recact.addMetadata(RegisterAction.OPERATIONS,ops);
+ } catch (DefinitionServiceException e1) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e1);
+ }
+ }
+
+ try {
+ IPMDChangeCondition cc = getStartProcess().createChangeCondition("Start Pick: "+getAttributes().getName(),
+ org.apache.ode.condition.DefaultConditional.class.getName());
+ IPMDAction ss = cc.createAction("Start Pick: "+getAttributes().getName(),
+ org.apache.ode.action.bpel.PickAction.class.getName());
+ ss.setMetadata(pickProps);
+ } catch (DefinitionServiceException e) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e);
+ }
+
+
+ }
+
+ /**
+ * @see org.apache.ode.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+ */
+ String getActivityDescription() {
+ return "pick is implemented by: " + org.apache.ode.action.bpel.BlockingAction.class.getName() + ". It is used to block the business process until a specific message event arrives.";
+ }
+
+ BPELLink notifyLink(BPELLink link, BPELFlow node) throws DeploymentException {
+ // the link has crossed the pick boundry so capture it here
+ if ( link.getSource() != this && link.getTarget() != this ) {
+ links.add(link);
+ }
+ if ( m_parserStack != null ) return m_parserStack.notifyLink(link, node);
+ return null;
+ }
+
+ void createEnd() throws DeploymentException {
+
+ Vector linkLocators = new Vector();
+ //int inc=0;
+
+ IPMDChangeCondition ccE = null;
+ IPMDAction es = null;
+
+ // Create the end switch action
+ try {
+ ccE = getEndProcess().createChangeCondition("End Pick: "+getAttributes().getName(),
+ org.apache.ode.condition.DefaultConditional.class.getName());
+ es = ccE.createAction("End Pick: "+getAttributes().getName(),
+ org.apache.ode.action.bpel.EndConditionalFlowAction.class.getName());
+ } catch (DefinitionServiceException e1) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e1);
+ }
+
+ // iterate over the transition links and add them as metadata
+ // the runtime will set all links at the end of the switch.
+ for ( Iterator linkItr = links.iterator(); linkItr.hasNext(); ) {
+ BPELLink link = (BPELLink)linkItr.next();
+ BPELVariable var = link.getTransitionCondVar();
+ linkLocators.add(var.createLocator(es,this,null,null,true));
+ }
+
+ Properties md = new Properties();
+ md.put(org.apache.ode.action.bpel.EndConditionalFlowAction.LINKS,linkLocators);
+
+ es.setMetadata(md);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.deployment.bpel.BPELNode#getProxy(org.apache.ode.deployment.bpel.BPELFlow, org.apache.ode.deployment.bpel.BPELNode)
+ */
+ BPELNode getProxy(BPELFlow linkOwner, BPELNode source) {
+ return this;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELProcess.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELProcess.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELProcess.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELProcess.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,279 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on May 23, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ode.definition.IPMDChangeCondition;
+import org.apache.ode.definition.IPMDProcess;
+import org.apache.ode.definition.IPMDRoot;
+import org.apache.ode.definition.service.DefinitionServiceException;
+//import org.apache.ode.definition.service.IPMDAction;
+import org.apache.ode.event.IStaticKey;
+import org.apache.ode.lang.ResourceGetter;
+import org.apache.ode.wsdl.extensions.BPELPropertyAlias;
+
+/**
+ * Implements the BPEL <i>process</i> node. The process node is the root of a
+ * business process graph.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tProcess.
+ *
+ * @author waterman
+ */
+class BPELProcess extends BPELStructuredActivity {
+
+ private static final Logger logger = Logger.getLogger(BPELProcess.class.getName());
+
+ private IPMDRoot m_processRoot;
+
+ // Holds a counter of scope IDs
+ private int m_scopeCount = 0;
+
+ // Holds a collection of BPELPropertyDefinition
+ private HashMap m_bpelProps;
+
+ private boolean m_isStateless = true;
+
+ //private boolean m_isProtectedIntantiation = false;
+ private HashSet instCreatingstaticKeys = new HashSet();
+ private HashSet nonInstCreatingstaticKeys = new HashSet();
+
+
+
+ /**
+ * @param previous the parent schema node
+ * @param attrs the schema attributes
+ */
+
+ BPELProcess(IPMDRoot newRoot, IPMDProcess process, BPELAttributes attrs, ExtensibilityArtifacts ea) throws DeploymentException {
+ super(null,BPELSchema.PROCESS,attrs,logger);
+
+ m_processRoot = newRoot;
+ ea.setProcess(this);
+
+ m_bpelProps = ea.buildProperties();
+
+ m_process = process;
+ m_endProcess = createProcess((m_attributes.getName() == null)? "end activity" : "end " + m_attributes.getName());
+
+ createProcessSequence(getAttributes(),getEndProcess());
+ }
+
+ /**
+ * @see org.apache.ode.deployment.bpel.BPELNode#addActivity(org.apache.ode.deployment.bpel.BPELNode)
+ */
+ void addActivity(BPELNode activity) throws DeploymentException {
+
+ createProcessSequence(activity.getAttributes(),activity.getStartProcess());
+
+ linkProcess(BPELProcessType.START,(BPELLinkedActivity)activity,BPELProcessType.START,true);
+
+ ((BPELLinkedActivity)activity).linkProcess(BPELProcessType.END,this,BPELProcessType.END,false);
+ }
+
+ /**
+ * Creates a new process definition from the root business process
+ *
+ */
+ IPMDProcess createProcess(String label) throws DeploymentException {
+
+ IPMDProcess ret = null;
+
+ try {
+ if ( m_process == null ) {
+ ret = (IPMDProcess)m_processRoot.createProcess(label);
+ } else {
+ ret = m_process.createUnLinkedProcess(label);
+ }
+ } catch (DefinitionServiceException e) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEPROCESS",new Object[] {getProcess().getAttributes().getName(), label},e);
+ }
+
+ return ret;
+ }
+
+ /**
+ * @see org.apache.ode.deployment.bpel.BPELNode#getScopeCounter()
+ */
+ int getScopeCounter() {
+ return m_scopeCount++;
+ }
+
+ /**
+ * @see org.apache.ode.deployment.bpel.BPELNode#getScopePath(org.apache.ode.deployment.bpel.BPELScopePath)
+ */
+ BPELScopePath getScopePath(BPELScopePath path) {
+
+ return path;
+
+ }
+
+ IPMDRoot getDefinitionRoot() {
+ return m_processRoot;
+ }
+
+ BPELProcess getProcess() {
+ return this;
+ }
+
+
+ BPELAttributes getPropertyAttributes(QName qn, QName varMsgType) throws DeploymentException {
+ BPELAttributes ret = new BPELAttributes();
+
+ if ( varMsgType == null ) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_MSGTYPE_NOTFOUND",new Object[] {getProcess().getAttributes().getName(),qn.toString()},null);
+ }
+
+ BPELPropertyDefinition bpelProp = (BPELPropertyDefinition)m_bpelProps.get(qn);
+
+ if ( bpelProp == null ) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_PROPERTY_NOTFOUND",new Object[] {getProcess().getAttributes().getName(),qn.toString()},null);
+ }
+
+ ret.put(BPELSchema.TYPE_ATTR.getValue(),bpelProp.getPropertyType());
+
+ // find a matching alias
+
+ for ( Iterator itr = bpelProp.getAlias(); itr.hasNext(); ) {
+ BPELPropertyAlias pa = (BPELPropertyAlias)itr.next();
+ if ( varMsgType.equals(pa.getMessageType())) {
+ if ( pa.getPart() != null ) ret.setProperty(BPELSchema.PART_ATTR.getValue(),pa.getPart());
+ if ( pa.getQuery() != null ) ret.setProperty(BPELSchema.QUERY_ATTR.getValue(),pa.getQuery());
+ if ( pa.getNamspaceMap() != null ) ret.setProperty("NSMAP", pa.getNamspaceMap());
+ ret.setProperty(BPELSchema.NAME_ATTR.getValue(),qn.getLocalPart());
+ break;
+ }
+ }
+
+ return ret;
+ }
+
+ BPELNode pop() throws DeploymentException {
+
+ IPMDChangeCondition cc = null;
+
+ try {
+
+ // Create the end process action
+ cc = getEndProcess().createChangeCondition("End Process: "+getAttributes().getName(),
+ org.apache.ode.condition.DefaultConditional.class.getName());
+ cc.createAction("End Process: "+getAttributes().getName(),
+ org.apache.ode.action.bpel.EndProcessAction.class.getName());
+ } catch (DefinitionServiceException e) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e);
+ }
+
+ return null;
+ }
+
+ BPELVariable getVariable(String varName) throws DeploymentException {
+
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_VARNOTFOUND", new Object[] {getAttributes().getName(), varName }, null);
+
+ return null;
+ }
+
+ void setIsStateFull() {
+ m_isStateless = false;
+ }
+
+ boolean getStateFlag() {
+ return m_isStateless;
+ }
+
+
+ void addInstanceCreatingStaticKey(IStaticKey staticKey ) {
+ instCreatingstaticKeys.add(staticKey.toString());
+ }
+
+ void addNonInstanceCreatingStaticKey(IStaticKey staticKey ) {
+ nonInstCreatingstaticKeys.add(staticKey.toString());
+ }
+
+ boolean getIsProtectedInstantiation() {
+ Iterator it = instCreatingstaticKeys.iterator();
+ while ( it.hasNext() ) {
+ String key = (String)it.next();
+ if ( ! nonInstCreatingstaticKeys.add(key) ) {
+ logger.log(Level.WARNING,ResourceGetter.getString("BPEL_PROTECT_INST"));
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.deployment.bpel.BPELNode#getNamespace(java.lang.String)
+ */
+ String getNamespace(String prefix) throws DeploymentException {
+ String uri = super.getNamespace(prefix);
+
+ if ( uri == null ) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"DEPLOY_UNKNOWN_NS",new Object[] {getAttributes().getName(),prefix}, null);
+ }
+
+ return uri;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.deployment.bpel.BPELNode#getTargetNamespace()
+ */
+ String getTargetNamespace() throws DeploymentException {
+ String tns = getAttributes().getProperty("targetNamespace");
+ if ( tns == null ) {
+ tns = getAttributes().getProperty(BPELSchema.NAMESPACE_KEY);
+ }
+
+ if ( tns == null ) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_TNSNOTFOUND",null,null);
+ }
+ return getAttributes().getProperty("targetNamespace");
+ }
+
+ String getQueryLanguage() {
+ return getAttributes().getQueryLanguage();
+ }
+
+ String getExpressionLanguage() {
+ return getAttributes().getExpressionLanguage();
+ }
+
+ /**
+ * @see org.apache.ode.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+ */
+ String getActivityDescription() {
+ return "process is the root node of a business process";
+ }
+
+ /**
+ * @param key
+ * @param supportDoc
+ */
+ public void addSupportingDocument(String key, String supportDoc) {
+ m_processRoot.addSupportingDocument(key, supportDoc);
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELProcessType.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELProcessType.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELProcessType.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELProcessType.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Jun 12, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+/**
+ * An enumeration of the process type. Structured BPEL activities ( BPELWhile,
+ * BPELSequence, ... ) hold both a beginning business process definition and
+ * and ending business process definition.
+ *
+ * @author waterman
+ *
+ */
+class BPELProcessType {
+
+ private String m_value;
+ private static final String START_VALUE = "START";
+ private static final String END_VALUE = "END";
+
+ private BPELProcessType() {
+
+ }
+
+ private BPELProcessType ( String type ) {
+ m_value = type;
+ }
+
+ static final BPELProcessType START = new BPELProcessType(START_VALUE);
+ static final BPELProcessType END = new BPELProcessType(END_VALUE);
+
+ String getValue()
+ {
+ return m_value;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELPropertyDefinition.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELPropertyDefinition.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELPropertyDefinition.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELPropertyDefinition.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Aug 12, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ode.wsdl.extensions.BPELProperty;
+import org.apache.ode.wsdl.extensions.BPELPropertyAlias;
+
+/**
+ * @author waterman
+ *
+ */
+public class BPELPropertyDefinition {
+
+ private BPELProperty bpelProperty;
+ private Vector alias = new Vector();
+
+ /**
+ *
+ */
+ BPELPropertyDefinition(BPELProperty prop) {
+
+ bpelProperty = prop;
+
+ }
+
+ void addAlias(BPELPropertyAlias propAlias) {
+ alias.add(propAlias);
+ }
+
+ Iterator getAlias() {
+ return alias.iterator();
+ }
+
+ String getPropertyName() {
+ return bpelProperty.getName();
+ }
+
+ QName getPropertyType() {
+ return bpelProperty.getType();
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELPrune.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELPrune.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELPrune.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELPrune.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.ode.deployment.bpel;
+
+import java.util.HashMap;
+import java.util.logging.Logger;
+
+import org.apache.ode.interaction.IInvocation;
+import org.apache.ode.interaction.InvocationFactory;
+import org.apache.ode.util.BPException;
+
+public class BPELPrune extends BPELSimpleUpdate
+{
+ private static final Logger logger = Logger.getLogger(BPELPrune.class.getName());
+ BPELPrune(BPELNode previous, BPELSchema tag, BPELAttributes attrs, Logger logger)
+ {
+ super(previous, tag, attrs, logger);
+ // TODO Auto-generated constructor stub
+ }
+
+ public BPELPrune(BPELNode node, BPELAttributes attr)
+ {
+ super(node,BPELSchema.PRUNE,attr,logger);
+ }
+
+ protected IInvocation createInvocation( String invocationString) throws BPException
+ {
+ HashMap namespaceMap = getNamespaceMap(invocationString);
+
+ IInvocation invocation = InvocationFactory.newInstance()
+ .createXPathPruneTreeInvocation(invocationString,namespaceMap);
+
+ return invocation;
+
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELReceive.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELReceive.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELReceive.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELReceive.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,186 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Jun 21, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.action.bpel.RegisterAction;
+import org.apache.ode.definition.IPMDAction;
+import org.apache.ode.definition.IPMDChangeCondition;
+import org.apache.ode.definition.IPMDCorrelation;
+import org.apache.ode.definition.IPMDOperation;
+import org.apache.ode.definition.IPMDProcess;
+import org.apache.ode.definition.IPMDRoot;
+import org.apache.ode.definition.service.DefinitionServiceException;
+import org.apache.ode.event.BPELStaticKey;
+import org.apache.ode.event.IStaticKey;
+//import org.apache.ode.lang.ResourceGetter;
+
+
+/**
+ * Implements the BPEL <i>receive</i> node. The receive node holds
+ * attributes that define the receipt of a WSDL message.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tReceive.
+ *
+ * @author waterman
+ * @see BPELCorrelation
+ */
+class BPELReceive extends BPELIOActivity {
+
+ private static final Logger logger = Logger.getLogger(BPELReceive.class.getName());
+
+
+ /**
+ * @param previous the parent schema node
+ * @param attrs the schema attributes
+ * @throws DefinitionServiceException
+ */
+ BPELReceive(BPELNode previous, BPELAttributes attrs)
+ throws DeploymentException {
+ super(previous, BPELSchema.RECEIVE, attrs, logger);
+ }
+
+ /**
+ * @see org.apache.ode.deployment.bpel.BPELNode#collectThreadBoundries(java.util.HashSet)
+ */
+ HashSet collectThreadBoundries(HashSet hs) {
+
+ hs.add(this);
+
+ return super.collectThreadBoundries(hs);
+ }
+
+
+ /**
+ * @see org.apache.ode.deployment.bpel.BPELNode#pop()
+ */
+ BPELNode pop() throws DeploymentException {
+
+ try {
+ IPMDAction recact = null;
+ ArrayList ops = new ArrayList();
+
+ IPMDProcess process = getStartProcess();
+
+ BPELVariable var = ( getAttributes().getVariable() != null ) ? getVariable(getAttributes().getVariable()) : null;
+
+ // Create the change condition
+ IPMDChangeCondition cc =
+ process.createChangeCondition("ChangeCondition: " + getAttributes().getName(),
+ org.apache.ode.condition.DefaultConditional.class.getName());
+
+
+ if ( BPELBoolean.YES.equals(getAttributes().getCreateInstance())) {
+ // If this receive initiates a process instance add the static
+ // message key metadata to the root process definition. Note:
+ // a BPEL process definition will contain a single initiating
+ // receive.
+
+ recact = createReceiveAction(cc,getAttributes().getName());
+ IPMDOperation initOp = getOperation(null,recact,var,BPELPatternValue.IN,true,null);
+ getProcess().addInstanceCreatingStaticKey(initOp.getKey());
+ getProcess().getDefinitionRoot().addInstanceCreatingOperation(initOp);
+
+ ops.add(initOp);
+ recact.addMetadata(RegisterAction.OPERATIONS,ops);
+
+ recact.addMetadata(org.apache.ode.action.bpel.ReceiveAction.PARTNER_LINK,
+ getAttributes().getPartnerLink());
+
+
+ // TODO: Lance - hijack eventHandlers
+ // if the global scope has eventHandlers registered the receive
+ // will need to hijack the eventHandlers and register them here.
+ // TODO: Lance - validation implementation
+ // validate that the receive is the first node in the process
+
+ } else {
+ // the static key for a non instance creating recieve will end up
+ // in a DB column, this can not be longer that 256 chars
+ BPELStaticKey sk = getStaticKey();
+ if ( sk.toString().length() > 256 ) {
+ throw new DeploymentException("BPEL_STATIC_KEY_TO_LONG", new Object[]{sk.getTargetNamespace(),
+ sk.getPortType(),sk.getOperation()});
+ }
+
+ IPMDAction regact = createRegisterAction(cc,getAttributes().getName());
+ recact = createReceiveAction(cc,getAttributes().getName());
+ IPMDAction remact = createUnRegisterAction(cc,getAttributes().getName());
+
+ IPMDOperation initOp = getOperation(regact,null,var,BPELPatternValue.IN,false,null);
+ getProcess().addNonInstanceCreatingStaticKey(initOp.getKey());
+
+ ops.add(initOp);
+ regact.addMetadata(RegisterAction.OPERATIONS,ops);
+ remact.addMetadata(RegisterAction.OPERATIONS,ops);
+
+ recact.addMetadata(org.apache.ode.action.bpel.ReceiveAction.PARTNER_LINK,
+ getAttributes().getPartnerLink());
+
+ getProcess().setIsStateFull();
+ }
+
+ if ( var != null) {
+ var.createLocator(recact,this,null,BPELInvocationType.SELECT_NODE,true);
+ }
+ } catch (DefinitionServiceException e) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e);
+ }
+
+ //recact.setMetadata(getAttributes());
+
+ return super.pop();
+ }
+
+ IPMDAction createReceiveAction(IPMDChangeCondition cc, String label) throws DeploymentException {
+ IPMDAction ret = null;
+
+ try {
+ ret = cc.createAction("ReceiveAction:" + label,
+ org.apache.ode.action.bpel.ReceiveAction.class.getName());
+ } catch (DefinitionServiceException e) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), label},e);
+ }
+
+ return ret;
+
+ }
+
+ /**
+ * @see org.apache.ode.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+ */
+ String getActivityDescription() {
+ return "receive is implemented by: " + org.apache.ode.action.bpel.ReceiveAction.class.getName() + ". It is used to block the business process until a specific message event arrives.";
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.deployment.bpel.BPELIOActivity#createOperation(org.apache.ode.definition.service.IPMDRoot, java.lang.String, org.apache.ode.event.IStaticKey, org.apache.ode.definition.service.IPMDCorrelation, boolean, java.lang.String)
+ */
+ protected IPMDOperation createOperation(IPMDRoot defRoot,
+ String operationId, IStaticKey key, IPMDCorrelation corrl,
+ boolean instanceCreating, String defId) {
+ return defRoot.createRecieveOperation(operationId, key, corrl,
+ instanceCreating, defId);
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELReply.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELReply.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELReply.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELReply.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Jun 21, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.util.ArrayList;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.action.bpel.RegisterAction;
+import org.apache.ode.action.bpel.ReplyAction;
+import org.apache.ode.definition.IPMDAction;
+import org.apache.ode.definition.IPMDChangeCondition;
+import org.apache.ode.definition.IPMDOperation;
+import org.apache.ode.definition.IPMDProcess;
+import org.apache.ode.definition.service.DefinitionServiceException;
+
+/**
+ * Implements the BPEL <i>reply</i> node. The reply node holds
+ * attributes that define the transmission of a WSDL message.
+ * <p>
+ * See <A HREF="../../../../../BPEL4WS.xsd">BPEL4WS.xsd</A> - complexType = tReply.
+ *
+ * @author waterman
+ * @see BPELCorrelation
+ */
+class BPELReply extends BPELIOActivity {
+
+ private static final Logger logger = Logger.getLogger(BPELReply.class.getName());
+ //private Vector correlations = new Vector();
+
+ /**
+ * @param previous the parent schema node
+ * @param attrs the schema attributes
+ * @throws DefinitionServiceException
+ */
+ BPELReply(BPELNode previous, BPELAttributes attrs)
+ throws DeploymentException {
+ super(previous, BPELSchema.REPLY, attrs, logger);
+ }
+
+ /**
+ * @see org.apache.ode.deployment.bpel.BPELNode#addCorrelation(org.apache.ode.deployment.bpel.BPELCorrelation)
+ */
+// void addCorrelation(BPELCorrelation correlation){
+// correlations.add(correlation);
+// }
+
+ /**
+ * @see org.apache.ode.deployment.bpel.BPELNode#pop()
+ */
+ BPELNode pop() throws DeploymentException {
+
+ ArrayList ops = new ArrayList();
+ IPMDOperation op = null;
+
+ IPMDProcess process = getStartProcess();
+
+ try {
+ // Create the change condition
+ IPMDChangeCondition cc =
+ process.createChangeCondition("ChangeCondition: " + getAttributes().getName(),
+ org.apache.ode.condition.DefaultConditional.class.getName());
+
+ // Create the change action
+ IPMDAction ccact =
+ cc.createAction("ChangeAction:" + getAttributes().getName(),
+ org.apache.ode.action.bpel.ReplyAction.class.getName());
+
+ // The BPEL application can reply with a fault or it can
+ // reply with data. Reply with fault does not cause an
+ // application exception.
+
+ BPELVariable var = ( getAttributes().getVariable() != null ) ? getVariable(getAttributes().getVariable()) : null;
+
+ if ( var != null) {
+ var.createLocator(ccact,this,null,BPELInvocationType.SELECT_NODE,true);
+ op = getOperation(null,ccact,var,BPELPatternValue.IN,false,null);
+ if ( op != null ) ops.add(op);
+ }
+
+ // Add the attributes of the Reply tag as metadata to the Reply Action
+ // ccact.setMetadata(getAttributes());
+ if ( getAttributes().getFaultName() != null ) {
+ ccact.addMetadata(ReplyAction.REPLY_FAULT_NAME,getAttributes().getFaultName());
+ ccact.addMetadata(ReplyAction.REPLY_NAMESPACE,getTargetNamespace());
+ }
+
+ if ( !ops.isEmpty() ) ccact.addMetadata(RegisterAction.OPERATIONS,ops);
+ } catch (DefinitionServiceException e) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATEACTION",new Object[] {getProcess().getAttributes().getName(), getAttributes().getName()},e);
+ }
+
+ return super.pop();
+ }
+
+ /**
+ * @see org.apache.ode.deployment.bpel.BPELLinkedActivity#getActivityDescription()
+ */
+ String getActivityDescription() {
+ return "reply is implemented by: " + org.apache.ode.action.bpel.ReplyAction.class.getName() + ". It is used to return a message from a business process.";
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELReplyVariable.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELReplyVariable.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELReplyVariable.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/deployment/bpel/BPELReplyVariable.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Jul 1, 2003
+ *
+ */
+package org.apache.ode.deployment.bpel;
+
+import java.util.Iterator;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.definition.IPMDLocatorHolder;
+import org.apache.ode.definition.service.DefinitionServiceException;
+
+/**
+ * @author waterman
+ *
+ */
+public class BPELReplyVariable extends BPELVariable {
+ private static final Logger logger = Logger.getLogger(BPELReplyVariable.class.getName());
+
+ private static final String REPLY_LOCATION = "BPEL_REPLY_LOCATION";
+ private Vector parts = new Vector();
+
+
+ /**
+ * @param attrs
+ */
+ public BPELReplyVariable() {
+ super(new BPELAttributes(),logger);
+
+ m_attributes.setName(REPLY_LOCATION);
+ }
+
+ public void addPart(String name) {
+ parts.add(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.deployment.bpel.BPELVariable#createLocator(org.apache.ode.definition.service.IPMDLocatorHolder, org.apache.ode.deployment.bpel.BPELNode, org.apache.ode.deployment.bpel.BPELAttributes, boolean)
+ */
+ Object createLocator(
+ IPMDLocatorHolder locator,
+ BPELNode node,
+ BPELNode tagNode,
+ BPELAttributes attrs,
+ BPELInvocationType type,
+ boolean forOutPut)
+ throws DeploymentException {
+
+ String part=null;
+
+ try {
+ for ( Iterator itr = parts.iterator(); itr.hasNext();) {
+ part = (String)itr.next();
+ node.createLocator(true,locator,getName()+":"+part,
+ m_attributes.getName()+BPELScopePath.PATH_DELIMITER+part,
+ null, null, 0, forOutPut, false);
+ }
+ } catch (DefinitionServiceException e) {
+ BPELUtil.throwNewException(logger,Level.SEVERE,"BPEL_CREATELOCATOR",new Object[] {node.getProcess().getAttributes().getName(), getName()+":"+part,m_attributes.getName()+BPELScopePath.PATH_DELIMITER+part},e);
+ }
+ return null;
+ }
+
+}