commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ate Douma <...@douma.nu>
Subject Re: SCXML retrieve root context
Date Sat, 12 Apr 2014 15:48:50 GMT
On 12-04-14 10:28, tendaf@free.fr wrote:
> Hi,
>
> I would like to know if it's possible to retrieve the rootcontext given during the creation
of an SCXMLExecutor inside a custon action (i.e. Hello.class example).

Yes you can. There isn't a direct API for it but its easy to retrieve the root 
context with:

     @Override
     public void execute(ActionExecutionContext exctx) throws ModelException, 
SCXMLExpressionException {
         Context context = exctx.getGlobalContext();
         while (context.getParent() != null) {
             context = context.getParent();
         }
         // context now references the root context
       ...
     }

The above starts with the global context (the one used and reserved for the 
root/script element) and walks the parent tree up. Currently only the system 
context sits between the root and global context.

HTH, Ate

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


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


Mime
View raw message