X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=inc%2Fclasses%2Fmain%2Fclass_BaseFrameworkSystem.php;h=e3d1584869e1be61fc0b5ea8c26bbc48737a5341;hb=8da8c73c7c0e93f643408dfd28a7793f87b8cc97;hp=3ea5bcf5d49cda30bbfa8d5f3ce1bd1096b90c13;hpb=8b22bc0e24500bb2b00e1112203f767ca73210d5;p=core.git diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 3ea5bcf5..e3d15848 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -218,6 +218,16 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ private $communicatorInstance = NULL; + /** + * The concrete output instance + */ + private $outputInstance = NULL; + + /** + * State instance + */ + private $stateInstance = NULL; + /** * Thousands separator */ @@ -258,6 +268,11 @@ 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 @@ -349,8 +364,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { const EXCEPTION_FILE_NOT_REACHABLE = 0x038; const EXCEPTION_FILE_CANNOT_BE_READ = 0x039; const EXCEPTION_FILE_CANNOT_BE_WRITTEN = 0x03a; - const EXCEPTION_DATABASE_UPDATED_NOT_ALLOWED = 0x03b; - const EXCEPTION_FILTER_CHAIN_INTERCEPTED = 0x03c; + const EXCEPTION_PATH_CANNOT_BE_WRITTEN = 0x03b; + const EXCEPTION_DATABASE_UPDATED_NOT_ALLOWED = 0x03c; + const EXCEPTION_FILTER_CHAIN_INTERCEPTED = 0x03d; /** * Hexadecimal->Decimal translation array @@ -428,7 +444,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { } /** - * Destructor for all classes + * Destructor for all classes. You should not call this method on your own. * * @return void */ @@ -475,10 +491,13 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Init argument string $argsString = ''; - // Is it empty or an array? - if (empty($args)) { + // Is it NULL, empty or an array? + if (is_null($args)) { // No arguments $argsString = 'NULL'; + } elseif (empty($args)) { + // Empty arguments + $argsString = '(empty)'; } elseif (is_array($args)) { // Some arguments are there foreach ($args as $arg) { @@ -1530,6 +1549,44 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $this->communicatorInstance = $communicatorInstance; } + /** + * Setter for state instance + * + * @param $stateInstance A Stateable instance + * @return void + */ + public final function setStateInstance (Stateable $stateInstance) { + $this->stateInstance = $stateInstance; + } + + /** + * Getter for state instance + * + * @return $stateInstance A Stateable instance + */ + public final function getStateInstance () { + return $this->stateInstance; + } + + /** + * Setter for output instance + * + * @param $outputInstance The debug output instance + * @return void + */ + public final function setOutputInstance (OutputStreamer $outputInstance) { + $this->outputInstance = $outputInstance; + } + + /** + * Getter for output instance + * + * @return $outputInstance The debug output instance + */ + public final function getOutputInstance () { + return $this->outputInstance; + } + /** * Setter for command name * @@ -1568,6 +1625,25 @@ 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 @@ -1795,6 +1871,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * * @param $className Name of the class (currently unsupported) * @return $debugInstance An instance of a debugger class + * @deprecated Not fully, as the new Logger facilities are not finished yet. */ public final static function createDebugInstance ($className) { // Is the instance set? @@ -1805,7 +1882,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Try it try { // Get a debugger instance - $debugInstance = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getSelfInstance()->getConfigEntry('debug_' . self::getResponseTypeFromSystem() . '_class')); + $debugInstance = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getSelfInstance()->getConfigEntry('debug_' . self::getResponseTypeFromSystem() . '_class'), $className); } catch (NullPointerException $e) { // Didn't work, no instance there exit('Cannot create debugInstance! Exception=' . $e->__toString() . ', message=' . $e->getMessage()); @@ -1891,12 +1968,12 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @param $str The string, what ever it is needs to be converted * @return $className Generated class name */ - public function convertToClassName ($str) { + public static final function convertToClassName ($str) { // Init class name $className = ''; // Convert all dashes in underscores - $str = $this->convertDashesToUnderscores($str); + $str = self::convertDashesToUnderscores($str); // Now use that underscores to get classname parts for hungarian style foreach (explode('_', $str) as $strPart) { @@ -1914,7 +1991,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @param $str The string with maybe dashes inside * @return $str The converted string with no dashed, but underscores */ - public final function convertDashesToUnderscores ($str) { + public static final function convertDashesToUnderscores ($str) { // Convert them all $str = str_replace('-', '_', $str); @@ -2084,7 +2161,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput($fieldName.':
'.print_r($fieldArray, TRUE).'
'); // Convert dashes to underscore - $fieldName2 = $this->convertDashesToUnderscores($fieldName); + $fieldName2 = self::convertDashesToUnderscores($fieldName); // Does the field exist? if ($this->isFieldSet($fieldName)) { @@ -2124,7 +2201,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . $this->__toString() . ':' . __LINE__ . '] fieldName=' . $fieldName . ',fieldArray=
'.print_r($fieldArray, TRUE).'
'); // Convert dashes to underscore - $fieldName = $this->convertDashesToUnderscores($fieldName); + $fieldName = self::convertDashesToUnderscores($fieldName); // Determine it $isSet = isset($fieldArray[$fieldName]); @@ -2148,7 +2225,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $configEntry = $resultInstance->getUpdateInstance()->getWrapperConfigEntry(); // Create object instance - $wrapperInstance = ObjectFactory::createObjectByConfiguredName($configEntry); + $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName($configEntry); // Yes, then send the whole result to the database layer $wrapperInstance->doUpdateByResult($this->getResultInstance()); @@ -3274,7 +3351,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $isReadable = FALSE; // Is within parameters, so check if it is a file and readable - $isReadable = ((self::isReachableFilePath($fileName)) && (is_file($fileName)) && (is_readable($fileName))); + $isReadable = ((self::isReachableFilePath($fileName)) && (file_exists($fileName)) && (is_file($fileName)) && (is_readable($fileName))); // Return status return $isReadable;