root/trunk/framework/TService.php

Revision 2482, 1.6 kB (checked in by knut, 4 months ago)

updated copyright

  • Property svn:keywords set to Id
Line 
1<?php
2/**
3 * TService class file.
4 *
5 * @author Qiang Xue <qiang.xue@gmail.com>
6 * @link http://www.pradosoft.com/
7 * @copyright Copyright &copy; 2005-2008 PradoSoft
8 * @license http://www.pradosoft.com/license/
9 * @version $Id$
10 * @package System
11 */
12
13/**
14 * TService class.
15 *
16 * TService implements the basic methods required by IService and may be
17 * used as the basic class for application services.
18 *
19 * @author Qiang Xue <qiang.xue@gmail.com>
20 * @version $Id$
21 * @package System
22 * @since 3.0
23 */
24abstract class TService extends TApplicationComponent implements IService
25{
26    /**
27     * @var string service id
28     */
29    private $_id;
30    /**
31     * @var boolean whether the service is enabled
32     */
33    private $_enabled=true;
34
35    /**
36     * Initializes the service and attaches {@link run} to the RunService event of application.
37     * This method is required by IService and is invoked by application.
38     * @param TXmlElement module configuration
39     */
40    public function init($config)
41    {
42    }
43
44    /**
45     * @return string id of this service
46     */
47    public function getID()
48    {
49        return $this->_id;
50    }
51
52    /**
53     * @param string id of this service
54     */
55    public function setID($value)
56    {
57        $this->_id=$value;
58    }
59
60    /**
61     * @return boolean whether the service is enabled
62     */
63    public function getEnabled()
64    {
65        return $this->_enabled;
66    }
67
68    /**
69     * @param boolean whether the service is enabled
70     */
71    public function setEnabled($value)
72    {
73        $this->_enabled=TPropertyValue::ensureBoolean($value);
74    }
75
76    /**
77     * Runs the service.
78     */
79    public function run()
80    {
81    }
82}
83
84?>
Note: See TracBrowser for help on using the browser.