Renamed Registry -> GenericRegistry to make it clear that this registry does
[core.git] / framework / main / classes / class_BaseFrameworkSystem.php
index f88b8d36fe5732c3bda6a80144c5dab92d2236fb..0390d528d228f141e3462efa265ca7552185fc46 100644 (file)
@@ -1,55 +1,56 @@
 <?php
 // Own namespace
-namespace CoreFramework\Object;
+namespace Org\Mxchange\CoreFramework\Object;
 
 // Import framework stuff
-use CoreFramework\Bootstrap\FrameworkBootstrap;
-use CoreFramework\Compressor\Compressor;
-use CoreFramework\Configuration\FrameworkConfiguration;
-use CoreFramework\Connection\Database\DatabaseConnection;
-use CoreFramework\Controller\Controller;
-use CoreFramework\Criteria\Criteria;
-use CoreFramework\Criteria\Local\LocalSearchCriteria;
-use CoreFramework\Criteria\Local\LocalUpdateCriteria;
-use CoreFramework\Crypto\Cryptable;
-use CoreFramework\Crypto\RandomNumber\RandomNumberGenerator;
-use CoreFramework\Database\Frontend\DatabaseWrapper;
-use CoreFramework\EntryPoint\ApplicationEntryPoint;
-use CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
-use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Filesystem\Block;
-use CoreFramework\Filesystem\FilePointer;
-use CoreFramework\Filesystem\FrameworkDirectory;
-use CoreFramework\Filesystem\PathWriteProtectedException;
-use CoreFramework\Generic\FrameworkInterface;
-use CoreFramework\Generic\NullPointerException;
-use CoreFramework\Generic\UnsupportedOperationException;
-use CoreFramework\Handler\Handleable;
-use CoreFramework\Handler\Stream\IoHandler;
-use CoreFramework\Helper\Helper;
-use CoreFramework\Index\Indexable;
-use CoreFramework\Lists\Listable;
-use CoreFramework\Loader\ClassLoader;
-use CoreFramework\Manager\ManageableApplication;
-use CoreFramework\Middleware\Compressor\CompressorChannel;
-use CoreFramework\Middleware\Debug\DebugMiddleware;
-use CoreFramework\Parser\Parseable;
-use CoreFramework\Registry\Register;
-use CoreFramework\Registry\Registry;
-use CoreFramework\Resolver\Resolver;
-use CoreFramework\Result\Database\CachedDatabaseResult;
-use CoreFramework\Result\Search\SearchableResult;
-use CoreFramework\Stacker\Stackable;
-use CoreFramework\State\Stateable;
-use CoreFramework\Stream\Input\InputStream;
-use CoreFramework\Stream\Output\OutputStreamer;
-use CoreFramework\Stream\Output\OutputStream;
-use CoreFramework\Template\CompileableTemplate;
-use CoreFramework\User\ManageableAccount;
-use CoreFramework\Visitor\Visitor;
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Compressor\Compressor;
+use Org\Mxchange\CoreFramework\Configuration\FrameworkConfiguration;
+use Org\Mxchange\CoreFramework\Connection\Database\DatabaseConnection;
+use Org\Mxchange\CoreFramework\Controller\Controller;
+use Org\Mxchange\CoreFramework\Criteria\Criteria;
+use Org\Mxchange\CoreFramework\Criteria\Local\LocalSearchCriteria;
+use Org\Mxchange\CoreFramework\Criteria\Local\LocalUpdateCriteria;
+use Org\Mxchange\CoreFramework\Crypto\Cryptable;
+use Org\Mxchange\CoreFramework\Crypto\RandomNumber\RandomNumberGenerator;
+use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseWrapper;
+use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
+use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Filesystem\Block;
+use Org\Mxchange\CoreFramework\Filesystem\FilePointer;
+use Org\Mxchange\CoreFramework\Filesystem\FrameworkDirectory;
+use Org\Mxchange\CoreFramework\Filesystem\PathWriteProtectedException;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
+use Org\Mxchange\CoreFramework\Generic\NullPointerException;
+use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
+use Org\Mxchange\CoreFramework\Handler\Handleable;
+use Org\Mxchange\CoreFramework\Handler\Stream\IoHandler;
+use Org\Mxchange\CoreFramework\Helper\Helper;
+use Org\Mxchange\CoreFramework\Index\Indexable;
+use Org\Mxchange\CoreFramework\Lists\Listable;
+use Org\Mxchange\CoreFramework\Loader\ClassLoader;
+use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
+use Org\Mxchange\CoreFramework\Middleware\Compressor\CompressorChannel;
+use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
+use Org\Mxchange\CoreFramework\Parser\Parseable;
+use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
+use Org\Mxchange\CoreFramework\Registry\Register;
+use Org\Mxchange\CoreFramework\Resolver\Resolver;
+use Org\Mxchange\CoreFramework\Result\Database\CachedDatabaseResult;
+use Org\Mxchange\CoreFramework\Result\Search\SearchableResult;
+use Org\Mxchange\CoreFramework\Stacker\Stackable;
+use Org\Mxchange\CoreFramework\State\Stateable;
+use Org\Mxchange\CoreFramework\Stream\Input\InputStream;
+use Org\Mxchange\CoreFramework\Stream\Output\OutputStreamer;
+use Org\Mxchange\CoreFramework\Stream\Output\OutputStream;
+use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+use Org\Mxchange\CoreFramework\User\ManageableAccount;
+use Org\Mxchange\CoreFramework\Visitor\Visitor;
 
 // Import SPL stuff
 use \stdClass;
+use \InvalidArgumentException;
 use \Iterator;
 use \ReflectionClass;
 use \SplFileInfo;
