From 2b297e04dae3af7a58f1c413d5be463e49e8fc6c Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 15 May 2014 22:29:36 +0200 Subject: [PATCH] Renamed initStack() -> initFileStack() in BaseFileStack + added initStack() from BaseStacker to overwrite it. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../file_stack/class_BaseFileStack.php | 23 +++++++++++++++++-- .../file_stack/fifo/class_FiFoFileStack.php | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/inc/classes/main/stacker/file_stack/class_BaseFileStack.php b/inc/classes/main/stacker/file_stack/class_BaseFileStack.php index 0e91c788..911b92e5 100644 --- a/inc/classes/main/stacker/file_stack/class_BaseFileStack.php +++ b/inc/classes/main/stacker/file_stack/class_BaseFileStack.php @@ -34,12 +34,12 @@ class BaseFileStack extends BaseStacker { } /** - * Initializes this stack. + * Initializes this file-based stack. * * @param $fileName File name of this stack * @return void */ - protected function initStack ($fileName) { + protected function initFileStack ($fileName) { // Get a file i/o pointer instance $pointerInstance = ObjectFactory::createObjectByConfiguredName('file_raw_input_output_class', array($fileName)); @@ -53,6 +53,25 @@ class BaseFileStack extends BaseStacker { $this->setIteratorInstance($iteratorInstance); } + /** + * Initializes given stacker + * + * @param $stackerName Name of the stack + * @param $forceReInit Force re-initialization + * @return void + * @throws AlreadyInitializedStackerException If the stack is already initialized + */ + public function initStack ($stackerName, $forceReInit = FALSE) { + // Is the stack already initialized? + if (($forceReInit === FALSE) && ($this->isStackInitialized($stackerName))) { + // Then throw the exception + throw new AlreadyInitializedStackerException(array($this, $stackerName, $forceReInit), self::EXCEPTION_STACKER_ALREADY_INITIALIZED); + } // END - if + + // Initialize the given stack + $this->partialStub('stackerName=' . $stackerName . ',forceReInit=' . intval($forceReInit)); + } + /** * Checks whether the given stack is initialized (set in array $stackers) * diff --git a/inc/classes/main/stacker/file_stack/fifo/class_FiFoFileStack.php b/inc/classes/main/stacker/file_stack/fifo/class_FiFoFileStack.php index e9624dd8..201bb84e 100644 --- a/inc/classes/main/stacker/file_stack/fifo/class_FiFoFileStack.php +++ b/inc/classes/main/stacker/file_stack/fifo/class_FiFoFileStack.php @@ -43,7 +43,7 @@ class FiFoFileStack extends BaseFileStack implements Stackable { $stackInstance = new FiFoFileStack(); // Init this stack - $stackInstance->initStack($fileName); + $stackInstance->initFileStack($fileName); // Return the prepared instance return $stackInstance; -- 2.30.2