X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=framework%2Fmain%2Fclasses%2Fclass_BaseFrameworkSystem.php;h=07e0e601029ac0ee6f8ddb11a8218136ec5238b6;hb=2f930fd62f97e06a6b90afb971cce6343522f9b9;hp=3eaf3d2fea4a6b3bfb6ca98d90dfc797445ba111;hpb=de0fb4d6e2785338f2ba881761efc7b15c4a9530;p=core.git diff --git a/framework/main/classes/class_BaseFrameworkSystem.php b/framework/main/classes/class_BaseFrameworkSystem.php index 3eaf3d2f..07e0e601 100644 --- a/framework/main/classes/class_BaseFrameworkSystem.php +++ b/framework/main/classes/class_BaseFrameworkSystem.php @@ -1,52 +1,61 @@ . */ -class BaseFrameworkSystem extends stdClass implements FrameworkInterface { +abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterface { /** * Length of output from hash() */ @@ -167,11 +176,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ private $parserInstance = NULL; - /** - * A HandleableProtocol instance - */ - private $protocolInstance = NULL; - /** * A database wrapper instance */ @@ -182,16 +186,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 */ @@ -203,7 +197,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { private $outputStreamInstance = NULL; /** - * Networkable handler instance + * Handler instance */ private $handlerInstance = NULL; @@ -212,11 +206,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ private $visitorInstance = NULL; - /** - * DHT instance - */ - private $dhtInstance = NULL; - /** * An instance of a database wrapper class */ @@ -248,24 +237,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 @@ -307,11 +296,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 @@ -406,6 +390,7 @@ 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; /** * Hexadecimal->Decimal translation array @@ -469,7 +454,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) @@ -497,8 +482,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 %s is already destroyed.', - __CLASS__, + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('The object %s is already destroyed.', $this->__toString() )); } else { @@ -590,7 +574,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // 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('[unknown::%s]: Stub! Args: %s', $methodName, $argsString )); @@ -792,7 +776,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); } /** @@ -801,7 +785,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; } @@ -812,7 +796,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); } /** @@ -822,7 +806,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; @@ -835,7 +819,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); } /** @@ -844,7 +828,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; } @@ -855,7 +839,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); } /** @@ -865,7 +849,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; @@ -878,7 +862,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); } /** @@ -887,7 +871,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; } @@ -897,7 +881,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; } @@ -908,7 +892,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return void */ public final function setApplicationInstance (ManageableApplication $applicationInstance) { - Registry::getRegistry()->addInstance('application', $applicationInstance); + GenericRegistry::getRegistry()->addInstance('application', $applicationInstance); } /** @@ -917,7 +901,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; } @@ -929,7 +913,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); } /** @@ -1141,25 +1125,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 * @@ -1240,44 +1205,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 * @@ -1329,7 +1256,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; @@ -1354,25 +1281,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 * @@ -1524,79 +1432,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; } /** @@ -1637,25 +1545,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 @@ -1745,7 +1634,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)) { @@ -1777,7 +1666,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Is a message set? if (!empty($message)) { // Construct message - $content = sprintf('
' . PHP_EOL, $message); + $content = sprintf(' ' . PHP_EOL, $message); } // END - if // Generate the output @@ -1790,7 +1681,16 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { ); // Output it - ApplicationEntryPoint::app_exit(sprintf('