Hello everyone,

I'm trying to configure SCXML to read custom actions like this:

> <my:custom>
>     <my:command name="foo"/>
>     <my:command name="bar"/>
> </my:custom>

I've read the custom actions tutorial 
(http://commons.apache.org/scxml/guide/custom-actions.html), which sends back 
to Digester API for custom action with nested children and I end up with the 
following code:

>         Digester digester = SCXMLParser.newInstance(null, new 
> URLResolver(scxmlDocument), null);
>         digester.setNamespaceAware(true);
>         digester.setRuleNamespaceURI("http://www.my.org/SCXML";);
> 
>         digester.addObjectCreate("*/custom", MyCustomAction.class);
>         digester.addSetProperties("*/custom");
>         digester.addObjectCreate("*/custom/command", MyCustomAction.class);
>         digester.addSetNext("*/custom/command", "addCommand", 
> "my.package.CommandCustomAction");
> 
>         digester.setErrorHandler(errHandler);
> 
>         try {
>             stateMachine = (SCXML) digester.parse(scxmlDocument.toString());
> 
>             if (stateMachine != null) {
>                 SCXMLParser.updateSCXML(stateMachine);
>             }
>         } catch (RuntimeException rte) {
>             logError(rte);
>         } catch (IOException ioe) {
>             logError(ioe);
>         } catch (SAXException sae) {
>             logError(sae);
>         } catch (ModelException me) {
>             logError(me);
>         }

MyCustomAction class implements CustomAction and stores an ArrayList of 
CommandCustomAction and has a addCommand method.
The CommandCustomAction defines the setName() and getName() methods.

This code seems to work (I mean no crash nor warning)... but does nothing.
I guess I just read successfully the XML file, but didn't tell SCXML that it 
has to call the execute method in MyCustomeAction class. How to do it ?
Is there an example somewhere of the use of such custom actions with children 
elements ?

Kind regards,
Ben
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to