You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Ate Douma (JIRA)" <ji...@apache.org> on 2014/10/28 00:58:33 UTC

[jira] [Resolved] (SCXML-219) API to influence Element during runtime

     [ https://issues.apache.org/jira/browse/SCXML-219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ate Douma resolved SCXML-219.
-----------------------------
    Resolution: Won't Fix

It isn't clear to me for what scenario you would need to 'forget' a history, but it seems to me a 'red herring' for incorrect usage and definition of the state machine itself.
If you have a specific scenario where state history shouldn't be restored, then why not use a different/specific transition NOT targeting a history state?
Seems to me such a scenario itself should be encoded in the state machine, not hacked underwater through some magical scripting, which very likely makes the state machine (much more) unpredictable.

Exposing the internal state management to the scripting layer definitely isn't something I'd advise, although of course you can do this already today, even without the above unnecessary changes (just extend SCXMLExecutor and expose the SCInstance through the global context should do the trick).

But I'm not inclined to do this in the core. The SCInstance really is intended to be used internally only, or if need be by developers, but not SCXML engine users.

> API to influence <history> Element during runtime
> -------------------------------------------------
>
>                 Key: SCXML-219
>                 URL: https://issues.apache.org/jira/browse/SCXML-219
>             Project: Commons SCXML
>          Issue Type: Improvement
>    Affects Versions: 2.0
>            Reporter: Johannes Neuber
>
> Is there a possibility to influence a certain <history> from the SCXML specification during runtime by using a special (JEXL) API? It would be really helpful to be able to (at least) reset a certain history using its ID.
> Something like: History.reset(id)
> I took a look into the source code recently and found that there doesn't seem to be a possibility like this. That's why I made the following changes manually to be able to access a certain history using a custom action:
> {code:java}
> public class SCXMLExecutor implements SCXMLIOProcessor {
>     // changed to public from protected ...
>     public SCInstance getSCInstance() {
>         return exctx.getScInstance();
>     }
> }
> public class SCInstance implements Serializable {
>     // added this method to access a certain history using it's id ...
>     public void resetConfiguration(final String id) {
>       if (id == null || id.length() == 0) {
>         return;
>       }
>       History history = null;
>       for (History h : histories.keySet()) {
>         if ( h.getId().equals(id) ) 
>           history = h;
>           break;
>         }
>       }
>       if (history != null) {
>         resetConfiguration(history);
>       }
>     }
> }
> {code}
> It seems to work. Maybe you could include this code in the following releases ...?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)