PEIP_Store_Collection.php

Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  * This file is part of the PEIP package.
00005  * (c) 2010 Timo Michna <timomichna/yahoo.de>
00006  * 
00007  * For the full copyright and license information, please view the LICENSE
00008  * file that was distributed with this source code.
00009  */
00010 
00023 class PEIP_Store_Collection 
00024     extends PEIP_Internal_Store_Abstract 
00025     implements PEIP_INF_Store_Collection{
00026 
00027     protected $factory;
00028     
00029     protected $stores;
00030 
00031     
00037     public function __construct(PEIP_INF_Dedicated_Factory $factory){
00038         $this->factory = $factory;
00039     }
00040 
00041     
00047     protected function getStoreOrCreate($namespace){
00048         if(!$this->hasPrivateValue($namespace)){
00049             $store = $this->factory->build();
00050             if($store instanceof PEIP_Store_Interface){
00051                 $this->setPrivateValue($namespace, $store);
00052             }else{
00053                 throw new Exception('Could not build Instance of PEIP_Store_Interface from factory.');
00054             }
00055         }
00056         return $this->getPrivateValue($namespace);
00057     }
00058     
00059   
00074     public function setValues($namespace, array $parameters){
00075         $this->getStoreOrCreate($namespace)->setValues($parameters);
00076    }
00077   
00078   
00085     public function addValues($namespace, array $parameters){
00086         $this->getStoreOrCreate($namespace)->addValues($parameters);
00087    }
00088   
00089   
00102     public function getValues($namespace){
00103         $this->getStoreOrCreate($namespace)->getValues();
00104    }
00105   
00106   
00113     public function getValue($namespace, $name){
00114         $this->getStoreOrCreate($namespace)->getValue($name);
00115    }
00116   
00117   
00125     public function setValue($namespace, $name, $value){
00126         $this->getStoreOrCreate($namespace)->setValues($parameters);
00127    }
00128   
00129   
00136     public function hasValue($namespace, $name){
00137         $this->getStoreOrCreate($namespace)->hasValue($name);
00138    }
00139 
00140   
00147     public function deleteValue($namespace, $name){
00148         $this->getStoreOrCreate($namespace)->setValues($parameters);
00149    }
00150 
00151   
00158     public function setStore($namespace, PEIP_Store_Interface $store){
00159         $this->setInternalValue($namespace, $store);    
00160   } 
00161 
00162   
00168     public function getStore($namespace){
00169         $this->getInternalValue($namespace);
00170   }
00171 
00172   
00178     public function hasStore($namespace){
00179     return $this->hasInternalValue($namespace);
00180   }
00181 
00182   
00188     public function deleteStore($namespace){
00189         return $this->deleteInternalValue($namespace);
00190   } 
00191     
00192     
00193     
00194     
00195 
00196 }

Generated on Mon Apr 12 11:39:00 2010 for PEIP by  doxygen 1.5.1