public function __construct($configFile, $includePath, $cacheFile = null) { $cache = null; if ($cacheFile != null) { $cache = new \org\equinox\utils\cache\CacheFile(); $cache->setFileName($cacheFile); $cache->load(); $cachedContext = $cache->get('applicationContext'); if ($cachedContext != null) { $this->applicationContext = $cachedContext; $this->applicationContext->loadPlaceHolder($this); return; } } $this->applicationContext = new ApplicationContext(); $loader = new SimpleXmlLoader(); $loader->loadXml($this, $this->applicationContext, $configFile, $includePath); if (!empty($cache)) { $cache->put('applicationContext', $this->applicationContext); } }
/** * Load the application context Xml File, if a cache file name is provided * check if the context is in cache before loading */ public function loadContext($configFile, array $includePath, $cacheFile = null) { $cache = null; if ($cacheFile != null) { $cache = new \org\equinox\utils\cache\CacheFile(); $cache->setFileName($cacheFile); $cache->load(); $cachedContext = $cache->get('applicationContext'); if ($cachedContext != null) { $this->context = $cachedContext; $this->context->initializeNotLazyBeans(); return; } } $this->context = new ApplicationContext(); $loader = new XmlContextLoader($this->context, $includePath); $loader->addConfig($configFile); if (!empty($cache)) { $cache->put('applicationContext', $this->context); } $this->context->initializeNotLazyBeans(); }