From 0365b72dcb35112e38701f46cb60fc2304777f47 Mon Sep 17 00:00:00 2001 From: Janne Valkealahti Date: Mon, 13 Apr 2015 11:59:49 +0100 Subject: [PATCH] Polish docs --- docs/src/reference/asciidoc/index.adoc | 17 --------- docs/src/reference/asciidoc/introduction.adoc | 12 +++---- docs/src/reference/asciidoc/sm-examples.adoc | 15 +++++++- docs/src/reference/asciidoc/sm.adoc | 12 ++++--- .../docs/DocsConfigurationSampleTests.java | 36 ++++++++++++------- 5 files changed, 51 insertions(+), 41 deletions(-) diff --git a/docs/src/reference/asciidoc/index.adoc b/docs/src/reference/asciidoc/index.adoc index d69eb415..0ea6b108 100644 --- a/docs/src/reference/asciidoc/index.adoc +++ b/docs/src/reference/asciidoc/index.adoc @@ -1,12 +1,3 @@ -:hadoop-Configuration: http://hadoop.apache.org/docs/r{hadoop-version}/api/org/apache/hadoop/conf/Configuration.html -:hadoop-FileSystem: http://hadoop.apache.org/docs/r{hadoop-version}/api/org/apache/hadoop/fs/FileSystem.html -:hadoop-Security: http://hadoop.apache.org/docs/r{hadoop-version}/hadoop-project-dist/hadoop-common/SecureMode.html -:hadoop-Streaming: http://hadoop.apache.org/docs/r{hadoop-version}/hadoop-mapreduce-client/hadoop-mapreduce-client-core/HadoopStreaming.html -:hadoop-DistributedCache: http://hadoop.apache.org/docs/r{hadoop-version}/hadoop-mapreduce-client/hadoop-mapreduce-client-core/DistributedCacheDeploy.html -:hadoop-WordCount: http://hadoop.apache.org/docs/r{hadoop-version}/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html#Example:_WordCount_v1.0 -:hadoop-FileSystemShell: http://hadoop.apache.org/docs/r{hadoop-version}/hadoop-project-dist/hadoop-common/FileSystemShell.html -:hadoop-WebHdfs: http://hadoop.apache.org/docs/r{hadoop-version}/hadoop-project-dist/hadoop-hdfs/WebHDFS.html -:hadoop-Hftp: http://hadoop.apache.org/docs/r{hadoop-version}/hadoop-project-dist/hadoop-hdfs/Hftp.html :java-ClassLoader: http://docs.oracle.com/javase/7/docs/api/java/lang/ClassLoader.html :core-ApplicationContext: http://docs.spring.io/spring/docs/{spring-version}/javadoc-api/org/springframework/context/ApplicationContext.html :core-beans-factory-placeholderconfigurer: http://docs.spring.io/spring/docs/{spring-version}/spring-framework-reference/html/beans.html#beans-factory-placeholderconfigurer @@ -18,14 +9,6 @@ :core-dao-exceptions: http://docs.spring.io/spring/docs/{spring-version}/spring-framework-reference/html/dao.html#dao-exceptions :core-jdbc: http://docs.spring.io/spring/docs/{spring-version}/spring-framework-reference/html/jdbc.html :core-jdbc-JdbcTemplate: http://docs.spring.io/spring/docs/{spring-version}/spring-framework-reference/html/jdbc.html#jdbc-JdbcTemplate -:shdp-FsShell: http://docs.spring.io/spring-hadoop/docs/{spring-hadoop-version}/api/org/springframework/data/hadoop/fs/FsShell.html -:shdp-DistCp: http://docs.spring.io/spring-hadoop/docs/{spring-hadoop-version}/api/org/springframework/data/hadoop/fs/DistCp.html -:shdp-HdfsResourceLoader: http://docs.spring.io/spring-hadoop/docs/{spring-hadoop-version}/api/org/springframework/data/hadoop/fs/HdfsResourceLoader.html -:shdp-SpringDataStoreTextWriterConfigurerAdapter: http://docs.spring.io/spring-hadoop/docs/{spring-hadoop-version}/api/org/springframework/data/hadoop/store/config/annotation/SpringDataStoreTextWriterConfigurerAdapter.html -:shdp-EnableDataStoreTextWriter: http://docs.spring.io/spring-hadoop/docs/{spring-hadoop-version}/api/org/springframework/data/hadoop/store/config/annotation/EnableDataStoreTextWriter.html -:shdp-DataStoreTextWriterConfigurer: http://docs.spring.io/spring-hadoop/docs/{spring-hadoop-version}/api/org/springframework/data/hadoop/store/config/annotation/builders/DataStoreTextWriterConfigurer.html -:shdp-DataStoreWriter: http://docs.spring.io/spring-hadoop/docs/{spring-hadoop-version}/api/org/springframework/data/hadoop/store/DataStoreWriter.html -:spring-data-hadoop-boot-jar: spring-data-hadoop-boot-{spring-hadoop-version}.jar = Spring Statemachine - Reference Documentation diff --git a/docs/src/reference/asciidoc/introduction.adoc b/docs/src/reference/asciidoc/introduction.adoc index 4a2f2d8a..2c658d16 100644 --- a/docs/src/reference/asciidoc/introduction.adoc +++ b/docs/src/reference/asciidoc/introduction.adoc @@ -1,6 +1,6 @@ [[introduction]] = Introduction -Spring State Machine(SSM) is a framework for application developers to +Spring Statemachine(SSM) is a framework for application developers to use traditional state machine concepts with Spring applications. SSM aims to provide following features: @@ -22,8 +22,8 @@ familiar with state machine concepts. == Requirements Spring Statemachine {revnumber} is built and tested with JDK 7 and Spring Framework {spring-version} and doesn't require any other dependencies -outside of Spring Framework. Samples will require spring-shell and -spring-boot which will pull other dependencies beyond Framework +outside of Spring Framework. Samples require spring-shell and +spring-boot which pulls other dependencies beyond framework itself. == Background @@ -32,12 +32,12 @@ consistent and relatively easily debugged due to ways how operational rules are written in stone when machine is started. Idea is that your application is and may exist in a finite number of states and then something happens which takes your application from one state to the next. What -will drive a state machine are triggers which are either based on an +will drive a state machine are triggers which are either based on events or timers. It is much easier to design high level logic outside of your application and then interact with a state machine with a various -different ways. You will simple send interact with a state machine by +different ways. You can simply interact with a state machine by sending event, listening what a state machine does or simply request a current state. @@ -67,7 +67,7 @@ You are already trying to implement a state machine if: == Feature Limitations -A lot of features are planned thus not all expected feature are ntot +A lot of features are planned for future releases thus some are not yet implemented: * Regions are not fully supported and currently contains many bugs. diff --git a/docs/src/reference/asciidoc/sm-examples.adoc b/docs/src/reference/asciidoc/sm-examples.adoc index 685f88eb..403ca2a7 100644 --- a/docs/src/reference/asciidoc/sm-examples.adoc +++ b/docs/src/reference/asciidoc/sm-examples.adoc @@ -2,11 +2,24 @@ = State Machine Examples This part of the reference documentation explains the use of state -machines as sample code together with a uml state charts. We do few +machines together with a sample code and a uml state charts. We do few shortcuts when representing relationship between a state chart, SSM configuration and what an application does with a state machine. For complete examples go and study the samples repository. +Samples are build directly from a main source distribution during a +normal build cycle. + +[source,text] +---- +./gradlew clean build -x test +---- + +Every sample is located in its own directory under +`spring-statemachine-samples`. Samples are based on spring-boot and +spring-shell and you will find usual boot fat jars under every sample +projects `build/libs` directory. + == Turnstile Turnstile is a simple device which gives you an access if payment is diff --git a/docs/src/reference/asciidoc/sm.adoc b/docs/src/reference/asciidoc/sm.adoc index aaef7f6c..83ec552c 100644 --- a/docs/src/reference/asciidoc/sm.adoc +++ b/docs/src/reference/asciidoc/sm.adoc @@ -8,7 +8,9 @@ that Spring Statemachine provides to any Spring based application. <> describes the generic state machine factory support. -<> describes the generic state machine listener support. +<> describes the use of triggers. + +<> describes the use of state machine listeners. <> describes the generic Spring application context support. @@ -53,15 +55,15 @@ include::samples/DocsConfigurationSampleTests.java[tags=snippetC] === Configuring Guards Guards are used to protect state transitions. Interface _Guard_ is -used to do an evaluation where method has access to _StateContext_. +used to do an evaluation where method has access to a _StateContext_. [source,java,indent=0] ---- include::samples/DocsConfigurationSampleTests.java[tags=snippetD] ---- -In above two different types of guard configuration is used. Firstly a -simply _Guard_ is created as a bean and attached to transition between +In above two different types of guard configurations are used. Firstly a +simple _Guard_ is created as a bean and attached to transition between states `S1` and `S2`. Secondly a simple spel expression can be used as a guard where @@ -238,7 +240,7 @@ event enums user have created due to java language limitations, thus string representation have to be used. However if you want to have a type safe annotation it is possible to -create a new annotation and use _@OnTransition_ as meta annotations. +create a new annotation and use _@OnTransition_ as meta annotation. This user level annotation can make a reference to actual states and events enums and framework will try to match these in a same way. diff --git a/spring-statemachine-core/src/test/java/org/springframework/statemachine/docs/DocsConfigurationSampleTests.java b/spring-statemachine-core/src/test/java/org/springframework/statemachine/docs/DocsConfigurationSampleTests.java index 8a690b03..b91beed0 100644 --- a/spring-statemachine-core/src/test/java/org/springframework/statemachine/docs/DocsConfigurationSampleTests.java +++ b/spring-statemachine-core/src/test/java/org/springframework/statemachine/docs/DocsConfigurationSampleTests.java @@ -59,7 +59,8 @@ public class DocsConfigurationSampleTests extends AbstractStateMachineTests { public static class Config1 extends EnumStateMachineConfigurerAdapter { @Override - public void configure(StateMachineStateConfigurer states) throws Exception { + public void configure(StateMachineStateConfigurer states) + throws Exception { states .withStates() .initial(States.S1) @@ -76,7 +77,8 @@ public class DocsConfigurationSampleTests extends AbstractStateMachineTests { public static class Config2 extends EnumStateMachineConfigurerAdapter { @Override - public void configure(StateMachineStateConfigurer states) throws Exception { + public void configure(StateMachineStateConfigurer states) + throws Exception { states .withStates() .initial(States.S1) @@ -97,7 +99,8 @@ public class DocsConfigurationSampleTests extends AbstractStateMachineTests { public static class Config3 extends EnumStateMachineConfigurerAdapter { @Override - public void configure(StateMachineStateConfigurer states) throws Exception { + public void configure(StateMachineStateConfigurer states) + throws Exception { states .withStates() .initial(States.S1) @@ -105,7 +108,8 @@ public class DocsConfigurationSampleTests extends AbstractStateMachineTests { } @Override - public void configure(StateMachineTransitionConfigurer transitions) throws Exception { + public void configure(StateMachineTransitionConfigurer transitions) + throws Exception { transitions .withExternal() .source(States.S1).target(States.S2) @@ -129,7 +133,8 @@ public class DocsConfigurationSampleTests extends AbstractStateMachineTests { public static class Config4 extends EnumStateMachineConfigurerAdapter { @Override - public void configure(StateMachineTransitionConfigurer transitions) throws Exception { + public void configure(StateMachineTransitionConfigurer transitions) + throws Exception { transitions .withExternal() .source(States.S1).target(States.S2) @@ -163,7 +168,8 @@ public class DocsConfigurationSampleTests extends AbstractStateMachineTests { public static class Config5 extends EnumStateMachineConfigurerAdapter { @Override - public void configure(StateMachineTransitionConfigurer transitions) throws Exception { + public void configure(StateMachineTransitionConfigurer transitions) + throws Exception { transitions .withExternal() .source(States.S1) @@ -189,10 +195,12 @@ public class DocsConfigurationSampleTests extends AbstractStateMachineTests { // tag::snippetF[] @Configuration @EnableStateMachineFactory - public static class Config6 extends EnumStateMachineConfigurerAdapter { + public static class Config6 + extends EnumStateMachineConfigurerAdapter { @Override - public void configure(StateMachineStateConfigurer states) throws Exception { + public void configure(StateMachineStateConfigurer states) + throws Exception { states .withStates() .initial(States.S1) @@ -205,7 +213,8 @@ public class DocsConfigurationSampleTests extends AbstractStateMachineTests { // tag::snippetG[] - static class StateMachineApplicationEventListener implements ApplicationListener { + static class StateMachineApplicationEventListener + implements ApplicationListener { @Override public void onApplicationEvent(StateMachineEvent event) { @@ -214,7 +223,8 @@ public class DocsConfigurationSampleTests extends AbstractStateMachineTests { // end::snippetG[] // tag::snippetH[] - static class StateMachineEventListener extends StateMachineListenerAdapter { + static class StateMachineEventListener + extends StateMachineListenerAdapter { @Override public void stateChanged(State from, State to) { @@ -314,12 +324,14 @@ public class DocsConfigurationSampleTests extends AbstractStateMachineTests { // tag::snippetN[] @Configuration @EnableStateMachine(contextEvents = false) - public static class Config8 extends EnumStateMachineConfigurerAdapter { + public static class Config8 + extends EnumStateMachineConfigurerAdapter { } @Configuration @EnableStateMachineFactory(contextEvents = false) - public static class Config9 extends EnumStateMachineConfigurerAdapter { + public static class Config9 + extends EnumStateMachineConfigurerAdapter { } // end::snippetN[]