]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/class_BaseFrameworkSystem.php
Continued:
[core.git] / framework / main / classes / class_BaseFrameworkSystem.php
index ab2e5540a5d5bb7fc0136fe42afdc04225127bdc..357f228a8f703cf6d6168591d695bbecbf784e09 100644 (file)
@@ -1,50 +1,62 @@
 <?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\Factory\Database\Wrapper\DatabaseWrapperFactory;
-use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Filesystem\Block;
-use CoreFramework\Filesystem\FilePointer;
-use CoreFramework\Filesystem\FrameworkDirectory;
-use CoreFramework\Generic\FrameworkInterface;
-use CoreFramework\Generic\NullPointerException;
-use CoreFramework\Handler\Stream\IoHandler;
-use CoreFramework\Index\Indexable;
-use CoreFramework\Listener\Listenable;
-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\Stream\Output\OutputStreamer;
-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\Localization\ManageableLanguage;
+use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
+use Org\Mxchange\CoreFramework\Menu\RenderableMenu;
+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\String\Utils\StringUtils;
+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;
 
 /**
  * The simulator system class is the super class of all other classes. This
@@ -52,7 +64,7 @@ use \ReflectionClass;
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2019 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -69,12 +81,17 @@ use \ReflectionClass;
  * 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()
         */
        private static $hashLength = NULL;
 
+       /**
+        * Self-referencing instance
+        */
+       private static $instance = NULL;
+
        /**
         * The real class name
         */
@@ -165,11 +182,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        private $parserInstance = NULL;
 
-       /**
-        * A HandleableProtocol instance
-        */
-       private $protocolInstance = NULL;
-
        /**
         * A database wrapper instance
         */
@@ -180,16 +192,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
         */
@@ -201,7 +203,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        private $outputStreamInstance = NULL;
 
        /**
-        * Networkable handler instance
+        * Handler instance
         */
        private $handlerInstance = NULL;
 
@@ -210,11 +212,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        private $visitorInstance = NULL;
 
-       /**
-        * DHT instance
-        */
-       private $dhtInstance = NULL;
-
        /**
         * An instance of a database wrapper class
         */
@@ -246,24 +243,24 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        private $directoryInstance = NULL;
 
        /**
-        * Listener instance
+        * The concrete output instance
         */
-       private $listenerInstance = NULL;
+       private $outputInstance = NULL;
 
        /**
-        * An instance of a communicator
+        * State instance
         */
-       private $communicatorInstance = NULL;
+       private $stateInstance = NULL;
 
        /**
-        * The concrete output instance
+        * Registry instance (implementing Register)
         */
-       private $outputInstance = NULL;
+       private $registryInstance = NULL;
 
        /**
-        * State instance
+        * Call-back instance
         */
-       private $stateInstance = NULL;
+       private $callbackInstance = NULL;
 
        /**
         * Thousands separator
@@ -280,16 +277,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        private $socketResource = false;
 
-       /**
-        * Regular expression to use for validation
-        */
-       private $regularExpression = '';
-
-       /**
-        * Package data
-        */
-       private $packageData = array();
-
        /**
         * Generic array
         */
@@ -305,11 +292,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        private $controllerName = '';
 
