]> git.mxchange.org Git - hub.git/commitdiff
Hub project continued:
authorRoland Häder <roland@mxchange.org>
Mon, 21 Nov 2011 19:52:45 +0000 (19:52 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 21 Nov 2011 19:52:45 +0000 (19:52 +0000)
- Added a telnet listener for the 'chat' console
- Some minor cleanups/improvements

14 files changed:
.gitattributes
application/hub/config.php
application/hub/main/filter/task/chat/class_ChatTaskHandlerInitializerFilter.php
application/hub/main/filter/task/node/class_NodeTaskHandlerInitializerFilter.php
application/hub/main/listener/tcp/class_TcpListener.php
application/hub/main/pools/class_BasePool.php
application/hub/main/statistics/connection/class_ConnectionStatisticsHelper.php
application/hub/main/tasks/chat/.htaccess [new file with mode: 0644]
application/hub/main/tasks/chat/class_ [new file with mode: 0644]
application/hub/main/tasks/chat/class_ChatTelnetListenerTask.php [new file with mode: 0644]
application/hub/main/tasks/class_
application/hub/main/tasks/hub/class_HubSocketListenerTask.php
application/hub/main/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php
application/hub/templates/xml/cruncher/producer/work_unit.xml

index 2ccd8ddc2c9a7e1997a6141e9d4069c588ab7618..8108bb226d91637ed3ae5d1162fada5eda0c139b 100644 (file)
@@ -500,6 +500,9 @@ application/hub/main/tags/class_BaseTags.php svneol=native#text/plain
 application/hub/main/tags/package/.htaccess -text svneol=unset#text/plain
 application/hub/main/tags/package/class_PackageTags.php svneol=native#text/plain
 application/hub/main/tasks/.htaccess -text svneol=unset#text/plain
+application/hub/main/tasks/chat/.htaccess -text svneol=unset#text/plain
+application/hub/main/tasks/chat/class_ svneol=native#text/plain
+application/hub/main/tasks/chat/class_ChatTelnetListenerTask.php svneol=native#text/plain
 application/hub/main/tasks/class_ svneol=native#text/plain
 application/hub/main/tasks/class_BaseTask.php svneol=native#text/plain
 application/hub/main/tasks/cruncher/.htaccess svneol=native#text/plain
index 6d52631274d85e4410c37344edaf0f3f0a0374fa..ff8e966b430b516ecba493f662c336f16a133ab2 100644 (file)
@@ -705,6 +705,18 @@ $cfg->setConfigEntry('chat_bootstrap_generic_activation_filter', 'ChatBootstrapG
 // CFG: CHAT-SHUTDOWN-FILTER
 $cfg->setConfigEntry('chat_shutdown_filter', 'ChatShutdownFilter');
 
+// CFG: CHAT-TELNET-LISTENER-TASK-CLASS
+$cfg->setConfigEntry('chat_telnet_listener_task_class', 'ChatTelnetListenerTask');
+
+// CFG: TASK-CHAT-TELNET-LISTENER-STARTUP-DELAY
+$cfg->setConfigEntry('task_chat_telnet_listener_startup_delay', 2500);
+
+// CFG: TASK-CHAT-TELNET-LISTENER-INTERVAL-DELAY
+$cfg->setConfigEntry('task_chat_telnet_listener_interval_delay', 10);
+
+// CFG: TASK-CHAT-TELNET-LISTENER-MAX-RUNS
+$cfg->setConfigEntry('task_chat_telnet_listener_max_runs', 0);
+
 ///////////////////////////////////////////////////////////////////////////////
 //                            HTTP Configuration
 ///////////////////////////////////////////////////////////////////////////////
index 5d984d75c846ae1ab15cbab8716cc2352768c90b..e386bb470b0c617111c346eb71bd9e977303dffc 100644 (file)
@@ -61,11 +61,13 @@ class ChatTaskHandlerInitializerFilter extends BaseFilter implements Filterable
                // Get a new task handler instance
                $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class');
 
-               // Register all tasks:
-               //
-               // 1) A task for fetching WUs (work units) or test units
-               //$taskInstance = ObjectFactory::createObjectByConfiguredName('chat_work_unit_fetcher_task_class');
-               //$handlerInstance->registerTask('chat_work_unit_fetcher', $taskInstance);
+               /*
+                * Register all tasks:
+                *
+                * 1) Telnet session listener
+                */
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('chat_telnet_listener_task_class');
+               $handlerInstance->registerTask('chat_telnet_listener', $taskInstance);
 
                // Put the task handler in registry
                Registry::getRegistry()->addInstance('task', $handlerInstance);
index 34dff9338749438b55e0e0a4bff51e5dbc953ec6..620135ba848cb9fd9a62cd47ae82fac13980920b 100644 (file)
@@ -58,9 +58,6 @@ class NodeTaskHandlerInitializerFilter extends BaseFilter implements Filterable
                // Get node instance
                $nodeInstance = Registry::getRegistry()->getInstance('node');
 
-               // Get the list instance here
-               $listInstance = $nodeInstance->getListenerPoolInstance()->getPoolEntriesInstance();
-
                // Get a new task handler instance
                $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class');
 
@@ -100,6 +97,9 @@ class NodeTaskHandlerInitializerFilter extends BaseFilter implements Filterable
                // 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));
 
index a1f87a766685826b4cf4c13c9b1fcd685008e65d..6554016d3873a0a579ec72593a3da2f8761e6740 100644 (file)
@@ -250,7 +250,7 @@ class TcpListener extends BaseListener implements Listenable {
         * @return      $accepts                Wether this listener does accept
         */
        public function ifListenerAcceptsPackageData (array $packageData) {
-               $this->partialStub('This call should not happen. Please report it.');
+               $this->debugBackTrace('This call should not happen. Please report it.');
        }
 }
 
index 0e58c98ba267fc1a14bd4b214ddb2f823d857de7..648277d4c2844fbc5d7223124b095e00cd816225 100644 (file)
@@ -115,10 +115,11 @@ class BasePool extends BaseHubSystem implements Visitable {
                        // Is this entry visitable?
                        if ($poolEntry instanceof Visitable) {
                                // Visit this entry as well
+                               //* NOISY-DEBUG: */ $this->debugOutput('BASE-POOL: Going to visit pooled object ' . $poolEntry->__toString() . ' with visitor ' . $visitorInstance->__toString() . ' ...');
                                $poolEntry->accept($visitorInstance);
                        } else {
                                // Cannot visit this entry
-                               $this->partialStub('Pool entry with key ' . $iteratorInstance->key() . ' has improper type ' . gettype($poolEntry) . '.');
+                               $this->partialStub('Pool entry with key ' . $iteratorInstance->key() . ' has improper type ' . gettype($poolEntry) . ', reason: not implementing Visitable.');
                        }
 
                        // Advance to next entry
index f125081eda00b6df41a48d6ee0d7f949bddcb892..8ff6d0225a41eb5921c9b6f947670997cd8a1d4e 100644 (file)
@@ -30,11 +30,12 @@ class ConnectionStatisticsHelper extends BaseHubSystem {
        private static $connectionStatistics = array(
                // Statistics for TCP connections
                'tcp' => array(
-                       // Tried connection attempts
+                       // Tried TCP connection attempts
                        'retry_count' => array(),
                ),
                // Statistics for UDP connections
                'udp' => array(
+                       // Tried UDP connection attempts
                        'retry_count' => array(),
                )
        );
diff --git a/application/hub/main/tasks/chat/.htaccess b/application/hub/main/tasks/chat/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/tasks/chat/class_ b/application/hub/main/tasks/chat/class_
new file mode 100644 (file)
index 0000000..2501e22
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+/**
+ * A ??? task for chat consoles
+ *
+ * @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 Chat???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 createChat???Task () {
+               // Get new instance
+               $taskInstance = new Chat???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]
+?>
diff --git a/application/hub/main/tasks/chat/class_ChatTelnetListenerTask.php b/application/hub/main/tasks/chat/class_ChatTelnetListenerTask.php
new file mode 100644 (file)
index 0000000..c245f50
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+/**
+ * A TelnetListener task for chat consoles
+ *
+ * @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 ChatTelnetListenerTask 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 createChatTelnetListenerTask () {
+               // Get new instance
+               $taskInstance = new ChatTelnetListenerTask();
+
+               // 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 ca9549023a201a06a0d6264e11558f99514c2d78..a5936c9a23ac4e11d8a8adc5304821bb2f83fd5b 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * A ??? task for crunchers
+ * A ??? task for !!!
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
@@ -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 Cruncher???Task extends BaseTask implements Taskable, Visitable {
+class !!!???Task extends BaseTask implements Taskable, Visitable {
        /**
         * Protected constructor
         *
@@ -37,9 +37,9 @@ class Cruncher???Task extends BaseTask implements Taskable, Visitable {
         *
         * @return      $taskInstance   An instance of a Visitable class
         */
-       public final static function createCruncher???Task () {
+       public final static function create!!!???Task () {
                // Get new instance
-               $taskInstance = new Cruncher???Task();
+               $taskInstance = new !!!???Task();
 
                // Return the prepared instance
                return $taskInstance;
index 139a2b4b2d1eb4b256755de8e6d97c0839ec8364..9eff3b15f5712ae7714b48eb823a6a8cdbc38abf 100644 (file)
@@ -56,6 +56,7 @@ class HubSocketListenerTask extends BaseTask implements Taskable, Visitable {
                $nodeInstance = Registry::getRegistry()->getInstance('node');
 
                // Visit the pool listener task
+               //* NOISY-DEBUG: */ $this->debugOutput('LISTENER-TASK: Going to visit object ' . $nodeInstance->getListenerPoolInstance()->__toString() . ' ...');
                $nodeInstance->getListenerPoolInstance()->accept($visitorInstance);
 
                // Visit this task
index 51eccab2e7c977bd4f8341ad9807095564ef1a0b..45228dcc62b7b25423fc8079e348a231013de240 100644 (file)
@@ -84,9 +84,9 @@ class RawDataPoolMonitorVisitor extends BaseVisitor implements PoolVisitor, List
         */
        public function visitDecorator (BaseDecorator $decoratorInstance) {
                // Do monitor here
-               //* DEBUG: */ $this->debugOutput('VISITOR: Visiting ' . $listenerInstance->__toString() . ' - START');
+               //* NOISY-DEBUG: */ $this->debugOutput('VISITOR: Visiting ' . $listenerInstance->__toString() . ' - START');
                $decoratorInstance->monitorIncomingRawData($this->getReceiverInstance());
-               //* DEBUG: */ $this->debugOutput('VISITOR: Visiting ' . $listenerInstance->__toString() . ' - FINISH');
+               //* NOISY-DEBUG: */ $this->debugOutput('VISITOR: Visiting ' . $listenerInstance->__toString() . ' - FINISH');
        }
 }
 
index 956095913732804732da22fddafef8cb07ebd404..ed80f189bce6913a865ffb53de1651527b989010 100644 (file)
@@ -42,10 +42,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
                        <cipher-name>{?cipher_name?}</cipher-name>
                </cipher>
                <!--
-               Timestamp in the format YYYY-mm-dd HH:ii:ss when this test unit has been
+               Timestamp in the format YYYY-mm-dd HH:ii:ss when this work unit has been
                created.
                //-->
-               <test-unit-created>{?test_unit_created</test-unit-created>
+               <work-unit-created>{?work_unit_created</work-unit-created>
                <!--
                The node's hub-id. This is required to verify the GPI.
                //-->