Commit Graph

197 Commits

Author SHA1 Message Date
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
79a91220f6 Fix possible NPE
- Relates to #182
2016-03-19 09:09:19 +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
5cd7d348e9 Package change
- Move RepositoryStateMachinePersist from support to
  persist as we're starting to have more persist related
  classes.
- Relates to #184
2016-03-06 16:57:48 +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
008316f434 Set executor for TimerTrigger
- Polish PR #178
- Also set taskExecutor
2016-03-02 08:23:36 +00:00
Lorin Metzger
d15493435d When using the StateMachineBuilder outside of the springboot framework, it is not possible to create a timer trigger, because the taskScheduler is not set on the TimerTrigger/LifecycleObjectSupport when the AbstractStateMachineFactory is building the TimerTrigger. This results in a NullPointerException while building the StateMachine. 2016-03-02 08:14:16 +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
Janne Valkealahti
294430c9fb Add redis persist sample
- New sample app eventservice which is used to
  demonstrate how redis is used as a repository
  for StateMachineContext.
- Uses pooled request scope machine instances so
  that with every request a machine is reseted from
  a redis.
- Provides UI to play around.
- Provides rest endpoint to send 'pageview' events
  for processing. For example using curl command like:
  curl http://localhost:8080/feed -H "Content-Type: application/json" --data '{"user":"joe","id":"VIEW_I"}'
- Fixes #160
2016-01-26 13:11:17 +00:00
Janne Valkealahti
a952714857 Reset machine with null context
- Modify reset feature so that null context
  will take machine back to its initial state
  and empty extended state.
- Fixes #166
2016-01-26 09:09:30 +00:00
Janne Valkealahti
f6079c8a94 Add source to event not accepted stage
- It makes sense to give source state when
  event is not accepted.
- Polish
- Relates #150
2016-01-23 10:13:37 +00:00
Janne Valkealahti
e28caf1164 Add test for timer transition 2016-01-21 08:45:17 +00:00
Janne Valkealahti
26b52dedb6 Add default taskExecutor/taskScheduler via builder
- As with javaconfig, use default intances if not set
  because it is anyway required. User can then customise
  or override.
- Fixes #161
2016-01-16 19:28:57 +00:00
Janne Valkealahti
c866bdcaa2 Fix javadoc errors 2016-01-10 09:37:33 +00:00
Janne Valkealahti
95c91cef6c Polish tests
- Relates to #150
2016-01-10 09:29:37 +00:00
Janne Valkealahti
f22fc8495c Polish javadocs 2016-01-09 09:44:25 +00:00
Janne Valkealahti
51bc34b897 Update docs and polish
- Modify docs and add a better content.
- Add access to payload in EventSecurityExpressionRoot
  #114.
2016-01-09 09:26:15 +00:00
Janne Valkealahti
e08edf0265 Remove most of the non state context usage
- Relates to #150
2016-01-02 18:13:59 +00:00
Janne Valkealahti
4aa18a4ca5 Fix some StateContext use cases
- This is part 1 of changes for #150.
- Modify AbstractStateMachine to pass context in part of
  a stages.
- Add some tests
- Add preliminary docs
2015-12-31 17:39:57 +00:00
Janne Valkealahti
79c49c5a78 Add synchronization
- Relates to #131
2015-12-30 11:09:48 +00:00
Janne Valkealahti
9d59209ce8 Fix event defer issues
- Event may get not accepted in some cases
  while it should be deferred. Check defer
  again before accept would return false.
- Relates to #131
2015-12-30 08:47:35 +00:00
Janne Valkealahti
4f5eb88626 Add StateContext into StateMachineListener
- new StateMachineListener method for listening all
  StateContext changes in a various stages.
- StateContext now has a stage enum field telling at
  which stage it is.
- Polish some classes and docs.
- Prepare tests for StateContext.
- Relates to #126, #138 and #150
2015-12-26 16:37:56 +00:00
Janne Valkealahti
c2a458ce70 Overhaul annotation and listener processing
- This is stage 2 for these changes. Relates to
  #126 and #138.
- Better support for other stuff available from
  a state context.
- Started to add docs.
- Polish.
2015-12-25 09:10:36 +00:00
Janne Valkealahti
0ac5785ec5 Overhaul annotation and listener processing
- This is state 1 for these changes.
- This is a stage one of fixes for #126 and #138, thus
  not giving full support not complete features.
