Development (again) continued:
authorRoland Häder <roland@mxchange.org>
Thu, 16 Feb 2012 23:32:18 +0000 (23:32 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 16 Feb 2012 23:32:18 +0000 (23:32 +0000)
- New interface 'HandleableChunks introduced
- Task for chunk assembler/handler added, still some required methods are not
  yet added (unfinished)
- Changed interfaces in some setter to more generic to allow more object
  instances being set (which are still fine)
- Moved initialization of e.g. network package instance in task classes to
  factory method to speed-up things in executeTask() method
- TODOs.txt updated

16 files changed:
.gitattributes
application/hub/config.php
application/hub/interfaces/handler/chunks/.htaccess [new file with mode: 0644]
application/hub/interfaces/handler/chunks/class_HandleableChunks.php [new file with mode: 0644]
application/hub/main/class_BaseHubSystem.php
application/hub/main/filter/task/node/class_NodeTaskHandlerInitializerFilter.php
application/hub/main/handler/chunks/class_ChunkHandler.php
application/hub/main/handler/class_
application/hub/main/package/class_NetworkPackage.php
application/hub/main/tasks/hub/chunks/.htaccess [new file with mode: 0644]
application/hub/main/tasks/hub/chunks/class_HubChunkAssemblerTask.php [new file with mode: 0644]
application/hub/main/tasks/hub/class_Hub [new file with mode: 0644]
application/hub/main/tasks/hub/ping/class_HubPingTask.php
application/hub/main/tasks/network/class_NetworkPackageReaderTask.php
application/hub/main/tasks/network/class_NetworkPackageWriterTask.php
docs/TODOs.txt

index aba2aab5730f378ddc8532b40ef4340d72efb3dd..5c678d1782875c666efde4d8237eb27dcbd05425 100644 (file)
@@ -46,6 +46,8 @@ application/hub/interfaces/discovery/class_DiscoverableSocket.php svneol=native#
 application/hub/interfaces/executor/.htaccess svneol=native#text/plain
 application/hub/interfaces/executor/class_Executor.php svneol=native#text/plain
 application/hub/interfaces/handler/.htaccess -text svneol=unset#text/plain
+application/hub/interfaces/handler/chunks/.htaccess -text svneol=unset#text/plain
+application/hub/interfaces/handler/chunks/class_HandleableChunks.php svneol=native#text/plain
 application/hub/interfaces/handler/class_Handleable.php svneol=native#text/plain
 application/hub/interfaces/handler/network/.htaccess -text svneol=unset#text/plain
 application/hub/interfaces/handler/network/class_Networkable.php svneol=native#text/plain
@@ -533,6 +535,9 @@ application/hub/main/tasks/cruncher/class_CruncherWorkUnitFetcherTask.php svneol
 application/hub/main/tasks/hub/.htaccess -text svneol=unset#text/plain
 application/hub/main/tasks/hub/announcement/.htaccess -text svneol=unset#text/plain
 application/hub/main/tasks/hub/announcement/class_HubSelfAnnouncementTask.php svneol=native#text/plain
+application/hub/main/tasks/hub/chunks/.htaccess -text svneol=unset#text/plain
+application/hub/main/tasks/hub/chunks/class_HubChunkAssemblerTask.php svneol=native#text/plain
+application/hub/main/tasks/hub/class_Hub svneol=native#text/plain
 application/hub/main/tasks/hub/class_HubSelfConnectTask.php svneol=native#text/plain
 application/hub/main/tasks/hub/ping/.htaccess -text svneol=unset#text/plain
 application/hub/main/tasks/hub/ping/class_HubPingTask.php svneol=native#text/plain
index 4c60d5ea9cd9cdcb13e719d8e4f471d2f195f615..fc996d7e3bc02b5e1fdd0bc950d6e77022ead901 100644 (file)
@@ -270,6 +270,15 @@ $cfg->setConfigEntry('stacker_package_declared_max_size', 1000);
 // CFG: STACKER-PACKAGE-OUTGOING-MAX-SIZE
 $cfg->setConfigEntry('stacker_package_outgoing_max_size', 100);
 
+// CFG: STACKER-PACKAGE-DECODED-DATA-MAX-SIZE
+$cfg->setConfigEntry('stacker_package_decoded_data_max_size', 200);
+
+// CFG: STACKER-PACKAGE-HANDLED-DECODED-MAX-SIZE
+$cfg->setConfigEntry('stacker_package_handled_decoded_max_size', 200);
+
+// CFG: STACKER-PACKAGE-CHUNKED-DECODED-MAX-SIZE
+$cfg->setConfigEntry('stacker_package_chunked_decoded_max_size', 800);
+
 // CFG: STACKER-PACKAGE-BACKBUFFER-MAX-SIZE
 $cfg->setConfigEntry('stacker_package_backbuffer_max_size', 1000);
 
@@ -291,12 +300,6 @@ $cfg->setConfigEntry('stacker_incoming_queue_max_size', 100000);
 // CFG: STACKER-DECODED-DATA-MAX-SIZE
 $cfg->setConfigEntry('stacker_decoded_data_max_size', 100);
 
-// CFG: STACKER-PACKAGE-DECODED-DATA-MAX-SIZE
-$cfg->setConfigEntry('stacker_package_decoded_data_max_size', 200);
-
-// CFG: STACKER-PACKAGE-HANDLED-DECODED-MAX-SIZE
-$cfg->setConfigEntry('stacker_package_handled_decoded_max_size', 200);
-
 // CFG: STACKER-FINAL-CHUNKS-MAX-SIZE
 $cfg->setConfigEntry('stacker_final_chunks_max_size', 100);
 
@@ -393,6 +396,9 @@ $cfg->setConfigEntry('hub_package_reader_task_class', 'NetworkPackageReaderTask'
 // CFG: HUB-SOCKET-LISTENER-TASK-CLASS
 $cfg->setConfigEntry('hub_socket_listener_task_class', 'HubSocketListenerTask');
 
+// CFG: HUB-CHUNK-ASSEMBLER-TASK-CLASS
+$cfg->setConfigEntry('hub_chunk_assembler_task_class', 'HubChunkAssemblerTask');
+
 // CFG: TASK-NETWORK-PACKAGE-WRITER-STARTUP-DELAY
 $cfg->setConfigEntry('task_network_package_writer_startup_delay', 2500);
 
@@ -420,6 +426,15 @@ $cfg->setConfigEntry('task_socket_listener_interval_delay', 10);
 // CFG: TASK-SOCKET-LISTENER-MAX-RUNS
 $cfg->setConfigEntry('task_socket_listener_max_runs', 0);
 
+// CFG: TASK-CHUNK-ASSEMBLER-STATUP-DELAY
+$cfg->setConfigEntry('task_chunk_assembler_startup_delay', 1500);
+
+// CFG: TASK-CHUNK-ASSEMBLER-INTERVAL-DELAY
+$cfg->setConfigEntry('task_chunk_assembler_interval_delay', 10);
+
+// CFG: TASK-CHUNK-ASSEMBLER-MAX-RUNS
+$cfg->setConfigEntry('task_chunk_assembler_max_runs', 0);
+
 // CFG: TASK-LIST-CLASS
 $cfg->setConfigEntry('task_list_class', 'TaskList');
 
diff --git a/application/hub/interfaces/handler/chunks/.htaccess b/application/hub/interfaces/handler/chunks/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/handler/chunks/class_HandleableChunks.php b/application/hub/interfaces/handler/chunks/class_HandleableChunks.php
new file mode 100644 (file)
index 0000000..253e8b5
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Handleable chunks interface
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface HandleableChunks extends Handleable {
+       /**
+        * Adds all chunks if the last one verifies as a 'final chunk'.
+        *
+        * @param       $chunks         An array with chunks, the last one should be a 'final'
+        * @return      void
+        * @throws      FinalChunkVerificationException         If the final chunk does not start with 'EOP:'
+        */
+       function addAllChunksWithFinal (array $chunks);
+}
+
+// [EOF]
+?>
index 10f5cc3dff109e91f31ff7dc144b7383583238b8..fd0d4ad7b9298f2c73090fb61ada247ffa6e2a24 100644 (file)
@@ -136,10 +136,10 @@ class BaseHubSystem extends BaseFrameworkSystem {
        /**
         * Setter for network package handler instance
         *
-        * @param       $packageInstance        The network package handler instance we shall set
+        * @param       $packageInstance        The network package instance we shall set
         * @return      void
         */
-       protected final function setPackageInstance (Networkable $packageInstance) {
+       protected final function setPackageInstance (Deliverable $packageInstance) {
                $this->packageInstance = $packageInstance;
        }
 
index 620135ba848cb9fd9a62cd47ae82fac13980920b..a64280ca4425376ef42fd922e4e323138176f2c2 100644 (file)
@@ -79,6 +79,12 @@ class NodeTaskHandlerInitializerFilter extends BaseFilter implements Filterable
                // Register it as well
                $handlerInstance->registerTask('network_package_writer', $taskInstance);
 
+               // Generate chunk assembler task
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('hub_chunk_assembler_task_class');
+
+               // Register it as well
+               $handlerInstance->registerTask('chunk_assembler', $taskInstance);
+
                // Query handler instance
                $handlerInstance->registerTask('query_handler', $nodeInstance->getQueryConnectorInstance());
 
index ea5865ab8f7ab972f0635a3aa87b4cfdb83c6e54..a6826670b6ab2278b494bc73a8d6f9cdba9d212d 100644 (file)
@@ -21,7 +21,7 @@
  * 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 ChunkHandler extends BaseHandler implements Registerable {
+class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable {
        /**
         * Stacker for chunks with final EOP
         */
@@ -38,15 +38,6 @@ class ChunkHandler extends BaseHandler implements Registerable {
 
                // Set handler name
                $this->setHandlerName('chunk');
-
-               // Get a FIFO stacker
-               $stackerInstance = ObjectFactory::createObjectByConfiguredName('chunk_handler_stacker_class');
-
-               // Init all stacker
-               $stackerInstance->initStacker(self::STACKER_NAME_CHUNKS_WITH_FINAL_EOP);
-
-               // Set the stacker in this handler
-               $this->setStackerInstance($stackerInstance);
        }
 
        /**
@@ -58,6 +49,15 @@ class ChunkHandler extends BaseHandler implements Registerable {
                // Get new instance
                $handlerInstance = new ChunkHandler();
 
+               // Get a FIFO stacker
+               $stackerInstance = ObjectFactory::createObjectByConfiguredName('chunk_handler_stacker_class');
+
+               // Init all stacker
+               $stackerInstance->initStacker(self::STACKER_NAME_CHUNKS_WITH_FINAL_EOP);
+
+               // Set the stacker in this handler
+               $handlerInstance->setStackerInstance($stackerInstance);
+
                // Return the prepared instance
                return $handlerInstance;
        }
@@ -82,6 +82,19 @@ class ChunkHandler extends BaseHandler implements Registerable {
                        $this->getStackerInstance()->pushNamed(self::STACKER_NAME_CHUNKS_WITH_FINAL_EOP, $chunk);
                } // END - foreach
        }
+
+       /**
+        * Checks whether unhandled chunks are available
+        *
+        * @return      $unhandledChunks        Whether unhandled chunks are left
+        */
+       public function ifUnhandledChunksAvailable () {
+               // Simply check if the stacker is not empty
+               $unhandledChunks = $this->getStackerInstance()->isStackEmpty(self::STACKER_NAME_CHUNKS_WITH_FINAL_EOP) === false;
+
+               // Return result
+               return $unhandledChunks;
+       }
 }
 
 // [EOF]
index e268407c66bba4a9a805ac07b9d23f7b7b4f7fff..ddef1e2d10775aba8f208b33981c8f389384e6a4 100644 (file)
@@ -21,7 +21,7 @@
  * 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 ???Handler extends BaseHandler {
+class ???Handler extends BaseHandler implements Handleable {
        /**
         * Protected constructor
         *
index 37c36f19a129c18afc31c8673f1bc0b4452550e0..0c28f7fc2da9248b8132bd5511a78e3a323c1fc2 100644 (file)
@@ -121,6 +121,11 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Receiva
         */
        const STACKER_NAME_DECODED_HANDLED = 'package_handled_decoded';
 
+       /**
+        * Stacker name for "chunked" decoded raw data
+        */
+       const STACKER_NAME_DECODED_CHUNKED = 'package_chunked_decoded';
+
        /**
         * Stacker name for "back-buffered" packages
         */
@@ -190,9 +195,10 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Receiva
        /**
         * Initialize all stackers
         *
+        * @param       $forceReInit    Whether to force reinitialization of all stacks
         * @return      void
         */
-       protected function initStackers () {
+       protected function initStackers ($forceReInit = false) {
                // Initialize all
                foreach (
                        array(
@@ -201,10 +207,11 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Receiva
                                self::STACKER_NAME_OUTGOING,
                                self::STACKER_NAME_DECODED_INCOMING,
                                self::STACKER_NAME_DECODED_HANDLED,
+                               self::STACKER_NAME_DECODED_CHUNKED,
                                self::STACKER_NAME_BACK_BUFFER
                        ) as $stackerName) {
                                // Init this stacker
-                               $this->getStackerInstance()->initStacker($stackerName);
+                               $this->getStackerInstance()->initStacker($stackerName, $forceReInit);
                } // END - foreach
        }
 
@@ -699,12 +706,17 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Receiva
                // Get current package content (an array with two elements; see handleIncomingDecodedData() for details)
                $packageContent = $this->getStackerInstance()->getNamed(self::STACKER_NAME_DECODED_HANDLED);
 
-               // Get a package assembler instance from factory
+               // Get a singleton package assembler instance from factory
                $assemblerInstance = PackageAssemblerFactory::createAssemblerInstance();
 
                // Start assembling the raw package data array by chunking it
                $assemblerInstance->chunkPackageContent($packageContent);
-               die(__METHOD__.': BACK!' . chr(10));
+
+               // Remove the package from 'handled_decoded' stack ...
+               $this->getStackerInstance()->popNamed(self::STACKER_NAME_DECODED_HANDLED);
+
+               // ... and push it on the 'chunked' stacker
+               $this->getStackerInstance()->pushNamed(self::STACKER_NAME_DECODED_CHUNKED, $packageContent);
        }
 
        /**
@@ -739,19 +751,8 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Receiva
         * @return      void
         */
        public function clearAllStacker () {
-               // Do the cleanup (no flushing)
-               foreach (
-                       array(
-                               self::STACKER_NAME_UNDECLARED,
-                               self::STACKER_NAME_DECLARED,
-                               self::STACKER_NAME_OUTGOING,
-                               self::STACKER_NAME_DECODED_INCOMING,
-                               self::STACKER_NAME_DECODED_HANDLED,
-                               self::STACKER_NAME_BACK_BUFFER
-                       ) as $stackerName) {
-                               // Clear this stacker by forcing an init
-                               $this->getStackerInstance()->initStacker($stackerName, true);
-               } // END - foreach
+               // Call the init method to force re-initialization
+               $this->initStackers(true);
 
                // Debug message
                /* DEBUG: */ $this->debugOutput('PACKAGE: All stacker have been re-initialized.');
diff --git a/application/hub/main/tasks/hub/chunks/.htaccess b/application/hub/main/tasks/hub/chunks/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/tasks/hub/chunks/class_HubChunkAssemblerTask.php b/application/hub/main/tasks/hub/chunks/class_HubChunkAssemblerTask.php
new file mode 100644 (file)
index 0000000..cc2c5d7
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+/**
+ * A ChunkAssembler hub-task
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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 HubChunkAssemblerTask extends BaseTask implements Taskable, Visitable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $taskInstance   An instance of a Visitable class
+        */
+       public final static function createHubChunkAssemblerTask () {
+               // Get new instance
+               $taskInstance = new HubChunkAssemblerTask();
+
+               // Get a chunk handler instance
+               $handlerInstance = ChunkHandlerFactory::createChunkHandlerInstance();
+
+               // And add it to this task instance
+               $taskInstance->setHandlerInstance($handlerInstance);
+
+               // Return the prepared instance
+               return $taskInstance;
+       }
+
+       /**
+        * Accepts the visitor to process the visit "request"
+        *
+        * @param       $visitorInstance        An instance of a Visitor class
+        * @return      void
+        * @todo        Also visit some sub-objects?
+        */
+       public function accept (Visitor $visitorInstance) {
+               // Visit this task
+               $visitorInstance->visitTask($this);
+       }
+
+       /**
+        * Executes the task
+        *
+        * @return      void
+        */
+       public function executeTask () {
+               // Are there chunks to handle?
+               if ($this->getHandlerInstance()->ifUnhandledChunksAvailable()) {
+                       // Then handle them (not all!)
+                       $this->getHandlerInstance()->handleAvailableChunks();
+               } // END - if
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/tasks/hub/class_Hub b/application/hub/main/tasks/hub/class_Hub
new file mode 100644 (file)
index 0000000..f435e52
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+/**
+ * A ??? hub-task
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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 Hub???Task extends BaseTask implements Taskable, Visitable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $taskInstance   An instance of a Visitable class
+        */
+       public final static function createHub???Task () {
+               // Get new instance
+               $taskInstance = new Hub???Task();
+
+               // Return the prepared instance
+               return $taskInstance;
+       }
+
+       /**
+        * Accepts the visitor to process the visit "request"
+        *
+        * @param       $visitorInstance        An instance of a Visitor class
+        * @return      void
+        * @todo        Maybe visit some sub-objects
+        */
+       public function accept (Visitor $visitorInstance) {
+               // Visit this task
+               $visitorInstance->visitTask($this);
+       }
+
+       /**
+        * Executes the task
+        *
+        * @return      void
+        * @todo        0%
+        */
+       public function executeTask () {
+               $this->partialStub('Unimplemented task.');
+       }
+}
+
+// [EOF]
+?>
index d63c04f05a0917f2d75931278952788acb73e9dd..272617a20877800419a56a7385743a5381103647 100644 (file)
@@ -60,6 +60,7 @@ class HubPingTask extends BaseTask implements Taskable, Visitable {
         *
         * @param       $visitorInstance        An instance of a Visitor class
         * @return      void
+        * @todo        Also visit some sub-objects?
         */
        public function accept (Visitor $visitorInstance) {
                // Visit this task
index fc7d8516875998507e7a4c15c247173ec0fff790..7e10c0e84044dee71e3d4a12a34aaed4689c2ddc 100644 (file)
@@ -45,6 +45,12 @@ class NetworkPackageReaderTask extends BaseTask implements Taskable, Visitable {
                // Set the listener instance here
                $taskInstance->setListenerPoolInstance($poolInstance);
 
+               // Get a singleton network package instance
+               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
+
+               // And set it in this task
+               $taskInstance->setPackageInstance($packageInstance);
+
                // Return the prepared instance
                return $taskInstance;
        }
@@ -54,6 +60,7 @@ class NetworkPackageReaderTask extends BaseTask implements Taskable, Visitable {
         *
         * @param       $visitorInstance        An instance of a Visitor class
         * @return      void
+        * @todo        Also visit some sub-objects?
         */
        public function accept (Visitor $visitorInstance) {
                // Visit this task
@@ -66,23 +73,20 @@ class NetworkPackageReaderTask extends BaseTask implements Taskable, Visitable {
         * @return      void
         */
        public function executeTask () {
-               // Get a singleton network package instance
-               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
-
                // Do we have something to handle?
-               if ($packageInstance->isNewRawDataPending($this->getListenerPoolInstance())) {
+               if ($this->getPackageInstance()->isNewRawDataPending($this->getListenerPoolInstance())) {
                        // We have to handle raw data from the socket
-                       $packageInstance->handleIncomingDecodedData();
-               } elseif ($packageInstance->isIncomingDecodedDataHandled()) {
+                       $this->getPackageInstance()->handleIncomingDecodedData();
+               } elseif ($this->getPackageInstance()->isIncomingDecodedDataHandled()) {
                        /*
                         * We have handled decoded data so we should validate it, if we have
                         * all chunks/fragments together, and assemble it into an abstract
                         * network package.
                         */
-                       $packageInstance->assembleDecodedDataToPackage();
-               } elseif ($packageInstance->isNewPackageArrived()) {
+                       $this->getPackageInstance()->assembleDecodedDataToPackage();
+               } elseif ($this->getPackageInstance()->isNewPackageArrived()) {
                        // Okay, then handle newly arrived package
-                       $packageInstance->handleNewlyArrivedPackage();
+                       $this->getPackageInstance()->handleNewlyArrivedPackage();
                } // END - if
        }
 }
index 39874dedde1ec896fa2f6b41b97b8c9b0862f866..12cbd092daa06de4ff2db52fddc8bd6a1d525909 100644 (file)
@@ -41,6 +41,12 @@ class NetworkPackageWriterTask extends BaseTask implements Taskable, Visitable {
                // Get new instance
                $taskInstance = new NetworkPackageWriterTask();
 
+               // Get a singleton network package instance
+               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
+
+               // And set it in this task
+               $taskInstance->setPackageInstance($packageInstance);
+
                // Return the prepared instance
                return $taskInstance;
        }
@@ -50,6 +56,7 @@ class NetworkPackageWriterTask extends BaseTask implements Taskable, Visitable {
         *
         * @param       $visitorInstance        An instance of a Visitor class
         * @return      void
+        * @todo        Also visit some sub-objects?
         */
        public function accept (Visitor $visitorInstance) {
                // Visit this task
@@ -62,19 +69,16 @@ class NetworkPackageWriterTask extends BaseTask implements Taskable, Visitable {
         * @return      void
         */
        public function executeTask () {
-               // Get a singleton network package instance
-               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
-
                // Do we have something to deliver?
-               if ($packageInstance->isPackageEnqueued()) {
+               if ($this->getPackageInstance()->isPackageEnqueued()) {
                        // Okay, then deliver (better discover its recipients) this package
-                       $packageInstance->declareEnqueuedPackage();
-               } elseif ($packageInstance->isPackageDeclared()) {
+                       $this->getPackageInstance()->declareEnqueuedPackage();
+               } elseif ($this->getPackageInstance()->isPackageDeclared()) {
                        // Prepare package for delivery
-                       $packageInstance->deliverDeclaredPackage();
-               } elseif ($packageInstance->isPackageWaitingForDelivery()) {
+                       $this->getPackageInstance()->deliverDeclaredPackage();
+               } elseif ($this->getPackageInstance()->isPackageWaitingForDelivery()) {
                        // Sent it finally out
-                       $packageInstance->sendWaitingPackage();
+                       $this->getPackageInstance()->sendWaitingPackage();
                }
        }
 }
index ad5c9aab9ee26839908b045b311174f4b9d471a5..757301ad125f0702b878089e4c5c8f1d2b4179f9 100644 (file)
 ./application/hub/main/nodes/regular/class_HubRegularNode.php:58:       * @todo        Implement this method
 ./application/hub/main/nodes/regular/class_HubRegularNode.php:68:       * @todo        Unfinished method
 ./application/hub/main/nodes/regular/class_HubRegularNode.php:91:              // @TODO Add some filters here
-./application/hub/main/package/class_NetworkPackage.php:218:    * @todo        $helperInstance is unused
-./application/hub/main/package/class_NetworkPackage.php:222:           // @TODO crc32() is very weak, but it needs to be fast
+./application/hub/main/package/class_NetworkPackage.php:225:    * @todo        $helperInstance is unused
+./application/hub/main/package/class_NetworkPackage.php:229:           // @TODO crc32() is very weak, but it needs to be fast
 ./application/hub/main/package/class_NetworkPackage.php:23: * @todo            Needs to add functionality for handling the object's type
-./application/hub/main/package/class_NetworkPackage.php:386:                   // @TODO We may want to do somthing more here?
-./application/hub/main/package/class_NetworkPackage.php:492:                   // @TODO Add some logging here
-./application/hub/main/package/class_NetworkPackage.php:518:                   // @TODO Add some logging here
-./application/hub/main/package/class_NetworkPackage.php:622:                   // @TODO Add some logging here
-./application/hub/main/package/class_NetworkPackage.php:716:           // @TODO Add some content here
-./application/hub/main/package/class_NetworkPackage.php:766:    * @todo        This may be enchanced for outgoing packages?
+./application/hub/main/package/class_NetworkPackage.php:393:                   // @TODO We may want to do somthing more here?
+./application/hub/main/package/class_NetworkPackage.php:499:                   // @TODO Add some logging here
+./application/hub/main/package/class_NetworkPackage.php:525:                   // @TODO Add some logging here
+./application/hub/main/package/class_NetworkPackage.php:629:                   // @TODO Add some logging here
+./application/hub/main/package/class_NetworkPackage.php:728:           // @TODO Add some content here
+./application/hub/main/package/class_NetworkPackage.php:767:    * @todo        This may be enchanced for outgoing packages?
 ./application/hub/main/package/fragmenter/class_PackageFragmenter.php:427:      * @todo        $helperInstance is unused
 ./application/hub/main/producer/cruncher/keys/class_CruncherKeyProducer.php:106:                       // @TODO Do something with it
 ./application/hub/main/producer/cruncher/keys/class_CruncherKeyProducer.php:62:         * @todo        Find something for init phase of this key producer
 ./application/hub/main/tasks/cruncher/class_CruncherTestUnitProducerTask.php:53:        * @todo        Maybe visit some sub-objects
 ./application/hub/main/tasks/cruncher/class_CruncherWorkUnitFetcherTask.php:54:         * @todo        Maybe visit some sub-objects
 ./application/hub/main/tasks/hub/announcement/class_HubSelfAnnouncementTask.php:53:     * @todo        0%
+./application/hub/main/tasks/hub/chunks/class_HubChunkAssemblerTask.php:59:     * @todo        Also visit some sub-objects?
 ./application/hub/main/tasks/hub/class_HubSelfConnectTask.php:53:       * @todo        0%
 ./application/hub/main/tasks/hub/class_HubSocketListenerTask.php:63:           // @TODO Do we need to visit this task? $visitorInstance->visitTask($this);
 ./application/hub/main/tasks/hub/class_HubSocketListenerTask.php:70:    * @todo        0% done
-./application/hub/main/tasks/hub/ping/class_HubPingTask.php:73:         * @todo        0% done
+./application/hub/main/tasks/hub/ping/class_HubPingTask.php:63:         * @todo        Also visit some sub-objects?
+./application/hub/main/tasks/hub/ping/class_HubPingTask.php:74:         * @todo        0% done
 ./application/hub/main/tasks/hub/update/class_HubUpdateCheckTask.php:53:        * @todo        0%
+./application/hub/main/tasks/network/class_NetworkPackageReaderTask.php:63:     * @todo        Also visit some sub-objects?
+./application/hub/main/tasks/network/class_NetworkPackageWriterTask.php:59:     * @todo        Also visit some sub-objects?
 ./application/hub/main/template/announcement/class_XmlAnnouncementTemplateEngine.php:10: * @todo               This template engine does not make use of setTemplateType()
 ./application/hub/main/template/connect/class_XmlSelfConnectTemplateEngine.php:10: * @todo             This template engine does not make use of setTemplateType()
 ./application/hub/main/template/connect/class_XmlSelfConnectTemplateEngine.php:240:     * @todo        Find something useful with this!