/** * {@inheritDoc} */ public SetNextRule get() { return new SetNextRule(this.methodName, this.paramType); }
@Override public Object createObject(Attributes attributes) { String methodName = attributes.getValue("methodname"); String paramType = attributes.getValue("paramtype"); return (paramType == null || paramType.length() == 0) ? new SetNextRule( methodName) : new SetNextRule( methodName, paramType); } }
/** * Add a "set next" rule for the specified parameters. * * @param pattern Element matching pattern * @param methodName Method name to call on the parent element * @see SetNextRule */ public void addSetNext(String pattern, String methodName) { addRule(pattern, new SetNextRule(methodName)); }
/** * Add a "set next" rule for the specified parameters. * * @param pattern Element matching pattern * @param methodName Method name to call on the parent element * @param paramType Java class name of the expected parameter type * (if you wish to use a primitive type, specify the corresonding * Java wrapper class instead, such as <code>java.lang.Boolean</code> * for a <code>boolean</code> parameter) * @see SetNextRule */ public void addSetNext(String pattern, String methodName, String paramType) { addRule(pattern, new SetNextRule(methodName, paramType)); }
public Object createObject(Attributes attributes) { String methodName = attributes.getValue("methodname"); String paramType = attributes.getValue("paramtype"); return (paramType == null || paramType.length() == 0) ? new SetNextRule( methodName) : new SetNextRule( methodName, paramType); } }
/** * Add a "set next" rule for the specified parameters. * * @param pattern Element matching pattern * @param methodName Method name to call on the parent element * @see SetNextRule */ public void addSetNext(String pattern, String methodName) { addRule(pattern, new SetNextRule(methodName)); }
/** * Add a "set next" rule for the specified parameters. * * @param pattern Element matching pattern * @param methodName Method name to call on the parent element * @param paramType Java class name of the expected parameter type * (if you wish to use a primitive type, specify the corresonding * Java wrapper class instead, such as <code>java.lang.Boolean</code> * for a <code>boolean</code> parameter) * @see SetNextRule */ public void addSetNext(String pattern, String methodName, String paramType) { addRule(pattern, new SetNextRule(methodName, paramType)); }
/** * Add Digester rules for all <onentry> and <onexit> * elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param pr The {@link PathResolver} for this document * @param customActions The list of custom actions this digester needs * to be able to process */ private static void addHandlerRules(final String xp, final ExtendedBaseRules scxmlRules, final PathResolver pr, final List customActions) { scxmlRules.add(xp + XPF_ONEN, new ObjectCreateRule(OnEntry.class)); addActionRules(xp + XPF_ONEN, scxmlRules, pr, customActions); scxmlRules.add(xp + XPF_ONEN, new SetNextRule("setOnEntry")); scxmlRules.add(xp + XPF_ONEX, new ObjectCreateRule(OnExit.class)); addActionRules(xp + XPF_ONEX, scxmlRules, pr, customActions); scxmlRules.add(xp + XPF_ONEX, new SetNextRule("setOnExit")); }
/** * Add Digester rules for all <onentry> and <onexit> * elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param pr The {@link PathResolver} for this document * @param customActions The list of custom actions this digester needs * to be able to process */ private static void addHandlerRules(final String xp, final ExtendedBaseRules scxmlRules, final PathResolver pr, final List customActions) { scxmlRules.add(xp + XPF_ONEN, new ObjectCreateRule(OnEntry.class)); addActionRules(xp + XPF_ONEN, scxmlRules, pr, customActions); scxmlRules.add(xp + XPF_ONEN, new SetNextRule("setOnEntry")); scxmlRules.add(xp + XPF_ONEX, new ObjectCreateRule(OnExit.class)); addActionRules(xp + XPF_ONEX, scxmlRules, pr, customActions); scxmlRules.add(xp + XPF_ONEX, new SetNextRule("setOnExit")); }
/** * Add Digester rules for all <datamodel> elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param pr The PathResolver * @param scxml The parent SCXML document (or null) */ private static void addDatamodelRules(final String xp, final ExtendedBaseRules scxmlRules, final SCXML scxml, final PathResolver pr) { scxmlRules.add(xp, new ObjectCreateRule(Datamodel.class)); scxmlRules.add(xp + XPF_DATA, new ObjectCreateRule(Data.class)); scxmlRules.add(xp + XPF_DATA, new SetPropertiesRule()); scxmlRules.add(xp + XPF_DATA, new SetCurrentNamespacesRule()); scxmlRules.add(xp + XPF_DATA, new SetNextRule("addData")); try { scxmlRules.add(xp + XPF_DATA, new ParseDataRule(pr)); } catch (ParserConfigurationException pce) { org.apache.commons.logging.Log log = LogFactory. getLog(SCXMLDigester.class); log.error(ERR_PARSER_CFG_DATA, pce); } scxmlRules.add(xp, new SetNextRule("setDatamodel")); }
/** * Add Digester rules for all <datamodel> elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param pr The PathResolver * @param scxml The parent SCXML document (or null) */ private static void addDatamodelRules(final String xp, final ExtendedBaseRules scxmlRules, final SCXML scxml, final PathResolver pr) { scxmlRules.add(xp, new ObjectCreateRule(Datamodel.class)); scxmlRules.add(xp + XPF_DATA, new ObjectCreateRule(Data.class)); scxmlRules.add(xp + XPF_DATA, new SetPropertiesRule()); scxmlRules.add(xp + XPF_DATA, new SetCurrentNamespacesRule()); scxmlRules.add(xp + XPF_DATA, new SetNextRule("addData")); try { scxmlRules.add(xp + XPF_DATA, new ParseDataRule(pr)); } catch (ParserConfigurationException pce) { org.apache.commons.logging.Log log = LogFactory. getLog(SCXMLParser.class); log.error(ERR_PARSER_CFG_DATA, pce); } scxmlRules.add(xp, new SetNextRule("setDatamodel")); }
/** * Add Digester rules for all <initial> elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param customActions The list of custom actions this digester needs * to be able to process * @param pr The PathResolver * @param scxml The parent SCXML document (or null) */ private static void addInitialRules(final String xp, final ExtendedBaseRules scxmlRules, final List customActions, final PathResolver pr, final SCXML scxml) { scxmlRules.add(xp, new ObjectCreateRule(Initial.class)); addPseudoStatePropertiesRules(xp, scxmlRules, customActions, pr, scxml); scxmlRules.add(xp, new UpdateModelRule(scxml)); addTransitionRules(xp + XPF_TR, scxmlRules, "setTransition", pr, customActions); scxmlRules.add(xp, new SetNextRule("setInitial")); }
/** * Add Digester rules for all <initial> elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param customActions The list of custom actions this digester needs * to be able to process * @param pr The PathResolver * @param scxml The parent SCXML document (or null) */ private static void addInitialRules(final String xp, final ExtendedBaseRules scxmlRules, final List customActions, final PathResolver pr, final SCXML scxml) { scxmlRules.add(xp, new ObjectCreateRule(Initial.class)); addPseudoStatePropertiesRules(xp, scxmlRules, customActions, pr, scxml); scxmlRules.add(xp, new UpdateModelRule(scxml)); addTransitionRules(xp + XPF_TR, scxmlRules, "setTransition", pr, customActions); scxmlRules.add(xp, new SetNextRule("setInitial")); }
/** * Add the run of the mill Digester rules for any element. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param klass The class in the Java object model to be instantiated * in the ObjectCreateRule for this action * @param args The attributes to be mapped into the object model * @param props The properties that args get mapped to * @param addMethod The method that the SetNextRule should call */ private static void addSimpleRulesTuple(final String xp, final ExtendedBaseRules scxmlRules, final Class klass, final String[] args, final String[] props, final String addMethod) { scxmlRules.add(xp, new ObjectCreateRule(klass)); if (args == null) { scxmlRules.add(xp, new SetPropertiesRule()); } else { scxmlRules.add(xp, new SetPropertiesRule(args, props)); } scxmlRules.add(xp, new SetNextRule(addMethod)); }
/** * Add the run of the mill Digester rules for any element. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param klass The class in the Java object model to be instantiated * in the ObjectCreateRule for this action * @param args The attributes to be mapped into the object model * @param props The properties that args get mapped to * @param addMethod The method that the SetNextRule should call */ private static void addSimpleRulesTuple(final String xp, final ExtendedBaseRules scxmlRules, final Class klass, final String[] args, final String[] props, final String addMethod) { scxmlRules.add(xp, new ObjectCreateRule(klass)); if (args == null) { scxmlRules.add(xp, new SetPropertiesRule()); } else { scxmlRules.add(xp, new SetPropertiesRule(args, props)); } scxmlRules.add(xp, new SetNextRule(addMethod)); }
/** * Add Digester rules for all <invoke> elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param customActions The list of {@link CustomAction}s this digester * instance will process, can be null or empty * @param pr The PathResolver * @param scxml The parent SCXML document (or null) */ private static void addInvokeRules(final String xp, final ExtendedBaseRules scxmlRules, final List customActions, final PathResolver pr, final SCXML scxml) { scxmlRules.add(xp, new ObjectCreateRule(Invoke.class)); scxmlRules.add(xp, new SetPropertiesRule()); scxmlRules.add(xp, new SetCurrentNamespacesRule()); scxmlRules.add(xp, new SetPathResolverRule(pr)); scxmlRules.add(xp + XPF_PRM, new ObjectCreateRule(Param.class)); scxmlRules.add(xp + XPF_PRM, new SetPropertiesRule()); scxmlRules.add(xp + XPF_PRM, new SetCurrentNamespacesRule()); scxmlRules.add(xp + XPF_PRM, new SetNextRule("addParam")); scxmlRules.add(xp + XPF_FIN, new ObjectCreateRule(Finalize.class)); scxmlRules.add(xp + XPF_FIN, new UpdateFinalizeRule()); addActionRules(xp + XPF_FIN, scxmlRules, pr, customActions); scxmlRules.add(xp + XPF_FIN, new SetNextRule("setFinalize")); scxmlRules.add(xp, new SetNextRule("setInvoke")); }
/** * Add Digester rules for all <invoke> elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param customActions The list of {@link CustomAction}s this digester * instance will process, can be null or empty * @param pr The PathResolver * @param scxml The parent SCXML document (or null) */ private static void addInvokeRules(final String xp, final ExtendedBaseRules scxmlRules, final List customActions, final PathResolver pr, final SCXML scxml) { scxmlRules.add(xp, new ObjectCreateRule(Invoke.class)); scxmlRules.add(xp, new SetPropertiesRule()); scxmlRules.add(xp, new SetCurrentNamespacesRule()); scxmlRules.add(xp, new SetPathResolverRule(pr)); scxmlRules.add(xp + XPF_PRM, new ObjectCreateRule(Param.class)); scxmlRules.add(xp + XPF_PRM, new SetPropertiesRule()); scxmlRules.add(xp + XPF_PRM, new SetCurrentNamespacesRule()); scxmlRules.add(xp + XPF_PRM, new SetNextRule("addParam")); scxmlRules.add(xp + XPF_FIN, new ObjectCreateRule(Finalize.class)); scxmlRules.add(xp + XPF_FIN, new UpdateFinalizeRule()); addActionRules(xp + XPF_FIN, scxmlRules, pr, customActions); scxmlRules.add(xp + XPF_FIN, new SetNextRule("setFinalize")); scxmlRules.add(xp, new SetNextRule("setInvoke")); }
/** * Add Digester rules for all <history> elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param customActions The list of custom actions this digester needs * to be able to process * @param pr The PathResolver * @param scxml The parent SCXML document (or null) */ private static void addHistoryRules(final String xp, final ExtendedBaseRules scxmlRules, final List customActions, final PathResolver pr, final SCXML scxml) { scxmlRules.add(xp, new ObjectCreateRule(History.class)); addPseudoStatePropertiesRules(xp, scxmlRules, customActions, pr, scxml); scxmlRules.add(xp, new UpdateModelRule(scxml)); scxmlRules.add(xp, new SetPropertiesRule(new String[] {"type"}, new String[] {"type"})); addTransitionRules(xp + XPF_TR, scxmlRules, "setTransition", pr, customActions); scxmlRules.add(xp, new SetNextRule("addHistory")); }
/** * Add Digester rules for all <history> elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param customActions The list of custom actions this digester needs * to be able to process * @param pr The PathResolver * @param scxml The parent SCXML document (or null) */ private static void addHistoryRules(final String xp, final ExtendedBaseRules scxmlRules, final List customActions, final PathResolver pr, final SCXML scxml) { scxmlRules.add(xp, new ObjectCreateRule(History.class)); addPseudoStatePropertiesRules(xp, scxmlRules, customActions, pr, scxml); scxmlRules.add(xp, new UpdateModelRule(scxml)); scxmlRules.add(xp, new SetPropertiesRule(new String[] {"type"}, new String[] {"type"})); addTransitionRules(xp + XPF_TR, scxmlRules, "setTransition", pr, customActions); scxmlRules.add(xp, new SetNextRule("addHistory")); }
/** * Add Digester rules for all <state> elements. * * @param xp The Digester style XPath expression of the parent * XML element * @param scxmlRules The rule set to be used for digestion * @param customActions The list of custom actions this digester needs * to be able to process * @param scxml The parent SCXML document (or null) * @param pr The PathResolver */ private static void addStateRules(final String xp, final ExtendedBaseRules scxmlRules, final List customActions, final SCXML scxml, final PathResolver pr) { scxmlRules.add(xp, new ObjectCreateRule(State.class)); addStatePropertiesRules(xp, scxmlRules, customActions, pr, scxml); addDatamodelRules(xp + XPF_DM, scxmlRules, scxml, pr); addInvokeRules(xp + XPF_INV, scxmlRules, customActions, pr, scxml); addInitialRules(xp + XPF_INI, scxmlRules, customActions, pr, scxml); addHistoryRules(xp + XPF_HIST, scxmlRules, customActions, pr, scxml); addTransitionRules(xp + XPF_TR, scxmlRules, "addTransition", pr, customActions); addHandlerRules(xp, scxmlRules, pr, customActions); scxmlRules.add(xp, new UpdateModelRule(scxml)); scxmlRules.add(xp, new SetNextRule("addChild")); }