]> git.mxchange.org Git - hub.git/commitdiff
Deprecated visitor removed, new added, rewrites:
authorRoland Häder <roland@mxchange.org>
Mon, 17 Aug 2009 20:40:23 +0000 (20:40 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 17 Aug 2009 20:40:23 +0000 (20:40 +0000)
- Deprecated visitor HandlerListenerPoolVisitor removed due to pools cannot be
  tasks (see ActiveTaskVisitor) and we don't need to visit it again for handling
  pooled listeners because we handle them directly.
- QueryConnectorVisitor added for visiting query connector classes
- LocalQueryList added for handling queries in an OOP'ed way
- LocalQuery added which runs queries locally

25 files changed:
.gitattributes
application/hub/class_ApplicationHelper.php
application/hub/config.php
application/hub/interfaces/pool/listener/class_PoolableListener.php
application/hub/interfaces/visitor/connector/.htaccess [new file with mode: 0644]
application/hub/interfaces/visitor/connector/class_QueryConnectorVisitor.php [new file with mode: 0644]
application/hub/main/class_
application/hub/main/commands/console/class_HubConsoleMainCommand.php
application/hub/main/connectors/query/class_
application/hub/main/connectors/query/class_BaseQueryConnector.php
application/hub/main/connectors/query/local/class_LocalQueryConnector.php
application/hub/main/filter/shutdown/class_HubShutdownDeinitQueuesFilter.php
application/hub/main/filter/task/class_TaskHandlerInitializerFilter.php
application/hub/main/lists/query/.htaccess [new file with mode: 0644]
application/hub/main/lists/query/local/.htaccess [new file with mode: 0644]
application/hub/main/lists/query/local/class_LocalQueryList.php [new file with mode: 0644]
application/hub/main/nodes/class_BaseHubNode.php
application/hub/main/pools/listener/class_DefaultListenerPool.php
application/hub/main/queries/.htaccess [new file with mode: 0644]
application/hub/main/queries/class_ [new file with mode: 0644]
application/hub/main/queries/class_BaseQuery.php [new file with mode: 0644]
application/hub/main/queries/local/.htaccess [new file with mode: 0644]
application/hub/main/queries/local/class_LocalQuery.php [new file with mode: 0644]
application/hub/main/visitor/pool/handler/class_HandlerListenerPoolVisitor.php [deleted file]
application/hub/main/visitor/tasks/class_ActiveTaskVisitor.php

index a7f2b027cf0a9f38ac43021ebf211b356e5005ae..7a678a733354be7d710c798eb4942e8b5736c9c1 100644 (file)
@@ -52,6 +52,8 @@ application/hub/interfaces/tasks/class_Taskable.php -text
 application/hub/interfaces/visitor/.htaccess -text
 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/pool/.htaccess -text
 application/hub/interfaces/visitor/pool/class_PoolVisitor.php -text
 application/hub/interfaces/visitor/pool/listener/.htaccess -text
@@ -167,6 +169,9 @@ application/hub/main/lists/groups/.htaccess -text
 application/hub/main/lists/groups/class_ListGroupList.php -text
 application/hub/main/lists/pool/.htaccess -text
 application/hub/main/lists/pool/class_PoolEntriesList.php -text
+application/hub/main/lists/query/.htaccess -text
+application/hub/main/lists/query/local/.htaccess -text
+application/hub/main/lists/query/local/class_LocalQueryList.php -text
 application/hub/main/lists/tasks/.htaccess -text
 application/hub/main/lists/tasks/class_TaskList.php -text
 application/hub/main/nodes/.htaccess -text
@@ -187,6 +192,11 @@ application/hub/main/pools/client/.htaccess -text
 application/hub/main/pools/client/class_DefaultClientPool.php -text
 application/hub/main/pools/listener/.htaccess -text
 application/hub/main/pools/listener/class_DefaultListenerPool.php -text
+application/hub/main/queries/.htaccess -text
+application/hub/main/queries/class_ -text
+application/hub/main/queries/class_BaseQuery.php -text
+application/hub/main/queries/local/.htaccess -text
+application/hub/main/queries/local/class_LocalQuery.php -text
 application/hub/main/queues/.htaccess -text
 application/hub/main/queues/class_ -text
 application/hub/main/queues/class_BaseQueue.php -text
@@ -223,7 +233,6 @@ application/hub/main/visitor/pool/.htaccess -text
 application/hub/main/visitor/pool/class_ -text
 application/hub/main/visitor/pool/handler/.htaccess -text
 application/hub/main/visitor/pool/handler/class_Handler -text
-application/hub/main/visitor/pool/handler/class_HandlerListenerPoolVisitor.php -text
 application/hub/main/visitor/pool/shutdown/.htaccess -text
 application/hub/main/visitor/pool/shutdown/class_Shutdown -text
 application/hub/main/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php -text
index 49c4acab7f927d546f972fbea2876b2af6071b7f..3e62874fdf7eab5c0c79e3984769ec3b67a99f8e 100644 (file)
@@ -219,7 +219,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
        public function handleFatalMessages (array $messageList) {
                // Walk through all messages
                foreach ($messageList as $message) {
-                       die("MSG:" . $message);
+                       die('MSG:' . $message);
                }
        }
 
index 319f83868f4042deb7b590e12f4acaffdde2ee11..f0b6bc42fc029e71a36b744545f03007fdbc2c3d 100644 (file)
@@ -102,9 +102,6 @@ $cfg->setConfigEntry('tcp_network_package_handler_class', 'TcpNetworkPackageHand
 // CFG: SHUTDOWN-LISTENER-POOL-VISITOR-CLASS
 $cfg->setConfigEntry('shutdown_listener_pool_visitor_class', 'ShutdownListenerPoolVisitor');
 
-// CFG: HANDLER-LISTENER-POOL-VISITOR-CLASS
-$cfg->setConfigEntry('handler_listener_pool_visitor_class', 'HandlerListenerPoolVisitor');
-
 // CFG: ACTIVE-TASK-VISITOR-CLASS
 $cfg->setConfigEntry('active_task_visitor_class', 'ActiveTaskVisitor');
 
@@ -207,5 +204,11 @@ $cfg->setConfigEntry('task_pool_iterator_class', 'TaskPoolIterator');
 // CFG: DEFAULT-ITERATOR-CLASS
 $cfg->setConfigEntry('default_iterator_class', 'DefaultIterator');
 
+// CFG: LOCAL-QUERY-LIST-CLASS
+$cfg->setConfigEntry('local_query_list_class', 'LocalQueryList');
+
+// CFG: LOCAL-QUERY-CLASS
+$cfg->setConfigEntry('local_query_class', 'LocalQuery');
+
 // [EOF]
 ?>
index 5b0f65c13756c966e8d741282c88ff185bd435ad..162d8a6c7dc9cab5b2da6b92364531eb76f2bb94 100644 (file)
@@ -29,13 +29,6 @@ interface PoolableListener extends Poolable {
         * @return      void
         */
        function addListener (Listenable $listenerInstance);
-
-       /**
-        * Handle the listeners by asking them for received network packages
-        *
-        * @return      void
-        */
-       function handleListenerPool ();
 }
 
 //
diff --git a/application/hub/interfaces/visitor/connector/.htaccess b/application/hub/interfaces/visitor/connector/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/visitor/connector/class_QueryConnectorVisitor.php b/application/hub/interfaces/visitor/connector/class_QueryConnectorVisitor.php
new file mode 100644 (file)
index 0000000..baf86ed
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+/**
+ * An interface for the visitor implementation for query connectors
+ *
+ * @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 QueryConnectorVisitor extends Visitor {
+       /**
+        * QueryConnector visitor method for active queries
+        *
+        * @param       $connectorInstance      A Connectable instance
+        * @return      void
+        */
+       function visitQueryConnector (Connectable $connectorInstance);
+}
+
+// [EOF]
+?>
index 9f2dcb69606a525ba25c57d74e3bfd15cfcf59a7..ea4538679e37fa0cf26e93d3258a6b8a62846733 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 ??? extends BaseFrameworkSystem {
+class ??? extends BaseFrameworkSystem implements === {
        /**
         * Protected constructor
         *
index d57140cb1ef399f95cabefc4d3c4ce12bc08cc64..2463c9a58a8e16669f88df4ea62f0da70a6d9bc9 100644 (file)
@@ -89,10 +89,6 @@ class HubConsoleMainCommand extends BaseCommand implements Commandable {
                while (($nodeInstance->isHubActive()) && ($handlerInstance->hasTasksLeft())) {
                        // Handle all tasks here
                        $handlerInstance->handleTasks();
-
-                       // Handle the listeners
-                       // @TODO We may have to catch some exceptions here
-                       //$nodeInstance->getListenerPoolInstance()->handleListenerPool();
                } // END - while
 
                // Debug message
index 066db0bda0939897fc0958ff29d6c6ca66ae7834..4a285a0477b5a34f3b98820cce87b5c8f9b3434b 100644 (file)
@@ -1,12 +1,13 @@
 <?php
 /**
- * A ??? queue connector class
+ * A ??? query connector class
  *
  * @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
+ * @todo               Find an interface for: handleAllQueries()
  *
  * 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
@@ -21,7 +22,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 ???QueueConnector extends BaseQueueConnector implements Connectable, Queueable {
+class ???QueryConnector extends BaseQueryConnector implements Connectable, Visitable {
        /**
         * Protected constructor
         *
@@ -33,17 +34,48 @@ class ???QueueConnector extends BaseQueueConnector implements Connectable, Queue
        }
 
        /**
-        * Creates an instance of this queue connector class
+        * Creates an instance of this query connector class
         *
-        * @return      $connectorInstance      An instance of this queue connector class
+        * @param       $nodeInstance           An instance of a node
+        * @return      $connectorInstance      An instance of this query connector class
         */
-       public final static function create???QueueConnector () {
+       public final static function create???QueryConnector (NodeHelper $nodeInstance) {
                // Create the instance
-               $connectorInstance = new ???QueueConnector();
+               $connectorInstance = new ???QueryConnector();
 
-               // Finally return it
+               // Set the node instance
+               $connectorInstance->setNodeInstance($nodeInstance);
+
+               // Get a list instance
+               $listInstance = ObjectFactory::createObjectByConfiguredName('!!!_query_list_class');
+
+               // Set it in the connector
+               $connectorInstance->setListInstance($listInstance);
+
+               // Finally return the connector
                return $connectorInstance;
        }
+
+       /**
+        * Accepts the visitor to rpocess the visit "request"
+        *
+        * @param       $visitorInstance        An instance of a Visitor class
+        * @return      void
+        */
+       public function accept (Visitor $visitorInstance) {
+               // Visit the query connector
+               $visitorInstance->visitQuery($this);
+       }
+
+       /**
+        * Handles all unsent queries and should be called from a visitor
+        *
+        * @return      void
+        * @todo        0% done
+        */
+       public function handleAllQueries () {
+               $this->partialStub('Please implement this method.');
+       }
 }
 
 // [EOF]
index f84666857a03774256053459b40eaaf02277b44a..df4d0960d97284f255ebd6ee1a48c2f7fe82dc14 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 class BaseQueryConnector extends BaseConnector {
+       /**
+        * A FIFO (First In First Out) list instance
+        */
+       private $listInstance = null;
+
        /**
         * Protected constructor
         *
@@ -32,6 +37,25 @@ class BaseQueryConnector extends BaseConnector {
                // Call parent constructor
                parent::__construct($className);
        }
+
+       /**
+        * Getter for FIFO list instance
+        *
+        * @return      $listInstance   A FIFO list instance
+        */
+       protected final function getListInstance () {
+               return $this->listInstance;
+       }
+
+       /**
+        * Setter for FIFO list instance
+        *
+        * @param       $listInstance   A FIFO list instance
+        * @return      void
+        */
+       private final function setListInstance (Listable $listInstance) {
+               $this->listInstance = $listInstance;
+       }
 }
 
 // [EOF]
index 22f0521355b5d3bcb57fc6577eb26d040c591250..23989f4bdbea01c32edbe676ce497b021bcccdfd 100644 (file)
@@ -7,6 +7,7 @@
  * @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
+ * @todo               Find an interface for: handleAllQueries()
  *
  * 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
  * 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 LocalQueryConnector extends BaseQueryConnector implements Connectable, Queryable, Visitable {
+class LocalQueryConnector extends BaseQueryConnector implements Connectable, Visitable {
+       /**
+        * The query class instance
+        */
+       private $queryInstance = null;
+
        /**
         * Protected constructor
         *
@@ -30,6 +36,9 @@ class LocalQueryConnector extends BaseQueryConnector implements Connectable, Que
        protected function __construct () {
                // Call parent constructor
                parent::__construct(__CLASS__);
+
+               // Init query instance
+               $this->queryInstance = ObjectFactory::createObjectByConfiguredName('local_query_class');
        }
 
        /**
@@ -45,7 +54,13 @@ class LocalQueryConnector extends BaseQueryConnector implements Connectable, Que
                // Set the node instance
                $connectorInstance->setNodeInstance($nodeInstance);
 
-               // Finally return it
+               // Get a list instance
+               $listInstance = ObjectFactory::createObjectByConfiguredName('local_query_list_class');
+
+               // Set it in the connector
+               $connectorInstance->setListInstance($listInstance);
+
+               // Finally return the connector
                return $connectorInstance;
        }
 
@@ -57,7 +72,10 @@ class LocalQueryConnector extends BaseQueryConnector implements Connectable, Que
         */
        public function accept (Visitor $visitorInstance) {
                // Visit the query connector
-               $visitorInstance->visitQuery($this);
+               $visitorInstance->visitQueryConnector($this);
+
+               // Visit the query as well
+               $this->queryInstance->accept($visitorInstance);
        }
 }
 
index aba685df3ad48393616540938ef6d4c8423ff9fa..dea5619e3f220a71dbe4aa0025b99110b3d15b08 100644 (file)
@@ -59,16 +59,16 @@ class HubShutdownDeinitQueuesFilter extends BaseFilter implements Filterable {
                $nodeInstance = Registry::getRegistry()->getInstance('node');
 
                // Get query instance
-               $queryInstance = $nodeInstance->getQueryInstance();
+               $connectorInstance = $nodeInstance->getQueryConnectorInstance();
 
                // Sanity-check on it
-               if (is_null($queryInstance)) {
+               if (is_null($connectorInstance)) {
                        // Throws a FilterChainException to stop further processing
                        throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
                } // END - if
 
                // Now shutdown this one done
-               $queryInstance->doShutdown();
+               $connectorInstance->doShutdown();
        }
 }
 
index 2d2f3adf14fbe1b234e4143366babc663d2e35e6..da413addc9e7173aaefd37216e0b7fce7c06a3e2 100644 (file)
@@ -65,7 +65,7 @@ class TaskHandlerInitializerFilter extends BaseFilter implements Filterable {
                // 1.) Network package reader, needs to be delayed a little
                $handlerInstance->registerTask('network_package_reader', $nodeInstance->getListenerPoolInstance());
                // 2.) Query instance
-               $handlerInstance->registerTask('query_handler', $nodeInstance->getQueryInstance());
+               $handlerInstance->registerTask('query_handler', $nodeInstance->getQueryConnectorInstance());
 
                // Generate idle task
                $taskInstance = ObjectFactory::createObjectByConfiguredName('idle_task_class');
diff --git a/application/hub/main/lists/query/.htaccess b/application/hub/main/lists/query/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/lists/query/local/.htaccess b/application/hub/main/lists/query/local/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/lists/query/local/class_LocalQueryList.php b/application/hub/main/lists/query/local/class_LocalQueryList.php
new file mode 100644 (file)
index 0000000..83475e0
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A LocalQuery list
+ *
+ * @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 LocalQueryList extends BaseList implements Listable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $listInstance           An instance a Listable class
+        */
+       public final static function createLocalQueryList () {
+               // Get new instance
+               $listInstance = new LocalQueryList();
+
+               // Return the prepared instance
+               return $listInstance;
+       }
+}
+
+// [EOF]
+?>
index c6aba05b665b3d91819f26623df684bda00e97a5..633e207e6bc5508013afa24ccac5ea248706437e 100644 (file)
@@ -40,7 +40,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
        /**
         * Query connector instance
         */
-       private $queryInstance = null;
+       private $connectorInstance = null;
 
        /**
         * Listener pool instance
@@ -123,20 +123,20 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
        /**
         * Setter for query instance
         *
-        * @param       $queryInstance          Our new query instance
+        * @param       $connectorInstance              Our new query instance
         * @return      void
         */
-       private final function setQueryInstance (Queryable $queryInstance) {
-               $this->queryInstance = $queryInstance;
+       private final function setQueryConnectorInstance (Connectable $connectorInstance) {
+               $this->connectorInstance = $connectorInstance;
        }
 
        /**
         * Getter for query instance
         *
-        * @return      $queryInstance          Our new query instance
+        * @return      $connectorInstance              Our new query instance
         */
-       public final function getQueryInstance () {
-               return $this->queryInstance;
+       public final function getQueryConnectorInstance () {
+               return $this->connectorInstance;
        }
 
        /**
@@ -308,10 +308,10 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
                $this->debugOutput('BOOTSTRAP: Initialize queues: START');
 
                // Set the query connector instance
-               $this->setQueryInstance(ObjectFactory::createObjectByConfiguredName('query_connector_class', array($this)));
+               $this->setQueryConnectorInstance(ObjectFactory::createObjectByConfiguredName('query_connector_class', array($this)));
 
                // Run a test query
-               $this->getQueryInstance()->doTestQuery();
+               $this->getQueryConnectorInstance()->doTestQuery();
 
                // Debug message
                $this->debugOutput('BOOTSTRAP: Initialize queues: FINISHED');
index 621c80c21fbfc1d93b5d5816b5bf855d0cf6c97c..dccbfcc347c3a5ae5b9795f7286bb2fa62f947e3 100644 (file)
@@ -67,21 +67,6 @@ class DefaultListenerPool extends BasePool implements PoolableListener {
                );
        }
 
-       /**
-        * Handle the listeners by asking them for received network packages.
-        * You should not add any debug lines here because they will be executed
-        * in the main loop and may be a performance impact.
-        *
-        * @return      void
-        */
-       public function handleListenerPool () {
-               // Get a visitor instance
-               $visitorInstance = ObjectFactory::createObjectByConfiguredName('handler_listener_pool_visitor_class');
-
-               // Start the visit
-               $this->accept($visitorInstance);
-       }
-
        /**
         * Run the shutdown seqeuence by a Visitor Pattern
         *
diff --git a/application/hub/main/queries/.htaccess b/application/hub/main/queries/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/queries/class_ b/application/hub/main/queries/class_
new file mode 100644 (file)
index 0000000..99d8ab5
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A ??? query
+ *
+ * @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 ???Query extends BaseQuery implements Queryable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $queryInstance  An instance of a Queryable class
+        */
+       public final static function create???Query () {
+               // Get new instance
+               $queryInstance = new ???Query();
+
+               // Return the prepared instance
+               return $queryInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/queries/class_BaseQuery.php b/application/hub/main/queries/class_BaseQuery.php
new file mode 100644 (file)
index 0000000..e85325e
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/**
+ * A general Query
+ *
+ * @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 BaseQuery extends BaseHubSystem {
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Name of the class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/queries/local/.htaccess b/application/hub/main/queries/local/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/queries/local/class_LocalQuery.php b/application/hub/main/queries/local/class_LocalQuery.php
new file mode 100644 (file)
index 0000000..b6ae4b0
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A Local query
+ *
+ * @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 LocalQuery extends BaseQuery implements Queryable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $queryInstance  An instance of a Queryable class
+        */
+       public final static function createLocalQuery () {
+               // Get new instance
+               $queryInstance = new LocalQuery();
+
+               // Return the prepared instance
+               return $queryInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/visitor/pool/handler/class_HandlerListenerPoolVisitor.php b/application/hub/main/visitor/pool/handler/class_HandlerListenerPoolVisitor.php
deleted file mode 100644 (file)
index 65dd5bc..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-/**
- * A ListenerPool handler visitor
- *
- * @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 HandlerListenerPoolVisitor extends BaseVisitor implements ListenerPoolVisitor {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-
-               // Set visitor mode
-               $this->setVisitorMode('handler');
-       }
-
-       /**
-        * Creates an instance of this class
-        *
-        * @return      $visitorInstance                An instance a Visitorable class
-        */
-       public final static function createHandlerListenerPoolVisitor () {
-               // Get new instance
-               $visitorInstance = new HandlerListenerPoolVisitor();
-
-               // Return the prepared instance
-               return $visitorInstance;
-       }
-
-       /**
-        * Visits the given pool instance
-        *
-        * @param       $poolInstance   A Poolable instance
-        * @return      void
-        * @todo        Find some use of doListen() method in listener pool classes
-        */
-       public function visitPool (Poolable $poolInstance) {
-               // The pool itself wont listen to any connections but maybe we need
-               // this stub for something later on
-               // $poolInstance->doListen();
-       }
-
-       /**
-        * Visits the given decorator instance
-        *
-        * @param       $listenerInstance       A Listenable instance
-        * @return      void
-        * @todo        Find some use of doListen() method in listener decorator classes
-        */
-       public function visitDecorator (Listenable $listenerInstance) {
-               // The decorator itself wont listen to any connections but maybe we need
-               // this stub for something later on
-               // $listenerInstance->doListen();
-       }
-
-       /**
-        * Visits the given listener instance
-        *
-        * @param       $listenerInstance       A listenerable instance
-        * @return      void
-        */
-       public function visitListener (Listenable $listenerInstance) {
-               // Just call the listener->doListen
-               $listenerInstance->doListen();
-       }
-}
-
-//
-?>
index 5794ae6bc81ec67bb1a63ee67dd2590a913bde9a..6d4bfc429d2d6645dc764ad5f4604945ad55ec07 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, QueryVisitor, PoolVisitor {
+class ActiveTaskVisitor extends BaseVisitor implements TaskVisitor, QueryConnectorVisitor, PoolVisitor {
        /**
         * Protected constructor
         *
@@ -60,14 +60,14 @@ class ActiveTaskVisitor extends BaseVisitor implements TaskVisitor, QueryVisitor
        }
 
        /**
-        * Query visitor method for active tasks
+        * Connector visitor method for active tasks
         *
-        * @param       $queryInstance  A Queryable instance
+        * @param       $connectorInstance      A Connectable instance
         * @return      void
         */
-       public function visitQuery (Queryable $queryInstance) {
+       public function visitQueryConnector (Connectable $connectorInstance) {
                // Handle all queries
-               $queryInstance->handleQueries();
+               $connectorInstance->handleQueryConnector();
        }
 
        /**
@@ -78,7 +78,8 @@ class ActiveTaskVisitor extends BaseVisitor implements TaskVisitor, QueryVisitor
         */
        public function visitPool (Poolable $poolInstance) {
                // We don't need to visit a pool as an active task because a pool can
-               // never become a task.
+               // never become a task. Instead e.g. by a listener pool we should visit
+               // all listeners one by one
        }
 }