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/filter/.htaccess -text
application/hub/main/filter/activation/.htaccess -text
application/hub/main/filter/activation/class_ -text
// CFG: NODE-INFO-DB-WRAPPER-CLASS
$cfg->setConfigEntry('node_info_db_wrapper_class', 'NodeInformationDatabaseWrapper');
+// CFG: NODE-LIST-DB-WRAPPER-CLASS
+$cfg->setConfigEntry('node_list_db_wrapper_class', 'NodeListDatabaseWrapper');
+
// CFG: WEB-CONTENT-TYPE
$cfg->setConfigEntry('web_content_type', '');
* @return void
*/
function activateHub (Requestable $requestInstance, Responseable $responseInstance);
+
+ /**
+ * Generates a session id which will be sent to the other hubs and clients
+ *
+ * @return void
+ */
+ function bootstrapGenerateSessionId ();
+
+ /**
+ * Initializes the listener pool (class)
+ *
+ * @return void
+ */
+ function initializeListenerPool ();
+
+ /**
+ * Restores a previously stored node list from database
+ *
+ * @return void
+ */
+ function bootstrapRestoreNodeList ();
}
//
--- /dev/null
+<?php
+/**
+ * A database wrapper for node 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 NodeListDatabaseWrapper extends BaseDatabaseWrapper {
+ // Table names
+ const DB_TABLE_NODE_LIST = 'node_list';
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct() {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this database wrapper by a provided user class
+ *
+ * @return $wrapperInstance An instance of the created wrapper class
+ */
+ public final static function createNodeListDatabaseWrapper () {
+ // Get a new instance
+ $wrapperInstance = new NodeListDatabaseWrapper();
+
+ // Set (primary!) table name
+ $wrapperInstance->setTableName(self::DB_TABLE_NODE_LIST);
+
+ // Return the instance
+ return $wrapperInstance;
+ }
+
+ /**
+ * Getter for index key
+ *
+ * @return $indexKey Index key
+ */
+ public final function getIndexKey () {
+ return $this->getDatabaseInstance()->getIndexKey();
+ }
+}
+
+// [EOF]
+?>
* @return void
*/
protected function initGenericQueues () {
+ // Debug message
+ $this->debugOutput('BOOTSTRAP: Initialize queues: START');
+
// Set the query connector instance
$this->setQueryInstance(ObjectFactory::createObjectByConfiguredName('query_connector_class', array($this)));
// Run a test query
$this->getQueryInstance()->doTestQuery();
- // Query queue initialized
- $this->debugOutput('BOOTSTRAP: Query queue initialized.');
+ // Debug message
+ $this->debugOutput('BOOTSTRAP: Initialize queues: FINISHED');
}
/**
*/
public function initializeListenerPool () {
// Debug output
- $this->debugOutput('HUB: Initializing listeners...');
+ $this->debugOutput('HUB: Initialize listener: START');
// Get a new pool instance
$this->listenerPoolInstance = ObjectFactory::createObjectByConfiguredName('listener_pool_class', array($this));
$this->listenerPoolInstance->addListener($decoratorInstance);
// Debug output
- $this->debugOutput('HUB: All listeners are initialized.');
+ $this->debugOutput('HUB: Initialize listener: FINISHED.');
+ }
+
+ /**
+ * Restores a previously stored node list from database
+ *
+ * @return void
+ */
+ public function bootstrapRestoreNodeList () {
+ // Debug output
+ $this->debugOutput('HUB: Restore node list: START');
+
+ // Get a wrapper instance
+ $wrapperInstance = ObjectFactory::createObjectByConfiguredName('node_list_db_wrapper_class');
+
+ // Now get a search criteria instance
+ $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+ // Search for the node number zero which is hard-coded the default
+ // @TODO Add some criteria, e.g. if the node is active or so
+ //$searchInstance->addCriteria(NodeListDatabaseWrapper::DB_COLUMN_NODE_NR, 1);
+ //$searchInstance->addCriteria(NodeListDatabaseWrapper::DB_COLUMN_NODE_TYPE, $this->getRequestInstance()->getRequestElement('mode'));
+ //$searchInstance->setLimit(1);
+
+ // Get a result back
+ $resultInstance = $wrapperInstance->doSelectByCriteria($searchInstance);
+
+ // Is it valid?
+ if ($resultInstance->next()) {
+ $this->partialStub('Do something for restoring the list.');
+ // Output message
+ //$this->debugOutput('BOOTSTRAP: ');
+ } // END - if
+
+ // Debug output
+ $this->debugOutput('HUB: Restore node list: FINISHED.');
}
}