commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ten...@free.fr
Subject SCXML retrieve root context
Date Sat, 12 Apr 2014 19:46:20 GMT
Thank you for your help Ate, it works very well, I still have a long way to go in understanding
SCXML..

Francis,


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


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


Mime
View raw message