Source for file Services.interface.php

Documentation is available at Services.interface.php

  1. <?php
  2.  
  3. /**
  4. * The ServicesInterface defines the functionality required by any Services class or derivative.
  5. * The ServicesInterface defines the functionality required by any Services class or derivative.
  6. *
  7. * @package harmoni.services
  8. *
  9. * @copyright Copyright &copy; 2005, Middlebury College
  10. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  11. *
  12. * @version $Id: Services.interface.php,v 1.7 2007/09/04 20:25:49 adamfranco Exp $
  13. */
  14. class ServicesInterface {
  15. /* STATIC METHODS */
  16. /**
  17. * Registers a new service.
  18. *
  19. * Registers a new service named $name. Upon starting, a new class of type $class will be instantiated.
  20. * @param string $name The reference name of the service.
  21. * @param string $class The class name to be instantiated.
  22. * @access public
  23. * @static
  24. * @return boolean True on success. False if service is registered and running or an error occurs.
  25. ***/
  26. function registerService( $name, $class ) { die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class."); }
  27. /**
  28. * Register's an object as a service.
  29. * @param string $name The name of the new service.
  30. * @param ref object $object The object.
  31. * @access public
  32. * @return void
  33. ***/
  34. function registerObjectAsService($name, $object) {
  35. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  36. }
  37. /**
  38. * Returns the services object.
  39. * @access public
  40. * @static
  41. * @return object Services The Services object.
  42. ***/
  43. function getServices() {die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");}
  44. /**
  45. * Returns the service object associated with reference name $name.
  46. * @param string $name The reference name of the service.
  47. * @access public
  48. * @static
  49. * @return object Object The service object.
  50. ***/
  51. function getService( $name ) {die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");}
  52. /**
  53. * Attempts to start the service referenced by $name.
  54. * @param string $name The service name.
  55. * @param optional mixed $args,... Optional arguments to pass to the constructor of the service class.
  56. * @access public
  57. * @static
  58. * @return boolean True on success.
  59. ***/
  60. function startService( $name, $args=null ) {die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");}
  61. /**
  62. * Cycles through all registered services and attempts to start them.
  63. * @static
  64. * @access public
  65. * @return void
  66. ***/
  67. function startAllServices() {
  68. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  69. }
  70. /**
  71. * Attempts to stop the service reference by $name.
  72. * @param string $name The service name.
  73. * @access public
  74. * @static
  75. * @return boolean True on success.
  76. ***/
  77. function stopService( $name ) {die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");}
  78. /**
  79. * Attempts to stop all running services.
  80. * @access public
  81. * @return void
  82. ***/
  83. function stopAllServices() {
  84. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  85. }
  86. /**
  87. * Attempts to restart the service reference by $name.
  88. * @param string $name The service name.
  89. * @access public
  90. * @static
  91. * @return boolean True on success.
  92. ***/
  93. function restartService( $name ) {die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");}
  94. /**
  95. * Checks if the service referenced by $name is available for use.
  96. * @access public
  97. * @param string $name The service name.
  98. * @static
  99. * @return boolean True if the service is available, false otherwise.
  100. ***/
  101. function serviceAvailable( $name ) {die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");}
  102. /**
  103. * Checks if the service referenced by $name has been started.
  104. * @access public
  105. * @param string $name The service name.
  106. * @static
  107. * @return boolean True if the service is running, false otherwise.
  108. ***/
  109. function serviceRunning( $name ) {die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");}
  110. /**
  111. * The Require Service function checks for required service availability.
  112. *
  113. * The function first checks for service availabilty, and then attempts to
  114. * start the service if it's available. If either action fails, it stops
  115. * script execution. If $start=false then the function will only check for
  116. * availability.
  117. * @param string $name The name of the service.
  118. * @param boolean $start If we should attempt to start the service or not.
  119. * @access public
  120. * @static
  121. * @return ref object The started service object.
  122. * @deprecated 2004/07/28 Use {@link startService()} and {@link getService()} instead.
  123. ***/
  124. function requireService( $service, $start=true ) {
  125. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  126. }
  127. /* MEMBER METHODS */
  128. /**
  129. * Registers a new service.
  130. *
  131. * Registers a new service named $name. Upon starting, a new class of type $class will be instantiated.
  132. * @param string $name The reference name of the service.
  133. * @param string $class The class name to be instantiated.
  134. * @access public
  135. * @return boolean True on success. False if service is registered and running or an error occurs.
  136. ***/
  137. function register( $name, $class ) {die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");}
  138. /**
  139. * Register's an object as a service.
  140. * @param string $name The name of the new service.
  141. * @param ref object $object The object.
  142. * @access public
  143. * @return void
  144. ***/
  145. function registerObject($name ,$object) {
  146. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  147. }
  148. /**
  149. * Returns the service object associated with reference name $name.
  150. * Returns the service object associated with reference name $name.
  151. * @param string $name The reference name of the service.
  152. * @access public
  153. * @return object Object The service object.
  154. ***/
  155. function get( $name ) {die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");}
  156. /**
  157. * Attempts to stop all running services.
  158. * @access public
  159. * @return void
  160. ***/
  161. function stopAll() {
  162. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  163. }
  164. /**
  165. * Attempts to start the service referenced by $name.
  166. * Attempts to start the service referenced by $name.
  167. * @access public
  168. * @param string $name The service name.
  169. * @param optional mixed $args,... Optional args to pass to the constructor of the service class.
  170. * @return boolean True on success.
  171. ***/
  172. function start( $name, $args=null ) {die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");}
  173. /**
  174. * Cycles through all registered services and attempts to start them.
  175. * @access public
  176. * @return void
  177. ***/
  178. function startAll() {
  179. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  180. }
  181. /**
  182. * Attempts to stop the service reference by $name.
  183. * Attempts to stop the service reference by $name.
  184. * @access public
  185. * @param string $name The service name.
  186. * @return boolean True on success.
  187. ***/
  188. function stop( $name ) {die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");}
  189. /**
  190. * Attempts to restart the service reference by $name.
  191. * Attempts to restart the service reference by $name.
  192. * @access public
  193. * @param string $name The service name.
  194. * @return boolean True on success.
  195. ***/
  196. function restart( $name ) {die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");}
  197. /**
  198. * Checks if the service referenced by $name is available for use.
  199. * Checks if the service referenced by $name is available for use.
  200. * @access public
  201. * @param string $name The service name.
  202. * @return boolean True if the service is available, false otherwise.
  203. ***/
  204. function available( $name ) {die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");}
  205. /**
  206. * Checks if the service referenced by $name has been started.
  207. * Checks if the service referenced by $name has been started.
  208. * @access public
  209. * @param string $name The service name.
  210. * @return boolean True if the service is running, false otherwise.
  211. ***/
  212. function running( $name ) {die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");}
  213. }
  214. ?>

Documentation generated on Wed, 19 Sep 2007 10:26:27 -0400 by phpDocumentor 1.3.0RC3