You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Fasih <fa...@baypackets.com> on 2006/05/08 02:54:37 UTC

[SCXML] Parallel States

Hello ppl
I am trying to create a state with external source, but stargely enough, the state machine enters the state "automatically". my xml:
<scxml
  xmlns="http://www.w3.org/2005/07/SCXML"
  initialstate="setup-call">
    <state id="setup-call">
        <parallel id="ivr-interaction">
          <state id="orig-leg"/>
          <state id="ivr-leg">
            <initial>
              <transition target="external-ivr"/>
            </initial>
            <state id="external-ivr" src="external-hello.scxml"/>
          </state>
        </parallel>
    </state>
    <state id="hungup" src="external-hello.scxml"/>
</scxml>

external-hello.scxml
<scxml
  xmlns="http://www.w3.org/2005/07/SCXML"
  version="1.0"
  initialstate="wait-for-ivr-request">
  <state id="wait-for-ivr-request"/>
</scxml>


Results in:
[main] WARN org.apache.commons.scxml.env.SimpleErrorReporter - ILLEGAL_CONFIG (Not all AND states active for parallel ivr-interaction): /setup-call/ivr-interaction : [/setup-call/ivr-interaction/orig-leg]
[main] WARN org.apache.commons.scxml.env.SimpleErrorReporter - ILLEGAL_CONFIG (Multiple top-level OR states active!): <SCXML> : [/setup-call, /hungup]

Any clues as to what is wrong in this????

Any help greatly appreciated

+Fasih




Re: [SCXML] Parallel States

Posted by Rahul Akolkar <ra...@gmail.com>.
On 5/8/06, Fasih <fa...@baypackets.com> wrote:
> Thanx
> I dont think that I really got your example!
> What will src="http://foo.bar/baz.scxml?param=1" do. More precisely, who is
> "producing" the SCXML template? Reading your mail I thougth you are
> suggesting something like
> src=http://foo.bar/baz.jsp?param=1 which would produce an SCXML! In any
> case, how does the param=1 help.
<snip/>

It will get us an InputSource for the Digester from the mentioned URL.
The URL doesn't have to be "static" URL/document, it could be a
servlet, JSP, velocity template, ASP.NET view ...

For example, if this is the bulk of a JSP 2.0 page,

<state id="foo${param.id}">
 <!-- some content -->
</state>

placed at URL http://foo.bar/baz.jsp , then
src="http://foo.bar/baz.jsp?id=1" will get us:

<state id="foo1">
 <!-- some content -->
</state>

to be pulled in as child state.


> Are you saying that I just add param=1
> param=2 etc to "fool" the scxml engine to think that they are different
> external srcs?
<snap/>

>From the runtime perspective, there is no such thing as a "external
source". It all becomes one state machine (as it should). The engine
pays attention to state IDs, they have be unique when all external
sources are pulled in.


>  By the way, what purpose does param=1 serve, other than being "intervowen"
> into ids? Does this mangling change the way I have done something? As in, if
> an event is thrown from baz.scxml will it be mangled too?
>
<snip/>

No. It just eliminates duplicate IDs when state templates are used. We
should really have an example of this.

-Rahul


>
> As an aside [;)] I did realize after some more snooping around that the
> problem is due to the same external ref that I am using, had it not been for
> the parallel, the SCXML would not have gone into an "illegal config"
>
> +Fasih
<snap/>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] Parallel States

Posted by Fasih <fa...@baypackets.com>.
Thanx
I dont think that I really got your example!
What will src="http://foo.bar/baz.scxml?param=1" do. More precisely, who is 
"producing" the SCXML template? Reading your mail I thougth you are 
suggesting something like
src=http://foo.bar/baz.jsp?param=1 which would produce an SCXML! In any 
case, how does the param=1 help. Are you saying that I just add param=1 
param=2 etc to "fool" the scxml engine to think that they are different 
external srcs?
 By the way, what purpose does param=1 serve, other than being "intervowen" 
into ids? Does this mangling change the way I have done something? As in, if 
an event is thrown from baz.scxml will it be mangled too?

