- Interface 'NodeInformationWrapper' introduced, this may help other developers to implement their own classes
- Interface 'NodeListWrapper' introduced with same intension
- TODOs.txt update
application/hub/interfaces/visitor/tasks/class_TaskVisitor.php svneol=native#text/plain
application/hub/interfaces/work_units/.htaccess svneol=native#text/plain
application/hub/interfaces/work_units/class_UnitHelper.php svneol=native#text/plain
+application/hub/interfaces/wrapper/.htaccess -text svneol=unset#text/plain
+application/hub/interfaces/wrapper/class_NodeInformationWrapper.php svneol=native#text/plain
+application/hub/interfaces/wrapper/class_NodeListWrapper.php svneol=native#text/plain
application/hub/loader.php svneol=native#text/plain
application/hub/main/.htaccess -text svneol=unset#text/plain
application/hub/main/chat/.htaccess svneol=native#text/plain
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for node-information (database) wrapper
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 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 NodeInformationWrapper extends FrameworkInterface {
+ /**
+ * 'Registers' a new node id along with data provided in the node instance.
+ * This may sound confusing but avoids double code very nicely...
+ *
+ * @param $nodeInstance A node instance
+ * @param $requestInstance An instance of a Requestable class
+ * @return void
+ */
+ function registerNodeId (BaseHubNode $nodeInstance, Requestable $requestInstance);
+
+ /**
+ * 'Registers' a new session id along with data provided in the node instance.
+ * This may sound confusing but avoids double code very nicely...
+ *
+ * @param $nodeInstance A node instance
+ * @param $requestInstance An instance of a Requestable class
+ * @return void
+ */
+ function registerSessionId (BaseHubNode $nodeInstance, Requestable $requestInstance);
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An interface for node-list (database) wrapper
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 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 NodeListWrapper extends FrameworkInterface {
+ /**
+ * Resolves a session id into an ip:port combination
+ *
+ * @param $sessionId A valid session id
+ * @param $protocol Name of the protocol (TCP/UDP)
+ * @return $recipient Recipient as ip:port combination
+ */
+ function resolveIpPortBySessionId ($sessionId, $protocol);
+
+ /**
+ * Resolves a ip:port combination into a session id
+ *
+ * @param $ipPort Ip:port combination
+ * @param $protocol Name of the used protocol (TCP/UDP)
+ * @return $sessionId A valid session id
+ */
+ function resolveSessionIdByIpPort ($ipPort, $protocol);
+
+ /**
+ * Registeres a node by given message data.
+ *
+ * @param $messageData An array of all message data
+ * @param $handlerInstance An instance of a HandleableMessage class
+ * @return void
+ */
+ function registerNodeByMessageData (array $messageData, HandleableMessage $handlerInstance);
+
+ /**
+ * Updates an existing entry in node list
+ *
+ * @param $messageData An array of all message data
+ * @param $handlerInstance An instance of a HandleableMessage class
+ * @return void
+ */
+ function updateNodeByMessageData (array $messageData, HandleableMessage $handlerInstance);
+}
+
+// [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 NodeInformationDatabaseWrapper extends BaseDatabaseWrapper {
+class NodeInformationDatabaseWrapper extends BaseDatabaseWrapper implements NodeInformationWrapper {
// Constants for database table names
const DB_TABLE_NODE_INFORMATION = 'node_data';
* 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 implements Registerable {
+class NodeListDatabaseWrapper extends BaseDatabaseWrapper implements NodeListWrapper Registerable {
// Table names
const DB_TABLE_NODE_LIST = 'node_list';
// Run the "INSERT" query
$this->queryInsertDataSet($dataSetInstance);
}
+
+ /**
+ * Updates an existing entry in node list
+ *
+ * @param $messageData An array of all message data
+ * @param $handlerInstance An instance of a HandleableMessage class
+ * @return void
+ */
+ public function updateNodeByMessageData (array $messageData, HandleableMessage $handlerInstance) {
+ // Get a data set instance
+ $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_NODE_LIST));
+
+ // Set primary key (session id)
+ $dataSetInstance->setUniqueKey('node_' . XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID);
+
+ // Add all array elements
+ $handlerInstance->addArrayToDataSet($dataSetInstance, $messageData);
+
+ // Run the "UPDATE" query
+ $this->queryUpdateDataSet($dataSetInstance);
+ }
}
// [EOF]
*
* @param $messageArray An array with all minimum message data
* @return void
+ * @todo Add something more, e.g. spreading information over DHT
*/
protected function registerNodeByMessageData (array $messageData) {
// Get a wrapper instance
// Is there already an entry?
if ($resultInstance->next()) {
- // Entry found
- $resultInstance->debugBackTrace('Entry found!');
+ // Entry found, so update it
+ $wrapperInstance->updateNodeByMessageData($messageData, $this);
} else {
// Nothing found, so register it
$wrapperInstance->registerNodeByMessageData($messageData, $this);
./application/hub/main/filter/task/chat/class_ChatTaskHandlerInitializerFilter.php:55: * @todo 5% done
./application/hub/main/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php:55: * @todo 5% done
./application/hub/main/filter/task/node/class_NodeTaskHandlerInitializerFilter.php:55: * @todo Maybe some more tasks needs to be added?
+./application/hub/main/handler/message-types/class_BaseMessageHandler.php:108: * @todo Add something more, e.g. spreading information over DHT
./application/hub/main/handler/message-types/self-connect/class_NodeMessageSelfConnectHandler.php:71: // @TODO Throw an exception here instead of dying
./application/hub/main/handler/network/class_BaseRawDataHandler.php:148: * @todo This method will be moved to a better place
./application/hub/main/handler/network/udp/class_UdpRawDataHandler.php:58: * @todo 0%
./application/hub/main/tasks/network/class_NetworkPackageWriterTask.php:59: * @todo Also visit some sub-objects?
./application/hub/main/template/announcement/class_XmlAnnouncementTemplateEngine.php:10: * @todo This template engine does not make use of setTemplateType()
./application/hub/main/template/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php:10: * @todo This template engine does not make use of setTemplateType()
-./application/hub/main/template/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php:247: * @todo Find something useful with this!
+./application/hub/main/template/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php:257: * @todo Find something useful with this!
./application/hub/main/template/connect/class_XmlSelfConnectTemplateEngine.php:10: * @todo This template engine does not make use of setTemplateType()
./application/hub/main/template/connect/class_XmlSelfConnectTemplateEngine.php:249: * @todo Find something useful with this!
./application/hub/main/template/objects/class_XmlObjectRegistryTemplateEngine.php:10: * @todo This template engine does not make use of setTemplateType()
./inc/classes/main/user/class_BaseUser.php:308: * @todo Try to make this method more generic so we can move it in BaseFrameworkSystem
./inc/classes/main/user/class_BaseUser.php:80: * @todo Find a way of casting here. "(int)" might destroy the user id > 32766
./inc/classes/main/user/member/class_Member.php:84: * @todo Add more ways over creating user classes
-./inc/classes/middleware/debug/class_DebugMiddleware.php:112: // @TODO Initialization phase
+./inc/classes/middleware/debug/class_DebugMiddleware.php:113: // @TODO Initialization phase
./inc/classes.php:10: * @todo We should minimize these includes
-./inc/config/class_FrameworkConfiguration.php:194: * @todo We have to add some more entries from $_SERVER here
+./inc/config/class_FrameworkConfiguration.php:212: * @todo We have to add some more entries from $_SERVER here
./inc/database.php:11: * @todo We should minimize these includes
./inc/database.php:51:// @TODO Rewrite this
./inc/hooks.php:11: * @todo We should minimize these includes