spring statemachine - Can we use UmlStateMachineModelFactory inside a StateMachineBuilder -
i using statemachinebuilder create state machine , coz needed use programatically configure states , transitions.
but due requirement change configuration constant , wanted use eclipse uml modelling since no longer need build state machine dynamically or programatically. avoid big code rework thought of using umlstatemachinemodelfactory inside builder below.
builder<string, string> builder = statemachinebuilder .<string, string> builder(); builder.configureconfiguration() .withconfiguration() .autostartup(false) .listener(listener()) .beanfactory( this.applicationcontext.getautowirecapablebeanfactory()); builder.configuremodel().withmodel().factory(new umlstatemachinemodelfactory("classpath:model2.uml"));
1) legal in state machine, if how can attach entry actions each state?
currently using builder using below code attaching entry actions each state
stateconfigurer.state("state1", this.state1entryaction, null);
// state1entryaction @autowired inside controller class , // state1entryaction implements action<string, string> , // annotated @component (org.springframework.stereotype.component)
2) can give name of entry action class inside uml model, order attach entry actions each stage? if how can in eclipse papyrus.
thanks in advance!
docs little unclear of this(especially if user not familiar papyrus , uml concepts). i'd start studying uml test sources in uml xml test files how actions/guards referenced uml runtime resolving. things become more clear when see using real papyrus uml modeler.
on default guard/action resolve equivalent bean name application context, there way hook additional instances manually(i.e. if guard/action not defined bean).
this test testsimpleflat2() register additional actions/guards. these resolved via statemachinecomponentresolver
interface , internally instance of defaultstatemachinecomponentresolver
resolve beanfactory
if it's known user can add secondary defaultstatemachinecomponentresolver
demonstrated in test.
Comments
Post a Comment