Update ref docs

- First set of changes for doc updates for M3
- Relates #88
This commit is contained in:
Janne Valkealahti
2015-07-26 16:50:29 +01:00
parent e92a6c5a09
commit 706f1de232
11 changed files with 623 additions and 13 deletions

View File

@@ -32,18 +32,19 @@ import org.springframework.statemachine.zookeeper.ZookeeperStateMachineEnsemble;
@Configuration
public class Application {
//tag::snippetA[]
@Configuration
@EnableStateMachine
static class StateMachineConfig
extends StateMachineConfigurerAdapter<String, String> {
//tag::snippetA[]
@Override
public void configure(StateMachineConfigurationConfigurer<String, String> config) throws Exception {
config
.withDistributed()
.ensemble(stateMachineEnsemble());
}
//end::snippetA[]
@Override
public void configure(StateMachineStateConfigurer<String, String> states)
@@ -69,6 +70,7 @@ public class Application {
.event("PUSH");
}
//tag::snippetB[]
@Bean
public StateMachineEnsemble<String, String> stateMachineEnsemble() throws Exception {
return new ZookeeperStateMachineEnsemble<String, String>(curatorClient(), "/foo");
@@ -79,27 +81,20 @@ public class Application {
CuratorFramework client = CuratorFrameworkFactory.builder().defaultData(new byte[0])
.retryPolicy(new ExponentialBackoffRetry(1000, 3))
.connectString("localhost:2181").build();
// for testing we start it here, thought initiator
// is trying to start it if not already done
client.start();
return client;
}
//end::snippetB[]
}
//end::snippetA[]
//tag::snippetB[]
public static enum States {
LOCKED, UNLOCKED
}
//end::snippetB[]
//tag::snippetC[]
public static enum Events {
COIN, PUSH
}
//end::snippetC[]
public static void main(String[] args) throws Exception {
Bootstrap.main(args);