Example usage for org.apache.commons.scxml.model CustomAction CustomAction

List of usage examples for org.apache.commons.scxml.model CustomAction CustomAction

Introduction

In this page you can find the example usage for org.apache.commons.scxml.model CustomAction CustomAction.

Prototype

public CustomAction(final String namespaceURI, final String localName,
        final Class<? extends Action> actionClass) 

Source Link

Document

Constructor, if the namespace or local name is null or empty, or if the implementation is not an Action , an IllegalArgumentException is thrown.

Usage

From source file:alma.acs.nc.sm.generic.AcsScxmlActionDispatcher.java

/**
 * Wraps the registered action handlers in a form suitable for the SCXML framework.
 * The framework will instantiate DispatchingScxmlAction for each action,
 * which will then call back to {@link #execute(Enum, EventDispatcher, ErrorReporter, SCInstance, Collection)}. 
 * @return// ww w . ja  v  a2s  .c  o  m
 */
protected List<CustomAction> getScxmlActionMap() {
    List<CustomAction> ret = new ArrayList<CustomAction>();

    for (A action : actionMap.keySet()) {
        ret.add(new CustomAction(CUSTOM_ACTIONS_DOMAIN_NAME, action.name(), AcsScxmlDispatchingAction.class));
    }
    return ret;
}

From source file:com.headstrong.fusion.statemachine.SCXMLStateMachine.java

/**
 * Returns list of custom actions.// w  w  w  .  j a  va 2s. c om
 * 
 * @return {@link List} of {@link CustomAction}
 */
private static List<CustomAction> getCustomActions() {
    // (1) Create a list of custom actions, add as many as are needed
    // currently only one custom action is exposed which internally would
    // execute action service registered by the component.
    List<CustomAction> customActions = new ArrayList<CustomAction>();
    CustomAction customAction = new CustomAction(NAMESPACE, CUSTOM_ACTION_SERVICE, SCXMLCustomAction.class);
    customActions.add(customAction);
    return customActions;
}

From source file:de.dfki.iui.mmds.scxml.engine.impl.SCXMLEngineImpl.java

/**
 * Load the SCXML object representing this state machine.
 * /*from   ww w.  ja v a  2 s .  com*/
 * @param scxmlDocument
 *            The URL pointing to the SCXML document that describes the
 *            &quot;lifecycle&quot; of the instances of this class.
 * @return Returns the stateMachine.
 */
private SCXML load(final URL scxmlDocument) {

    log = LogFactory.getLog(this.getClass());
    // logInfo(log.getClass().getName());
    if (log.isDebugEnabled()) {
        // logInfo("debub enabled");
    }
    ErrorHandler errHandler = new SimpleErrorHandler();
    try {

        List customActions = new ArrayList();
        CustomAction ca = new CustomAction("http://www.dfki.de/mmds/scxml/customaction", "raise", Raise.class);
        customActions.add(ca);

        SCXML stateMachine = SCXMLParser.parse(scxmlDocument, errHandler, customActions);
        // logInfo("SCXML loaded");
        return stateMachine;
    } catch (IOException ioe) {
        logError(ioe);
    } catch (SAXException sae) {
        logError(sae);
    } catch (ModelException me) {
        logError(me);
    }
    return null;
}

From source file:org.finra.datagenerator.engine.negscxml.NegSCXMLEngine.java

private List<CustomAction> customActions() {
    List<CustomAction> actions = new LinkedList<>();
    CustomAction tra = new CustomAction("org.finra.datagenerator", "transform", Transform.class);
    actions.add(tra);//w  w  w . ja v  a  2  s. c  om
    CustomAction neg = new CustomAction("org.finra.datagenerator", "negative", NegativeAssign.class);
    actions.add(neg);
    return actions;
}

From source file:org.finra.datagenerator.engine.scxml.SCXMLEngine.java

private List<CustomAction> customActionsFromTagExtensions() {
    List<CustomAction> customActions = new ArrayList<>();

    for (CustomTagExtension tagExtension : tagExtensionList) {
        if (!tagExtension.getTagNameSpace().equals("http://www.w3.org/2005/07/scxml")) {
            CustomAction action = new CustomAction(tagExtension.getTagNameSpace(), tagExtension.getTagName(),
                    tagExtension.getTagActionClass());
            customActions.add(action);/*  w ww .  j  ava2  s.c  o m*/
        }
    }

    return customActions;
}

From source file:org.finra.datagenerator.engine.scxml.SCXMLFrontierTest.java

private List<CustomAction> customActionsFromTagExtensions(List<CustomTagExtension> tagExtensionList) {
    List<CustomAction> customActions = new ArrayList<>();

    for (CustomTagExtension tagExtension : tagExtensionList) {
        if (!tagExtension.getTagName().equals("assign")) {
            CustomAction action = new CustomAction(tagExtension.getTagNameSpace(), tagExtension.getTagName(),
                    tagExtension.getTagActionClass());
            customActions.add(action);// www  . j  ava 2s  . c  om
        }
    }

    return customActions;
}

From source file:org.finra.datagenerator.engine.scxml.SCXMLGapper.java

private void setModel(String model, List<CustomTagExtension> tagExtensionList) {
    List<CustomAction> customActions = new ArrayList<>();

    for (CustomTagExtension tagExtension : tagExtensionList) {
        if (!tagExtension.getTagNameSpace().equals("http://www.w3.org/2005/07/scxml")) {
            CustomAction action = new CustomAction(tagExtension.getTagNameSpace(), tagExtension.getTagName(),
                    tagExtension.getTagActionClass());
            customActions.add(action);/*from   w ww.  j  av  a  2 s.co m*/
        }
    }

    try {
        InputStream is = new ByteArrayInputStream(model.getBytes());
        this.model = SCXMLParser.parse(new InputSource(is), null, customActions);
    } catch (IOException | SAXException | ModelException e) {
        e.printStackTrace();
    }
}