Andy

the state is either triggered or not triggered depending on the boolean 
evaluation of  cond  e.g.

     <state id="foo3">
      <!--
        ... some content ...
      -->
      <transition event="foo.bar" cond="true"
                     target next="bar" />
     </state>

for now just try hardcoding cond to evaluate to true (and see if that will 
activate the state)

http://commons.apache.org/scxml/guide/scxml-documents.html#custom

sorry..did'nt mean to jump in mid-thread rahul!

Martin Gainty 
______________________________________________ 
Note de déni et de confidentialité
 Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




> Subject: RE: [Commons SCXML] - Parallel states and external invocation. Best 
> practice.
> Date: Tue, 20 Apr 2010 16:27:00 +0100
> From: amans...@globeop.com
> To: user@commons.apache.org
> 
> Sorry yes, the src attribute.
> 
> Essentially what I want to be able to do is something like :
> 
>  <parallel id="p1">
> 
>     <state id="region1">
> 
>       <state id="sub1">
>         <invoke targettype="component_invoker" src="comp1"/>
>         <transition event="sub1.invoke.done" target="final1" />
>       </state>
> 
>       <final id="final1"/>
> 
>     </state>
> 
>     <state id="region2">
> 
>       <state id="sub2">
>         <invoke targettype="scxml" src="sub-statemachine.xml"/>
>         <transition event="sub2.invoke.done" target="final2" />
>       </state>
> 
>       <final id="final2"/>
> 
>     </state>
> 
>     <transition event="p1.done" target="s3" />
> 
>   </parallel>
> 
> When I tested it the sub statemachine would never fire. 
> 
> Thanks,
> Andy
> 
> -----Original Message-----
> From: Rahul Akolkar [mailto:rahul.akol...@gmail.com] 
> Sent: 20 April 2010 16:24
> To: Commons Users List
> Subject: Re: [Commons SCXML] - Parallel states and external invocation. Best 
> practice.
> 
> On Tue, Apr 20, 2010 at 9:46 AM, Andrew Mansfield <amans...@globeop.com> 
> wrote:
> > Hi Rahul,
> >
> > One other question if I may and assuming it's possible.
> >
> > Can I start a new state machine from one of the sub states i.e. sub2 
> > (using src="my.xml") and have that follow the same logic i.e. the 
> > parallel execution will wait for the sub state machine to execute.
> >
> <snip/>
> 
> Do you mean src attribute of <state> (which has now been removed from latest 
> version of the W3C draft) or src attribute of <invoke> ?
> 
> 
> > I tried using the invoke with srctype of scxml and the document name 
> > but for whatever reason it didn't fire.
> >
> <snap/>
> 
> There isn't a srctype attribute on <invoke>, did you mean type?
> 
> -Rahul
> 
> 
> > Regards,
> > Andy
> >
> > -----Original Message-----
> > From: Andrew Mansfield [mailto:amans...@globeop.com]
> > Sent: 20 April 2010 13:38
> > To: Commons Users List
> > Subject: RE: [Commons SCXML] - Parallel states and external invocation.
> > Best practice.
> >
> > That's a tidy solution. Worked a charm.
> >
> > Thanks,
> > Andy
> >
> > -----Original Message-----
> > From: Rahul Akolkar [mailto:rahul.akol...@gmail.com]
> > Sent: 19 April 2010 22:26
> > To: Commons Users List
> > Subject: Re: [Commons SCXML] - Parallel states and external invocation.
> > Best practice.
> >
> > On Mon, Apr 19, 2010 at 7:33 AM, Andrew Mansfield 
> > <amans...@globeop.com>
> > wrote:
> >> Hi,
> >>
> >> I am attempting to build a state machine that essentially models my 
> >> applications workflow.
> >>
> >> To do this I have built a simple custom component invoker that can be 
> >> executed from the <invoke/> tag to execute Java code. The 
> >> 'id.invoke.done' event simply transitions to the next state in the 
> >> workflow. The flexibility is required as components will be plugged 
> >> in
> >
> >> for different configurations to change default behaviour often.
> >>
> >> e.g.
> >>
> >>   <state id="s1">
> >>        <invoke targettype="component_invoker" 
> >> srcexpr="componentId1"/>
> >>        <transition event="s1.invoke.done" cond="cond1 != null"
> >> target="s2" />
> >>        <transition event="s1.invoke.done" target="s3" />
> >>    </state>
> >>
> >>    <state id="s2">
> >>        <invoke targettype="component_invoker" 
> >> srcexpr="componentId2"/>
> >>        <transition event="s2.invoke.done" target="s3" />
> >>    </state>
> >>
> >>    <state id="s3" final="true">
> >>
> >>    </state>
> >>
> >> What I want to do is allow for parallel execution of states which 
> >> themselves have the abilty to invoke external code. I.e.
> >>
> >>    <state id="s1">
> >>        <invoke targettype="component_invoker" 
> >> srcexpr="componentId1"/>
> >>        <transition event="s1.invoke.done" cond="cond1 != null"
> >> target="s2" />
> >>        <transition event="s1.invoke.done" target="s3" />
> >>    </state>
> >>
> >>    <state id="s2">
> >>        <invoke targettype="component_invoker" 
> >> srcexpr="componentId2"/>
> >>        <transition event="s2.invoke.done" target="p1" />
> >>    </state>
> >>
> >>        <parallel id="p1">
> >>
> >>                <state id="sub1">
> >>                <invoke targettype="component_invoker" src="comp1"/>
> >>                <transition event="sub1.invoke.done" target="s3" />
> >>                </state>
> >>
> >>            <state id="sub2">
> >>                <invoke targettype="component_invoker" src="comp2"/>
> >>                <transition event="sub2.invoke.done" target="s3" />
> >>            </state>
> >>
> >>            <transition event="p1.done" target="s3" />
> >>
> >>        </parallel>
> >>
> >>    <state id="s3" final="true">
> >>
> >>    </state>
> >>
> >> What I can;t seem to work out is how to exit my component invocations 
> >> from the substates correctly. Is it event possible to achieve what I 
> >> am trying to do or is there a better way to do this ?
> >>
> > <snip/>
> >
> > Sure, it is possible.
> >
> > When the orthogonal regions have no substructure, any of the 
> > transitions such as those gating on events "sub1.invoke.done" or 
> > "sub2.invoke.done"
> > cause the entire parallel to be exited. If you want join-like behavior 
> > where the parallel waits for both invokes (or more, if more than two
> > regions) to be finished before transitioning out, then its best to 
> > model it as such using final children of regions and waiting for all 
> > regions to transition to their respective finals.
> >
> > So, reworking the example above, along these lines:
> >
> >  <state id="s1">
> >    <invoke targettype="component_invoker" srcexpr="componentId1"/>
> >    <transition event="s1.invoke.done" cond="cond1 != null" target="s2"
> > />
> >    <transition event="s1.invoke.done" target="s3" />
> >  </state>
> >
> >  <state id="s2">
> >    <invoke targettype="component_invoker" srcexpr="componentId2"/>
> >    <transition event="s2.invoke.done" target="p1" />
> >  </state>
> >
> >  <parallel id="p1">
> >
> >    <state id="region1">
> >
> >      <state id="sub1">
> >        <invoke targettype="component_invoker" src="comp1"/>
> >        <transition event="sub1.invoke.done" target="final1" />
> >      </state>
> >
> >      <final id="final1"/>
> >
> >    </state>
> >
> >    <state id="region2">
> >
> >      <state id="sub2">
> >        <invoke targettype="component_invoker" src="comp2"/>
> >        <transition event="sub2.invoke.done" target="final2" />
> >      </state>
> >
> >      <final id="final2"/>
> >
> >    </state>
> >
> >    <transition event="p1.done" target="s3" />
> >
> >  </parallel>
> >
> >  <state id="s3" final="true">
> >     ...
> >
> > -Rahul
> >
> >
> >> Any help would be much appreciated.
> >>
> >> Regards,
> >> Andy
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> > For additional commands, e-mail: user-h...@commons.apache.org
> >
> >
> > ----------------------------------------------------------------------
> > --
> > --
> > This email with all information contained herein or attached hereto 
> > may contain confidential and/or privileged information intended for 
> > the
> > addressee(s) only. If you have received this email in error, please 
> > contact the sender and immediately delete this email in its entirety 
> > and any attachments thereto.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> > For additional commands, e-mail: user-h...@commons.apache.org
> >
> >
> > ----------------------------------------------------------------------
> > ---- This email with all information contained herein or attached 
> > hereto may contain confidential and/or privileged information intended for 
> > the addressee(s) only. If you have received this email in error, please 
> > contact the sender and immediately delete this email in its entirety and 
> > any attachments thereto.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> > For additional commands, e-mail: user-h...@commons.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
> 
> 
> --------------------------------------------------------------------------
> This email with all information contained herein or attached hereto may 
> contain confidential and/or privileged information intended for the 
> addressee(s) only. If you have received this email in error, please contact 
> the sender and immediately delete this email in its entirety and any 
> attachments thereto.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
> 
                                          
_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

Reply via email to