KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > soto > state > StateMachineService


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 /**
10  * @author Yanick Duchesne
11  * <dl>
12  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
13  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
14  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
15  * </dl>
16  */

17 public class StateMachineService implements Service, ObjectHandlerIF {
18   protected StateMachine _stm = new StateMachine();
19
20   /**
21    *
22    */

23   public StateMachineService() {
24   }
25
26   /**
27    * @see org.sapia.soto.Service#init()
28    */

29   public void init() throws Exception JavaDoc {
30     _stm.init();
31   }
32
33   /**
34    * @see org.sapia.soto.Service#start()
35    */

36   public void start() throws Exception JavaDoc {
37   }
38
39   /**
40    * @see org.sapia.soto.Service#dispose()
41    */

42   public void dispose() {
43   }
44
45   /**
46    * Adds a state machine to this instance.
47    *
48    * @param stm a <code>StateMachine</code>.
49    */

50   public void addStateMachine(StateMachine stm) throws ConfigurationException {
51     _stm.merge(stm);
52   }
53
54   /**
55    * @see StateMachine#execute(String, String, Context)
56    */

57   public Result execute(String JavaDoc stateId, String JavaDoc module, Context ctx)
58     throws StateExecException {
59     return _stm.execute(stateId, module, ctx);
60   }
61
62   /**
63    * @see org.sapia.util.xml.confix.ObjectHandlerIF#handleObject(java.lang.String, java.lang.Object)
64    */

65   public void handleObject(String JavaDoc name, Object JavaDoc obj)
66     throws ConfigurationException {
67     if (obj instanceof StateMachine) {
68       addStateMachine((StateMachine) obj);
69     }
70   }
71 }
72
Popular Tags