Changeset 40

Show
Ignore:
Timestamp:
01/05/07 17:43:54 (2 years ago)
Author:
mikey
Message:

cleaned stubClassLoader from XJConf stuff, moved this into helper.stubXJConfLoader

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/docroot/index.php

    r2 r40  
    22require '../src/main/php/stubClassLoader.php'; 
    33stubClassLoader::load('websites.PageFactory', 
    4                       'helper.RegistryFactory' 
     4                      'helper.RegistryFactory', 
     5                      'helper.stubXJConfLoader' 
    56); 
    67class Bootstrap 
     
    89    public static function main() 
    910    { 
    10         $pageFactory = new PageFactory(stubClassLoader::getInstance()); 
     11        $pageFactory = new PageFactory(stubXJConfLoader::getInstance()); 
    1112        var_dump($pageFactory->getPage('../config/xml/pages/index.xml')); 
    1213         
  • trunk/src/main/php/helper/RegistryFactory.php

    r2 r40  
    77 * @subpackage  helper 
    88 */ 
     9stubClassLoader::load('helper.stubXJConfLoader'); 
    910/** 
    1011 * Class for initializing the Registry. 
     
    2223    public static function init($configFile) 
    2324    { 
    24         $tagParser = new DefinitionParser(array('http://stubbles.net/registry' => stubClassLoader::getInstance())); 
     25        $tagParser = new DefinitionParser(array('http://stubbles.net/registry' => stubXJConfLoader::getInstance())); 
    2526        $defs      = $tagParser->parse(stubFactory::getResourcePath() . '/xjconf/registry.xml'); 
    2627        $xmlParser = new XmlParser(); 
  • trunk/src/main/php/stubClassLoader.php

    r2 r40  
    55 * @author  Frank Kleine <mikey@stubbles.net> 
    66 */ 
    7 require 'XJConf/XJConfLoader.php'; 
    8 XJConfLoader::load('XJConfClassLoader'); 
    97/** 
    108 * Class loader for all stubbles classes. 
     
    1614 * @package  stubbles 
    1715 */ 
    18 class stubClassLoader implements XJConfClassLoader 
     16class stubClassLoader 
    1917{ 
    2018    /** 
     
    2422     */ 
    2523    private static $loadedFiles = array(); 
    26     /** 
    27      * instance of the class loader 
    28      * 
    29      * @var  stubClassLoader 
    30      */ 
    31     private static $instance; 
    3224     
    3325    /** 
     
    7870        return str_replace('.', '/', $classname) . '.php'; 
    7971    } 
    80      
    81     /** 
    82      * forbidden constructor (singleton) 
    83      */ 
    84     private final function __construct() 
    85     { 
    86         // nothing to do 
    87     } 
    88      
    89     /** 
    90      * returns an instance of the class loader 
    91      * 
    92      * @return  stubClassLoader 
    93      */ 
    94     public static function getInstance() 
    95     { 
    96         if (null == self::$instance) { 
    97             self::$instance = new self(); 
    98         } 
    99          
    100         return self::$instance; 
    101     } 
    102      
    103     /** 
    104      * forbidden cloning (singleton) 
    105      */ 
    106     private final function __clone() 
    107     { 
    108         // nothing to do 
    109     } 
    110      
    111     /** 
    112      * load the file with the given class 
    113      * 
    114      * @param  string  $fqClassName  the full qualified class name 
    115      */ 
    116     public function loadClass($fqClassName) 
    117     { 
    118         self::load($fqClassName); 
    119     } 
    120      
    121     /** 
    122      * returns short class name 
    123      * 
    124      * @param  string  $fqClassName  the full qualified class name 
    125      */ 
    126     public function getType($fqClassName) 
    127     { 
    128         $className = explode('.', $fqClassName); 
    129         return $className[count($className) - 1]; 
    130     } 
    13172} 
    13273?> 
  • trunk/src/main/php/websites/PageFactory.php

    r2 r40  
    77 * @subpackage  websites 
    88 */ 
    9 require_once 'XJConf/XJConfLoader.php'; 
     9stubClassLoader::load('stubFactory', 
     10                      'helper.stubXJConfLoader', 
     11                      'websites.exceptions.PageConfigurationException' 
     12); 
    1013XJConfLoader::load('DefinitionParser', 
    1114                   'XmlParser', 
    1215                   'XJConfClassLoader' 
    13 ); 
    14 stubClassLoader::load('stubFactory', 
    15                       'websites.exceptions.PageConfigurationException' 
    1616); 
    1717/** 
     
    3535     * @param  stubClassLoader  $classLoader  class loader to use for loading unloaded classes 
    3636     */ 
    37     public function __construct(stubClassLoader $classLoader) 
     37    public function __construct(stubXJConfLoader $classLoader) 
    3838    { 
    3939        if (null == self::$xmlParser) {