-       /**
-        * Name of used protocol
-        */
-       private $protocolName = 'invalid';
-
        /**
         * Array with bitmasks and such for pack/unpack methods to support both
         * 32-bit and 64-bit systems
@@ -404,6 +386,8 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        const EXCEPTION_PATH_CANNOT_BE_WRITTEN       = 0x03b;
        const EXCEPTION_DATABASE_UPDATED_NOT_ALLOWED = 0x03c;
        const EXCEPTION_FILTER_CHAIN_INTERCEPTED     = 0x03d;
+       const EXCEPTION_INVALID_SOCKET               = 0x03e;
+       const EXCEPTION_SELF_INSTANCE                = 0x03f;
 
        /**
         * Hexadecimal->Decimal translation array
@@ -467,7 +451,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                // Set configuration instance if no registry ...
                if (!$this instanceof Register) {
                        // ... because registries doesn't need to be configured
-                       $this->setConfigInstance(FrameworkConfiguration::getSelfInstance());
+                       $this->setConfigInstance(FrameworkBootstrap::getConfigurationInstance());
                } // END - if
 
                // Is the startup time set? (0 cannot be true anymore)
@@ -495,8 +479,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                        $this->setRealClass('DestructedObject');
                } elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) {
                        // Already destructed object
-                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:] The object <span class="object_name">%s</span> is already destroyed.',
-                               __CLASS__,
+                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('The object <span class="object_name">%s</span> is already destroyed.',
                                $this->__toString()
                        ));
                } else {
@@ -514,22 +497,40 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      void
         */
        public final function __call ($methodName, $args) {
-               return self::__callStatic($methodName, $args);
+               // Set self-instance
+               self::$instance = $this;
+
+               // Call static method
+               self::__callStatic($methodName, $args);
+
+               // Clear self-instance
+               self::$instance = NULL;
        }
 
        /**
         * The __callStatic() method where all non-implemented static methods end up
         *
         * @param       $methodName             Name of the missing method
-        * @args        $args                   Arguments passed to the method
+        * @param       $args                   Arguments passed to the method
         * @return      void
+        * @throws      InvalidArgumentException If self::$instance is not a framework's own object
         */
        public static final function __callStatic ($methodName, $args) {
                // Trace message
                //* PRINT-DEBUG: */ printf('[%s:%d]: methodName=%s,args[]=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $methodName, gettype($args));
 
-               // Init argument string
+               // Init argument string and class name
                $argsString = '';
+               $className = 'unknown';
+
+               // Is self-instance set?
+               if (self::$instance instanceof FrameworkInterface) {
+                       // Framework's own instance
+                       $className = self::$instance->__toString();
+               } elseif (!is_null(self::$instance)) {
+                       // Invalid argument!
+                       throw new InvalidArgumentException(sprintf('self::instance[%s] is not expected.', gettype(self::$instance)), self::EXCEPTION_SELF_INSTANCE);
+               }
 
                // Is it NULL, empty or an array?
                if (is_null($args)) {
@@ -574,8 +575,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                                $argsString .= ', ';
                        } // END - foreach
 
-                       // Remove last comma
+                       // Last comma found?
                        if (substr($argsString, -2, 1) == ',') {
+                               // Remove last comma
                                $argsString = substr($argsString, 0, -2);
                        } // END - if
 
@@ -583,12 +585,13 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                        $argsString .= ')';
                } else {
                        // Invalid arguments!
-                       $argsString = '!INVALID:' . gettype($args) . '!';
+                       $argsString = sprintf('!INVALID:%s!', gettype($args));
                }
 
                // Output stub message
                // @TODO __CLASS__ does always return BaseFrameworkSystem but not the extending (=child) class
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[unknown::%s:] Stub! Args: %s',
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s::%s]: Stub! Args: %s',
+                       $className,
                        $methodName,
                        $argsString
                ));