@@ -77,7 +78,7 @@ use \SplFileInfo;
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
+abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        /**
         * Length of output from hash()
         */
@@ -183,16 +184,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        private $helperInstance = NULL;
 
-       /**
-        * An instance of a Source class
-        */
-       private $sourceInstance = NULL;
-
-       /**
-        * An instance of a UrlSource class
-        */
-       private $urlSourceInstance = NULL;
-
        /**
         * An instance of a InputStream class
         */
@@ -243,11 +234,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        private $directoryInstance = NULL;
 
-       /**
-        * An instance of a communicator
-        */
-       private $communicatorInstance = NULL;
-
        /**
         * The concrete output instance
         */
@@ -797,7 +783,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      $configInstance         Configuration instance
         */
        public final function getConfigInstance () {
-               $configInstance = Registry::getRegistry()->getInstance('config');
+               $configInstance = GenericRegistry::getRegistry()->getInstance('config');
                return $configInstance;
        }
 
@@ -818,7 +804,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        public final function getDebugInstance () {
                // Get debug instance
-               $debugInstance = Registry::getRegistry()->getInstance('debug');
+               $debugInstance = GenericRegistry::getRegistry()->getInstance('debug');
 
                // Return it
                return $debugInstance;
@@ -840,7 +826,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      $webOutputInstance - Instance to class WebOutput
         */
        public final function getWebOutputInstance () {
-               $webOutputInstance = Registry::getRegistry()->getInstance('web_output');
+               $webOutputInstance = GenericRegistry::getRegistry()->getInstance('web_output');
                return $webOutputInstance;
        }
 
@@ -861,7 +847,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        public final function getDatabaseInstance () {
                // Get instance
-               $databaseInstance = Registry::getRegistry()->getInstance('db_instance');
+               $databaseInstance = GenericRegistry::getRegistry()->getInstance('db_instance');
 
                // Return instance
                return $databaseInstance;
@@ -883,7 +869,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      $compressorInstance             The compressor channel
         */
        public final function getCompressorChannel () {
-               $compressorInstance = Registry::getRegistry()->getInstance('compressor');
+               $compressorInstance = GenericRegistry::getRegistry()->getInstance('compressor');
                return $compressorInstance;
        }
 
@@ -893,7 +879,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      $applicationInstance    An instance of a manageable application helper class
         */
        protected final function getApplicationInstance () {
-               $applicationInstance = Registry::getRegistry()->getInstance('app');
+               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
                return $applicationInstance;
        }
 
@@ -913,7 +899,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      $langInstance   An instance to the language sub-system
         */
        protected final function getLanguageInstance () {
-               $langInstance = Registry::getRegistry()->getInstance('language');
+               $langInstance = GenericRegistry::getRegistry()->getInstance('language');
                return $langInstance;
        }
 
@@ -1217,44 +1203,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                return $this->helperInstance;
        }
 
-       /**
-        * Setter for a Source instance
-        *
-        * @param       $sourceInstance         An instance of a Source class
-        * @return      void
-        */
-       protected final function setSourceInstance (Source $sourceInstance) {
-               $this->sourceInstance = $sourceInstance;
-       }
-
-       /**
-        * Getter for a Source instance
-        *
-        * @return      $sourceInstance         An instance of a Source class
-        */
-       protected final function getSourceInstance () {
-               return $this->sourceInstance;
-       }
-
-       /**
-        * Setter for a UrlSource instance
-        *
-        * @param       $sourceInstance         An instance of a UrlSource class
-        * @return      void
-        */
-       protected final function setUrlSourceInstance (UrlSource $urlSourceInstance) {
-               $this->urlSourceInstance = $urlSourceInstance;
-       }
-
-       /**
-        * Getter for a UrlSource instance
-        *
-        * @return      $urlSourceInstance              An instance of a UrlSource class
-        */
-       protected final function getUrlSourceInstance () {
-               return $this->urlSourceInstance;
-       }
-
        /**
         * Getter for a InputStream instance
         *
@@ -1481,25 +1429,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                return $this->directoryInstance;
        }
 
-       /**
-        * Getter for communicator instance
-        *
-        * @return      $communicatorInstance   An instance of a Communicator class
-        */
-       public final function getCommunicatorInstance () {
-               return $this->communicatorInstance;
-       }
-
-       /**
-        * Setter for communicator instance
-        *
-        * @param       $communicatorInstance   An instance of a Communicator class
-        * @return      void
-        */
-       protected final function setCommunicatorInstance (Communicator $communicatorInstance) {
-               $this->communicatorInstance = $communicatorInstance;
-       }
-
        /**
         * Setter for state instance
         *
@@ -1703,7 +1632,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                // Is the application instance set?
                if (is_null($applicationInstance)) {
                        // Get the current instance
-                       $applicationInstance = Registry::getRegistry()->getInstance('app');
+                       $applicationInstance = GenericRegistry::getRegistry()->getInstance('app');
 
                        // Still null?
                        if (is_null($applicationInstance)) {
@@ -1866,7 +1795,7 @@ Loaded includes:
                        Registry::getRegistry()->addInstance('debug', $debugInstance);
                } else {
                        // Get instance from registry
-                       $debugInstance = Registry::getRegistry()->getInstance('debug');
+                       $debugInstance = GenericRegistry::getRegistry()->getDebugInstance();
                }
 
                // Return it
@@ -3194,7 +3123,7 @@ Loaded includes:
         */
        protected function initWebOutputInstance () {
                // Get application instance
-               $applicationInstance = Registry::getRegistry()->getInstance('app');
+               $applicationInstance = GenericRegistry::getRegistry()->getInstance('app');
 
                // Init web output instance
                $outputInstance = ObjectFactory::createObjectByConfiguredName('output_class', array($applicationInstance));