]> git.mxchange.org Git - hub.git/commitdiff
Tasks added and registered with handler:
authorRoland Häder <roland@mxchange.org>
Thu, 20 Aug 2009 17:00:28 +0000 (17:00 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 20 Aug 2009 17:00:28 +0000 (17:00 +0000)
- HubUpdateCheckTask added which shall periodicly check for updates
- HubPingTask added which shall ping outgoing hub connections
- Both above tasks are registered (see config.php for timing details)
- Missing configuration entries added

.gitattributes
application/hub/config.php
application/hub/main/filter/task/class_TaskHandlerInitializerFilter.php
application/hub/main/iterator/hub/.htaccess [new file with mode: 0644]
application/hub/main/iterator/hub/class_HubPingIterator.php [new file with mode: 0644]
application/hub/main/tasks/hub/ping/.htaccess [new file with mode: 0644]
application/hub/main/tasks/hub/ping/class_HubPingTask.php [new file with mode: 0644]
application/hub/main/tasks/hub/update/.htaccess [new file with mode: 0644]
application/hub/main/tasks/hub/update/class_HubUpdateCheckTask.php [new file with mode: 0644]

index 0aa62cbdcba7fab200aec3149f9aec0a75222831..e5858576e80af80df2e9d3db08d15f44f03228aa 100644 (file)
@@ -139,6 +139,8 @@ application/hub/main/handler/tasks/class_TaskHandler.php -text
 application/hub/main/iterator/.htaccess -text
 application/hub/main/iterator/class_ -text
 application/hub/main/iterator/class_BaseIterator.php -text
+application/hub/main/iterator/hub/.htaccess -text
+application/hub/main/iterator/hub/class_HubPingIterator.php -text
 application/hub/main/iterator/network/.htaccess -text
 application/hub/main/iterator/network/class_NetworkListenIterator.php -text
 application/hub/main/iterator/pool/.htaccess -text
@@ -232,6 +234,10 @@ application/hub/main/tasks/class_ -text
 application/hub/main/tasks/class_BaseTask.php -text
 application/hub/main/tasks/hub/.htaccess -text
 application/hub/main/tasks/hub/class_HubSelfConnectTask.php -text
+application/hub/main/tasks/hub/ping/.htaccess -text
+application/hub/main/tasks/hub/ping/class_HubPingTask.php -text
+application/hub/main/tasks/hub/update/.htaccess -text
+application/hub/main/tasks/hub/update/class_HubUpdateCheckTask.php -text
 application/hub/main/tasks/idle/.htaccess -text
 application/hub/main/tasks/idle/class_IdleLoopTask.php -text
 application/hub/main/visitor/.htaccess -text
index 57cf9fd5b42a4c94a15e6307a69854b168417e94..6c80e23d8d1e92c8b10089f39694731d6b3ee4b1 100644 (file)
@@ -198,12 +198,30 @@ $cfg->setConfigEntry('task_self_connect_startup_delay', 4000);
 // CFG: TASK-SELF-CONNECT-INTERVAL-DELAY
 $cfg->setConfigEntry('task_self_connect_interval_delay', 1000*60*30);
 
+// CFG: TASK-UPDATE-CHECK-STARTUP-DELAY
+$cfg->setConfigEntry('task_update_check_startup_delay', 1000*60*60*6);
+
+// CFG: TASK-UPDATE-CHECK-INTERVAL-DELAY
+$cfg->setConfigEntry('task_update_check_interval_delay', 1000*60*60*24);
+
+// CFG: TASK-PING-STARTUP-DELAY
+$cfg->setConfigEntry('task_ping_startup_delay', 1000*60);
+
+// CFG: TASK-PING-INTERVAL-DELAY
+$cfg->setConfigEntry('task_ping_interval_delay', 1000*60*60);
+
 // CFG: IDLE-TASK-CLASS
 $cfg->setConfigEntry('idle_task_class', 'IdleLoopTask');
 
 // CFG: HUB-SELFCONNECT-TASK-CLASS
 $cfg->setConfigEntry('hub_selfconnect_task_class', 'HubSelfConnectTask');
 
+// CFG: HUB-UPDATE-CHECK-TASK-CLASS
+$cfg->setConfigEntry('hub_update_check_task_class', 'HubUpdateCheckTask');
+
+// CFG: HUB-PING-TASK-CLASS
+$cfg->setConfigEntry('hub_ping_task_class', 'HubPingTask');
+
 // CFG: TASK-LIST-CLASS
 $cfg->setConfigEntry('task_list_class', 'TaskList');
 
@@ -216,6 +234,9 @@ $cfg->setConfigEntry('default_iterator_class', 'DefaultIterator');
 // CFG: QUERY-ITERATOR-CLASS
 $cfg->setConfigEntry('query_iterator_class', 'DefaultIterator');
 
+// CFG: HUB-PING-ITERATOR-CLASS
+$cfg->setConfigEntry('hub_ping_iterator_class', 'HubPingIterator');
+
 // CFG: LOCAL-QUERY-LIST-CLASS
 $cfg->setConfigEntry('local_query_list_class', 'LocalQueryList');
 
index acba7cd92e01b9bc451901ea881d5452021c0104..a2a95d424bb75263073995e155150927c29e18e0 100644 (file)
@@ -61,10 +61,10 @@ class TaskHandlerInitializerFilter extends BaseFilter implements Filterable {
                // Get a new task handler instance
                $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class');
 
-               // Register some tasks and provide both instances for this:
-               // 1.) Network package reader, needs to be delayed a little
+               // Network package reader, needs to be delayed a little
                $handlerInstance->registerTask('network_package_reader', $nodeInstance->getListenerPoolInstance());
-               // 2.) Query instance
+
+               // Query handler instance
                $handlerInstance->registerTask('query_handler', $nodeInstance->getQueryConnectorInstance());
 
                // Generate idle task
@@ -81,6 +81,21 @@ class TaskHandlerInitializerFilter extends BaseFilter implements Filterable {
 
                // Register it
                $handlerInstance->registerTask('self_connect', $taskInstance);
+
+               // Prepare a update-check task
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('hub_update_check_task_class');
+
+               // Register it
+               $handlerInstance->registerTask('update_check', $taskInstance);
+
+               // Get the list instance here
+               $listInstance = $nodeInstance->getListenerPoolInstance()->getPoolEntriesInstance();
+
+               // Prepare a ping task
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('hub_ping_task_class', array($listInstance));
+
+               // Register it
+               $handlerInstance->registerTask('ping', $taskInstance);
        }
 }
 
diff --git a/application/hub/main/iterator/hub/.htaccess b/application/hub/main/iterator/hub/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/iterator/hub/class_HubPingIterator.php b/application/hub/main/iterator/hub/class_HubPingIterator.php
new file mode 100644 (file)
index 0000000..4c21ee7
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+/**
+ * A HubPing iterator
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 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 HubPingIterator extends BaseIterator implements Iterator {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $iteratorInstance               An instance of a Iterator class
+        */
+       public final static function createHubPingIterator () {
+               // Get new instance
+               $iteratorInstance = new HubPingIterator();
+
+               // Return the prepared instance
+               return $iteratorInstance;
+       }
+
+       /**
+        * Getter for current value from group or generic
+        *
+        * @return      $current        Current value in iteration
+        */
+       public function current () {
+               // Default is null
+               $current = null;
+
+               $this->partialStub('Please implement this method.');
+
+               // Return it
+               return $current;
+       }
+
+       /**
+        * Getter for key from group or generic
+        *
+        * @return      $key    Current key in iteration
+        */
+       public function key () {
+               // Default is null
+               $key = null;
+
+               $this->partialStub('Please implement this method.');
+
+               // Return it
+               return $key;
+       }
+
+       /**
+        * Advances to the next entry
+        *
+        * @return      void
+        */
+       public function next () {
+               $this->partialStub('Please implement this method.');
+       }
+
+       /**
+        * Rewinds to the beginning of the iteration
+        *
+        * @return      void
+        */
+       public function rewind () {
+               $this->partialStub('Please implement this method.');
+       }
+
+       /**
+        * Checks wether the current entry is valid (not at the end of the list)
+        *
+        * @return      void
+        */
+       public function valid () {
+               $this->partialStub('Please implement this method.');
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/tasks/hub/ping/.htaccess b/application/hub/main/tasks/hub/ping/.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/ping/class_HubPingTask.php b/application/hub/main/tasks/hub/ping/class_HubPingTask.php
new file mode 100644 (file)
index 0000000..c0a6ca2
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+/**
+ * A HubPing task
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 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 HubPingTask extends BaseTask implements Visitable, Taskable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $listInstance   A Listable instance
+        * @return      $taskInstance   An instance of a Visitable class
+        */
+       public final static function createHubPingTask (Listable $listInstance) {
+               // Get new instance
+               $taskInstance = new HubPingTask();
+
+               // Se the list instance in this task
+               $taskInstance->setListInstance($listInstance);
+
+               // Init ping iterator instance
+               $iteratorInstance = ObjectFactory::createObjectByConfiguredName('hub_ping_iterator_class', array($listInstance));
+
+               // Set it as well
+               $taskInstance->setIteratorInstance($iteratorInstance);
+
+               // Return the prepared instance
+               return $taskInstance;
+       }
+
+       /**
+        * Accepts the visitor to rpocess the visit "request"
+        *
+        * @param       $visitorInstance        An instance of a Visitor class
+        * @return      void
+        * @todo        0%
+        */
+       public function accept (Visitor $visitorInstance) {
+               $this->partialStub('Please implement this method. visitor='.$visitorInstance->__toString());
+       }
+
+       /**
+        * Executes the task
+        *
+        * @return      void
+        */
+       public function execute () {
+               $this->partialStub('Unimplemented task.');
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/tasks/hub/update/.htaccess b/application/hub/main/tasks/hub/update/.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/update/class_HubUpdateCheckTask.php b/application/hub/main/tasks/hub/update/class_HubUpdateCheckTask.php
new file mode 100644 (file)
index 0000000..87c5604
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+/**
+ * A HubUpdateCheck task
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 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 HubUpdateCheckTask extends BaseTask implements Visitable, Taskable {
+       /**
+        * 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 createHubUpdateCheckTask () {
+               // Get new instance
+               $taskInstance = new HubUpdateCheckTask();
+
+               // Return the prepared instance
+               return $taskInstance;
+       }
+
+       /**
+        * Accepts the visitor to rpocess the visit "request"
+        *
+        * @param       $visitorInstance        An instance of a Visitor class
+        * @return      void
+        * @todo        0%
+        */
+       public function accept (Visitor $visitorInstance) {
+               $this->partialStub('Please implement this method. visitor='.$visitorInstance->__toString());
+       }
+
+       /**
+        * Executes the task
+        *
+        * @return      void
+        */
+       public function execute () {
+               $this->partialStub('Unimplemented task.');
+       }
+}
+
+// [EOF]
+?>