]> git.mxchange.org Git - core.git/commitdiff
Don't call the class' factory method directly, use ObjectFactory and
authorRoland Haeder <roland@mxchange.org>
Wed, 14 May 2014 19:39:18 +0000 (21:39 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 14 May 2014 19:39:18 +0000 (21:39 +0200)
createObjectByConfiguredName() instead. This makes reimplementing classes much
easier.

Signed-off-by: Roland Häder <roland@mxchange.org>
inc/classes/main/console/class_ConsoleTools.php
inc/classes/main/io/io_handler/class_FileIoStream.php
inc/config.php

index 98d6ec4b53f7cffbcc4564d23357741078b8b222..32746b476178f973ecf1fdbe4fc60fdf2fcf8f50 100644 (file)
@@ -207,13 +207,13 @@ class ConsoleTools extends BaseFrameworkSystem {
 
                try {
                        // Get a file pointer
-                       $io = FrameworkFileInputPointer::createFrameworkFileInputPointer($helperInstance->getConfigInstance()->getConfigEntry('hostname_file'));
+                       $fileInstance = ObjectFactory::createObjectByConfiguredName('file_raw_input_class', $helperInstance->getConfigInstance()->getConfigEntry('hostname_file'));
 
                        // Read the file
-                       $rawData = trim($io->readFromFile());
+                       $rawData = trim($fileInstance->readFromFile());
 
                        // Close the file
-                       $io->closeFile();
+                       $fileInstance->closeFile();
 
                        // Extract hostname from it
                        $hostname = $helperInstance->extractHostnameFromRawData($rawData);
index 35d00eddceda0f6dc6db18d027473c9ffd6cb3e1..d8cd58031fa7c1a9b2d57d46db0d4334c9a24ed9 100644 (file)
@@ -79,7 +79,7 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil
                for ($idx = 0; $idx < 5; $idx++) {
                        // Get a file output pointer
                        try {
-                               $fileInstance = FrameworkFileOutputPointer::createFrameworkFileOutputPointer($fileName, 'w');
+                               $fileInstance = ObjectFactory::createObjectByConfiguredName('file_raw_output_class', $fileName);
                        } catch (FileIoException $e) {
                                // Create missing directory
                                $dirName = dirname($fileName);
@@ -147,7 +147,7 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil
                $readData = ''; // This will contain our read data
 
                // Get a file input handler
-               $fileInstance = FrameworkFileInputPointer::createFrameworkFileInputPointer($fqfn);
+               $fileInstance = ObjectFactory::createObjectByConfiguredName('file_raw_input_class', $fqfn);
 
                // Read all it's contents (we very and transparently decompress it below)
                while ($readRawLine = $fileInstance->readFromFile()) {
index ba05848decd8715ccbe1ac78d166fd84dd608ae1..b828bb1a25608601e5567cc84d4e9a122e9bb94d 100644 (file)
@@ -359,5 +359,14 @@ $cfg->setConfigEntry('database_cache_enabled', FALSE);
 // CFG: DIRECTORY-CLASS
 $cfg->setConfigEntry('directory_class', 'FrameworkDirectoryPointer');
 
+// CFG: FILE-INPUT-CLASS
+$cfg->setConfigEntry('file_raw_input_class', 'FrameworkFileInputPointer');
+
+// CFG: FILE-OUTPUT-CLASS
+$cfg->setConfigEntry('file_raw_output_class', 'FrameworkFileOutputPointer');
+
+// CFG: FILE-INPUT-OUTPUT-CLASS
+$cfg->setConfigEntry('file_raw_input_output_class', 'FrameworkFileInputOutputPointer');
+
 // [EOF]
 ?>