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
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
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
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
public function handleFatalMessages (array $messageList) {
// Walk through all messages
foreach ($messageList as $message) {
- die("MSG:" . $message);
+ die('MSG:' . $message);
}
}
// 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');
// 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]
?>
* @return void
*/
function addListener (Listenable $listenerInstance);
-
- /**
- * Handle the listeners by asking them for received network packages
- *
- * @return void
- */
- function handleListenerPool ();
}
//
--- /dev/null
+Deny from all
--- /dev/null
+<?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]
+?>
* 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
*
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
<?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
* 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
*
}
/**
- * 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]
* 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
*
// 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]
* @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
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
+
+ // Init query instance
+ $this->queryInstance = ObjectFactory::createObjectByConfiguredName('local_query_class');
}
/**
// 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;
}
*/
public function accept (Visitor $visitorInstance) {
// Visit the query connector
- $visitorInstance->visitQuery($this);
+ $visitorInstance->visitQueryConnector($this);
+
+ // Visit the query as well
+ $this->queryInstance->accept($visitorInstance);
}
}
$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();
}
}
// 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');
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?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]
+?>
/**
* Query connector instance
*/
- private $queryInstance = null;
+ private $connectorInstance = null;
/**
* Listener pool instance
/**
* 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;
}
/**
$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');
);
}
- /**
- * 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
*
--- /dev/null
+Deny from all
--- /dev/null
+<?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]
+?>
--- /dev/null
+<?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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?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]
+?>
+++ /dev/null
-<?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();
- }
-}
-
-//
-?>
* 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
*
}
/**
- * 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();
}
/**
*/
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
}
}