Author: objectiser
Date: 2011-03-15 10:56:00 -0400 (Tue, 15 Mar 2011)
New Revision: 1319
Modified:
branches/ODE/RiftSaw-ODE-trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGenerator.java
branches/ODE/RiftSaw-ODE-trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java
branches/ODE/RiftSaw-ODE-trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OScope.java
branches/ODE/RiftSaw-ODE-trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java
branches/ODE/RiftSaw-ODE-trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/AssignHelper.java
branches/ODE/RiftSaw-ODE-trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java
Log:
Bring riftsaw-ode trunk upto date with changes in ODE-915 patch.
Modified:
branches/ODE/RiftSaw-ODE-trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGenerator.java
===================================================================
---
branches/ODE/RiftSaw-ODE-trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGenerator.java 2011-03-03
10:53:41 UTC (rev 1318)
+++
branches/ODE/RiftSaw-ODE-trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGenerator.java 2011-03-15
14:56:00 UTC (rev 1319)
@@ -45,8 +45,8 @@
import javax.xml.namespace.QName;
/**
- * Generates code for <code><assign></code> activities.
- *
+ * Generates code for <code><assign></code> activities.
+ *
* @author Maciej Szefler ( m s z e f l e r @ g m a i l . c o m )
*/
class AssignGenerator extends DefaultActivityGenerator {
@@ -80,7 +80,7 @@
if (scopy.getFrom() == null)
throw new
CompilationException(__cmsgs.errMissingFromSpec().setSource(scopy));
ocopy.from = compileFrom(scopy.getFrom(), toResultType[0]);
-
+
verifyCopy(ocopy);
oassign.copy.add(ocopy);
@@ -92,7 +92,7 @@
/**
* Verify that a copy follows the correct form.
- *
+ *
* @param ocopy
*/
private void verifyCopy(OAssign.Copy ocopy) {
@@ -204,9 +204,9 @@
}
/**
- * Compile an extension to/from-spec. Extension to/from-specs are compiled into
- * "DirectRef"s.
- *
+ * Compile an extension to/from-spec. Extension to/from-specs are compiled into
+ * "DirectRef"s.
+ *
* @param extVal source representation
* @return compiled representation
*/
Modified:
branches/ODE/RiftSaw-ODE-trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java
===================================================================
---
branches/ODE/RiftSaw-ODE-trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java 2011-03-03
10:53:41 UTC (rev 1318)
+++
branches/ODE/RiftSaw-ODE-trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java 2011-03-15
14:56:00 UTC (rev 1319)
@@ -37,7 +37,7 @@
/**
* Get the name of the variable.
- *
+ *
* @return variable name
*/
public String getName() {
@@ -46,7 +46,7 @@
/**
* Get the type name of this variable.
- *
+ *
* @return an XML element, XML schema type, or WSDL message type name.
*/
public QName getTypeName() {
@@ -72,7 +72,7 @@
/**
* Get the type of declaration; one of: {@link #TYPE_SCHEMA},
* {@link #TYPE_ELEMENT}, or {@link #TYPE_MESSAGE}.
- *
+ *
* @return type of variable decleration
*/
public Kind getKind() {
@@ -90,7 +90,7 @@
//
// Stuff related to external variables.
//
-
+
/**
* Get the external variable identifier (each one will be defined in the deployment
descriptor)
*/
@@ -105,15 +105,15 @@
public boolean isExternal() {
return null != getExternalId();
}
-
+
/**
* External variable support - get the "related" variable name.
* @return
*/
public String getRelated() {
- return getAttribute(ExtensibilityQNames.EXTVAR_RELATED, null);
+ return getAttribute(ExtensibilityQNames.EXTVAR_RELATED, null);
}
-
+
/**
* Get the 'from' specification.
*
Modified:
branches/ODE/RiftSaw-ODE-trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OScope.java
===================================================================
---
branches/ODE/RiftSaw-ODE-trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OScope.java 2011-03-03
10:53:41 UTC (rev 1318)
+++
branches/ODE/RiftSaw-ODE-trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OScope.java 2011-03-15
14:56:00 UTC (rev 1319)
@@ -22,7 +22,6 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -32,7 +31,7 @@
* are generated by the BPEL compiler.
*/
public class OScope extends OActivity {
-
+
static final long serialVersionUID = -1L ;
/** Name of the scope. */
@@ -46,7 +45,7 @@
/** ScopeLikeConstructImpl's compensation handler. */
public OCompensationHandler compensationHandler;
-
+
/** ScopeLikeConstructImpl's termination handler. */
public OTerminationHandler terminationHandler;
@@ -54,12 +53,7 @@
public OEventHandler eventHandler;
/** Variables declared within the scope. */
- /* madars.vitolins _at
gmail.com 2009.04.11 Inline variable initialization
- * We need LinkedHashMap because order of variables are significant!
- * So that next variable can be initialized from previous (if previous is inline
initialized)
- * LinkedHashMap acts like HashMap but it keeps the order
- */
- public final LinkedHashMap<String,Variable> variables = new
LinkedHashMap<String,Variable>();
+ public final HashMap<String,Variable> variables = new
HashMap<String,Variable>();
/** OCorrelation sets declared within the scope. */
public final Map<String,CorrelationSet> correlationSets = new
HashMap<String, CorrelationSet>();
@@ -71,8 +65,11 @@
public boolean implicitScope;
+ /** Is this scope <em>atomic</em> i.e. meant to execute in a single
transaction. */
public boolean atomicScope;
+ public final List<Variable> variableList = new ArrayList<Variable>();
+
public OScope(OProcess owner, OActivity parent) {
super(owner, parent);
}
@@ -101,6 +98,7 @@
public void addLocalVariable(Variable variable) {
variables.put(variable.name, variable);
+ variableList.add(variable);
}
public Variable getVisibleVariable(String varName) {
@@ -155,11 +153,11 @@
public static final class CorrelationSet extends OBase {
static final long serialVersionUID = -1L ;
-
+
public String name;
public OScope declaringScope;
public final List<OProcess.OProperty>properties = new
ArrayList<OProcess.OProperty>();
-
+
/**
* Indicates that this correlation set has a join use case in the scope.
*/
@@ -204,35 +202,38 @@
return buf.toString();
}
}
-
+
@Override
public void dehydrate() {
- super.dehydrate();
- this.activity = null;
- if (compensatable != null) {
- compensatable.clear();
- }
- if (compensationHandler != null) {
- compensationHandler.dehydrate();
- compensationHandler = null;
- }
- if (terminationHandler != null) {
- terminationHandler.dehydrate();
- terminationHandler = null;
- }
- if (eventHandler != null) {
- eventHandler.dehydrate();
- eventHandler = null;
- }
- if (variables != null) {
- variables.clear();
- }
- if (correlationSets != null) {
- correlationSets.clear();
- }
- if (partnerLinks != null) {
- partnerLinks.clear();
- }
+ super.dehydrate();
+ this.activity = null;
+ if (compensatable != null) {
+ compensatable.clear();
+ }
+ if (compensationHandler != null) {
+ compensationHandler.dehydrate();
+ compensationHandler = null;
+ }
+ if (terminationHandler != null) {
+ terminationHandler.dehydrate();
+ terminationHandler = null;
+ }
+ if (eventHandler != null) {
+ eventHandler.dehydrate();
+ eventHandler = null;
+ }
+ if (variables != null) {
+ variables.clear();
+ }
+ if (variableList != null) {
+ variableList.clear();
+ }
+ if (correlationSets != null) {
+ correlationSets.clear();
+ }
+ if (partnerLinks != null) {
+ partnerLinks.clear();
+ }
}
}
Modified:
branches/ODE/RiftSaw-ODE-trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java
===================================================================
---
branches/ODE/RiftSaw-ODE-trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java 2011-03-03
10:53:41 UTC (rev 1318)
+++
branches/ODE/RiftSaw-ODE-trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java 2011-03-15
14:56:00 UTC (rev 1319)
@@ -126,4 +126,5 @@
private OAssign getOAsssign() {
return (OAssign) _self.o;
}
+
}
Modified:
branches/ODE/RiftSaw-ODE-trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/AssignHelper.java
===================================================================
---
branches/ODE/RiftSaw-ODE-trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/AssignHelper.java 2011-03-03
10:53:41 UTC (rev 1318)
+++
branches/ODE/RiftSaw-ODE-trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/AssignHelper.java 2011-03-15
14:56:00 UTC (rev 1319)
@@ -141,6 +141,42 @@
}
}// initVar()
+ /**
+ * Assumes that variable is variable not kind of partner links.
+ *
+ * @param var
+ * @return
+ * @throws FaultException
+ * @throws ExternalVariableModuleException
+ * @author madars.vitolins _at
gmail.com
+ */
+ public Node evalLValue(Variable var) throws FaultException,
+ ExternalVariableModuleException {
+ final BpelRuntimeContext napi = getBpelRuntimeContext();
+ Node lval = null;
+ VariableInstance lvar = _scopeFrame.resolve(var);
+ if (!napi.isVariableInitialized(lvar)) {
+ Document doc = DOMUtils.newDocument();
+ Node val = var.type.newInstance(doc);
+ if (val.getNodeType() == Node.TEXT_NODE) {
+ Element tempwrapper = doc.createElementNS(null,
+ "temporary-simple-type-wrapper");
+ doc.appendChild(tempwrapper);
+ tempwrapper.appendChild(val);
+ val = tempwrapper;
+ } else
+ doc.appendChild(val);
+ // Only external variables need to be initialized, others are new
+ // and going to be overwritten
+ if (lvar.declaration.extVar != null)
+ lval = initializeVariable(lvar, val);
+ else
+ lval = val;
+ } else
+ lval = fetchVariableData(lvar, true);
+ return lval;
+ }
+
public void run() {
String errMsg="AssignHelper cannot be ran as ACTIVITY";
__log.error(errMsg);
@@ -189,42 +225,6 @@
return lval;
}
- /**
- * Assumes that variable is variable not kind of partner links.
- *
- * @param var
- * @return
- * @throws FaultException
- * @throws ExternalVariableModuleException
- * @author madars.vitolins _at
gmail.com
- */
- public Node evalLValue(Variable var) throws FaultException,
- ExternalVariableModuleException {
- final BpelRuntimeContext napi = getBpelRuntimeContext();
- Node lval = null;
- VariableInstance lvar = _scopeFrame.resolve(var);
- if (!napi.isVariableInitialized(lvar)) {
- Document doc = DOMUtils.newDocument();
- Node val = var.type.newInstance(doc);
- if (val.getNodeType() == Node.TEXT_NODE) {
- Element tempwrapper = doc.createElementNS(null,
- "temporary-simple-type-wrapper");
- doc.appendChild(tempwrapper);
- tempwrapper.appendChild(val);
- val = tempwrapper;
- } else
- doc.appendChild(val);
- // Only external variables need to be initialized, others are new
- // and going to be overwritten
- if (lvar.declaration.extVar != null)
- lval = initializeVariable(lvar, val);
- else
- lval = val;
- } else
- lval = fetchVariableData(lvar, true);
- return lval;
- }
-
/**
* Get the r-value. There are several possibilities:
* <ul>
@@ -411,7 +411,7 @@
if (__log.isDebugEnabled())
__log.debug("Assign.copy(" + ocopy + ")");
-
+
ScopeEvent se;
// Check for message to message - copy, we can do this efficiently in
@@ -534,7 +534,7 @@
throw fe;
}
}
-
+
private void replaceEndpointRefence(PartnerLinkInstance plval, Node rvalue) throws
FaultException {
if (rvalue.getNodeType() == Node.ATTRIBUTE_NODE){
rvalue = rvalue.getOwnerDocument().createTextNode(((Attr) rvalue).getValue());
@@ -584,7 +584,7 @@
}
parent.replaceChild(replacement, ptr);
DOMUtils.copyNSContext(ptr, replacement);
-
+
return (lval == ptr) ? replacement : lval;
}
@@ -718,14 +718,14 @@
private Node _rootNode;
private EvaluationContext _ctx;
-
+
private EvaluationContextProxy(Variable var, Node varNode) {
_var = var;
_varNode = varNode;
_ctx = getEvaluationContext();
}
-
+
public Node readVariable(OScope.Variable variable, OMessageVarType.Part part)
throws FaultException {
if (variable.name.equals(_var.name)) {
if (part == null) return _varNode;
@@ -798,7 +798,7 @@
}
public Date getCurrentEventDateTime() {
- return Calendar.getInstance().getTime();
+ return Calendar.getInstance().getTime();
}
}
Modified:
branches/ODE/RiftSaw-ODE-trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java
===================================================================
---
branches/ODE/RiftSaw-ODE-trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java 2011-03-03
10:53:41 UTC (rev 1318)
+++
branches/ODE/RiftSaw-ODE-trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java 2011-03-15
14:56:00 UTC (rev 1319)
@@ -62,7 +62,7 @@
*/
class SCOPE extends ACTIVITY {
private static final long serialVersionUID = 6111903798996023525L;
-
+
private static final Log __log = LogFactory.getLog(SCOPE.class);
private OScope _oscope;
@@ -98,7 +98,7 @@
private void initVars() throws FaultException,
ExternalVariableModuleException {
AssignHelper assignHelper = new AssignHelper(_self, _scopeFrame, _linkFrame);
- for (OScope.Variable var : _oscope.variables.values()) {
+ for (OScope.Variable var : _oscope.variableList) {
if (var != null && var.from != null) {
assignHelper.initVar(var);
@@ -107,7 +107,7 @@
}
public void run() {
-
+
// Start the child activity.
_child = new ActivityInfo(genMonotonic(),
_oscope.activity,
@@ -124,7 +124,7 @@
_eventHandlers.add(ehi);
instance(new EH_ALARM(ehi.psc,ehi.tc, ehi.cc, alarm, _scopeFrame));
}
-
+
for (Iterator<OEventHandler.OEvent> i =
_oscope.eventHandler.onMessages.iterator(); i.hasNext(); ) {
OEventHandler.OEvent event = i.next();
EventHandlerInfo ehi = new EventHandlerInfo(event,
@@ -136,7 +136,7 @@
}
}
- getBpelRuntimeContext().initializePartnerLinks(_scopeFrame.scopeInstanceId,
+ getBpelRuntimeContext().initializePartnerLinks(_scopeFrame.scopeInstanceId,
_oscope.partnerLinks.values());
sendEvent(new ScopeStartEvent());
@@ -429,7 +429,7 @@
}
} else /* completed ok */ {
sendEvent(new ScopeCompletionEvent());
-
+
if (_oscope.compensationHandler != null) {
CompensationHandler compensationHandler = new
CompensationHandler(
_scopeFrame,
@@ -519,7 +519,7 @@
bestMatch = c;
} else {
// Otherwise we prefer name and variable matches but prefer name-only
matches to
- // variable-only matches.
+ // variable-only matches.
int existingScore = (bestMatch.faultName == null ? 0 : 2) +
(bestMatch.faultVariable == null ? 0 : 1);
int currentScore = (c.faultName == null ? 0 : 2) + (c.faultVariable ==
null ? 0 : 1);
if (currentScore > existingScore) {