Commit Graph

173 Commits

Author SHA1 Message Date
Janne Valkealahti
9c20ddd051 Fix state action tests
- Tests should now be more reliable as trying to
  make sure actions run before testing further.
- Fixes #257
2016-09-25 11:20:20 +01:00
Janne Valkealahti
49bae38eb3 Hook StateMachineModelFactory and StateMachineFactory together
- Change so that machine id used in StateMachineFactory
  can use same id in StateMachineModelFactory which now
  extended with method build(String machineId).
- Polish repo and jpa classes.
- Fixes #255
2016-09-25 10:08:57 +01:00
Janne Valkealahti
9f9acd3567 Add docs for state actions
- Relates to #238
2016-09-24 15:55:06 +01:00
Janne Valkealahti
3a4aab647e Update docs for join state
- Relates to #238
2016-09-24 11:31:32 +01:00
Janne Valkealahti
693d7b8951 Fix StateMachineModelFactory usage
- When StateMachineModelFactory is passed into config
  it is now used everytime when machine is build which
  allows model factory to get a fresh model from its
  own storage if needed.
- Shuffled stuff around in machine factory base classes
  to call StateMachineModelFactory only once during a machine
  build operation.
- Other tweaks and a polish.
- Fixes #254
2016-09-23 15:44:13 +01:00
Janne Valkealahti
25e190c57d Fix local transition logic
- Add missing creating of a local transition
- Fix logic how entry/exit is not called with local
- Add tests comparing functionality with external
- Fixes #248
- Fixes #249
2016-09-11 10:25:05 +01:00
Christophe
e6f10b60f5 Ability to set UUID for StateMachine
- Squash commits with below entries
- Add factory with a given uuid
- Fix compile error, replace spaces by tabs and clean imports
- Make more sense to swap uuid and stringId
- Fixes #241
2016-09-09 15:42:19 +01:00
Christophe
4c34e46ccf Add capabilities to provide ActionError in Transition
- Add classes directory to be ignored by git
- Doesn't yet handle actions defined for entry,
  exit or do behariour.
- Docs to come when features around error actions
  are fully implemented.
- Fixes #240
2016-08-30 20:54:56 +01:00
Janne Valkealahti
062bc9aa0e Support state activity
- AbstractState now extends LifecycleObjectSupport getting
  access to TaskScheduler.
- Modify all configs so that we can have a cancellable Action
  which is executed after state is entered and which is
  cancelled(if running) when state is exited.
- Fixes #239
2016-08-14 10:06:33 +01:00
Janne Valkealahti
c387979d75 Support for UML Sub State Machines
- Enhance config model so that a state can be
  configured as a submachine or a factory.
- With uml it's possible to put multiple machines
  into one xml(one needs to be a root machine) and
  in a same way, define state as a separate machine.
- JavaConfig vs. uml config differs in a bit where
  latter is passing raw model data into pojo config and
  JavaConfig either full machine or machine factory.
- Fixes #121
2016-08-13 07:19:21 +01:00
Janne Valkealahti
049f811f56 Refactor join handling
- Refactor how join is handled
- Add new StateListener for listening entry/exit per State.
- Transition is now passed to next guy from a join state.
- A lot of changes in core machine/factory/executor to support
  this new join handling.
- Fixes #235
- Fixes #237
2016-08-11 08:58:34 +01:00
Janne Valkealahti
fca98d8e4d Add tests
- Adding a simple test for checking that
  custom task executor is set via configurer
  if executor is created as bean.
2016-05-12 15:31:26 +01:00
Janne Valkealahti
12137222a8 Join state should not be entered
- Fix join pseudostate to be transient.
- Fix tests which uses wrong concepts.
- Fixes #222
2016-05-06 17:24:54 +01:00
Janne Valkealahti
2836902635 Direct region entry doesn't bypass initial state entry
- Fix a case where region is entered directly. Essentially
  now trying to see if entry into a RegionState needs to
  start a region as otherwise we assume direct entry will
  do a start anyway.
- Fix some tests which kinda tested wrong scenarios.
- Fixes #221
2016-05-06 15:41:29 +01:00
Janne Valkealahti
e60cf77a04 TimerTrigger with delay fires immediately
- Fix use of correct delay.
- Move CountTrigger to support package
  as it's a generic class.
- Fixes #220
2016-05-04 19:48:05 +01:00
Janne Valkealahti
84197d6ce5 Add tests
- Failed attempt to find failing tests for #216
  but then we can't ever have enought tests so
  stashing ongoing work here.