- Add new annotations in a side of OnTransition
  reflecting stuff from a StateMachineListener.
- Prepare and modify call chains so that we have
  preliminary support(not feature ready) for these
  so that existing tests pass.
- Add new helper to handle some annotation and spel
  call caching.
- Enhance StateContext to better suit these needs.
2015-12-23 22:20:57 +00:00
Janne Valkealahti
3e322e4d00 Add redis persisting support
- Add new StateMachineContextRepository interface.
- Add new redis module having persisting support
  for StateMachineContext.
- Extract kryo serializers into a new kryo module which
  is then shared with zookeeper and redis modules.
- We'll add redis related tests later when we figure out
  a correct pattern for integration tests.
- Fixes #110
2015-12-20 15:44:15 +00:00
Janne Valkealahti
d0aaa4bfee Add base security support
- Add base of support using spring security to
  protect events, transitions and actions.
- Fixes #114
2015-12-20 14:33:54 +00:00
Janne Valkealahti
cba4b2fd0c Fix action error in transition
- Exception in action in transition may cause
  machine to malfunction. Fix this by logging warning
  and returning false for transit.
- Fixes #148
2015-12-19 21:42:20 +00:00
Janne Valkealahti
ab292eedca DefaultStateMachineExecutor using wrong extended state
- Remove passing extended state into DefaultStateMachineExecutor as
  after machine is reseted and extended state object changed, transitions
  from executor would get wrong object. Just get it from state machine
  itself for StateContext.
- Fixes #146
2015-12-16 18:51:06 +00:00
Janne Valkealahti
c28c07868f Wrong publish method calls
- notifyTransition and notifyTransitionEnd call wrong
  publish methods. fix by well calling correct methods.
- Fixes #144
2015-12-15 08:44:11 +00:00
Janne Valkealahti
8aaf66afea Fix machine autostart with annotation config
- This seem to relate with machine build from an annotation
  config which is then used as a session scoped bean.
- Fix autostart usage where appropriate and also fix some
  test which were using wrong logic to determine autostart
  usage(tests were wrong).
- Fixes #141
2015-12-12 20:05:43 +00:00
Janne Valkealahti
b7cc1df59b Event defer for substates and regions
- Modify state structure so that nested states and orthogonal
  regions can work with deferred events.
- Change executor to work better with deferred events and try
  to provide better model for run-to-completion when execution
  happens in a threads.
- Add new event defer section in ref docs.
- Fixes #131
2015-12-06 14:48:29 +00:00
Janne Valkealahti
ed25006075 Add support for session scope
- Add tweaks to DisposableBean.destroy() which integrates
  into a lifecycle and properly closes a machine if only
  destroy() is called which is a case when `session` scoped
  bean is destroyed when http session is invalidated.
- Tests in SessionScopedAnnotationTests and
  SessionScopedManualTests for both builder and
  annotation config.
- Fixes #112
2015-11-28 09:13:10 +00:00
Janne Valkealahti
c0b24a3ca1 Fix typo in OnStateMachineStop
- Fixes #129
2015-11-27 07:43:34 +00:00
Janne Valkealahti
68e0cd5f72 Change way BeanFactory and TaskExecutor are set
- Guard LifecycleObjectSupport.afterPropertiesSet() so that
  it's not called twice where other call would be initiated
  by app context if machine is returned as @Bean but still
  normally build via a builder.
- Tune internal handling of BeanFactory and TaskExecutor so that
  we play nice with machine and its executor.
- Fixes #130
2015-11-27 07:41:36 +00:00
Janne Valkealahti
40be191b21 Update tests 2015-11-26 15:30:39 +00:00
Janne Valkealahti
f6037802fd Fix empty @OnTransition
- Fix so that bean method will be called with
  plain @OnTransition having no source or target
  defined.
- Fixes #128
2015-11-26 12:10:22 +00:00
Janne Valkealahti
c981c5a6ee Update docs
- Remove most of a static class modifiers from docs
  to make things easier if doing copy/paste. Not
  all can be removed because some spring inner
  config classes has to be static.
- Fixes #123
2015-11-26 09:36:47 +00:00