Interfaces, BaseDecorator added:
authorRoland Häder <roland@mxchange.org>
Wed, 19 Aug 2009 20:18:19 +0000 (20:18 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 19 Aug 2009 20:18:19 +0000 (20:18 +0000)
- New interface DecoratorVisitor introduced which should be implemented by
  decorator visitors (so? ;-) )
- New interface ListenerVisitor introduced
- Listener are now visited by ActiveTaskVisitor and should listen again for
  incoming data
- NEWS/TODOs.txt updated

14 files changed:
.gitattributes
application/hub/interfaces/visitor/decorator/.htaccess [new file with mode: 0644]
application/hub/interfaces/visitor/decorator/class_DecoratorVisitor.php [new file with mode: 0644]
application/hub/interfaces/visitor/listener/.htaccess [new file with mode: 0644]
application/hub/interfaces/visitor/listener/class_ListenerVisitor.php [new file with mode: 0644]
application/hub/main/decorators/.htaccess [new file with mode: 0644]
application/hub/main/decorators/class_BaseDecorator.php [new file with mode: 0644]
application/hub/main/handler/tasks/class_TaskHandler.php
application/hub/main/listener/class_BaseListenerDecorator.php
application/hub/main/listener/udp/decorators/class_ClientUdpListenerDecorator.php
application/hub/main/listener/udp/decorators/class_HubUdpListenerDecorator.php
application/hub/main/visitor/tasks/class_ActiveTaskVisitor.php
docs/NEWS
docs/TODOs.txt

index 89cf94d9b2183cd1e42f0d47f37b7209a714d28c..0aa62cbdcba7fab200aec3149f9aec0a75222831 100644 (file)
@@ -54,6 +54,10 @@ application/hub/interfaces/visitor/class_Visitable.php -text
 application/hub/interfaces/visitor/class_Visitor.php -text
 application/hub/interfaces/visitor/connector/.htaccess -text
 application/hub/interfaces/visitor/connector/class_QueryConnectorVisitor.php -text
+application/hub/interfaces/visitor/decorator/.htaccess -text
+application/hub/interfaces/visitor/decorator/class_DecoratorVisitor.php -text
+application/hub/interfaces/visitor/listener/.htaccess -text
+application/hub/interfaces/visitor/listener/class_ListenerVisitor.php -text
 application/hub/interfaces/visitor/pool/.htaccess -text
 application/hub/interfaces/visitor/pool/class_PoolVisitor.php -text
 application/hub/interfaces/visitor/pool/listener/.htaccess -text
@@ -89,6 +93,8 @@ application/hub/main/database/.htaccess -text
 application/hub/main/database/wrapper/.htaccess -text
 application/hub/main/database/wrapper/class_NodeInformationDatabaseWrapper.php -text
 application/hub/main/database/wrapper/class_NodeListDatabaseWrapper.php -text
+application/hub/main/decorators/.htaccess -text
+application/hub/main/decorators/class_BaseDecorator.php -text
 application/hub/main/filter/.htaccess -text
 application/hub/main/filter/activation/.htaccess -text
 application/hub/main/filter/activation/class_HubActivation -text
