View Javadoc

1   /*
2    * $Id: Service.java 122 2004-11-01 13:06:54Z josem $
3    *
4    * Tarsis
5    * Copyright (C) 2002 Talika Open Source Group
6    *
7    * This program is free software; you can redistribute it and/or modify
8    * it under the terms of the GNU General Public License as published by
9    * the Free Software Foundation; either version 2 of the License, or
10   * (at your option) any later version.
11   *
12   * This program is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   * GNU General Public License for more details.
16   *
17   * You should have received a copy of the GNU General Public License
18   * along with this program; if not, write to the Free Software
19   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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      // Constants
45  
46      // Methods
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  }