@@ -790,7 +793,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      void
         */
        public final function setConfigInstance (FrameworkConfiguration $configInstance) {
-               Registry::getRegistry()->addInstance('config', $configInstance);
+               GenericRegistry::getRegistry()->addInstance('config', $configInstance);
        }
 
        /**
@@ -799,7 +802,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;
        }
 
@@ -810,7 +813,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      void
         */
        public final function setDebugInstance (DebugMiddleware $debugInstance) {
-               Registry::getRegistry()->addInstance('debug', $debugInstance);
+               GenericRegistry::getRegistry()->addInstance('debug', $debugInstance);
        }
 
        /**
@@ -820,7 +823,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;
@@ -833,7 +836,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      void
         */
        public final function setWebOutputInstance (OutputStreamer $webInstance) {
-               Registry::getRegistry()->addInstance('web_output', $webInstance);
+               GenericRegistry::getRegistry()->addInstance('web_output', $webInstance);
        }
 
        /**
@@ -842,7 +845,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;
        }
 
@@ -853,7 +856,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      void
         */
        public final function setDatabaseInstance (DatabaseConnection $databaseInstance) {
-               Registry::getRegistry()->addInstance('db_instance', $databaseInstance);
+               GenericRegistry::getRegistry()->addInstance('db_instance', $databaseInstance);
        }
 
        /**
@@ -863,7 +866,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;
@@ -876,7 +879,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      void
         */
        public final function setCompressorChannel (CompressorChannel $compressorInstance) {
-               Registry::getRegistry()->addInstance('compressor', $compressorInstance);
+               GenericRegistry::getRegistry()->addInstance('compressor', $compressorInstance);
        }
 
        /**
@@ -885,37 +888,17 @@ 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;
        }
 
-       /**
-        * Protected getter for a manageable application helper class
-        *
-        * @return      $applicationInstance    An instance of a manageable application helper class
-        */
-       protected final function getApplicationInstance () {
-               $applicationInstance = Registry::getRegistry()->getInstance('app');
-               return $applicationInstance;
-       }
-
-       /**
-        * Setter for a manageable application helper class
-        *
-        * @param       $applicationInstance    An instance of a manageable application helper class
-        * @return      void
-        */
-       public final function setApplicationInstance (ManageableApplication $applicationInstance) {
-               Registry::getRegistry()->addInstance('application', $applicationInstance);
-       }
-
        /**
         * Private getter for language instance
         *
         * @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;
        }
 
@@ -927,7 +910,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @see         LanguageSystem
         */
        public final function setLanguageInstance (ManageableLanguage $langInstance) {
-               Registry::getRegistry()->addInstance('language', $langInstance);
+               GenericRegistry::getRegistry()->addInstance('language', $langInstance);
        }
 
        /**
@@ -1139,25 +1122,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                return $this->parserInstance;
        }
 
-       /**
-        * Setter for HandleableProtocol instance
-        *
-        * @param       $protocolInstance       An instance of an HandleableProtocol
-        * @return      void
-        */
-       public final function setProtocolInstance (HandleableProtocol $protocolInstance) {
-               $this->protocolInstance = $protocolInstance;
-       }
-
-       /**
-        * Getter for HandleableProtocol instance
-        *
-        * @return      $protocolInstance       An instance of an HandleableProtocol
-        */
-       public final function getProtocolInstance () {
-               return $this->protocolInstance;
-       }
-
        /**
         * Setter for DatabaseWrapper instance
         *
@@ -1198,27 +1162,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                return $this->socketResource;
        }
 
-       /**
-        * Setter for regular expression
-        *
-        * @param       $regularExpression      A valid regular expression
-        * @return      void
-        */
-       public final function setRegularExpression ($regularExpression) {
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput($this->__toString() . '::' . __FUNCTION__ . ': regularExpression=' . $regularExpression . ',previous[' . gettype($this->regularExpression) . ']=' . $this->regularExpression);
-               $this->regularExpression = $regularExpression;
-       }
-
-       /**
-        * Getter for regular expression
-        *
-        * @return      $regularExpression      A valid regular expression
-        */
-       public final function getRegularExpression () {
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput($this->__toString() . '::' . __FUNCTION__ . ': regularExpression[' . gettype($this->regularExpression) . ']=' . $this->regularExpression);
-               return $this->regularExpression;
-       }
-
        /**
         * Setter for helper instance
         *
@@ -1238,44 +1181,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
         *
@@ -1327,7 +1232,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        /**
         * Getter for handler instance
         *
-        * @return      $handlerInstance        A Networkable instance
+        * @return      $handlerInstance        A Handleable instance
         */
        protected final function getHandlerInstance () {
                return $this->handlerInstance;
@@ -1352,45 +1257,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                return $this->visitorInstance;
        }
 