diff --git a/application/hub/interfaces/visitor/decorator/.htaccess b/application/hub/interfaces/visitor/decorator/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/visitor/decorator/class_DecoratorVisitor.php b/application/hub/interfaces/visitor/decorator/class_DecoratorVisitor.php
new file mode 100644 (file)
index 0000000..ef96271
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+/**
+ * An interface for the visitor implementation for decorators
+ *
+ * @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/>.
+ */
+interface DecoratorVisitor extends Visitor {
+       /**
+        * Visits the given decorator instance
+        *
+        * @param       $decoratorInstance      A decorator instance
+        * @return      void
+        */
+       function visitDecorator (BaseDecorator $decoratorInstance);
+}
+
+// [EOF]
+?>
diff --git a/application/hub/interfaces/visitor/listener/.htaccess b/application/hub/interfaces/visitor/listener/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/visitor/listener/class_ListenerVisitor.php b/application/hub/interfaces/visitor/listener/class_ListenerVisitor.php
new file mode 100644 (file)
index 0000000..fa2da2c
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+/**
+ * An interface for the visitor implementation for listeners
+ *
+ * @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/>.
+ */
+interface ListenerVisitor extends Visitor {
+       /**
+        * Visits the given listener instance
+        *
+        * @param       $listenerInstance       A Listenable instance
+        * @return      void
+        */
+       function visitListener (Listenable $listenerInstance);
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/decorators/.htaccess b/application/hub/main/decorators/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/decorators/class_BaseDecorator.php b/application/hub/main/decorators/class_BaseDecorator.php
new file mode 100644 (file)
index 0000000..43b6e5d
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/**
+ * A general Decorator
+ *
+ * @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 BaseDecorator extends BaseHubSystem {
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Name of the class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+}
+
+// [EOF]
+?>
index a502ff44effdd392754a7e3b24e076d359068fb4..ee751541aaaa874ba42a33499ebcd37fc13027d5 100644 (file)
@@ -112,7 +112,7 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask {
                        $updateTask = true;
 
                        // Debug message
-                       $this->debugOutput('TASK-HANDLER: Task ' . $currentTask['id'] . ' started with startup_delay=' . $currentTask['task_startup_delay']);
+                       $this->debugOutput('TASK-HANDLER: Task ' . $currentTask['id'] . ' started with startup_delay=' . $currentTask['task_startup_delay'] . 'ms');
                } // END - if
 
                // Get time difference from interval delay
index 92c69431f60ca08d73fca69b0346fbaec030c145..dcf284649d2e9e649cd9a7e6ff25197e28769c1d 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 BaseListenerDecorator extends BaseHubSystem implements Visitable {
+class BaseListenerDecorator extends BaseDecorator implements Visitable {
        /**
         * Protected constructor
         *
@@ -67,17 +67,11 @@ class BaseListenerDecorator extends BaseHubSystem implements Visitable {
         * @return      void
         */
        public function accept (Visitor $visitorInstance) {
-               // Debug message
-               //* DEBUG: */ $this->debugOutput('DECO-LISTENER: ' . $visitorInstance->__toString() . ' has visited - START');
-
                // Visit this decorator
                $visitorInstance->visitDecorator($this);
 
                // Visit the covered class
                $visitorInstance->visitListener($this);
-
-               // Debug message
-               //* DEBUG: */ $this->debugOutput('DECO-LISTENER: ' . $visitorInstance->__toString() . ' has visited - FINISHED');
        }
 }
 