As an aside [;)] I did realize after some more snooping around that the 
problem is due to the same external ref that I am using, had it not been for 
the parallel, the SCXML would not have gone into an "illegal config"

+Fasih
----- Original Message ----- 
From: "Rahul Akolkar" <ra...@gmail.com>
To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
Sent: Monday, May 08, 2006 3:44 PM
Subject: Re: [SCXML] Parallel States


On 5/7/06, Fasih <fa...@baypackets.com> wrote:
> Hello ppl
> I am trying to create a state with external source, but stargely enough, 
> the state machine enters the state "automatically". my xml:
> <scxml
>  xmlns="http://www.w3.org/2005/07/SCXML"
>  initialstate="setup-call">
>    <state id="setup-call">
>        <parallel id="ivr-interaction">
>          <state id="orig-leg"/>
>          <state id="ivr-leg">
>            <initial>
>              <transition target="external-ivr"/>
>            </initial>
>            <state id="external-ivr" src="external-hello.scxml"/>
>          </state>
>        </parallel>
>    </state>
>    <state id="hungup" src="external-hello.scxml"/>
> </scxml>
>
> external-hello.scxml
> <scxml
>  xmlns="http://www.w3.org/2005/07/SCXML"
>  version="1.0"
>  initialstate="wait-for-ivr-request">
>  <state id="wait-for-ivr-request"/>
> </scxml>
>
>
> Results in:
> [main] WARN org.apache.commons.scxml.env.SimpleErrorReporter - 
> ILLEGAL_CONFIG (Not all AND states active for parallel ivr-interaction): 
> /setup-call/ivr-interaction : [/setup-call/ivr-interaction/orig-leg]
> [main] WARN org.apache.commons.scxml.env.SimpleErrorReporter - 
> ILLEGAL_CONFIG (Multiple top-level OR states active!): <SCXML> : 
> [/setup-call, /hungup]
>
> Any clues as to what is wrong in this????
>
<snip/>

Including external-hello.scxml twice in the parent document gave us
two states with ID "wait-for-ivr-request". Since the transition target
for the <initial> in "ivr-leg" is really meant to be an IDREF, that
throws the engine off.

What you're trying to do is a perfectly valid usecase. This is
sometimes referred to as "state templating", and the preferred way to
achieve this is to therefore use some templating technology (be it a
JSP that produces SCXML, or a Velocity template, or something else).
For example:

<scxml ... >

  <state id="foo1" src="http://foo.bar/baz.scxml?param=1">
    <!-- possibly something here -->
  </state>

  <state id="foo2" src="http://foo.bar/baz.scxml?param=2">
    <!-- possibly something (else) here -->
  </state>

</scxml>

And the param gets woven into the IDs and other relevant bits of the
generated SCXML snippet (to eliminate duplicate IDs, for one).

As an aside, this is not related to parallelism, other than <parallel>
just happens to be present in this particular example.

-Rahul



> Any help greatly appreciated
>
> +Fasih
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] Wiki

Posted by Rahul Akolkar <ra...@gmail.com>.
On 5/8/06, Fasih <fa...@baypackets.com> wrote:
> Hi
> I guess contributing to the Wiki is the least we can do ;)
> I dont see a section to add what I am doing. Is it OK to add a new section
> called "SCXML Patterns" or something? I guess putting it in FAQ will make it
> bulky!! Suggestions?
>
<snip/>

Ofcourse, the wiki is open to everyone. Personally, I'd like to see
some organization when pages are added. I suggest adding a "Tutorials"
(or whatever name you like) section to SCXML/HomePage, similar to this
example page:

http://wiki.apache.org/jakarta-taglibs/ReusableDialogComponents

where the Tutorials link leads to:

http://wiki.apache.org/jakarta-taglibs/ReusableDialogComponents/Tutorials

Note that the leading front slashes are used to give the
"parent-child" organization to the wiki pages. Happy wiki'ing.

-Rahul


> +Fasih
>
<snap/>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


[SCXML] Wiki

Posted by Fasih <fa...@baypackets.com>.
Hi
I guess contributing to the Wiki is the least we can do ;)
I dont see a section to add what I am doing. Is it OK to add a new section 
called "SCXML Patterns" or something? I guess putting it in FAQ will make it 
bulky!! Suggestions?