2016-05-01 19:27:30 +01:00
Janne Valkealahti
63e266e4b9 Update docs
- Relates to #194
2016-04-25 09:00:14 +01:00
Janne Valkealahti
06f839fb71 Guard should not break with Throwable
- Now catching all exceptions and throwables
  with evaluate and return false in those cases.
- Fixes #206
2016-04-22 15:04:23 +01:00
Janne Valkealahti
3d41bef524 Update docs
- Relates to #194
2016-04-22 13:35:38 +01:00
Janne Valkealahti
1adca702f6 Add support for default history state
- Add mechanism for transition into a default
  state vertex in cases where i.e. substate has
  never been entered, thus meaning there is no
  history. Without default vertex, submachine now
  does default entry logic to that region.
- Fixes #204
2016-04-22 07:46:17 +01:00
Janne Valkealahti
9339f6c742 Add new annotated method tests
- Relates to #197
2016-04-20 08:39:20 +01:00
Janne Valkealahti
0e79fe5ca2 Update docs
- Add section for junction state.
- Relates to #194
2016-04-16 18:26:55 +01:00
Janne Valkealahti
49b158d3c6 Add support for junction pseudostate
- Pretty much as choice as difference is more or less academic but
  needed for uml model.
- Fixes #42
2016-04-16 16:46:00 +01:00
Janne Valkealahti
3c7edd433e Add support for linked choice states
- With linked choices a machine got stuck in a pseudostate
  while it should automatically follow the links till
  non-pseudostate reached.
- Add ChoicePseudoState to use holder as state references
  may not be known at a time of its instantiation.
- Fixes #195
2016-04-16 09:50:26 +01:00
Janne Valkealahti
4e7b3eb66b Add new persist tests
- New tests related to persist/restore for
  a ssm id.
- Relates to #198
2016-04-15 15:37:49 +01:00
Janne Valkealahti
b5da16ac82 Update docs
- Relates to #194
2016-04-10 15:53:42 +01:00
Janne Valkealahti
ba1729c928 Add base support for exit/entry points
- New concepts of using exit and entry points
  to transition between sub-states.
- Add hooks to annotation config model.
- Relates to #192
2016-04-09 16:38:41 +01:00
Janne Valkealahti
51145f1368 Add base support for eclipse papyrus modeling
- First stage to add support for UI modeling via
  eclipse uml2 and papyrus frameworks.
- Add new interface StateMachineModelFactory which is
  a central point of building machines models outside
  of a normal annotation/build classes. What this mean is
  a hook to config model so that machine can be defined
  via a model factory, instead of writing config based on
  normal adapter callbacks.
- Integrate model config into an annotation model so that
  you can still use normal adapters but point those to
  model factory classes, which then allows external hooks
  for machine configuration.
- New spring-statemachine-uml package which supports
  eclipse uml2/emf frameworks to define a machine config.
- Relates to #193
2016-04-09 16:04:16 +01:00
Janne Valkealahti
6cce27e30b Add distibuted action
- New module spring-statemachine-cluster which is
  based on spring-cloud-cluster to provide leader
  election.
- Ensemble now has a concept of a leader if implementation
  supports it.
- New DistributedLeaderAction can use leader info to execute
  action only on a leader.
- Tweak web sample with these new concepts.
- Fixes #176
2016-03-28 10:44:48 +01:00
Janne Valkealahti
c61507cae6 Fix end state handling
- State is now properly reported even if
  state machine is stopped due to it terminating
  via end state.
- Submachine is now explicitly stopped when parent
  is moving its state into end state.
- Fixed some persistense issues handling along these fixes.
- Fixes #190
2016-03-25 09:06:51 +00:00
Janne Valkealahti
1bf65760d5 Allow user to use machine id
- change original id to uuid.
- This new id is now for user disposal.
- Currently only meant for a top-level machine.
- Can be set via annotation config, model classes or via
  new StateMachineFactory.getStateMachine(String).
- Is persisted with DefaultStateMachinePersister and
  StateMachineContext.
- Related new tests in ConfigurationTests and StateMachinePersistTests3.
- Fixes #186
2016-03-24 07:54:36 +00:00
Janne Valkealahti
a82ff5b936 Fix history state reset
- Fixing a persist/restore bug which failed to properly
  reset history state via StateMachineContext history mappings.
- Effectively caused by too early `break` from a loop resetting
  states where history reset needs to check all states to find
  substate machines.
