From 797279a53c443543fe5c3a41059d77ba7b5609a6 Mon Sep 17 00:00:00 2001 From: Janne Valkealahti Date: Sat, 5 Nov 2016 15:29:10 +0000 Subject: [PATCH] Document repository config changes - Generic changes - Document redis support - Relates to #263 --- .../reference/asciidoc/getting-started.adoc | 3 ++ docs/src/reference/asciidoc/sm.adoc | 38 ++++++++++--------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/docs/src/reference/asciidoc/getting-started.adoc b/docs/src/reference/asciidoc/getting-started.adoc index 7581a5a4..96bdfc96 100644 --- a/docs/src/reference/asciidoc/getting-started.adoc +++ b/docs/src/reference/asciidoc/getting-started.adoc @@ -44,6 +44,9 @@ framework. |spring-statemachine-data-jpa |Support module for `Spring Data JPA`. +|spring-statemachine-data-redis +|Support module for `Spring Data Redis`. + |spring-statemachine-zookeeper |`Zookeeper` integration for a distributed state machine. diff --git a/docs/src/reference/asciidoc/sm.adoc b/docs/src/reference/asciidoc/sm.adoc index 59c84665..192d323d 100644 --- a/docs/src/reference/asciidoc/sm.adoc +++ b/docs/src/reference/asciidoc/sm.adoc @@ -2047,13 +2047,6 @@ image::images/papyrus-gs-15.png[width=400] [[sm-repository]] == Repository Config Support - -[IMPORTANT] -==== -Repository abstraction support is still work in progress and scheduled -to be complete in future milestones. -==== - It is also possible to keep machine configuration in an external storage where it will be loaded on demand instead of creating a static configuration either using _JavaConfig_ or _UML_ based config. This @@ -2061,9 +2054,10 @@ integration works via _Spring Data Repository_ abstraction. We have created special `StateMachineModelFactory` implementation called `RepositoryStateMachineModelFactory` which is able to use base -repository interfaces `StateRepository` and `TransitionRepository` -accompanied with base entity interfaces `RepositoryState` and -`RepositoryTransition` respectively. +repository interfaces `StateRepository`, `TransitionRepository`, +`ActionRepository` and `GuardRepository` accompanied with base entity +interfaces `RepositoryState`, `RepositoryTransition`, +`RepositoryAction` and `RepositoryGuard` respectively. Due to way how _Entities_ and _Repositories_ work in a _Spring Data_, from a user perspective read access can be fully abstracted as it is @@ -2072,7 +2066,7 @@ know what is a real mapped _Entity_ class _Repository_ is working with. Writing into a _Repository_ is always dependant of using a real _Repository_ specific _Entity_ class. From machine configuration point of view we don't need to know these, meaning we don't need to know -actual implementation whether that is _JPA_, _Mongo_ or anything else +actual implementation whether that is _JPA_, _Redis_ or anything else what _Spring Data_ supports. Using a real _Repository_ related _Entity_ class comes into play when you manually try to write new states or transitions into a backed repository. @@ -2081,13 +2075,11 @@ Actual out of a box implementations are documented in below sections. [[sm-repository-jpa]] === JPA -Currently one repository implementation exists which uses _JPA_ to -access configured database. - Actual _Repository_ implementations for a _JPA_ are -`JpaStateRepository` and `JpaTransitionRepository` which are backed by -_Entity_ classes `JpaRepositoryState` and `JpaRepositoryTransition` -respectively. +`JpaStateRepository`, `JpaTransitionRepository`, `JpaActionRepository` +and `JpaGuardRepository` which are backed by +_Entity_ classes `JpaRepositoryState`, `JpaRepositoryTransition`, +`JpaRepositoryAction` and `JpaRepositoryGuard` respectively. Generic way to update states and transition manually is shown below. @@ -2097,5 +2089,15 @@ include::samples/DocsJpaRepositorySampleTests1.java[tags=snippetA] ---- Complete example can be found from sample -<>. +<>. This example is also showing how +repository can be pre-populated from existing _json_ file having a +definitions for entity classes. + +[[sm-repository-redis]] +=== Redis +Actual _Repository_ implementations for a _Redis_ are +`RedisStateRepository`, `RedisTransitionRepository`, `RedisActionRepository` +and `RedisGuardRepository` which are backed by +_Entity_ classes `RedisRepositoryState`, `RedisRepositoryTransition`, +`RedisRepositoryAction` and `RedisRepositoryGuard` respectively.