[cddlm] Doubts about SWITCH

Stuart Schaefer Sschaefer at softricity.com
Wed Dec 7 07:58:25 CST 2005


Roberto,

>> 1. In the 'component-model.xsd', the Switch element has the following 
>> element: <xsd:element ref="case" minOccurs="0" maxOccurs="unbounded"/>.
>> Is the 'minOccurs' value ZERO correct? I think that this attribute 
>> should have the value 1 (one), unless there will exist an "otherwise" 
>> without a "case" element.

The switch element should allow one to specify only the "otherwise" clause, if no "case"s are defined.  I am not sure that a simple <xsd:sequence> covers this correctly, but that is why there is a minOccurs="0".

>> 2. Is it possible to have more than one cmp:switch element in the same 
>> level of a CDL and referring to the same lifecycle? If so, does the 
>> order of the switch matter?

Yes, this is allowed.  Yes, order matters.

>> 3. Should all the components execute a lifecycle operation or a switch 
>> can avoid a component to be called in a certain operation?

A switch can avoid components being called.  However, this should be used carefully to ensure that the system is still left in a deterministic state after the transition has completed.

>> 4. How to proceed when there is more than one ref to the same component? 
>> Should we execute more than one time the same operation on that 
>> component?

Good question.  Cycles should be avoided, possibly an error case.  However, as it is unspecified in the documentation, my recommendation would be to invoke the operation which should lead to a fault.

>> 5. As we can have more than one "case" element for the swith, what does 
>> the otherwise mean? Should it execute when all case conditions are false 
>> or when the last one is false?

The case element follows that of BPEL.  It is an "if-then-elseif" construct.  Only one case should fire.  Thus, the otherwise should only be used if all other case conditions are false.




Stuart





More information about the cddlm-wg mailing list