- Ported test given with a #188.
- Relates to #188
2016-03-22 12:07:18 +00:00
Janne Valkealahti
9641afeeb4 Document spring javaconfig usage for beans
- Fixes #162
- Relates to #185
2016-03-19 16:27:16 +00:00
Janne Valkealahti
32c335c5e3 Polish model usage
- Make model data classes easier to use for
  simple use cases.
- Start adding dev docs.
- Generic docs changes.
- Relates to #172
- Relates to #158
- Relates to #185
2016-03-19 14:22:00 +00:00
Janne Valkealahti
d3eb24ed1c Refactor config model classes
- Better naming for public model
  data classes.
- Relates to #172
2016-03-19 10:06:38 +00:00
Janne Valkealahti
981a5335a8 Factories now use model SPI
- Actually pass StateMachineModel into AbstractStateMachineFactory
  instead of building it internally.
- Relates to #172
2016-03-13 16:20:14 +00:00
Janne Valkealahti
07de17784e Make verifier configurable
- Added new `withVerifier()` which can be used to
  set a custom one or disable verifier usage.
- Tuned default verifier.
- Disabled verifier for some tests which don't
  exactly use correct model.
- Relates to #103
2016-03-13 14:08:21 +00:00
Janne Valkealahti
5b5f9b7f69 Update docs
- Add new `timerOnce` related docs.
- Relates to #185
2016-03-12 16:43:26 +00:00
Janne Valkealahti
f72e4dad9e Add history support for persist
- Enhance StateMachineContext to contain possible
  history state mappings for substates.
- Add persist support for AbstractStateMachinePersister.
- Modify some AbstractStateMachine functionality
  for history handling which then allows to also
  reset history state.
- Relates to #182
2016-03-12 15:52:36 +00:00
Janne Valkealahti
f389244862 Polish 2016-03-11 18:46:13 +00:00
Janne Valkealahti
66fe71e9cc Enhance things around StateMachinePersister
- Polish StateMachinePersister
- Add redis specific RedisStateMachinePersister
- Add more docs.
- Change eventservice sample to use StateMachinePersister.
- Relates #184
- Relates #185
2016-03-11 18:43:45 +00:00
Janne Valkealahti
a981ed4361 Add base system for StateMachinePersister
- New concepts easing persisting operations.
- Base implementation of a persister which user can
  use instead of doing things manually to build a state
  machine context. Supports basic sm model but doesn't yet
  'understand' deep and complex mixed models.
- Fixed some features in sm reset functionality if root machine
  only have regions.
- Relates to #184
2016-03-06 15:17:37 +00:00
Janne Valkealahti
ef19e119b4 Fix timing in tests
- Relates to #165 as scheduler timing is
  causing some trouble in tests.
2016-03-05 18:19:46 +00:00
Janne Valkealahti
17389303aa Fix timing in tests
- Relates to #165 as scheduler timing is
  causing some trouble in tests.
2016-03-05 18:03:56 +00:00
Janne Valkealahti
c6f56df79d Handle annotation method call errors
- Instead of halting calling annotated methods when
  one user level method throws, catch and log those
  so that all methods are called.
- Fixes #180
2016-03-05 12:30:17 +00:00
Janne Valkealahti
28a23cbf15 Timer interval reset for states
- Add new features around Trigger to arm/disarm
  it so that state entry/exit can stop firing
  TimerTrigger. Default functionality for timer(long)
  still stays same, however timerOnce(long) will
  kick this new functionality where trigger will fire
  once after state has been entered.
- Fixes #165
2016-03-05 11:28:34 +00:00
Janne Valkealahti
8b560f5bba Support @WithStateMachine as meta annotation
- Remove explicit check for @Component in favour of
  @WithStateMachine which makes it more logical to
  check meta annotations.
- Fixes #179
2016-03-02 10:01:09 +00:00
Janne Valkealahti
c3b3fe65b7 Catch Throwable instead Exception
- Fixes #164
2016-02-20 09:48:18 +00:00
Janne Valkealahti
ebfa86a0ca Initial config error model and spi
- Move into a generic fail fast configuration error
  model with better exception messages.
- Initial move into a public SPI for state machine
  configuration pojo classes.
- new StateMachineModelVerifier interface for generic model verifying.
- Relates #103
- Relates #172
- Work is done together for above issues mostly because they
  relate to each others for config error handling. Meaning
  we can't really verify configuration if we don't have
  a proper model describing actual config model.
2016-02-13 15:32:18 +00:00
Janne Valkealahti
a72a27252c Make listeners not to cause malfunction
- Wrapping all listener calls so that exceptions
  are not propagated from a user code into a
  state machine execution causing malfunction.
- Fixes #164
2016-02-06 16:02:41 +00:00