Class doc for ResourceFactory

refs #5514
This commit is contained in:
Marius Hein 2014-08-28 11:08:57 +02:00
parent 22e17e9901
commit 9b83074cc9

View File

@ -14,13 +14,23 @@ use Icinga\Protocol\Statusdat\Reader as StatusdatReader;
use Icinga\Protocol\Ldap\Connection as LdapConnection; use Icinga\Protocol\Ldap\Connection as LdapConnection;
use Icinga\Protocol\File\Reader as FileReader; use Icinga\Protocol\File\Reader as FileReader;
/**
* Create resources from names or resource configuration
*/
class ResourceFactory implements ConfigAwareFactory class ResourceFactory implements ConfigAwareFactory
{ {
/** /**
* Resource configuration
*
* @var Zend_Config * @var Zend_Config
*/ */
private static $resources; private static $resources;
/**
* Set resource configurations
*
* @param Zend_Config $config
*/
public static function setConfig($config) public static function setConfig($config)
{ {
self::$resources = $config; self::$resources = $config;
@ -32,7 +42,8 @@ class ResourceFactory implements ConfigAwareFactory
* @param $resourceName String The resource's name * @param $resourceName String The resource's name
* *
* @return Zend_Config The configuration of the resource * @return Zend_Config The configuration of the resource
* @throws \Icinga\Exception\ConfigurationError *
* @throws ConfigurationError
*/ */
public static function getResourceConfig($resourceName) public static function getResourceConfig($resourceName)
{ {
@ -72,7 +83,7 @@ class ResourceFactory implements ConfigAwareFactory
/** /**
* Check if the existing resources are set. If not, throw an error. * Check if the existing resources are set. If not, throw an error.
* *
* @throws \Icinga\Exception\ProgrammingError * @throws ProgrammingError
*/ */
private static function assertResourcesExist() private static function assertResourcesExist()
{ {
@ -93,7 +104,7 @@ class ResourceFactory implements ConfigAwareFactory
* *
* @return DbConnection|LdapConnection|LivestatusConnection|StatusdatReader An objects that can be used to access * @return DbConnection|LdapConnection|LivestatusConnection|StatusdatReader An objects that can be used to access
* the given resource. The returned class depends on the configuration property 'type'. * the given resource. The returned class depends on the configuration property 'type'.
* @throws \Icinga\Exception\ConfigurationError When an unsupported type is given * @throws ConfigurationError When an unsupported type is given
*/ */
public static function createResource(Zend_Config $config) public static function createResource(Zend_Config $config)
{ {