KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > soto > examples > SecondaryService


1 package org.sapia.soto.examples;
2
3 import org.sapia.soto.Service;
4
5
6 /**
7  * @author Yanick Duchesne
8  * <dl>
9  * <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>
10  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
11  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
12  * </dl>
13  */

14 public class SecondaryService implements Service {
15   private MasterService _svc;
16
17   /**
18    * Constructor for SecondaryService.
19    */

20   public SecondaryService() {
21     super();
22   }
23
24   public void setSomeService(MasterService svc) {
25     _svc = svc;
26   }
27
28   public MasterService getSomeService() {
29     return _svc;
30   }
31
32   public boolean hasMaster() {
33     return _svc != null;
34   }
35
36   /**
37    * @see org.sapia.soto.Service#init()
38    */

39   public void init() throws Exception JavaDoc {
40     System.out.println("initializing " + getClass());
41   }
42
43   /**
44    * @see org.sapia.soto.Service#start()
45    */

46   public void start() throws Exception JavaDoc {
47     System.out.println("starting " + getClass());
48   }
49
50   /**
51    * @see org.sapia.soto.Service#dispose()
52    */

53   public void dispose() {
54   }
55
56   public void doSomethingElse() {
57     System.out.println("Calling master service...");
58     _svc.doSomething();
59   }
60 }
61
Popular Tags