1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.talika.tarsis.service;
24
25 import org.talika.tarsis.context.Context;
26
27 /**
28 * Interface that defines a service component in Tarsis MVC Framework.<br>
29 * <br>
30 * These architectural components provide auxiliar services to the rest of the
31 * framework. Typical services are, object factories or log.<br>
32 * <br>
33 * Services have their own life-cycle and are initiated throught <code>init</code>
34 * method when framework stars up and are destroyed calling <code>destroy</code>
35 * method when framework shutsdown.<br>
36 * <br>
37 * Every service is given a name. This name is unique in the context.
38 *
39 * @author Jose M. Palomar
40 * @version $Revision: 122 $
41 */
42 public interface Service {
43
44
45
46
47 /**
48 * Called by the framework to indicate that is being placed into service.
49 *
50 * @param context Context context that initialized service.
51 * @throws ServiceException if an exception has occurred that interferes with the
52 * services's normal operation
53 */
54 void init(Context context) throws ServiceException;
55
56 /**
57 * Called by the framework to indicate that is being placed out of service.
58 */
59 void destroy();
60
61 /**
62 * Returns name of service.
63 *
64 * @return String name of service.
65 */
66 String getName();
67
68 }