/**
  * Constructor
  * 
  * @param string id the id of the configuration array to load
  */
 function __construct()
 {
     // create configuration object
     $this->config = owa_coreAPI::entityFactory('base.configuration');
     // load the default settings
     $this->getDefaultConfig();
     // include/load config file
     $this->loadConfigFile();
     // apply config constants
     $this->applyConfigConstants();
     // setup directory paths
     $this->setupPaths();
     // set default timezone while surpressing any warning
     if (function_exists('date_default_timezone_set')) {
         $level = error_reporting(0);
         date_default_timezone_set($this->get('base', 'timezone'));
         error_reporting($level);
     }
     // Todo: must remove config object dependancy from all classes generated by $this->load
     // before we can uncomment this and remove it from owa_caller constructor or else there
     // is a race condition.
     //if ($this->isConfigFilePresent()) {
     //	$this->load($this->get('base', 'configuration_id'));
     //}
     // include storage engine class so that DTD constants get loaded
     owa_coreAPI::setupStorageEngine($this->get('base', 'db_type'));
 }
 /**
  * Creates a database connection for retrieving the requested data.
  **/
 function _getDatabaseConnection()
 {
     $db_type = owa_coreAPI::getSetting('base', 'db_type');
     $ret = owa_coreAPI::setupStorageEngine($db_type);
     if ($this->connection == null) {
         $connection_class = 'owa_db_' . $db_type;
         $this->connection = new $connection_class($this->settings->getDatabaseHost(), $this->settings->getDatabaseName(), $this->settings->getDatabaseUser(), $this->settings->getDatabasePassword());
     }
     return $this->connection;
 }
Exemplo n.º 3
0
 /**
  * Constructor
  * 
  * @param string id the id of the configuration array to load
  */
 function __construct()
 {
     // create configuration object
     $this->config = owa_coreAPI::entityFactory('base.configuration');
     // load the default settings
     $this->config->set('settings', $this->getDefaultSettingsArray());
     // include/load config file
     $this->loadConfigFile();
     // apply config constants
     $this->applyConfigConstants();
     // setup directory paths
     $this->setupPaths();
     // Todo: must remove config object dependancy from all classes generated by $this->load
     // before we can uncomment this and remove it from owa_caller constructor or else there
     // is a race condition.
     //if ($this->isConfigFilePresent()) {
     //	$this->load($this->get('base', 'configuration_id'));
     //}
     // include storage engine class so that DTD constants get loaded
     owa_coreAPI::setupStorageEngine($this->get('base', 'db_type'));
 }
 /**
  * Convienence method for generating entities
  *
  * @param unknown_type $entity_name
  * @return unknown
  */
 public static function entityFactory($entity_name)
 {
     /* SETUP STORAGE ENGINE */
     // Must be called before any entities are created
     if (!defined('OWA_DTD_INT')) {
         if (defined('OWA_DB_TYPE')) {
             owa_coreAPI::setupStorageEngine(OWA_DB_TYPE);
         } else {
             owa_coreAPI::setupStorageEngine('mysql');
         }
     }
     if (!class_exists('owa_entity')) {
         require_once OWA_BASE_CLASSES_DIR . 'owa_entity.php';
     }
     $entity = owa_coreAPI::moduleSpecificFactory($entity_name, 'entities', '', '', false);
     $entity->name = $entity_name;
     return $entity;
     //return owa_coreAPI::supportClassFactory('base', 'entityManager', $entity_name);
 }