@@ -33,19 +33,19 @@ public interface StateMachinePersist<S, E, T> {
|
||||
* with a context object {@code T}.
|
||||
*
|
||||
* @param context the context
|
||||
* @param contextOjb the context ojb
|
||||
* @param contextObj the context ojb
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
void write(StateMachineContext<S, E> context, T contextOjb) throws Exception;
|
||||
void write(StateMachineContext<S, E> context, T contextObj) throws Exception;
|
||||
|
||||
/**
|
||||
* Read a {@link StateMachineContext} from a persistent store
|
||||
* with a context object {@code T}.
|
||||
*
|
||||
* @param contextOjb the context ojb
|
||||
* @param contextObj the context ojb
|
||||
* @return the state machine context
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
StateMachineContext<S, E> read(T contextOjb) throws Exception;
|
||||
StateMachineContext<S, E> read(T contextObj) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -61,13 +61,13 @@ public abstract class AbstractStateMachinePersister<S, E, T> implements StateMac
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void persist(StateMachine<S, E> stateMachine, T contextOjb) throws Exception {
|
||||
stateMachinePersist.write(buildStateMachineContext(stateMachine), contextOjb);
|
||||
public final void persist(StateMachine<S, E> stateMachine, T contextObj) throws Exception {
|
||||
stateMachinePersist.write(buildStateMachineContext(stateMachine), contextObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final StateMachine<S, E> restore(StateMachine<S, E> stateMachine, T contextOjb) throws Exception {
|
||||
final StateMachineContext<S, E> context = stateMachinePersist.read(contextOjb);
|
||||
public final StateMachine<S, E> restore(StateMachine<S, E> stateMachine, T contextObj) throws Exception {
|
||||
final StateMachineContext<S, E> context = stateMachinePersist.read(contextObj);
|
||||
stateMachine.stop();
|
||||
stateMachine.getStateMachineAccessor().doWithAllRegions(new StateMachineFunction<StateMachineAccess<S, E>>() {
|
||||
|
||||
|
||||
@@ -42,13 +42,13 @@ public class RepositoryStateMachinePersist<S, E> implements StateMachinePersist<
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(StateMachineContext<S, E> context, String contextOjb) throws Exception {
|
||||
repository.save(context, contextOjb);
|
||||
public void write(StateMachineContext<S, E> context, String contextObj) throws Exception {
|
||||
repository.save(context, contextObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StateMachineContext<S, E> read(String contextOjb) throws Exception {
|
||||
return repository.getContext(contextOjb);
|
||||
public StateMachineContext<S, E> read(String contextObj) throws Exception {
|
||||
return repository.getContext(contextObj);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,19 +33,19 @@ public interface StateMachinePersister<S, E, T> {
|
||||
* Persist a state machine with a given context object.
|
||||
*
|
||||
* @param stateMachine the state machine
|
||||
* @param contextOjb the context ojb
|
||||
* @param contextObj the context ojb
|
||||
* @throws Exception the exception in case or any persist error
|
||||
*/
|
||||
void persist(StateMachine<S, E> stateMachine, T contextOjb) throws Exception;
|
||||
void persist(StateMachine<S, E> stateMachine, T contextObj) throws Exception;
|
||||
|
||||
/**
|
||||
* Reset a state machine with a given context object.
|
||||
* Returned machine has been reseted and is ready to be used.
|
||||
*
|
||||
* @param stateMachine the state machine
|
||||
* @param contextOjb the context ojb
|
||||
* @param contextObj the context ojb
|
||||
* @return the state machine
|
||||
* @throws Exception the exception in case or any persist error
|
||||
*/
|
||||
StateMachine<S, E> restore(StateMachine<S, E> stateMachine, T contextOjb) throws Exception;
|
||||
StateMachine<S, E> restore(StateMachine<S, E> stateMachine, T contextObj) throws Exception;
|
||||
}
|
||||
|
||||
@@ -104,13 +104,13 @@ public class DocsConfigurationSampleTests5 extends AbstractStateMachineTests {
|
||||
private final HashMap<String, StateMachineContext<String, String>> contexts = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void write(StateMachineContext<String, String> context, String contextOjb) throws Exception {
|
||||
contexts.put(contextOjb, context);
|
||||
public void write(StateMachineContext<String, String> context, String contextObj) throws Exception {
|
||||
contexts.put(contextObj, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StateMachineContext<String, String> read(String contextOjb) throws Exception {
|
||||
return contexts.get(contextOjb);
|
||||
public StateMachineContext<String, String> read(String contextObj) throws Exception {
|
||||
return contexts.get(contextObj);
|
||||
}
|
||||
}
|
||||
// end::snippetB[]
|
||||
|
||||
@@ -661,13 +661,13 @@ public class StateMachinePersistTests extends AbstractStateMachineTests {
|
||||
private final HashMap<String, StateMachineContext<String, String>> contexts = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void write(StateMachineContext<String, String> context, String contextOjb) throws Exception {
|
||||
contexts.put(contextOjb, context);
|
||||
public void write(StateMachineContext<String, String> context, String contextObj) throws Exception {
|
||||
contexts.put(contextObj, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StateMachineContext<String, String> read(String contextOjb) throws Exception {
|
||||
return contexts.get(contextOjb);
|
||||
public StateMachineContext<String, String> read(String contextObj) throws Exception {
|
||||
return contexts.get(contextObj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -676,13 +676,13 @@ public class StateMachinePersistTests extends AbstractStateMachineTests {
|
||||
private final HashMap<String, StateMachineContext<TestStates, TestEvents>> contexts = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void write(StateMachineContext<TestStates, TestEvents> context, String contextOjb) throws Exception {
|
||||
contexts.put(contextOjb, context);
|
||||
public void write(StateMachineContext<TestStates, TestEvents> context, String contextObj) throws Exception {
|
||||
contexts.put(contextObj, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StateMachineContext<TestStates, TestEvents> read(String contextOjb) throws Exception {
|
||||
return contexts.get(contextOjb);
|
||||
public StateMachineContext<TestStates, TestEvents> read(String contextObj) throws Exception {
|
||||
return contexts.get(contextObj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -282,13 +282,13 @@ public class StateMachinePersistTests2 extends AbstractStateMachineTests {
|
||||
private final Map<Object,StateMachineContext<String, String>> contexts = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void write(StateMachineContext<String, String> stateMachineContext, String contextOjb) throws Exception {
|
||||
contexts.put(contextOjb,stateMachineContext);
|
||||
public void write(StateMachineContext<String, String> stateMachineContext, String contextObj) throws Exception {
|
||||
contexts.put(contextObj,stateMachineContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StateMachineContext<String, String> read(String contextOjb) throws Exception {
|
||||
return contexts.get(contextOjb);
|
||||
public StateMachineContext<String, String> read(String contextObj) throws Exception {
|
||||
return contexts.get(contextObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,13 +176,13 @@ public class StateMachinePersistTests3 extends AbstractStateMachineTests {
|
||||
private final HashMap<String, StateMachineContext<String, String>> contexts = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void write(StateMachineContext<String, String> context, String contextOjb) throws Exception {
|
||||
contexts.put(contextOjb, context);
|
||||
public void write(StateMachineContext<String, String> context, String contextObj) throws Exception {
|
||||
contexts.put(contextObj, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StateMachineContext<String, String> read(String contextOjb) throws Exception {
|
||||
return contexts.get(contextOjb);
|
||||
public StateMachineContext<String, String> read(String contextObj) throws Exception {
|
||||
return contexts.get(contextObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,13 +162,13 @@ public class StateMachinePersistTests4 extends AbstractStateMachineTests {
|
||||
private final HashMap<String, StateMachineContext<TestStates, TestEvents>> contexts = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void write(StateMachineContext<TestStates, TestEvents> context, String contextOjb) throws Exception {
|
||||
contexts.put(contextOjb, context);
|
||||
public void write(StateMachineContext<TestStates, TestEvents> context, String contextObj) throws Exception {
|
||||
contexts.put(contextObj, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StateMachineContext<TestStates, TestEvents> read(String contextOjb) throws Exception {
|
||||
return contexts.get(contextOjb);
|
||||
public StateMachineContext<TestStates, TestEvents> read(String contextObj) throws Exception {
|
||||
return contexts.get(contextObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class TestStateMachinePersist implements StateMachinePersist<String, Stri
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(StateMachineContext<String, String> context, Void contextOjb) throws Exception {
|
||||
public void write(StateMachineContext<String, String> context, Void contextObj) throws Exception {
|
||||
synchronized (this) {
|
||||
contexts.add(context);
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class TestStateMachinePersist implements StateMachinePersist<String, Stri
|
||||
}
|
||||
|
||||
@Override
|
||||
public StateMachineContext<String, String> read(Void contextOjb) throws Exception {
|
||||
public StateMachineContext<String, String> read(Void contextObj) throws Exception {
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,13 +119,13 @@ public class EventServiceTests {
|
||||
private final HashMap<String, StateMachineContext<States, Events>> contexts = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void write(StateMachineContext<States, Events> context, String contextOjb) throws Exception {
|
||||
contexts.put(contextOjb, context);
|
||||
public void write(StateMachineContext<States, Events> context, String contextObj) throws Exception {
|
||||
contexts.put(contextObj, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StateMachineContext<States, Events> read(String contextOjb) throws Exception {
|
||||
return contexts.get(contextOjb);
|
||||
public StateMachineContext<States, Events> read(String contextObj) throws Exception {
|
||||
return contexts.get(contextObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user