1 package org.sapia.soto.state; 2 3 import org.sapia.soto.Service; 4 5 import org.sapia.util.xml.confix.ConfigurationException; 6 import org.sapia.util.xml.confix.ObjectHandlerIF; 7 8 9 17 public class StateMachineService implements Service, ObjectHandlerIF { 18 protected StateMachine _stm = new StateMachine(); 19 20 23 public StateMachineService() { 24 } 25 26 29 public void init() throws Exception { 30 _stm.init(); 31 } 32 33 36 public void start() throws Exception { 37 } 38 39 42 public void dispose() { 43 } 44 45 50 public void addStateMachine(StateMachine stm) throws ConfigurationException { 51 _stm.merge(stm); 52 } 53 54 57 public Result execute(String stateId, String module, Context ctx) 58 throws StateExecException { 59 return _stm.execute(stateId, module, ctx); 60 } 61 62 65 public void handleObject(String name, Object obj) 66 throws ConfigurationException { 67 if (obj instanceof StateMachine) { 68 addStateMachine((StateMachine) obj); 69 } 70 } 71 } 72 | Popular Tags |