Remove dependency to Spring Shell
This commit updates the samples to use Java's standard CLI utilities instead of Spring Shell. Resolves #1184
This commit is contained in:
@@ -17,7 +17,7 @@ dependencies outside of Spring Framework within its core system.
|
||||
|
||||
Other optional parts (such as <<sm-distributed>>) have dependencies on
|
||||
Zookeeper, while <<statemachine-examples>> has dependencies
|
||||
on `spring-shell` and `spring-boot`, which pull other dependencies
|
||||
on `spring-boot`, which pull other dependencies
|
||||
beyond the framework itself. Also, the optional security and data access features have
|
||||
dependencies to on Spring Security and Spring Data modules.
|
||||
|
||||
|
||||
@@ -231,15 +231,15 @@ The following example shows how this state machine actually works.
|
||||
====
|
||||
[source,text]
|
||||
----
|
||||
sm>sm start
|
||||
sm>start
|
||||
Entry state IDLE
|
||||
Entry state CLOSED
|
||||
State machine started
|
||||
|
||||
sm>cd lcd
|
||||
sm>lcd
|
||||
No CD
|
||||
|
||||
sm>cd library
|
||||
sm>list
|
||||
0: Greatest Hits
|
||||
0: Bohemian Rhapsody 05:56
|
||||
1: Another One Bites the Dust 03:36
|
||||
@@ -247,14 +247,14 @@ sm>cd library
|
||||
0: A Kind of Magic 04:22
|
||||
1: Under Pressure 04:08
|
||||
|
||||
sm>cd eject
|
||||
sm>eject
|
||||
Exit state CLOSED
|
||||
Entry state OPEN
|
||||
|
||||
sm>cd load 0
|
||||
sm>load 0
|
||||
Loading cd Greatest Hits
|
||||
|
||||
sm>cd play
|
||||
sm>play
|
||||
Exit state OPEN
|
||||
Entry state CLOSED
|
||||
Exit state CLOSED
|
||||
@@ -262,21 +262,21 @@ Exit state IDLE
|
||||
Entry state BUSY
|
||||
Entry state PLAYING
|
||||
|
||||
sm>cd lcd
|
||||
sm>lcd
|
||||
Greatest Hits Bohemian Rhapsody 00:03
|
||||
|
||||
sm>cd forward
|
||||
sm>forward
|
||||
|
||||
sm>cd lcd
|
||||
sm>lcd
|
||||
Greatest Hits Another One Bites the Dust 00:04
|
||||
|
||||
sm>cd stop
|
||||
sm>stop
|
||||
Exit state PLAYING
|
||||
Exit state BUSY
|
||||
Entry state IDLE
|
||||
Entry state CLOSED
|
||||
|
||||
sm>cd lcd
|
||||
sm>lcd
|
||||
Greatest Hits
|
||||
----
|
||||
====
|
||||
|
||||
@@ -44,27 +44,27 @@ The following example shows the state machine's output:
|
||||
====
|
||||
[source,text]
|
||||
----
|
||||
sm>persist db
|
||||
sm>list
|
||||
Order [id=1, state=PLACED]
|
||||
Order [id=2, state=PROCESSING]
|
||||
Order [id=3, state=SENT]
|
||||
Order [id=4, state=DELIVERED]
|
||||
|
||||
sm>persist process 1
|
||||
sm>process 1
|
||||
Exit state PLACED
|
||||
Entry state PROCESSING
|
||||
|
||||
sm>persist db
|
||||
sm>list
|
||||
Order [id=2, state=PROCESSING]
|
||||
Order [id=3, state=SENT]
|
||||
Order [id=4, state=DELIVERED]
|
||||
Order [id=1, state=PROCESSING]
|
||||
|
||||
sm>persist deliver 3
|
||||
sm>deliver 3
|
||||
Exit state SENT
|
||||
Entry state DELIVERED
|
||||
|
||||
sm>persist db
|
||||
sm>list
|
||||
Order [id=2, state=PROCESSING]
|
||||
Order [id=4, state=DELIVERED]
|
||||
Order [id=1, state=PROCESSING]
|
||||
|
||||
@@ -83,14 +83,14 @@ various events are sent to it:
|
||||
====
|
||||
[source,text]
|
||||
----
|
||||
sm>sm start
|
||||
sm>start
|
||||
Init foo to 0
|
||||
Entry state S0
|
||||
Entry state S1
|
||||
Entry state S11
|
||||
State machine started
|
||||
|
||||
sm>sm event A
|
||||
sm>event A
|
||||
Event A send
|
||||
|
||||
sm>sm event C
|
||||
@@ -101,12 +101,12 @@ Entry state S21
|
||||
Entry state S211
|
||||
Event C send
|
||||
|
||||
sm>sm event H
|
||||
sm>event H
|
||||
Switch foo to 1
|
||||
Internal transition source=S0
|
||||
Event H send
|
||||
|
||||
sm>sm event C
|
||||
sm>event C
|
||||
Exit state S211
|
||||
Exit state S21
|
||||
Exit state S2
|
||||
@@ -114,7 +114,7 @@ Entry state S1
|
||||
Entry state S11
|
||||
Event C send
|
||||
|
||||
sm>sm event A
|
||||
sm>event A
|
||||
Exit state S11
|
||||
Exit state S1
|
||||
Entry state S1
|
||||
@@ -144,27 +144,27 @@ handling works:
|
||||
====
|
||||
[source,text]
|
||||
----
|
||||
sm>sm variables
|
||||
sm>variables
|
||||
No variables
|
||||
|
||||
sm>sm start
|
||||
sm>start
|
||||
Init foo to 0
|
||||
Entry state S0
|
||||
Entry state S1
|
||||
Entry state S11
|
||||
State machine started
|
||||
|
||||
sm>sm variables
|
||||
sm>variables
|
||||
foo=0
|
||||
|
||||
sm>sm event H
|
||||
sm>event H
|
||||
Internal transition source=S1
|
||||
Event H send
|
||||
|
||||
sm>sm variables
|
||||
sm>variables
|
||||
foo=0
|
||||
|
||||
sm>sm event C
|
||||
sm>event C
|
||||
Exit state S11
|
||||
Exit state S1
|
||||
Entry state S2
|
||||
@@ -172,23 +172,23 @@ Entry state S21
|
||||
Entry state S211
|
||||
Event C send
|
||||
|
||||
sm>sm variables
|
||||
sm>variables
|
||||
foo=0
|
||||
|
||||
sm>sm event H
|
||||
sm>event H
|
||||
Switch foo to 1
|
||||
Internal transition source=S0
|
||||
Event H send
|
||||
|
||||
sm>sm variables
|
||||
sm>variables
|
||||
foo=1
|
||||
|
||||
sm>sm event H
|
||||
sm>event H
|
||||
Switch foo to 0
|
||||
Internal transition source=S2
|
||||
Event H send
|
||||
|
||||
sm>sm variables
|
||||
sm>variables
|
||||
foo=0
|
||||
----
|
||||
====
|
||||
|
||||
@@ -102,11 +102,11 @@ The following example shows how this state machine actually works:
|
||||
====
|
||||
[source,text]
|
||||
----
|
||||
sm>sm start
|
||||
sm>start
|
||||
State machine started
|
||||
Entry state READY
|
||||
|
||||
sm>tasks run
|
||||
sm>run
|
||||
Exit state READY
|
||||
Entry state TASKS
|
||||
run task on T2
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
Turnstile is a simple device that gives you access if payment is
|
||||
made. It is a concept that is simple to model using a state machine. In its
|
||||
simplest, form there are only two states: `LOCKED` and `UNLOCKED`. Two
|
||||
simplest form, there are only two states: `LOCKED` and `UNLOCKED`. Two
|
||||
events, `COIN` and `PUSH` can happen, depending on whether someone
|
||||
makes a payment or tries to go through the turnstile.
|
||||
The following image shows the state machine:
|
||||
@@ -16,7 +16,7 @@ The following listing shows the enumeration that defines the possible states:
|
||||
.States
|
||||
[source,java,indent=0]
|
||||
----
|
||||
include::samples/demo/turnstile/Application.java[tags=snippetB]
|
||||
include::samples/demo/turnstile/States.java[tags=snippetB]
|
||||
----
|
||||
====
|
||||
|
||||
@@ -26,7 +26,7 @@ The following listing shows the enumeration that defines the events:
|
||||
.Events
|
||||
[source,java,indent=0]
|
||||
----
|
||||
include::samples/demo/turnstile/Application.java[tags=snippetC]
|
||||
include::samples/demo/turnstile/Events.java[tags=snippetC]
|
||||
----
|
||||
====
|
||||
|
||||
@@ -36,7 +36,7 @@ The following listing shows the code that configures the state machine:
|
||||
.Configuration
|
||||
[source,java,indent=0]
|
||||
----
|
||||
include::samples/demo/turnstile/Application.java[tags=snippetA]
|
||||
include::samples/demo/turnstile/StateMachineConfiguration.java[tags=snippetA]
|
||||
----
|
||||
====
|
||||
|
||||
@@ -49,7 +49,7 @@ and shows the command's output:
|
||||
----
|
||||
$ java -jar spring-statemachine-samples-turnstile-{revnumber}.jar
|
||||
|
||||
sm>sm print
|
||||
sm>print
|
||||
+----------------------------------------------------------------+
|
||||
| SM |
|
||||
+----------------------------------------------------------------+
|
||||
@@ -70,15 +70,15 @@ sm>sm print
|
||||
| |
|
||||
+----------------------------------------------------------------+
|
||||
|
||||
sm>sm start
|
||||
sm>start
|
||||
State changed to LOCKED
|
||||
State machine started
|
||||
|
||||
sm>sm event COIN
|
||||
sm>event COIN
|
||||
State changed to UNLOCKED
|
||||
Event COIN send
|
||||
|
||||
sm>sm event PUSH
|
||||
sm>event PUSH
|
||||
State changed to LOCKED
|
||||
Event PUSH send
|
||||
----
|
||||
|
||||
@@ -57,28 +57,28 @@ The following example shows how this state machine actually works:
|
||||
====
|
||||
[source,text]
|
||||
----
|
||||
sm>sm start
|
||||
sm>start
|
||||
Entry state RUNNING
|
||||
Entry state WASHING
|
||||
State machine started
|
||||
|
||||
sm>sm event RINSE
|
||||
sm>event RINSE
|
||||
Exit state WASHING
|
||||
Entry state RINSING
|
||||
Event RINSE send
|
||||
|
||||
sm>sm event DRY
|
||||
sm>event DRY
|
||||
Exit state RINSING
|
||||
Entry state DRYING
|
||||
Event DRY send
|
||||
|
||||
sm>sm event CUTPOWER
|
||||
sm>event CUTPOWER
|
||||
Exit state DRYING
|
||||
Exit state RUNNING
|
||||
Entry state POWEROFF
|
||||
Event CUTPOWER send
|
||||
|
||||
sm>sm event RESTOREPOWER
|
||||
sm>event RESTOREPOWER
|
||||
Exit state POWEROFF
|
||||
Entry state RUNNING
|
||||
Entry state WASHING
|
||||
|
||||
@@ -48,16 +48,16 @@ The following example shows what happens:
|
||||
.Shell1
|
||||
[source,text]
|
||||
----
|
||||
sm>sm start
|
||||
sm>start
|
||||
Entry state LOCKED
|
||||
State machine started
|
||||
|
||||
sm>sm event COIN
|
||||
sm>event COIN
|
||||
Exit state LOCKED
|
||||
Entry state UNLOCKED
|
||||
Event COIN send
|
||||
|
||||
sm>sm state
|
||||
sm>state
|
||||
UNLOCKED
|
||||
----
|
||||
====
|
||||
@@ -73,10 +73,10 @@ The following example shows the state machine and its output:
|
||||
.Shell2
|
||||
[source,text]
|
||||
----
|
||||
sm>sm start
|
||||
sm>start
|
||||
State machine started
|
||||
|
||||
sm>sm state
|
||||
sm>state
|
||||
UNLOCKED
|
||||
----
|
||||
====
|
||||
@@ -89,7 +89,7 @@ The following example shows the state machine command and its output:
|
||||
.Shell2
|
||||
[source,text]
|
||||
----
|
||||
sm>sm event PUSH
|
||||
sm>event PUSH
|
||||
Exit state UNLOCKED
|
||||
Entry state LOCKED
|
||||
Event PUSH send
|
||||
|
||||
@@ -58,8 +58,7 @@ The following listing shows how to build the samples:
|
||||
====
|
||||
|
||||
Every sample is located in its own directory under
|
||||
`spring-statemachine-samples`. The samples are based on Spring Boot and
|
||||
Spring Shell, and you can find the usual Boot fat jars under every sample
|
||||
`spring-statemachine-samples`. The samples are based on Spring Boot and you can find the usual Boot fat jars under every sample
|
||||
project's `build/libs` directory.
|
||||
|
||||
NOTE: The filenames for the jars to which we refer in this section are populated during a
|
||||
|
||||
Reference in New Issue
Block a user