-       /**
-        * Setter for DHT instance
-        *
-        * @param       $dhtInstance    A Distributable instance
-        * @return      void
-        */
-       protected final function setDhtInstance (Distributable $dhtInstance) {
-               $this->dhtInstance = $dhtInstance;
-       }
-
-       /**
-        * Getter for DHT instance
-        *
-        * @return      $dhtInstance    A Distributable instance
-        */
-       protected final function getDhtInstance () {
-               return $this->dhtInstance;
-       }
-
-       /**
-        * Setter for raw package Data
-        *
-        * @param       $packageData    Raw package Data
-        * @return      void
-        */
-       public final function setPackageData (array $packageData) {
-               $this->packageData = $packageData;
-       }
-
-       /**
-        * Getter for raw package Data
-        *
-        * @return      $packageData    Raw package Data
-        */
-       public function getPackageData () {
-               return $this->packageData;
-       }
-
-
        /**
         * Setter for Iterator instance
         *
@@ -1522,79 +1388,79 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        }
 
        /**
-        * Setter for listener instance
+        * Setter for state instance
         *
-        * @param       $listenerInstance       A Listenable instance
+        * @param       $stateInstance  A Stateable instance
         * @return      void
         */
-       protected final function setListenerInstance (Listenable $listenerInstance) {
-               $this->listenerInstance = $listenerInstance;
+       public final function setStateInstance (Stateable $stateInstance) {
+               $this->stateInstance = $stateInstance;
        }
 
        /**
-        * Getter for listener instance
+        * Getter for state instance
         *
-        * @return      $listenerInstance       A Listenable instance
+        * @return      $stateInstance  A Stateable instance
         */
-       protected final function getListenerInstance () {
-               return $this->listenerInstance;
+       public final function getStateInstance () {
+               return $this->stateInstance;
        }
 
        /**
-        * Getter for communicator instance
+        * Setter for output instance
         *
-        * @return      $communicatorInstance   An instance of a Communicator class
+        * @param       $outputInstance The debug output instance
+        * @return      void
         */
-       public final function getCommunicatorInstance () {
-               return $this->communicatorInstance;
+       public final function setOutputInstance (OutputStreamer $outputInstance) {
+               $this->outputInstance = $outputInstance;
        }
 
        /**
-        * Setter for communicator instance
+        * Getter for output instance
         *
-        * @param       $communicatorInstance   An instance of a Communicator class
-        * @return      void
+        * @return      $outputInstance The debug output instance
         */
-       protected final function setCommunicatorInstance (Communicator $communicatorInstance) {
-               $this->communicatorInstance = $communicatorInstance;
+       public final function getOutputInstance () {
+               return $this->outputInstance;
        }
 
        /**
-        * Setter for state instance
+        * Setter for registry instance
         *
-        * @param       $stateInstance  A Stateable instance
+        * @param       $registryInstance               An instance of a Register class
         * @return      void
         */
-       public final function setStateInstance (Stateable $stateInstance) {
-               $this->stateInstance = $stateInstance;
+       protected final function setRegistryInstance (Register $registryInstance) {
+               $this->registryInstance = $registryInstance;
        }
 
        /**
-        * Getter for state instance
+        * Getter for registry instance
         *
-        * @return      $stateInstance  A Stateable instance
+        * @return      $registryInstance       The debug registry instance
         */
-       public final function getStateInstance () {
-               return $this->stateInstance;
+       public final function getRegistryInstance () {
+               return $this->registryInstance;
        }
 
        /**
-        * Setter for output instance
+        * Setter for call-back instance
         *
-        * @param       $outputInstance The debug output instance
+        * @param       $callbackInstance       An instance of a FrameworkInterface class
         * @return      void
         */
-       public final function setOutputInstance (OutputStreamer $outputInstance) {
-               $this->outputInstance = $outputInstance;
+       public final function setCallbackInstance (FrameworkInterface $callbackInstance) {
+               $this->callbackInstance = $callbackInstance;
        }
 
        /**
-        * Getter for output instance
+        * Getter for call-back instance
         *
-        * @return      $outputInstance The debug output instance
+        * @return      $callbackInstance       An instance of a FrameworkInterface class
         */
-       public final function getOutputInstance () {
-               return $this->outputInstance;
+       protected final function getCallbackInstance () {
+               return $this->callbackInstance;
        }
 
        /**
@@ -1635,25 +1501,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                return $this->controllerName;
        }
 
-       /**
-        * Getter for protocol name
-        *
-        * @return      $protocolName   Name of used protocol
-        */
-       public final function getProtocolName () {
-               return $this->protocolName;
-       }
-
-       /**
-        * Setter for protocol name
-        *
-        * @param       $protocolName   Name of used protocol
-        * @return      void
-        */
-       protected final function setProtocolName ($protocolName) {
-               $this->protocolName = $protocolName;
-       }
-
        /**
         * Checks whether an object equals this object. You should overwrite this
         * method to implement own equality checks
@@ -1743,7 +1590,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('application');
 
                        // Still null?
                        if (is_null($applicationInstance)) {
@@ -1775,7 +1622,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                // Is a message set?
                if (!empty($message)) {
                        // Construct message
-                       $content = sprintf('<div class="debug_message">Message: %s</div>' . PHP_EOL, $message);
+                       $content = sprintf('<div class="debug_message">
+       Message: %s
+</div>' . PHP_EOL, $message);
                } // END - if
 
                // Generate the output
@@ -1788,7 +1637,16 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                );
 
                // Output it
-               ApplicationEntryPoint::app_exit(sprintf('<div class="debug_header">%s debug output:</div><div class="debug_content">%s</div>Loaded includes: <div class="debug_include_list">%s</div>',
+               ApplicationEntryPoint::exitApplication(sprintf('<div class="debug_header">
+       %s debug output:
+</div>
+<div class="debug_content">
+       %s
+</div>
+Loaded includes:
+<div class="debug_include_list">
+       %s
+</div>',
                        $this->__toString(),
                        $content,
                        ClassLoader::getSelfInstance()->getPrintableIncludeList()
@@ -1821,21 +1679,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      void
         */
        protected function partialStub ($message = '') {
-               // Get the backtrace
-               $backtrace = debug_backtrace();
-
-               // Generate the class::method string
-               $methodName = 'UnknownClass-&gt;unknownMethod';
-               if ((isset($backtrace[1]['class'])) && (isset($backtrace[1]['function']))) {
-                       $methodName = $backtrace[1]['class'] . '-&gt;' . $backtrace[1]['function'];
-               } // END - if
-
-               // Construct the full message
-               $stubMessage = sprintf('[%s:] Partial stub!',
-                       $methodName
-               );
+               // Init variable
+               $stubMessage = 'Partial stub!';
 
-               // Is the extra message given?
+               // Is an extra message given?
                if (!empty($message)) {
                        // Then add it as well
                        $stubMessage .= ' Message: ' . $message;
@@ -1886,14 +1733,14 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        public final static function createDebugInstance ($className, $lineNumber = NULL) {
                // Is the instance set?
-               if (!Registry::getRegistry()->instanceExists('debug')) {
+               if (!GenericRegistry::getRegistry()->instanceExists('debug')) {
                        // Init debug instance
                        $debugInstance = NULL;
 
                        // Try it
                        try {
                                // Get a debugger instance
-                               $debugInstance = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getSelfInstance()->getConfigEntry('debug_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_class'), $className);
+                               $debugInstance = DebugMiddleware::createDebugMiddleware(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('debug_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_class'), $className);
                        } catch (NullPointerException $e) {
                                // Didn't work, no instance there
                                exit(sprintf('Cannot create debugInstance! Exception=%s,message=%s,className=%s,lineNumber=%d' . PHP_EOL, $e->__toString(), $e->getMessage(), $className, $lineNumber));
@@ -1902,11 +1749,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                        // Empty string should be ignored and used for testing the middleware
                        DebugMiddleware::getSelfInstance()->output('');
 
-                       // Set it in its own class. This will set it in the registry
-                       $debugInstance->setDebugInstance($debugInstance);
+                       // Set it in registry
+                       GenericRegistry::getRegistry()->addInstance('debug', $debugInstance);
                } else {
                        // Get instance from registry
-                       $debugInstance = Registry::getRegistry()->getDebugInstance();
+                       $debugInstance = GenericRegistry::getRegistry()->getDebugInstance();
                }
 
                // Return it
@@ -1938,6 +1785,28 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                // Set debug instance to NULL
                $debugInstance = NULL;
 
+               // Get backtrace
+               $backtrace = debug_backtrace(!DEBUG_BACKTRACE_PROVIDE_OBJECT);
+
+               // Is function partialStub/__callStatic ?
+               if (in_array($backtrace[1]['function'], array('partialStub', '__call', '__callStatic'))) {
+                       // Prepend class::function:line from 3rd element
+                       $message = sprintf('[%s::%s:%d]: %s',
+                               $backtrace[2]['class'],
+                               $backtrace[2]['function'],
+                               (isset($backtrace[2]['line']) ? $backtrace[2]['line'] : '0'),
+                               $message
+                       );
+               } else {
+                       // Prepend class::function:line from 2nd element
+                       $message = sprintf('[%s::%s:%d]: %s',
+                               $backtrace[1]['class'],
+                               $backtrace[1]['function'],
+                               (isset($backtrace[1]['line']) ? $backtrace[1]['line'] : '0'),
+                               $message
+                       );
+               }
+
                // Try it:
                try {
                        // Get debug instance
@@ -1984,7 +1853,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                $className = '';
 
                // Convert all dashes in underscores
-               $str = self::convertDashesToUnderscores($str);
+               $str = StringUtils::convertDashesToUnderscores($str);
 
                // Now use that underscores to get classname parts for hungarian style
                foreach (explode('_', $str) as $strPart) {
@@ -1996,20 +1865,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                return $className;
        }
 
-       /**
-        * Converts dashes to underscores, e.g. useable for configuration entries
-        *
-        * @param       $str    The string with maybe dashes inside
-        * @return      $str    The converted string with no dashed, but underscores
-        */
-       public static final function convertDashesToUnderscores ($str) {
-               // Convert them all
-               $str = str_replace('-', '_', $str);
-
-               // Return converted string
-               return $str;
-       }
-
        /**
         * Marks up the code by adding e.g. line numbers
         *
@@ -2172,7 +2027,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput($fieldName.':<pre>'.print_r($fieldArray, true).'</pre>');
 
                // Convert dashes to underscore
-               $fieldName2 = self::convertDashesToUnderscores($fieldName);
+               $fieldName2 = StringUtils::convertDashesToUnderscores($fieldName);
 
                // Does the field exist?
                if ($this->isFieldSet($fieldName)) {
@@ -2212,7 +2067,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . $this->__toString() . ':' . __LINE__ . '] fieldName=' . $fieldName . ',fieldArray=<pre>'.print_r($fieldArray, true).'</pre>');
 
                // Convert dashes to underscore
-               $fieldName = self::convertDashesToUnderscores($fieldName);
+               $fieldName = StringUtils::convertDashesToUnderscores($fieldName);
 
                // Determine it
                $isSet = isset($fieldArray[$fieldName]);
@@ -2600,20 +2455,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                return $ret;
        }
 
-       /**
-        * Checks whether start/end marker are set
-        *
-        * @param       $data   Data to be checked
-        * @return      $isset  Whether start/end marker are set
-        */
-       public final function ifStartEndMarkersSet ($data) {
-               // Determine it
-               $isset = ((substr($data, 0, strlen(BaseRawDataHandler::STREAM_START_MARKER)) == BaseRawDataHandler::STREAM_START_MARKER) && (substr($data, -1 * strlen(BaseRawDataHandler::STREAM_END_MARKER), strlen(BaseRawDataHandler::STREAM_END_MARKER)) == BaseRawDataHandler::STREAM_END_MARKER));
-
-               // ... and return it
-               return $isset;
-       }
-
        /**
         * Determines if an element is set in the generic array
         *
@@ -3212,7 +3053,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        protected function initWebOutputInstance () {
                // Get application instance
-               $applicationInstance = Registry::getRegistry()->getInstance('app');
+               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
 
                // Init web output instance
                $outputInstance = ObjectFactory::createObjectByConfiguredName('output_class', array($applicationInstance));
@@ -3310,32 +3151,32 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * Creates a full-qualified file name (FQFN) for given file name by adding
         * a configured temporary file path to it.
         *
-        * @param       $fileName       Name for temporary file
-        * @return      $fqfn   Full-qualified file name
+        * @param       $infoInstance   An instance of a SplFileInfo class
+        * @return      $tempInstance   An instance of a SplFileInfo class (temporary file)
         * @throw       PathWriteProtectedException If the path in 'temp_file_path' is write-protected
         * @throws      FileIoException If the file cannot be written
         */
-        protected static function createTempPathForFile ($fileName) {
+        protected static function createTempPathForFile (SplFileInfo $infoInstance) {
                // Get config entry
-               $basePath = FrameworkConfiguration::getSelfInstance()->getConfigEntry('temp_file_path');
+               $basePath = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('temp_file_path');
 
                // Is the path writeable?
                if (!is_writable($basePath)) {
                        // Path is write-protected
-                       throw new PathWriteProtectedException($fileName, self::EXCEPTION_PATH_CANNOT_BE_WRITTEN);
+                       throw new PathWriteProtectedException($infoInstance, self::EXCEPTION_PATH_CANNOT_BE_WRITTEN);
                } // END - if
 
                // Add it
-               $fqfn = $basePath . '/' . $fileName;
+               $tempInstance = new SplFileInfo($basePath . DIRECTORY_SEPARATOR . $infoInstance->getBasename());
 
                // Is it reachable?
-               if (!FrameworkBootstrap::isReachableFilePath($fqfn)) {
+               if (!FrameworkBootstrap::isReachableFilePath($tempInstance)) {
                        // Not reachable
-                       throw new FileIoException($fqfn, self::EXCEPTION_FILE_NOT_REACHABLE);
+                       throw new FileIoException($tempInstance, self::EXCEPTION_FILE_NOT_REACHABLE);
                } // END - if
 
                // Return it
-               return $fqfn;
+               return $tempInstance;
         }
 
        /**
@@ -3360,50 +3201,4 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                return $stateName;
        }
 
-       /**
-        * Handles socket error for given socket resource and peer data. This method
-        * validates $socketResource if it is a valid resource (see is_resource())
-        * but assumes valid data in array $recipientData, except that
-        * count($recipientData) is always 2.
-        *
-        * @param       $method                         Value of __METHOD__ from calling method
-        * @param       $line                           Value of __LINE__ from calling method
-        * @param       $socketResource         A valid socket resource
-        * @param       $socketData                     A valid socket data array (0 = IP/file name, 1 = port)
-        * @return      void
-        * @throws      InvalidSocketException  If $socketResource is no socket resource
-        * @throws      NoSocketErrorDetectedException  If socket_last_error() gives zero back
-        * @todo        Move all this socket-related stuff into own class, most of it resides in BaseListener
-        */
-       protected final function handleSocketError ($method, $line, $socketResource, array $socketData) {
-               // This method handles only socket resources
-               if (!is_resource($socketResource)) {
-                       // No resource, abort here
-                       throw new InvalidSocketException(array($this, $socketResource), BaseListener::EXCEPTION_INVALID_SOCKET);
-               } // END - if
-
-               // Check socket array, 1st element is mostly IP address (or file name), 2nd is port number
-               //* DEBUG-DIE: */ die(__METHOD__ . ':socketData=' . print_r($socketData, true));
-               assert(isset($socketData[0]));
-               assert(isset($socketData[1]));
-
-               // Get error code for first validation (0 is not an error)
-               $errorCode = socket_last_error($socketResource);
-
-               // If the error code is zero, someone called this method without an error
-               if ($errorCode == 0) {
-                       // No error detected (or previously cleared outside this method)
-                       throw new NoSocketErrorDetectedException(array($this, $socketResource), BaseListener::EXCEPTION_NO_SOCKET_ERROR);
-               } // END - if
-
-               // Get handler (method) name
-               $handlerName = $this->getSocketErrorHandlerFromCode($errorCode);
-
-               // Call-back the error handler method
-               call_user_func_array(array($this, $handlerName), array($socketResource, $socketData));
-
-               // Finally clear the error because it has been handled
-               socket_clear_error($socketResource);
-       }
-
 }