application/hub/main/tasks/.htaccess -text
application/hub/main/tasks/class_ -text
application/hub/main/tasks/class_BaseTask.php -text
+application/hub/main/tasks/hub/.htaccess -text
+application/hub/main/tasks/hub/class_HubSelfConnectTask.php -text
application/hub/main/tasks/idle/.htaccess -text
application/hub/main/tasks/idle/class_IdleLoopTask.php -text
application/hub/main/visitor/.htaccess -text
// CFG: TASK-IDLE-LOOP-INTERVAL-DELAY
$cfg->setConfigEntry('task_idle_loop_interval_delay', 0);
+// CFG: TASK-SELF-CONNECT-STARTUP-DELAY
+$cfg->setConfigEntry('task_self_connect_startup_delay', 4000);
+
+// CFG: TASK-SELF-CONNECT-INTERVAL-DELAY
+$cfg->setConfigEntry('task_self_connect_interval_delay', 1000*60*30);
+
// CFG: IDLE-TASK-CLASS
$cfg->setConfigEntry('idle_task_class', 'IdleLoopTask');
+// CFG: HUB-SELFCONNECT-TASK-CLASS
+$cfg->setConfigEntry('hub_selfconnect_task_class', 'HubSelfConnectTask');
+
// CFG: TASK-LIST-CLASS
$cfg->setConfigEntry('task_list_class', 'TaskList');
// CFG: DEFAULT-ITERATOR-CLASS
$cfg->setConfigEntry('default_iterator_class', 'DefaultIterator');
+// CFG: QUERY-ITERATOR-CLASS
+$cfg->setConfigEntry('query_iterator_class', 'DefaultIterator');
+
// CFG: LOCAL-QUERY-LIST-CLASS
$cfg->setConfigEntry('local_query_list_class', 'LocalQueryList');
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface Connectable extends FrameworkInterface {
+ /**
+ * Processes all pending queries. This method should be called by the
+ * ActiveTaskVisitor class and should use an iterator on all pending
+ * queries.
+ *
+ * @return void
+ */
+ function processAllPendingQueries ();
}
-//
+// [EOF]
?>
public function handleAllQueries () {
$this->partialStub('Please implement this method.');
}
+
+ /**
+ * Processes all pending queries. This method should be called by the
+ * ActiveTaskVisitor class and should use an iterator on all pending
+ * queries.
+ *
+ * @return void
+ * @todo 0% done
+ */
+ public function processAllPendingQueries () {
+ $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
- */
- protected final function setListInstance (Listable $listInstance) {
- $this->listInstance = $listInstance;
- }
}
// [EOF]
// Set it in the connector
$connectorInstance->setListInstance($listInstance);
+ // Prepare iterator instance
+ $iteratorInstance = ObjectFactory::createObjectByConfiguredName('query_iterator_class', array($listInstance));
+
+ // Set it, too
+ $connectorInstance->setIteratorInstance($iteratorInstance);
+
// Finally return the connector
return $connectorInstance;
}
// Visit the query as well
$this->queryInstance->accept($visitorInstance);
}
+
+ /**
+ * Processes all pending queries. This method should be called by the
+ * ActiveTaskVisitor class and should use an iterator on all pending
+ * queries.
+ *
+ * @return void
+ */
+ public function processAllPendingQueries () {
+ $this->partialStub('Please implement this method.');
+ }
}
// [EOF]
// Put the task handler in registry
Registry::getRegistry()->addInstance('task', $handlerInstance);
+
+ // Prepare a self-test task for the listeners
+ $taskInstance = ObjectFactory::createObjectByConfiguredName('hub_selfconnect_task_class');
+
+ // Register it
+ $handlerInstance->registerTask('self_connect', $taskInstance);
}
}
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BaseIterator extends BaseHubSystem {
- /**
- * Instance of the list
- */
- private $listInstance = null;
-
/**
* Protected constructor
*
// Call parent constructor
parent::__construct($className);
}
-
- /**
- * Setter for the list instance
- *
- * @param $listInstance A list of IteratorAggregate
- * @return void
- */
- protected final function setListInstance (IteratorAggregate $listInstance) {
- $this->listInstance = $listInstance;
- }
-
- /**
- * Getter for the list instance
- *
- * @return $listInstance A list of IteratorAggregate
- */
- protected final function getListInstance () {
- return $this->listInstance;
- }
}
// [EOF]
/**
* Creates an instance of this class
*
- * @param $listInstance A list of a IteratorAggregate
+ * @param $listInstance A list of a Listable
* @return $iteratorInstance An instance a Iterator class
*/
- public final static function createNetworkListenIterator (IteratorAggregate $listInstance) {
+ public final static function createNetworkListenIterator (Listable $listInstance) {
// Get new instance
$iteratorInstance = new NetworkListenIterator();
/**
* Creates an instance of this class
*
- * @param $listInstance A list of a IteratorAggregate
+ * @param $listInstance A list of a Listable
* @return $iteratorInstance An instance a Iterator class
*/
- public final static function createDefaultIterator (IteratorAggregate $listInstance) {
+ public final static function createDefaultIterator (Listable $listInstance) {
// Get new instance
$iteratorInstance = new DefaultIterator();
/**
* Creates an instance of this class
*
- * @param $listInstance A list of a IteratorAggregate
+ * @param $listInstance A list of a Listable
* @return $iteratorInstance An instance a Iterator class
*/
- public final static function createHandlerPoolIterator (IteratorAggregate $listInstance) {
+ public final static function createHandlerPoolIterator (Listable $listInstance) {
// Get new instance
$iteratorInstance = new HandlerPoolIterator();
/**
* Creates an instance of this class
*
- * @param $listInstance A list of a IteratorAggregate
+ * @param $listInstance A list of a Listable
* @return $iteratorInstance An instance a Iterator class
*/
- public final static function createShutdownPoolIterator (IteratorAggregate $listInstance) {
+ public final static function createShutdownPoolIterator (Listable $listInstance) {
// Get new instance
$iteratorInstance = new ShutdownPoolIterator();
/**
* Creates an instance of this class
*
- * @param $listInstance A list of a IteratorAggregate
+ * @param $listInstance A list of a Listable
* @return $iteratorInstance An instance a Iterator class
*/
- public final static function createTaskPoolIterator (IteratorAggregate $listInstance) {
+ public final static function createTaskPoolIterator (Listable $listInstance) {
// Get new instance
$iteratorInstance = new TaskPoolIterator();
* 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 {
+class ???Query extends BaseQuery implements Queryable, Visitable {
/**
* Protected constructor
*
* 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 {
+class LocalQuery extends BaseQuery implements Queryable, Visitable {
/**
* Protected constructor
*
// Return the prepared instance
return $queryInstance;
}
+
+ /**
+ * Accepts the visitor to rpocess the visit "request"
+ *
+ * @param $visitorInstance An instance of a Visitor class
+ * @return void
+ */
+ public function accept (Visitor $visitorInstance) {
+ // Visit this query
+ $visitorInstance->visitQuery($this);
+ }
}
// [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 ???Task extends BaseTask implements Visitable {
+class ???Task extends BaseTask implements Taskable, Visitable {
/**
* Protected constructor
*
* @todo 0%
*/
public function accept (Visitor $visitorInstance) {
- $this->partialStub('Please implement this method. visitor='.$visitorInstance->__toString());
+ $this->partialStub('Please implement this method. visitor=' . $visitorInstance->__toString());
}
/**
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A HubSelfConnect task
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class HubSelfConnectTask 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 createHubSelfConnectTask () {
+ // Get new instance
+ $taskInstance = new HubSelfConnectTask();
+
+ // Return the prepared instance
+ return $taskInstance;
+ }
+
+ /**
+ * Accepts the visitor to rpocess the visit "request"
+ *
+ * @param $visitorInstance An instance of a Visitor class
+ * @return void
+ * @todo 0%
+ */
+ public function accept (Visitor $visitorInstance) {
+ // Visit this task
+ $visitorInstance->visitTask($this);
+ }
+
+ /**
+ * Executes the task
+ *
+ * @return void
+ */
+ public function execute () {
+ $this->partialStub('Unimplemented task.');
+ }
+}
+
+// [EOF]
+?>
* @return void
*/
public function visitQueryConnector (Connectable $connectorInstance) {
- // Handle all queries
- $connectorInstance->handleQueryConnector();
+ // Process all pending queries
+ $connectorInstance->processAllPendingQueries();
}
/**
// never become a task. Instead e.g. by a listener pool we should visit
// all listeners one by one
}
+
+ /**
+ * Query visitor method for active queries
+ *
+ * @param $queryInstance A Queryable instance
+ * @return void
+ * @todo Does a query needs to perform some actions as an active task?
+ */
+ public function visitQuery (Queryable $queryInstance) {
+ // Empty for now...
+ }
}
// [EOF]