index 14f1150bcbaf99e8cd70c9873a85ec60190bc3ff..fc9c40cb29b71ec19735d84d0a45494f93b27c80 100644 (file)
@@ -64,7 +64,7 @@ class ClientUdpListenerDecorator extends BaseListenerDecorator implements Listen
         * @return      void
         */
        public function doListen() {
-               // Look for generic packages first
+               // Handle generic UDP packages first
                $this->getListenerInstance()->doListen();
 
                // Handle this client UDP package
index dc0630cc0ba20d5153b01b91fb0b256851cd3bf0..09a6c4462169abbc9a64c21349c529306b618623 100644 (file)
@@ -64,7 +64,7 @@ class HubUdpListenerDecorator extends BaseListenerDecorator implements Listenabl
         * @return      void
         */
        public function doListen() {
-               // Handle generic package first
+               // Handle generic UDP package first
                $this->getListenerInstance()->doListen();
 
                // Handle hub UDP package
index adbaf7010c5fe69589368d93c63e979951b60850..ecfe21bef227622c8c117ab587ba81cf39bc8dcf 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 ActiveTaskVisitor extends BaseVisitor implements TaskVisitor, QueryConnectorVisitor, PoolVisitor {
+class ActiveTaskVisitor extends BaseVisitor implements TaskVisitor, QueryConnectorVisitor, PoolVisitor, ListenerVisitor, DecoratorVisitor {
        /**
         * Protected constructor
         *
@@ -49,9 +49,9 @@ class ActiveTaskVisitor extends BaseVisitor implements TaskVisitor, QueryConnect
        }
 
        /**
-        * Visits the given pool instance
+        * Visits the given task instance
         *
-        * @param       $poolInstance   A Taskable instance
+        * @param       $taskInstance   A Taskable instance
         * @return      void
         */
        public function visitTask (Taskable $taskInstance) {
@@ -92,6 +92,28 @@ class ActiveTaskVisitor extends BaseVisitor implements TaskVisitor, QueryConnect
        public function visitQuery (Queryable $queryInstance) {
                // Empty for now...
        }
+
+       /**
+        * Visits the given listener instance
+        *
+        * @param       $listenerInstance       A Listenable instance
+        * @return      void
+        */
+       public function visitListener (Listenable $listenerInstance) {
+               // Do "listen" here
+               $listenerInstance->doListen();
+       }
+
+       /**
+        * Visits the given decorator instance
+        *
+        * @param       $decoratorInstance      A decorator instance
+        * @return      void
+        */
+       public function visitDecorator (BaseDecorator $decoratorInstance) {
+               // A decorator itself can never bevome an active task so this method
+               // remains empty.
+       }
 }
 
 // [EOF]
index a1dc3cf19dc8fe1e8af429eed239553b15453c1c..7339625fe69791df43521365d92c4ed2841f18bb 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -1,6 +1,13 @@
 NEWS / ChangeLog
 ================
 
+[2009-08-19]
+------------
+- These news are not in correct timeline!
+- Task handling added, first idle loop task added
+- Listeners are now visiited by ActiveTaskVisitor
+- Task added for self-tests, if the ports are reachable from public IP
+
 [2009-08-03]
 ------------
 - More debugging (and grep-able) output added
@@ -50,3 +57,6 @@ FreeMind: ("unoffical" but newer packages)
 
 OpenOffice:
   http://www.openoffice.org
+
+Might Commander:
+http://www.gnu.org/software/mc/
index d32831965b545d432884c9f9bf5e02a17fa4b580..a56d53c6962653ec5bfe1a3e15b9add0e870f398 100644 (file)
@@ -1,8 +1,8 @@
 ### WARNING: THIS FILE IS AUTO-GENERATED BY ./todo-builder.sh ###
 ### DO NOT EDIT THIS FILE. ###
 ./application/hub/interfaces/nodes/class_NodeHelper.php:10: * @todo            We need to find a better name for this interface
-./application/hub/main/commands/console/class_HubConsoleMainCommand.php:108:    * @todo        Should we add some more filters?
-./application/hub/main/commands/console/class_HubConsoleMainCommand.php:91:                    // @TODO We may have to catch some exceptions here
+./application/hub/main/commands/console/class_HubConsoleMainCommand.php:104:    * @todo        Should we add some more filters?
+./application/hub/main/connectors/query/local/class_LocalQueryConnector.php:10: * @todo                Find an interface for: handleAllQueries()
 ./application/hub/main/filter/node/class_NodeInitializationFilter.php:54:       * @todo        0% done
 ./application/hub/main/filter/node/class_NodeInitializationFilter.php:87:                      // @TODO Can we rewrite this to app_die() ?
 ./application/hub/main/filter/shutdown/class_HubShutdownDeinitQueuesFilter.php:55:      * @todo        0% done
 ./application/hub/main/filter/task/class_TaskHandlerInitializerFilter.php:55:   * @todo        0% done
 ./application/hub/main/handler/network/tcp/class_TcpNetworkPackageHandler.php:61:       * @todo        0%
 ./application/hub/main/handler/network/udp/class_UdpNetworkPackageHandler.php:55:       * @todo        0%
+./application/hub/main/handler/tasks/class_TaskHandler.php:140:                // @TODO Messurement can be added around this call
 ./application/hub/main/iterator/network/class_NetworkListenIterator.php:10: * @todo            This current implementation is not recommended, use a
 ./application/hub/main/iterator/network/class_NetworkListenIterator.php:11: * @todo            latency-based iteration or similar approaches
 ./application/hub/main/iterator/pool/handler/class_HandlerPoolIterator.php:10: * @todo         This current implementation is not recommended, use a
 ./application/hub/main/iterator/pool/handler/class_HandlerPoolIterator.php:11: * @todo         latency-based iteration or similar approaches
+./application/hub/main/iterator/pool/tasks/class_TaskPoolIterator.php:10: * @todo              This current implementation is not recommended, use a
+./application/hub/main/iterator/pool/tasks/class_TaskPoolIterator.php:11: * @todo              latency-based iteration or similar approaches
 ./application/hub/main/listener/tcp/class_TcpListener.php:160:  * @todo        0% done
 ./application/hub/main/listener/udp/class_UdpListener.php:61:   * @todo        stream_socket_server() was declared slow by some user comments.
 ./application/hub/main/listener/udp/class_UdpListener.php:62:   * @todo        Please rewrite it to socket_create() and its brothers.
 ./application/hub/main/listener/udp/class_UdpListener.php:85:   * @todo        0% done
-./application/hub/main/lists/class_BaseList.php:233:                   // @TODO Extend this somehow?
+./application/hub/main/lists/class_BaseList.php:236:                   // @TODO Extend this somehow?
 ./application/hub/main/nodes/boot/class_HubBootNode.php:113:    * @todo        0%
 ./application/hub/main/nodes/boot/class_HubBootNode.php:58:     * @todo        add some more special bootstrap things for this boot node
 ./application/hub/main/nodes/boot/class_HubBootNode.php:99:     * @todo        Unfinished method
 ./application/hub/main/nodes/regular/class_HubRegularNode.php:68:       * @todo        Unfinished method
 ./application/hub/main/nodes/regular/class_HubRegularNode.php:82:       * @todo        0%
 ./application/hub/main/resolver/state/network/class_NetworkStateResolver.php:69:        * @todo        0%
-./application/hub/main/visitor/pool/handler/class_HandlerListenerPoolVisitor.php:56:    * @todo        Find some use of doListen() method in listener pool classes
-./application/hub/main/visitor/pool/handler/class_HandlerListenerPoolVisitor.php:69:    * @todo        Find some use of doListen() method in listener decorator classes
+./application/hub/main/tasks/hub/class_HubSelfConnectTask.php:53:       * @todo        0%
+./application/hub/main/visitor/tasks/class_ActiveTaskVisitor.php:90:    * @todo        Does a query needs to perform some actions as an active task?
 ./inc/classes/exceptions/io/class_FileNotFoundException.php:10: * @todo                Rename this class to FileIoException
 ./inc/classes/exceptions/main/class_ClassNotFoundException.php:10: * @todo             Rename this class to NoClassException
 ./inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php:10: * @todo               Rename this class to NoFoundEntryException
 ./inc/classes/exceptions/main/class_MissingMethodException.php:13: * @todo             Try to rewrite user/guest login classes and mark this exception as deprecated
 ./inc/classes/interfaces/class_FrameworkInterface.php:11: * @todo              Find a better name for this interface
-./inc/classes/main/class_BaseFrameworkSystem.php:1040:  * @todo        Write a logging mechanism for productive mode
-./inc/classes/main/class_BaseFrameworkSystem.php:104:  // @todo Try to clean these constants up
-./inc/classes/main/class_BaseFrameworkSystem.php:1054:                 // @TODO Finish this part!
-./inc/classes/main/class_BaseFrameworkSystem.php:185:   * @todo        This is old code. Do we still need this old lost code?
-./inc/classes/main/class_BaseFrameworkSystem.php:253:   * @todo        SearchableResult and UpdateableResult shall have a super interface to use here
+./inc/classes/main/class_BaseFrameworkSystem.php:1045:  * @todo        Write a logging mechanism for productive mode
+./inc/classes/main/class_BaseFrameworkSystem.php:1059:                 // @TODO Finish this part!
+./inc/classes/main/class_BaseFrameworkSystem.php:109:  // @todo Try to clean these constants up
+./inc/classes/main/class_BaseFrameworkSystem.php:190:   * @todo        This is old code. Do we still need this old lost code?
+./inc/classes/main/class_BaseFrameworkSystem.php:258:   * @todo        SearchableResult and UpdateableResult shall have a super interface to use here
 ./inc/classes/main/commands/web/class_WebLoginAreaCommand.php:64:       * @todo        Add some stuff here: Some personal data, app/game related data
 ./inc/classes/main/console/class_ConsoleTools.php:41:   * @todo        We should connect this to a caching class to cache DNS requests
 ./inc/classes/main/console/class_ConsoleTools.php:54:          // @TODO Here should the cacher be implemented