+Fasih

----- Original Message ----- 
From: "Rahul Akolkar" <ra...@gmail.com>
To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
Sent: Monday, May 08, 2006 4:01 PM
Subject: Re: [SCXML] Parallel States


On 5/8/06, Rahul Akolkar <ra...@gmail.com> wrote:
<snip/>
>
> What you're trying to do is a perfectly valid usecase. This is
> sometimes referred to as "state templating", and the preferred way to
> achieve this is to therefore use some templating technology (be it a
> JSP that produces SCXML, or a Velocity template, or something else).
<snap/>

Oh, and if you try this, and feel like adding a wiki page to the
Commons SCXML wiki [1], I'm sure it will help others as well.

Thanks,
-Rahul

[1] http://wiki.apache.org/jakarta-commons/SCXML/HomePage

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] Parallel States

Posted by Rahul Akolkar <ra...@gmail.com>.
On 5/8/06, Rahul Akolkar <ra...@gmail.com> wrote:
<snip/>
>
> What you're trying to do is a perfectly valid usecase. This is
> sometimes referred to as "state templating", and the preferred way to
> achieve this is to therefore use some templating technology (be it a
> JSP that produces SCXML, or a Velocity template, or something else).
<snap/>

Oh, and if you try this, and feel like adding a wiki page to the
Commons SCXML wiki [1], I'm sure it will help others as well.

Thanks,
-Rahul

[1] http://wiki.apache.org/jakarta-commons/SCXML/HomePage

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] Parallel States

Posted by Rahul Akolkar <ra...@gmail.com>.
On 5/7/06, Fasih <fa...@baypackets.com> wrote:
> Hello ppl
> I am trying to create a state with external source, but stargely enough, the state machine enters the state "automatically". my xml:
> <scxml
>  xmlns="http://www.w3.org/2005/07/SCXML"
>  initialstate="setup-call">
>    <state id="setup-call">
>        <parallel id="ivr-interaction">
>          <state id="orig-leg"/>
>          <state id="ivr-leg">
>            <initial>
>              <transition target="external-ivr"/>
>            </initial>
>            <state id="external-ivr" src="external-hello.scxml"/>
>          </state>
>        </parallel>
>    </state>
>    <state id="hungup" src="external-hello.scxml"/>
> </scxml>
>
> external-hello.scxml
> <scxml
>  xmlns="http://www.w3.org/2005/07/SCXML"
>  version="1.0"
>  initialstate="wait-for-ivr-request">
>  <state id="wait-for-ivr-request"/>
> </scxml>
>
>
> Results in:
> [main] WARN org.apache.commons.scxml.env.SimpleErrorReporter - ILLEGAL_CONFIG (Not all AND states active for parallel ivr-interaction): /setup-call/ivr-interaction : [/setup-call/ivr-interaction/orig-leg]
> [main] WARN org.apache.commons.scxml.env.SimpleErrorReporter - ILLEGAL_CONFIG (Multiple top-level OR states active!): <SCXML> : [/setup-call, /hungup]
>
> Any clues as to what is wrong in this????
>
<snip/>

Including external-hello.scxml twice in the parent document gave us
two states with ID "wait-for-ivr-request". Since the transition target
for the <initial> in "ivr-leg" is really meant to be an IDREF, that
throws the engine off.

What you're trying to do is a perfectly valid usecase. This is
sometimes referred to as "state templating", and the preferred way to
achieve this is to therefore use some templating technology (be it a
JSP that produces SCXML, or a Velocity template, or something else).
For example:

<scxml ... >

  <state id="foo1" src="http://foo.bar/baz.scxml?param=1">
    <!-- possibly something here -->
  </state>

  <state id="foo2" src="http://foo.bar/baz.scxml?param=2">
    <!-- possibly something (else) here -->
  </state>

</scxml>

And the param gets woven into the IDs and other relevant bits of the
generated SCXML snippet (to eliminate duplicate IDs, for one).

As an aside, this is not related to parallelism, other than <parallel>
just happens to be present in this particular example.

-Rahul



> Any help greatly appreciated
>
> +Fasih
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org