Renamed/moved classes, added DHT bootstrap (very early):
authorRoland Häder <roland@mxchange.org>
Thu, 14 Feb 2013 22:21:13 +0000 (22:21 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 14 Feb 2013 22:21:13 +0000 (22:21 +0000)
- Added very early and untested code for DHT bootstrap
- To make things easier, more HubFooBar classes has been renamed to NodeFooBar
- Also they have to be moved to a new place to fit class prefix

38 files changed:
.gitattributes
application/hub/config.php
application/hub/interfaces/helper/dht/.htaccess [new file with mode: 0644]
application/hub/interfaces/helper/dht/class_HelpableDht.php [new file with mode: 0644]
application/hub/interfaces/helper/hub/class_HelpableHub.php
application/hub/interfaces/helper/node/.htaccess [new file with mode: 0644]
application/hub/interfaces/helper/node/class_HelpableNode.php [new file with mode: 0644]
application/hub/interfaces/package/class_Deliverable.php
application/hub/main/helper/class_ [new file with mode: 0644]
application/hub/main/helper/class_BaseHubSystemHelper.php [new file with mode: 0644]
application/hub/main/helper/dht/.htaccess [new file with mode: 0644]
application/hub/main/helper/dht/class_DhtBootstrapHelper.php [new file with mode: 0644]
application/hub/main/helper/hub/announcement/class_HubAnnouncementHelper.php
application/hub/main/helper/hub/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php
application/hub/main/helper/hub/answer/class_BaseHubAnswerHelper.php
application/hub/main/helper/hub/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php
application/hub/main/helper/hub/class_
application/hub/main/helper/hub/class_BaseHubHelper.php
application/hub/main/helper/hub/connection/class_HubSelfConnectHelper.php
application/hub/main/helper/hub/requests/class_NodeRequestNodeListHelper.php
application/hub/main/helper/node/.htaccess [new file with mode: 0644]
application/hub/main/helper/node/announcement/.htaccess [new file with mode: 0644]
application/hub/main/helper/node/announcement/class_NodeAnnouncementHelper.php [new file with mode: 0644]
application/hub/main/helper/node/answer/.htaccess [new file with mode: 0644]
application/hub/main/helper/node/answer/announcement/.htaccess [new file with mode: 0644]
application/hub/main/helper/node/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php [new file with mode: 0644]
application/hub/main/helper/node/answer/class_BaseHubAnswerHelper.php [new file with mode: 0644]
application/hub/main/helper/node/answer/requests/.htaccess [new file with mode: 0644]
application/hub/main/helper/node/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php [new file with mode: 0644]
application/hub/main/helper/node/class_ [new file with mode: 0644]
application/hub/main/helper/node/class_BaseNodeHelper.php [new file with mode: 0644]
application/hub/main/helper/node/connection/.htaccess [new file with mode: 0644]
application/hub/main/helper/node/connection/class_NodeSelfConnectHelper.php [new file with mode: 0644]
application/hub/main/helper/node/requests/.htaccess [new file with mode: 0644]
application/hub/main/helper/node/requests/class_NodeRequestNodeListHelper.php [new file with mode: 0644]
application/hub/main/package/class_NetworkPackage.php
application/hub/main/template/bootstrap/.htaccess [new file with mode: 0644]
application/hub/main/template/bootstrap/class_XmlBootstrapTemplateEngine.php [new file with mode: 0644]

index 6a9d5e874426fa48495f0b5baee61f920eb90cc8..e74efdf522f8e6f72236ebd4be81ba65c7b0582c 100644 (file)
@@ -81,10 +81,14 @@ application/hub/interfaces/handler/task/.htaccess -text svneol=unset#text/plain
 application/hub/interfaces/handler/task/class_HandleableTask.php svneol=native#text/plain
 application/hub/interfaces/helper/.htaccess -text svneol=unset#text/plain
 application/hub/interfaces/helper/connections/.htaccess -text
+application/hub/interfaces/helper/dht/.htaccess -text svneol=unset#text/plain
+application/hub/interfaces/helper/dht/class_HelpableDht.php svneol=native#text/plain
 application/hub/interfaces/helper/hub/.htaccess -text svneol=unset#text/plain
 application/hub/interfaces/helper/hub/class_HelpableHub.php svneol=native#text/plain
 application/hub/interfaces/helper/messages/.htaccess svneol=native#text/plain
 application/hub/interfaces/helper/messages/class_MessageHelper.php svneol=native#text/plain
+application/hub/interfaces/helper/node/.htaccess -text svneol=unset#text/plain
+application/hub/interfaces/helper/node/class_HelpableNode.php svneol=native#text/plain
 application/hub/interfaces/helper/nodes/.htaccess -text svneol=unset#text/plain
 application/hub/interfaces/helper/nodes/class_NodeHelper.php svneol=native#text/plain
 application/hub/interfaces/listener/.htaccess -text svneol=unset#text/plain
@@ -393,12 +397,16 @@ application/hub/main/handler/network/udp/class_UdpRawDataHandler.php svneol=nati
 application/hub/main/handler/tasks/.htaccess -text svneol=unset#text/plain
 application/hub/main/handler/tasks/class_TaskHandler.php svneol=native#text/plain
 application/hub/main/helper/.htaccess -text svneol=unset#text/plain
+application/hub/main/helper/class_ svneol=native#text/plain
+application/hub/main/helper/class_BaseHubSystemHelper.php svneol=native#text/plain
 application/hub/main/helper/connection/.htaccess -text svneol=unset#text/plain
 application/hub/main/helper/connection/class_BaseConnectionHelper.php svneol=native#text/plain
 application/hub/main/helper/connection/tcp/.htaccess -text svneol=unset#text/plain
 application/hub/main/helper/connection/tcp/class_TcpConnectionHelper.php svneol=native#text/plain
 application/hub/main/helper/connection/udp/.htaccess -text svneol=unset#text/plain
 application/hub/main/helper/connection/udp/class_UdpConnectionHelper.php svneol=native#text/plain
+application/hub/main/helper/dht/.htaccess -text svneol=unset#text/plain
+application/hub/main/helper/dht/class_DhtBootstrapHelper.php svneol=native#text/plain
 application/hub/main/helper/hub/.htaccess -text svneol=unset#text/plain
 application/hub/main/helper/hub/announcement/.htaccess -text svneol=unset#text/plain
 application/hub/main/helper/hub/announcement/class_HubAnnouncementHelper.php svneol=native#text/plain
@@ -419,6 +427,21 @@ application/hub/main/helper/messages/.htaccess svneol=native#text/plain
 application/hub/main/helper/messages/class_BaseMessageHelper.php svneol=native#text/plain
 application/hub/main/helper/messages/crypto/.htaccess svneol=native#text/plain
 application/hub/main/helper/messages/crypto/class_CryptoRandomUnitMessageHelper.php svneol=native#text/plain
+application/hub/main/helper/node/.htaccess -text svneol=unset#text/plain
+application/hub/main/helper/node/announcement/.htaccess -text svneol=unset#text/plain
+application/hub/main/helper/node/announcement/class_NodeAnnouncementHelper.php svneol=native#text/plain
+application/hub/main/helper/node/answer/.htaccess -text svneol=unset#text/plain
+application/hub/main/helper/node/answer/announcement/.htaccess -text svneol=unset#text/plain
+application/hub/main/helper/node/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php svneol=native#text/plain
+application/hub/main/helper/node/answer/class_BaseHubAnswerHelper.php svneol=native#text/plain
+application/hub/main/helper/node/answer/requests/.htaccess -text svneol=unset#text/plain
+application/hub/main/helper/node/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php svneol=native#text/plain
+application/hub/main/helper/node/class_ svneol=native#text/plain
+application/hub/main/helper/node/class_BaseNodeHelper.php svneol=native#text/plain
+application/hub/main/helper/node/connection/.htaccess -text svneol=unset#text/plain
+application/hub/main/helper/node/connection/class_NodeSelfConnectHelper.php svneol=native#text/plain
+application/hub/main/helper/node/requests/.htaccess -text svneol=unset#text/plain
+application/hub/main/helper/node/requests/class_NodeRequestNodeListHelper.php svneol=native#text/plain
 application/hub/main/helper/work_units/.htaccess svneol=native#text/plain
 application/hub/main/helper/work_units/class_BaseWorkUnitHelper.php svneol=native#text/plain
 application/hub/main/helper/work_units/cruncher/.htaccess svneol=native#text/plain
@@ -656,6 +679,8 @@ application/hub/main/template/announcement/class_XmlAnnouncementTemplateEngine.p
 application/hub/main/template/answer/.htaccess -text svneol=unset#text/plain
 application/hub/main/template/answer/announcement/.htaccess -text svneol=unset#text/plain
 application/hub/main/template/answer/requests/.htaccess -text svneol=unset#text/plain
+application/hub/main/template/bootstrap/.htaccess -text svneol=unset#text/plain
+application/hub/main/template/bootstrap/class_XmlBootstrapTemplateEngine.php svneol=native#text/plain
 application/hub/main/template/connect/.htaccess -text svneol=unset#text/plain
 application/hub/main/template/connect/class_XmlSelfConnectTemplateEngine.php svneol=native#text/plain
 application/hub/main/template/entries/.htaccess -text svneol=unset#text/plain
index 8faa8734cfcfe7ab3d1c64881f68cea87eb6e361..bdfcb0835c2d0c3ddf19c0af92b15b464884f3a1 100644 (file)
@@ -127,10 +127,13 @@ $cfg->setConfigEntry('node_raw_data_monitor_visitor_class', 'RawDataPoolMonitorV
 $cfg->setConfigEntry('list_group_class', 'ListGroupList');
 
 // CFG: NODE-ANNOUNCEMENT-HELPER-CLASS
-$cfg->setConfigEntry('node_announcement_helper_class', 'HubAnnouncementHelper');
+$cfg->setConfigEntry('node_announcement_helper_class', 'NodeAnnouncementHelper');
 
 // CFG: NODE-SELF-CONNECT-HELPER-CLASS
-$cfg->setConfigEntry('node_self_connect_helper_class', 'HubSelfConnectHelper');
+$cfg->setConfigEntry('node_self_connect_helper_class', 'NodeSelfConnectHelper');
+
+// CFG: DHT-BOOTSTRAP-HELPER-CLASS
+$cfg->setConfigEntry('dht_bootstrap_helper_class', 'DhtBootstrapHelper');
 
 // CFG: DEFAULT-CONSOLE-COMMAND
 $cfg->setConfigEntry('default_console_command', 'main');
@@ -249,6 +252,9 @@ $cfg->setConfigEntry('node_request_node_list_answer_template_class', 'XmlRequest
 // CFG: NODE-REQUEST-NODE-LIST-ENTRIES-TEMPLATE-CLASS
 $cfg->setConfigEntry('node_request_node_list_entries_template_class', 'XmlRequestNodeListEntryTemplateEngine');
 
+// CFG: DHT-BOOTSTRAP-TEMPLATE-CLASS
+$cfg->setConfigEntry('dht_bootstrap_template_class', 'XmlBootstrapTemplateEngine');
+
 // CFG: NODE-MESSAGE-TEMPLATE-EXTENSION
 $cfg->setConfigEntry('node_message_template_extension', '.xml');
 
diff --git a/application/hub/interfaces/helper/dht/.htaccess b/application/hub/interfaces/helper/dht/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/helper/dht/class_HelpableDht.php b/application/hub/interfaces/helper/dht/class_HelpableDht.php
new file mode 100644 (file)
index 0000000..cb684c6
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+/**
+ * An interface for hub helper classes
+ *
+ * @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 HelpableDht extends Helper {
+       /**
+        * Loads the descriptor XML file
+        *
+        * @return      void
+        */
+       function loadDescriptorXml ();
+
+       /**
+        * Send a package out
+        *
+        * @param       $dhtInstance    An instance of a Distributable class
+        * @return      void
+        */
+       function sendPackage (Distributable $dhtInstance);
+}
+
+// [EOF]
+?>
index 5c611a984e8752b80da0ed2d49682f29b7dac12f..f551ef47b7591c74e7b59193e56a1fa6505a87ab 100644 (file)
@@ -1,43 +1,3 @@
 <?php
-/**
- * An interface for hub helper classes
- *
- * @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 HelpableHub extends Helper {
-       /**
-        * Loads the descriptor XML file
-        *
-        * @param       $nodeInstance   An instance of a NodeHelper class
-        * @return      void
-        */
-       function loadDescriptorXml (NodeHelper $nodeInstance);
-
-       /**
-        * Send a package out
-        *
-        * @param       $nodeInstance   An instance of a NodeHelper class
-        * @return      void
-        */
-       function sendPackage (NodeHelper $nodeInstance);
-}
-
-// [EOF]
+// @DEPRECATED
 ?>
diff --git a/application/hub/interfaces/helper/node/.htaccess b/application/hub/interfaces/helper/node/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/helper/node/class_HelpableNode.php b/application/hub/interfaces/helper/node/class_HelpableNode.php
new file mode 100644 (file)
index 0000000..fd3d46b
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+/**
+ * An interface for hub helper classes
+ *
+ * @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 HelpableNode extends Helper {
+       /**
+        * Loads the descriptor XML file
+        *
+        * @param       $nodeInstance   An instance of a NodeHelper class
+        * @return      void
+        */
+       function loadDescriptorXml (NodeHelper $nodeInstance);
+
+       /**
+        * Send a package out
+        *
+        * @param       $nodeInstance   An instance of a NodeHelper class
+        * @return      void
+        */
+       function sendPackage (NodeHelper $nodeInstance);
+}
+
+// [EOF]
+?>
index 72d4ed139eaaf6a7fe0d8314f446822b973326a6..bf854dc06b497aa3b3c4f1002ae38dbd22ee96e6 100644 (file)
@@ -27,11 +27,11 @@ interface Deliverable extends FrameworkInterface {
         * from given helper's template instance and pushing it on the 'undeclared'
         * stack.
         *
-        * @param       $helperInstance         An instance of a HelpableHub class
+        * @param       $helperInstance         An instance of a HelpableNode class
         * @param       $protocol                       Name of used protocol (TCP/UDP)
         * @return      void
         */
-       function enqueueRawDataFromTemplate (HelpableHub $helperInstance, $protocol);
+       function enqueueRawDataFromTemplate (HelpableNode $helperInstance, $protocol);
 
        /**
         * Checks whether a package has been enqueued for delivery.
diff --git a/application/hub/main/helper/class_ b/application/hub/main/helper/class_
new file mode 100644 (file)
index 0000000..d3888ea
--- /dev/null
@@ -0,0 +1,86 @@
+<?php
+/**
+ * A ??? !!! helper class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ * @todo               Find an interface for hub helper
+ *
+ * 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 !!!???Helper extends BaseHubSystemHelper implements Helpable!!! {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set recipient type
+               $this->setRecipientType(NetworkPackage::NETWORK_TARGET_!!!);
+
+               // Set package tags
+               $this->setPackageTags(array('???'));
+       }
+
+       /**
+        * Creates the helper class
+        *
+        * @return      $helperInstance         A prepared instance of this helper
+        */
+       public final static function create!!!???Helper () {
+               // Get new instance
+               $helperInstance = new !!!???Helper();
+
+               // Return the prepared instance
+               return $helperInstance;
+       }
+
+       /**
+        * Loads the descriptor XML file
+        *
+        * @return      void
+        */
+       public function loadDescriptorXml () {
+               $this->partialStub('Please implement this method.');
+       }
+
+       /**
+        * Do the helped attempt by delivering a package to ourselfs
+        *
+        * @param       $|||Instance    An instance of a !!!Helper class
+        * @return      void
+        */
+       public function sendPackage (!!!Helper $|||Instance) {
+               // Sanity check: Is the ||| in the approx. state? (///)
+               $|||Instance->getStateInstance()->validate!!!StateIs+++();
+
+               // Compile the template, this inserts the loaded ||| data into the gaps.
+               $this->getTemplateInstance()->compileTemplate();
+
+               // Get a singleton network package instance
+               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
+
+               // Next, feed the content in. The network package class is a pipe-through class.
+               $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/helper/class_BaseHubSystemHelper.php b/application/hub/main/helper/class_BaseHubSystemHelper.php
new file mode 100644 (file)
index 0000000..79b80d1
--- /dev/null
@@ -0,0 +1,85 @@
+<?php
+/**
+ * A general hub helper class. This class does not extend BaseHelper.
+ *
+ * @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/>.
+ */
+class BaseHubSystemHelper extends BaseHubSystem {
+       /**
+        * Recipient type
+        */
+       private $recipientType = 'invalid';
+
+       /**
+        * Package tags
+        */
+       private $packageTags = array();
+
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Name of the concrete class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+
+       /**
+        * Setter for recipient type
+        *
+        * @return      $recipientType  Type of a recipient (the helper is made for)
+        */
+       protected final function setRecipientType ($recipientType) {
+               $this->recipientType = $recipientType;
+       }
+
+       /**
+        * Getter for recipient type
+        *
+        * @return      $recipientType  Type of a recipient (the helper is made for)
+        */
+       public final function getRecipientType () {
+               return $this->recipientType;
+       }
+
+       /**
+        * Getter for package tags in a simple array
+        *
+        * @return      $packageTags    An array with all tags for the currently handled package
+        */
+       public final function getPackageTags () {
+               return $this->packageTags;
+       }
+
+       /**
+        * Setter for package tags in a simple array
+        *
+        * @param       $packageTags    An array with all tags for the currently handled package
+        * @return      void
+        */
+       public final function setPackageTags (array $packageTags) {
+               $this->packageTags = $packageTags;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/helper/dht/.htaccess b/application/hub/main/helper/dht/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/helper/dht/class_DhtBootstrapHelper.php b/application/hub/main/helper/dht/class_DhtBootstrapHelper.php
new file mode 100644 (file)
index 0000000..110bf25
--- /dev/null
@@ -0,0 +1,97 @@
+<?php
+/**
+ * A Bootstrap Dht helper class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ * @todo               Find an interface for hub helper
+ *
+ * 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 DhtBootstrapHelper extends BaseHubSystemHelper implements HelpableDht {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set recipient type
+               $this->setRecipientType(NetworkPackage::NETWORK_TARGET_DHT);
+       }
+
+       /**
+        * Creates the helper class
+        *
+        * @return      $helperInstance         A prepared instance of this helper
+        */
+       public final static function createDhtBootstrapHelper () {
+               // Get new instance
+               $helperInstance = new DhtBootstrapHelper();
+
+               // Return the prepared instance
+               return $helperInstance;
+       }
+
+       /**
+        * Loads the announcement descriptor for parsing
+        *
+        * @return      void
+        */
+       public function loadDescriptorXml () {
+               // Debug message
+               self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Starting with DHT boostrap ...');
+
+               // Get a XML template instance
+               $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('dht_bootstrap_template_class');
+
+               // Set it for later use
+               $this->setTemplateInstance($templateInstance);
+
+               // Read the XML descriptor
+               $templateInstance->loadXmlTemplate();
+
+               // Render the XML content
+               $templateInstance->renderXmlContent();
+       }
+       }
+
+       /**
+        * Do the helped attempt by delivering a package to ourselfs
+        *
+        * @param       $dhtInstance    An instance of a Distributable class
+        * @return      void
+        */
+       public function sendPackage (Distributable $dhtInstance) {
+               // Sanity check: Is the dht in the approx. state? (init)
+               $dhtInstance->getStateInstance()->validateDhtStateIsInitialized();
+
+               // Compile the template, this inserts the loaded dht data into the gaps.
+               $this->getTemplateInstance()->compileTemplate();
+
+               // Get a singleton network package instance
+               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
+
+               // Next, feed the content in. The network package class is a pipe-through class.
+               $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
+       }
+}
+
+// [EOF]
+?>
index 06d4d5571c7477a77c76d4036b4b63a406e829d7..f551ef47b7591c74e7b59193e56a1fa6505a87ab 100644 (file)
@@ -1,104 +1,3 @@
 <?php
-/**
- * A helper class for announcing this node to other nodes
- *
- * @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
- * @todo               Find an interface for hub helper
- *
- * 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 HubAnnouncementHelper extends BaseHubHelper implements HelpableHub {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-
-               // Set recipient type
-               $this->setRecipientType(NetworkPackage::NETWORK_TARGET_UPPER_NODES);
-
-               // Set package tags
-               $this->setPackageTags(array('announcement'));
-       }
-
-       /**
-        * Creates the helper class
-        *
-        * @return      $helperInstance         A prepared instance of this helper
-        */
-       public static final function createHubAnnouncementHelper () {
-               // Get new instance
-               $helperInstance = new HubAnnouncementHelper();
-
-               // Return the prepared instance
-               return $helperInstance;
-       }
-
-       /**
-        * Loads the announcement descriptor for parsing
-        *
-        * @param       $nodeInstance   An instance of a NodeHelper class
-        * @return      void
-        */
-       public function loadDescriptorXml (NodeHelper $nodeInstance) {
-               // Debug message
-               self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Starting with announcement to upper hubs...');
-
-               // Get a XML template instance
-               $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_announcement_template_class');
-
-               // Set it for later use
-               $this->setTemplateInstance($templateInstance);
-
-               // Read the XML descriptor
-               $templateInstance->loadXmlTemplate();
-
-               // Render the XML content
-               $templateInstance->renderXmlContent();
-       }
-
-       /**
-        * Publishes the node's descriptor XML to all found upper nodes when the
-        * node has not yet published it's descriptor to a bootstrap node. This is
-        * done by getting the raw XML content and inserting all variables into
-        * the code. After this wents fine, the rendered content got "packaged"
-        * for network delivery.
-        *
-        * @param       $nodeInstance   An instance of a NodeHelper class
-        * @return      void
-        */
-       public function sendPackage (NodeHelper $nodeInstance) {
-               // Sanity check: Is the node in the approx. state? (active)
-               $nodeInstance->getStateInstance()->validateNodeStateIsActiveOrReachable();
-
-               // Compile the template, this inserts the loaded node data into the gaps.
-               $this->getTemplateInstance()->compileTemplate();
-
-               // Get a singleton network package instance
-               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
-
-               // Next, feed the content in. The network package class is a pipe-through class.
-               $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
-       }
-}
-
-// [EOF]
+// @DEPRECATED
 ?>
index 77a24360e3754dfca74768d5c16858b38ddd0514..f551ef47b7591c74e7b59193e56a1fa6505a87ab 100644 (file)
@@ -1,104 +1,3 @@
 <?php
-/**
- * A AnnouncementMessageAnswer node helper class
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- * @todo               Find an interface for hub helper
- *
- * 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 NodeAnnouncementMessageAnswerHelper extends BaseHubAnswerHelper implements HelpableHub {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-
-               // Init package tags
-               $this->setPackageTags(array('announcement_answer'));
-       }
-
-       /**
-        * Creates the helper class
-        *
-        * @param       $messageData            An array with all message data
-        * @return      $helperInstance         A prepared instance of this helper
-        */
-       public final static function createNodeAnnouncementMessageAnswerHelper (array $messageData) {
-               // Get new instance
-               $helperInstance = new NodeAnnouncementMessageAnswerHelper();
-
-               // Set session id of other peer as recipient
-               $helperInstance->setRecipientType($messageData[XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID]);
-
-               // Set message data
-               $helperInstance->setMessageData($messageData);
-
-               // Return the prepared instance
-               return $helperInstance;
-       }
-
-       /**
-        * Loads the descriptor XML file
-        *
-        * @param       $nodeInstance   An instance of a NodeHelper class
-        * @return      void
-        */
-       public function loadDescriptorXml (NodeHelper $nodeInstance) {
-               // Debug message
-               self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Attempting to answer an announcement...');
-
-               // Get a XML template instance
-               $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_announcement_answer_template_class');
-
-               // Set it for later use
-               $this->setTemplateInstance($templateInstance);
-
-               // Read the XML descriptor
-               $templateInstance->loadXmlTemplate();
-
-               // Render the XML content
-               $templateInstance->renderXmlContent();
-       }
-
-       /**
-        * Send out announcement answer package
-        *
-        * @param       $nodeInstance   An instance of a NodeHelper class
-        * @return      void
-        */
-       public function sendPackage (NodeHelper $nodeInstance) {
-               // Sanity check: Is the node in the approx. state? (active/reachable)
-               $nodeInstance->getStateInstance()->validateNodeStateIsActiveOrReachable();
-
-               // Compile the template, this inserts the loaded node data into the gaps.
-               $this->getTemplateInstance()->compileTemplate();
-
-               // Get a singleton network package instance
-               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
-
-               // Next, feed the content in. The network package class is a pipe-through class.
-               $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
-       }
-}
-
-// [EOF]
+// @DEPRECATED
 ?>
index c5850d249f07e166e568194963d42355f37fd73c..f551ef47b7591c74e7b59193e56a1fa6505a87ab 100644 (file)
@@ -1,61 +1,3 @@
 <?php
-/**
- * A general hub message answer helper class
- *
- * @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/>.
- */
-class BaseHubAnswerHelper extends BaseHubHelper {
-       /**
-        * Message data array
-        */
-       private $messageData = array();
-
-       /**
-        * Protected constructor
-        *
-        * @param       $className      Name of the concrete class
-        * @return      void
-        */
-       protected function __construct ($className) {
-               // Call parent constructor
-               parent::__construct($className);
-       }
-
-       /**
-        * Setter for message data
-        *
-        * @return      $messageData    An array with message data
-        */
-       protected final function setMessageData (array $messageData) {
-               $this->messageData = $messageData;
-       }
-
-       /**
-        * Getter for message data
-        *
-        * @return      $messageData    An array with message data
-        */
-       public final function getMessageData () {
-               return $this->messageData;
-       }
-}
-
-// [EOF]
+// @DEPRECATED
 ?>
index 6926ed28f07a8b2154419913c69703182d2b46d4..f551ef47b7591c74e7b59193e56a1fa6505a87ab 100644 (file)
@@ -1,110 +1,3 @@
 <?php
-/**
- * A RequestNodeListMessageAnswer node helper class
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- * @todo               Find an interface for hub helper
- *
- * 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 NodeRequestNodeListMessageAnswerHelper extends BaseHubAnswerHelper implements HelpableHub {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-
-               // Init package tags
-               $this->setPackageTags(array('request_node_list_answer'));
-       }
-
-       /**
-        * Creates the helper class
-        *
-        * @param       $messageData            An array with all message data
-        * @return      $helperInstance         A prepared instance of this helper
-        */
-       public final static function createNodeRequestNodeListMessageAnswerHelper (array $messageData) {
-               // Get new instance
-               $helperInstance = new NodeRequestNodeListMessageAnswerHelper();
-
-               // Set session id of other peer as recipient
-               $helperInstance->setRecipientType($messageData[XmlRequestNodeListTemplateEngine::REQUEST_DATA_SESSION_ID]);
-
-               // Set message data
-               $helperInstance->setMessageData($messageData);
-
-               // Return the prepared instance
-               return $helperInstance;
-       }
-
-       /**
-        * Loads the descriptor XML file
-        *
-        * @param       $nodeInstance   An instance of a NodeHelper class
-        * @return      void
-        */
-       public function loadDescriptorXml (NodeHelper $nodeInstance) {
-               // Debug message
-               self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Attempting to answer a request: node-list...');
-
-               // Get a XML template instance
-               $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_request_node_list_answer_template_class');
-
-               // Set it for later use
-               $this->setTemplateInstance($templateInstance);
-
-               // Read the XML descriptor
-               $templateInstance->loadXmlTemplate();
-
-               // "Cache" entries instance for next foreach loop
-               $entriesInstance = $templateInstance->getTemplateInstance();
-
-               // Is must not be NULL (then it can only be a template instance)
-               assert(!is_null($entriesInstance));
-
-               // Render the XML content
-               $templateInstance->renderXmlContent();
-       }
-
-       /**
-        * Send out request-node-list answer package
-        *
-        * @param       $nodeInstance   An instance of a NodeHelper class
-        * @return      void
-        */
-       public function sendPackage (NodeHelper $nodeInstance) {
-               // Sanity check: Is the node in the approx. state? (active/reachable)
-               $nodeInstance->getStateInstance()->validateNodeStateIsActiveOrReachable();
-
-               // Compile the template, this inserts the loaded node data into the gaps.
-               $this->getTemplateInstance()->compileTemplate();
-
-               // Get a singleton network package instance
-               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
-
-               // Next, feed the content in. The network package class is a pipe-through class.
-               $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
-       }
-}
-
-// [EOF]
+// @DEPRECATED
 ?>
index 337a1d7308b3c43ebf933b18ff4313123a6b0f3e..f551ef47b7591c74e7b59193e56a1fa6505a87ab 100644 (file)
@@ -1,83 +1,3 @@
 <?php
-/**
- * A ??? hub helper class
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- * @todo               Find an interface for hub helper
- *
- * 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 Hub???Helper extends BaseHubHelper implements HelpableHub {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-
-               // Set recipient type
-               $this->setRecipientType(NetworkPackage::NETWORK_TARGET_!!!);
-       }
-
-       /**
-        * Creates the helper class
-        *
-        * @return      $helperInstance         A prepared instance of this helper
-        */
-       public final static function createHub???Helper () {
-               // Get new instance
-               $helperInstance = new Hub???Helper();
-
-               // Return the prepared instance
-               return $helperInstance;
-       }
-
-       /**
-        * Loads the descriptor XML file
-        *
-        * @return      void
-        */
-       public function loadDescriptorXml () {
-               $this->partialStub('Please implement this method.');
-       }
-
-       /**
-        * Do the helped attempt by delivering a package to ourselfs
-        *
-        * @param       $nodeInstance   An instance of a NodeHelper class
-        * @return      void
-        */
-       public function sendPackage (NodeHelper $nodeInstance) {
-               // Sanity check: Is the node in the approx. state? (active)
-               $nodeInstance->getStateInstance()->validateNodeStateIsActive();
-
-               // Compile the template, this inserts the loaded node data into the gaps.
-               $this->getTemplateInstance()->compileTemplate();
-
-               // Get a singleton network package instance
-               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
-
-               // Next, feed the content in. The network package class is a pipe-through class.
-               $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_|||);
-       }
-}
-
-// [EOF]
+// @DEPRECATED
 ?>
index 0cb1458b896cd324d88620d5f3535a7a88ee8aad..f551ef47b7591c74e7b59193e56a1fa6505a87ab 100644 (file)
@@ -1,85 +1,3 @@
 <?php
-/**
- * A general hub helper class. This class does not extend BaseHelper.
- *
- * @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/>.
- */
-class BaseHubHelper extends BaseHubSystem {
-       /**
-        * Recipient type
-        */
-       private $recipientType = 'invalid';
-
-       /**
-        * Package tags
-        */
-       private $packageTags = array();
-
-       /**
-        * Protected constructor
-        *
-        * @param       $className      Name of the concrete class
-        * @return      void
-        */
-       protected function __construct ($className) {
-               // Call parent constructor
-               parent::__construct($className);
-       }
-
-       /**
-        * Setter for recipient type
-        *
-        * @return      $recipientType  Type of a recipient (the helper is made for)
-        */
-       protected final function setRecipientType ($recipientType) {
-               $this->recipientType = $recipientType;
-       }
-
-       /**
-        * Getter for recipient type
-        *
-        * @return      $recipientType  Type of a recipient (the helper is made for)
-        */
-       public final function getRecipientType () {
-               return $this->recipientType;
-       }
-
-       /**
-        * Getter for package tags in a simple array
-        *
-        * @return      $packageTags    An array with all tags for the currently handled package
-        */
-       public final function getPackageTags () {
-               return $this->packageTags;
-       }
-
-       /**
-        * Setter for package tags in a simple array
-        *
-        * @param       $packageTags    An array with all tags for the currently handled package
-        * @return      void
-        */
-       public final function setPackageTags (array $packageTags) {
-               $this->packageTags = $packageTags;
-       }
-}
-
-// [EOF]
+// @DEPRECATED
 ?>
index 7953f85133ea3f20c498d9c6979f17ee94e4c924..f551ef47b7591c74e7b59193e56a1fa6505a87ab 100644 (file)
@@ -1,100 +1,3 @@
 <?php
-/**
- * A SelfConnect hub helper class
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- * @todo               Find an interface for hub helper
- *
- * 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 HubSelfConnectHelper extends BaseHubHelper implements HelpableHub {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-
-               // Set recipient type
-               $this->setRecipientType(NetworkPackage::NETWORK_TARGET_SELF);
-
-               // Set package tags
-               $this->setPackageTags(array('self_connect'));
-       }
-
-       /**
-        * Creates the helper class
-        *
-        * @return      $helperInstance         A prepared instance of this helper
-        */
-       public static final function createHubSelfConnectHelper () {
-               // Get new instance
-               $helperInstance = new HubSelfConnectHelper();
-
-               // Return the prepared instance
-               return $helperInstance;
-       }
-
-       /**
-        * Loads the descriptor XML file
-        *
-        * @param       $nodeInstance   An instance of a NodeHelper class
-        * @return      void
-        */
-       public function loadDescriptorXml (NodeHelper $nodeInstance) {
-               // Debug message
-               self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Attempting self-connect...');
-
-               // Get a XML template instance
-               $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_self_connect_template_class');
-
-               // Set it for later use
-               $this->setTemplateInstance($templateInstance);
-
-               // Read the XML descriptor
-               $templateInstance->loadXmlTemplate();
-
-               // Render the XML content
-               $templateInstance->renderXmlContent();
-       }
-
-       /**
-        * Do the self-connect attempt by delivering a package to ourselfs
-        *
-        * @param       $nodeInstance   An instance of a NodeHelper class
-        * @return      void
-        */
-       public function sendPackage (NodeHelper $nodeInstance) {
-               // Sanity check: Is the node in the approx. state? (active)
-               $nodeInstance->getStateInstance()->validateNodeStateIsActiveOrAnnounced();
-
-               // Compile the template, this inserts the loaded node data into the gaps.
-               $this->getTemplateInstance()->compileTemplate();
-
-               // Get a singleton network package instance
-               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
-
-               // Next, feed the content in. The network package class is a pipe-through class.
-               $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
-       }
-}
-
-// [EOF]
+// @DEPRECATED
 ?>
index 87939508dcfb0974189561716ee1460af4b594b1..f551ef47b7591c74e7b59193e56a1fa6505a87ab 100644 (file)
@@ -1,100 +1,3 @@
 <?php
-/**
- * A ??? hub helper class
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- * @todo               Find an interface for hub helper
- *
- * 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 NodeRequestNodeListHelper extends BaseHubHelper implements HelpableHub {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-
-               // Set recipient type
-               $this->setRecipientType(NetworkPackage::NETWORK_TARGET_UPPER_NODES);
-
-               // Set package tags
-               $this->setPackageTags(array('request_node_list'));
-       }
-
-       /**
-        * Creates the helper class
-        *
-        * @return      $helperInstance         A prepared instance of this helper
-        */
-       public final static function createNodeRequestNodeListHelper () {
-               // Get new instance
-               $helperInstance = new NodeRequestNodeListHelper();
-
-               // Return the prepared instance
-               return $helperInstance;
-       }
-
-       /**
-        * Loads the descriptor XML file
-        *
-        * @param       $nodeInstance   An instance of a NodeHelper class
-        * @return      void
-        */
-       public function loadDescriptorXml (NodeHelper $nodeInstance) {
-               // Debug message
-               self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Attempting to request: node-list...');
-
-               // Get a XML template instance
-               $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_request_node_list_template_class');
-
-               // Set it for later use
-               $this->setTemplateInstance($templateInstance);
-
-               // Read the XML descriptor
-               $templateInstance->loadXmlTemplate();
-
-               // Render the XML content
-               $templateInstance->renderXmlContent();
-       }
-
-       /**
-        * Do the helped attempt by delivering a package to ourselfs
-        *
-        * @param       $nodeInstance   An instance of a NodeHelper class
-        * @return      void
-        */
-       public function sendPackage (NodeHelper $nodeInstance) {
-               // Sanity check: Is the node in the approx. state? (active)
-               $nodeInstance->getStateInstance()->validateNodeStateIsAnnouncementCompleted();
-
-               // Compile the template, this inserts the loaded node data into the gaps.
-               $this->getTemplateInstance()->compileTemplate();
-
-               // Get a singleton network package instance
-               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
-
-               // Next, feed the content in. The network package class is a pipe-through class.
-               $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
-       }
-}
-
-// [EOF]
+// @DEPRECATED
 ?>
diff --git a/application/hub/main/helper/node/.htaccess b/application/hub/main/helper/node/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/helper/node/announcement/.htaccess b/application/hub/main/helper/node/announcement/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/helper/node/announcement/class_NodeAnnouncementHelper.php b/application/hub/main/helper/node/announcement/class_NodeAnnouncementHelper.php
new file mode 100644 (file)
index 0000000..20561aa
--- /dev/null
@@ -0,0 +1,104 @@
+<?php
+/**
+ * A helper class for announcing this node to other nodes
+ *
+ * @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
+ * @todo               Find an interface for hub helper
+ *
+ * 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 NodeAnnouncementHelper extends BaseNodeHelper implements HelpableNode {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set recipient type
+               $this->setRecipientType(NetworkPackage::NETWORK_TARGET_UPPER_NODES);
+
+               // Set package tags
+               $this->setPackageTags(array('announcement'));
+       }
+
+       /**
+        * Creates the helper class
+        *
+        * @return      $helperInstance         A prepared instance of this helper
+        */
+       public static final function createNodeAnnouncementHelper () {
+               // Get new instance
+               $helperInstance = new NodeAnnouncementHelper();
+
+               // Return the prepared instance
+               return $helperInstance;
+       }
+
+       /**
+        * Loads the announcement descriptor for parsing
+        *
+        * @param       $nodeInstance   An instance of a NodeHelper class
+        * @return      void
+        */
+       public function loadDescriptorXml (NodeHelper $nodeInstance) {
+               // Debug message
+               self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Starting with announcement to upper hubs...');
+
+               // Get a XML template instance
+               $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_announcement_template_class');
+
+               // Set it for later use
+               $this->setTemplateInstance($templateInstance);
+
+               // Read the XML descriptor
+               $templateInstance->loadXmlTemplate();
+
+               // Render the XML content
+               $templateInstance->renderXmlContent();
+       }
+
+       /**
+        * Publishes the node's descriptor XML to all found upper nodes when the
+        * node has not yet published it's descriptor to a bootstrap node. This is
+        * done by getting the raw XML content and inserting all variables into
+        * the code. After this wents fine, the rendered content got "packaged"
+        * for network delivery.
+        *
+        * @param       $nodeInstance   An instance of a NodeHelper class
+        * @return      void
+        */
+       public function sendPackage (NodeHelper $nodeInstance) {
+               // Sanity check: Is the node in the approx. state? (active)
+               $nodeInstance->getStateInstance()->validateNodeStateIsActiveOrReachable();
+
+               // Compile the template, this inserts the loaded node data into the gaps.
+               $this->getTemplateInstance()->compileTemplate();
+
+               // Get a singleton network package instance
+               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
+
+               // Next, feed the content in. The network package class is a pipe-through class.
+               $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/helper/node/answer/.htaccess b/application/hub/main/helper/node/answer/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/helper/node/answer/announcement/.htaccess b/application/hub/main/helper/node/answer/announcement/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/helper/node/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php b/application/hub/main/helper/node/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php
new file mode 100644 (file)
index 0000000..dc51167
--- /dev/null
@@ -0,0 +1,104 @@
+<?php
+/**
+ * A AnnouncementMessageAnswer node helper class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ * @todo               Find an interface for hub helper
+ *
+ * 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 NodeAnnouncementMessageAnswerHelper extends BaseHubAnswerHelper implements HelpableNode {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Init package tags
+               $this->setPackageTags(array('announcement_answer'));
+       }
+
+       /**
+        * Creates the helper class
+        *
+        * @param       $messageData            An array with all message data
+        * @return      $helperInstance         A prepared instance of this helper
+        */
+       public final static function createNodeAnnouncementMessageAnswerHelper (array $messageData) {
+               // Get new instance
+               $helperInstance = new NodeAnnouncementMessageAnswerHelper();
+
+               // Set session id of other peer as recipient
+               $helperInstance->setRecipientType($messageData[XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID]);
+
+               // Set message data
+               $helperInstance->setMessageData($messageData);
+
+               // Return the prepared instance
+               return $helperInstance;
+       }
+
+       /**
+        * Loads the descriptor XML file
+        *
+        * @param       $nodeInstance   An instance of a NodeHelper class
+        * @return      void
+        */
+       public function loadDescriptorXml (NodeHelper $nodeInstance) {
+               // Debug message
+               self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Attempting to answer an announcement...');
+
+               // Get a XML template instance
+               $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_announcement_answer_template_class');
+
+               // Set it for later use
+               $this->setTemplateInstance($templateInstance);
+
+               // Read the XML descriptor
+               $templateInstance->loadXmlTemplate();
+
+               // Render the XML content
+               $templateInstance->renderXmlContent();
+       }
+
+       /**
+        * Send out announcement answer package
+        *
+        * @param       $nodeInstance   An instance of a NodeHelper class
+        * @return      void
+        */
+       public function sendPackage (NodeHelper $nodeInstance) {
+               // Sanity check: Is the node in the approx. state? (active/reachable)
+               $nodeInstance->getStateInstance()->validateNodeStateIsActiveOrReachable();
+
+               // Compile the template, this inserts the loaded node data into the gaps.
+               $this->getTemplateInstance()->compileTemplate();
+
+               // Get a singleton network package instance
+               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
+
+               // Next, feed the content in. The network package class is a pipe-through class.
+               $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/helper/node/answer/class_BaseHubAnswerHelper.php b/application/hub/main/helper/node/answer/class_BaseHubAnswerHelper.php
new file mode 100644 (file)
index 0000000..63f9296
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+/**
+ * A general hub message answer helper class
+ *
+ * @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/>.
+ */
+class BaseHubAnswerHelper extends BaseNodeHelper {
+       /**
+        * Message data array
+        */
+       private $messageData = array();
+
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Name of the concrete class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+
+       /**
+        * Setter for message data
+        *
+        * @return      $messageData    An array with message data
+        */
+       protected final function setMessageData (array $messageData) {
+               $this->messageData = $messageData;
+       }
+
+       /**
+        * Getter for message data
+        *
+        * @return      $messageData    An array with message data
+        */
+       public final function getMessageData () {
+               return $this->messageData;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/helper/node/answer/requests/.htaccess b/application/hub/main/helper/node/answer/requests/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/helper/node/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php b/application/hub/main/helper/node/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php
new file mode 100644 (file)
index 0000000..0964e9a
--- /dev/null
@@ -0,0 +1,110 @@
+<?php
+/**
+ * A RequestNodeListMessageAnswer node helper class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ * @todo               Find an interface for hub helper
+ *
+ * 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 NodeRequestNodeListMessageAnswerHelper extends BaseHubAnswerHelper implements HelpableNode {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Init package tags
+               $this->setPackageTags(array('request_node_list_answer'));
+       }
+
+       /**
+        * Creates the helper class
+        *
+        * @param       $messageData            An array with all message data
+        * @return      $helperInstance         A prepared instance of this helper
+        */
+       public final static function createNodeRequestNodeListMessageAnswerHelper (array $messageData) {
+               // Get new instance
+               $helperInstance = new NodeRequestNodeListMessageAnswerHelper();
+
+               // Set session id of other peer as recipient
+               $helperInstance->setRecipientType($messageData[XmlRequestNodeListTemplateEngine::REQUEST_DATA_SESSION_ID]);
+
+               // Set message data
+               $helperInstance->setMessageData($messageData);
+
+               // Return the prepared instance
+               return $helperInstance;
+       }
+
+       /**
+        * Loads the descriptor XML file
+        *
+        * @param       $nodeInstance   An instance of a NodeHelper class
+        * @return      void
+        */
+       public function loadDescriptorXml (NodeHelper $nodeInstance) {
+               // Debug message
+               self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Attempting to answer a request: node-list...');
+
+               // Get a XML template instance
+               $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_request_node_list_answer_template_class');
+
+               // Set it for later use
+               $this->setTemplateInstance($templateInstance);
+
+               // Read the XML descriptor
+               $templateInstance->loadXmlTemplate();
+
+               // "Cache" entries instance for next foreach loop
+               $entriesInstance = $templateInstance->getTemplateInstance();
+
+               // Is must not be NULL (then it can only be a template instance)
+               assert(!is_null($entriesInstance));
+
+               // Render the XML content
+               $templateInstance->renderXmlContent();
+       }
+
+       /**
+        * Send out request-node-list answer package
+        *
+        * @param       $nodeInstance   An instance of a NodeHelper class
+        * @return      void
+        */
+       public function sendPackage (NodeHelper $nodeInstance) {
+               // Sanity check: Is the node in the approx. state? (active/reachable)
+               $nodeInstance->getStateInstance()->validateNodeStateIsActiveOrReachable();
+
+               // Compile the template, this inserts the loaded node data into the gaps.
+               $this->getTemplateInstance()->compileTemplate();
+
+               // Get a singleton network package instance
+               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
+
+               // Next, feed the content in. The network package class is a pipe-through class.
+               $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/helper/node/class_ b/application/hub/main/helper/node/class_
new file mode 100644 (file)
index 0000000..5e5e493
--- /dev/null
@@ -0,0 +1,83 @@
+<?php
+/**
+ * A ??? hub helper class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ * @todo               Find an interface for hub helper
+ *
+ * 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 Node???Helper extends BaseNodeHelper implements HelpableNode {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set recipient type
+               $this->setRecipientType(NetworkPackage::NETWORK_TARGET_!!!);
+       }
+
+       /**
+        * Creates the helper class
+        *
+        * @return      $helperInstance         A prepared instance of this helper
+        */
+       public final static function createNode???Helper () {
+               // Get new instance
+               $helperInstance = new Node???Helper();
+
+               // Return the prepared instance
+               return $helperInstance;
+       }
+
+       /**
+        * Loads the descriptor XML file
+        *
+        * @return      void
+        */
+       public function loadDescriptorXml () {
+               $this->partialStub('Please implement this method.');
+       }
+
+       /**
+        * Do the helped attempt by delivering a package to ourselfs
+        *
+        * @param       $nodeInstance   An instance of a NodeHelper class
+        * @return      void
+        */
+       public function sendPackage (NodeHelper $nodeInstance) {
+               // Sanity check: Is the node in the approx. state? (active)
+               $nodeInstance->getStateInstance()->validateNodeStateIsActive();
+
+               // Compile the template, this inserts the loaded node data into the gaps.
+               $this->getTemplateInstance()->compileTemplate();
+
+               // Get a singleton network package instance
+               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
+
+               // Next, feed the content in. The network package class is a pipe-through class.
+               $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_|||);
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/helper/node/class_BaseNodeHelper.php b/application/hub/main/helper/node/class_BaseNodeHelper.php
new file mode 100644 (file)
index 0000000..416f198
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/**
+ * A general node helper class
+ *
+ * @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/>.
+ */
+class BaseNodeHelper extends BaseHubSystemHelper {
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Name of the concrete class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/helper/node/connection/.htaccess b/application/hub/main/helper/node/connection/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/helper/node/connection/class_NodeSelfConnectHelper.php b/application/hub/main/helper/node/connection/class_NodeSelfConnectHelper.php
new file mode 100644 (file)
index 0000000..f1746dc
--- /dev/null
@@ -0,0 +1,100 @@
+<?php
+/**
+ * A SelfConnect hub helper class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ * @todo               Find an interface for hub helper
+ *
+ * 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 NodeSelfConnectHelper extends BaseNodeHelper implements HelpableNode {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set recipient type
+               $this->setRecipientType(NetworkPackage::NETWORK_TARGET_SELF);
+
+               // Set package tags
+               $this->setPackageTags(array('self_connect'));
+       }
+
+       /**
+        * Creates the helper class
+        *
+        * @return      $helperInstance         A prepared instance of this helper
+        */
+       public static final function createNodeSelfConnectHelper () {
+               // Get new instance
+               $helperInstance = new NodeSelfConnectHelper();
+
+               // Return the prepared instance
+               return $helperInstance;
+       }
+
+       /**
+        * Loads the descriptor XML file
+        *
+        * @param       $nodeInstance   An instance of a NodeHelper class
+        * @return      void
+        */
+       public function loadDescriptorXml (NodeHelper $nodeInstance) {
+               // Debug message
+               self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Attempting self-connect...');
+
+               // Get a XML template instance
+               $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_self_connect_template_class');
+
+               // Set it for later use
+               $this->setTemplateInstance($templateInstance);
+
+               // Read the XML descriptor
+               $templateInstance->loadXmlTemplate();
+
+               // Render the XML content
+               $templateInstance->renderXmlContent();
+       }
+
+       /**
+        * Do the self-connect attempt by delivering a package to ourselfs
+        *
+        * @param       $nodeInstance   An instance of a NodeHelper class
+        * @return      void
+        */
+       public function sendPackage (NodeHelper $nodeInstance) {
+               // Sanity check: Is the node in the approx. state? (active)
+               $nodeInstance->getStateInstance()->validateNodeStateIsActiveOrAnnounced();
+
+               // Compile the template, this inserts the loaded node data into the gaps.
+               $this->getTemplateInstance()->compileTemplate();
+
+               // Get a singleton network package instance
+               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
+
+               // Next, feed the content in. The network package class is a pipe-through class.
+               $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/helper/node/requests/.htaccess b/application/hub/main/helper/node/requests/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/helper/node/requests/class_NodeRequestNodeListHelper.php b/application/hub/main/helper/node/requests/class_NodeRequestNodeListHelper.php
new file mode 100644 (file)
index 0000000..c955899
--- /dev/null
@@ -0,0 +1,100 @@
+<?php
+/**
+ * A ??? hub helper class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ * @todo               Find an interface for hub helper
+ *
+ * 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 NodeRequestNodeListHelper extends BaseNodeHelper implements HelpableNode {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set recipient type
+               $this->setRecipientType(NetworkPackage::NETWORK_TARGET_UPPER_NODES);
+
+               // Set package tags
+               $this->setPackageTags(array('request_node_list'));
+       }
+
+       /**
+        * Creates the helper class
+        *
+        * @return      $helperInstance         A prepared instance of this helper
+        */
+       public final static function createNodeRequestNodeListHelper () {
+               // Get new instance
+               $helperInstance = new NodeRequestNodeListHelper();
+
+               // Return the prepared instance
+               return $helperInstance;
+       }
+
+       /**
+        * Loads the descriptor XML file
+        *
+        * @param       $nodeInstance   An instance of a NodeHelper class
+        * @return      void
+        */
+       public function loadDescriptorXml (NodeHelper $nodeInstance) {
+               // Debug message
+               self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Attempting to request: node-list...');
+
+               // Get a XML template instance
+               $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_request_node_list_template_class');
+
+               // Set it for later use
+               $this->setTemplateInstance($templateInstance);
+
+               // Read the XML descriptor
+               $templateInstance->loadXmlTemplate();
+
+               // Render the XML content
+               $templateInstance->renderXmlContent();
+       }
+
+       /**
+        * Do the helped attempt by delivering a package to ourselfs
+        *
+        * @param       $nodeInstance   An instance of a NodeHelper class
+        * @return      void
+        */
+       public function sendPackage (NodeHelper $nodeInstance) {
+               // Sanity check: Is the node in the approx. state? (active)
+               $nodeInstance->getStateInstance()->validateNodeStateIsAnnouncementCompleted();
+
+               // Compile the template, this inserts the loaded node data into the gaps.
+               $this->getTemplateInstance()->compileTemplate();
+
+               // Get a singleton network package instance
+               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
+
+               // Next, feed the content in. The network package class is a pipe-through class.
+               $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
+       }
+}
+
+// [EOF]
+?>
index 6e21861c99a665f2e27765c9ee59e33b934b7096..09ca858bfc79bf88f11b51bc29fc35b070412fe7 100644 (file)
@@ -587,11 +587,11 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
         * from given helper's template instance and pushing it on the 'undeclared'
         * stack.
         *
-        * @param       $helperInstance         An instance of a HelpableHub class
+        * @param       $helperInstance         An instance of a HelpableNode class
         * @param       $protocol                       Name of used protocol (TCP/UDP)
         * @return      void
         */
-       public function enqueueRawDataFromTemplate (HelpableHub $helperInstance, $protocolName) {
+       public function enqueueRawDataFromTemplate (HelpableNode $helperInstance, $protocolName) {
                // Get the raw content ...
                $content = $helperInstance->getTemplateInstance()->getRawTemplateData();
                //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('content(' . strlen($content) . ')=' . $content);
diff --git a/application/hub/main/template/bootstrap/.htaccess b/application/hub/main/template/bootstrap/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/template/bootstrap/class_XmlBootstrapTemplateEngine.php b/application/hub/main/template/bootstrap/class_XmlBootstrapTemplateEngine.php
new file mode 100644 (file)
index 0000000..50bf15e
--- /dev/null
@@ -0,0 +1,336 @@
+<?php
+/**
+ * An Bootstrap template engine class for XML templates
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ * @todo               This template engine does not make use of setTemplateType()
+ *
+ * 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 XmlBootstrapTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+       /**
+        * Some XML nodes must be available for later data extraction
+        */
+       const BOOTSTRAP_DATA_SESSION_ID  = 'session-id';
+       const BOOTSTRAP_DATA_NODE_STATUS = 'node-status';
+       const BOOTSTRAP_DATA_NODE_MODE   = 'node-mode';
+       const BOOTSTRAP_DATA_EXTERNAL_IP = 'external-ip';
+       const BOOTSTRAP_DATA_INTERNAL_IP = 'internal-ip';
+       const BOOTSTRAP_DATA_LISTEN_PORT = 'listen-port';
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Init array
+               $this->subNodes = array(
+                       'bootstrap-data',
+                       'listener',
+                       self::BOOTSTRAP_DATA_NODE_STATUS,
+                       self::BOOTSTRAP_DATA_NODE_MODE,
+                       self::BOOTSTRAP_DATA_LISTEN_PORT,
+                       self::BOOTSTRAP_DATA_SESSION_ID,
+                       self::BOOTSTRAP_DATA_EXTERNAL_IP,
+                       self::BOOTSTRAP_DATA_INTERNAL_IP,
+                       'object-type-list',
+               );
+       }
+
+       /**
+        * Creates an instance of the class TemplateEngine and prepares it for usage
+        *
+        * @return      $templateInstance               An instance of TemplateEngine
+        * @throws      BasePathIsEmptyException                If the provided $templateBasePath is empty
+        * @throws      InvalidBasePathStringException  If $templateBasePath is no string
+        * @throws      BasePathIsNoDirectoryException  If $templateBasePath is no
+        *                                                                                      directory or not found
+        * @throws      BasePathReadProtectedException  If $templateBasePath is
+        *                                                                                      read-protected
+        */
+       public static final function createXmlBootstrapTemplateEngine () {
+               // Get a new instance
+               $templateInstance = new XmlBootstrapTemplateEngine();
+
+               // Init template instance
+               $templateInstance->initXmlTemplateEngine('node', 'bootstrap');
+
+               // Return the prepared instance
+               return $templateInstance;
+       }
+
+       /**
+        * Currently not used
+        *
+        * @param       $resource               XML parser resource (currently ignored)
+        * @param       $characters             Characters to handle
+        * @return      void
+        */
+       public function characterHandler ($resource, $characters) {
+               // Trim all spaces away
+               $characters = trim($characters);
+
+               // Is this string empty?
+               if (empty($characters)) {
+                       // Then skip it silently
+                       return false;
+               } // END - if
+
+               /*
+                * Assign the found characters to variable and use the last entry from
+                * stack as the name.
+                */
+               parent::assignVariable($this->getStackerInstance()->getNamed('node_bootstrap'), $characters);
+       }
+
+       /**
+        * Getter for cache file (FQFN)
+        *
+        * @return      $fqfn   Full-qualified file name of the menu cache
+        */
+       public function getMenuCacheFqfn () {
+               $this->partialStub('Please implement this method.');
+       }
+
+       /**
+        * Starts the bootstrap
+        *
+        * @return      void
+        */
+       protected function startBootstrap () {
+               // Push the node name on the stacker
+               $this->getStackerInstance()->pushNamed('node_bootstrap', 'node_bootstrap');
+       }
+
+       /**
+        * Starts the bootstrap data
+        *
+        * @return      void
+        */
+       protected function startBootstrapData () {
+               // Push the node name on the stacker
+               $this->getStackerInstance()->pushNamed('node_bootstrap', 'bootstrap-data');
+       }
+
+       /**
+        * Starts the node status
+        *
+        * @return      void
+        */
+       protected function startNodeStatus () {
+               // Push the node name on the stacker
+               $this->getStackerInstance()->pushNamed('node_bootstrap', self::BOOTSTRAP_DATA_NODE_STATUS);
+       }
+
+       /**
+        * Starts the node-mode
+        *
+        * @return      void
+        */
+       protected function startNodeMode () {
+               // Push the node name on the stacker
+               $this->getStackerInstance()->pushNamed('node_bootstrap', self::BOOTSTRAP_DATA_NODE_MODE);
+       }
+
+       /**
+        * Starts the listener
+        *
+        * @return      void
+        */
+       protected function startListener () {
+               // Push the node name on the stacker
+               $this->getStackerInstance()->pushNamed('node_bootstrap', 'listener');
+       }
+
+       /**
+        * Starts the TCP/UDP listen port
+        *
+        * @return      void
+        */
+       protected function startListenPort () {
+               // Push the node name on the stacker
+               $this->getStackerInstance()->pushNamed('node_bootstrap', self::BOOTSTRAP_DATA_LISTEN_PORT);
+       }
+
+       /**
+        * Starts the session id
+        *
+        * @return      void
+        */
+       protected function startSessionId () {
+               // Push the node name on the stacker
+               $this->getStackerInstance()->pushNamed('node_bootstrap', self::BOOTSTRAP_DATA_SESSION_ID);
+       }
+
+       /**
+        * Starts the public ip
+        *
+        * @return      void
+        */
+       protected function startExternalIp () {
+               // Push the node name on the stacker
+               $this->getStackerInstance()->pushNamed('node_bootstrap', self::BOOTSTRAP_DATA_EXTERNAL_IP);
+       }
+
+       /**
+        * Starts the private ip
+        *
+        * @return      void
+        */
+       protected function startInternalIp () {
+               // Push the node name on the stacker
+               $this->getStackerInstance()->pushNamed('node_bootstrap', self::BOOTSTRAP_DATA_INTERNAL_IP);
+       }
+
+       /**
+        * Starts the object type list
+        *
+        * @return      void
+        */
+       protected function startObjectTypeList () {
+               // Push the node name on the stacker
+               $this->getStackerInstance()->pushNamed('node_bootstrap', 'object-type-list');
+       }
+
+       /**
+        * Starts the object type
+        *
+        * @return      void
+        */
+       protected function startObjectType () {
+               // Push the node name on the stacker
+               $this->getStackerInstance()->pushNamed('node_bootstrap', 'object-type');
+       }
+
+       /**
+        * Finishes the object type
+        *
+        * @return      void
+        */
+       protected function finishObjectType () {
+               // Pop the last entry
+               $this->getStackerInstance()->popNamed('node_bootstrap');
+       }
+
+       /**
+        * Finishes the object type list
+        *
+        * @return      void
+        */
+       protected function finishObjectTypeList () {
+               // Pop the last entry
+               $this->getStackerInstance()->popNamed('node_bootstrap');
+       }
+
+       /**
+        * Finishes the session id
+        *
+        * @return      void
+        */
+       protected function finishSessionId () {
+               // Pop the last entry
+               $this->getStackerInstance()->popNamed('node_bootstrap');
+       }
+
+       /**
+        * Finishes the private ip
+        *
+        * @return      void
+        */
+       protected function finishInternalIp () {
+               // Pop the last entry
+               $this->getStackerInstance()->popNamed('node_bootstrap');
+       }
+
+       /**
+        * Finishes the public ip
+        *
+        * @return      void
+        */
+       protected function finishExternalIp () {
+               // Pop the last entry
+               $this->getStackerInstance()->popNamed('node_bootstrap');
+       }
+
+       /**
+        * Finishes the TCP/UDP listen port
+        *
+        * @return      void
+        */
+       protected function finishListenPort () {
+               // Pop the last entry
+               $this->getStackerInstance()->popNamed('node_bootstrap');
+       }
+
+       /**
+        * Finishes the listener
+        *
+        * @return      void
+        */
+       protected function finishListener () {
+               // Pop the last entry
+               $this->getStackerInstance()->popNamed('node_bootstrap');
+       }
+
+       /**
+        * Finishes the node mode
+        *
+        * @return      void
+        */
+       protected function finishNodeMode () {
+               // Pop the last entry
+               $this->getStackerInstance()->popNamed('node_bootstrap');
+       }
+
+       /**
+        * Finishes the node status
+        *
+        * @return      void
+        */
+       protected function finishNodeStatus () {
+               // Pop the last entry
+               $this->getStackerInstance()->popNamed('node_bootstrap');
+       }
+
+       /**
+        * Finishes the bootstrap data
+        *
+        * @return      void
+        */
+       protected function finishBootstrapData () {
+               // Pop the last entry
+               $this->getStackerInstance()->popNamed('node_bootstrap');
+       }
+
+       /**
+        * Finishes the bootstrap
+        *
+        * @return      void
+        */
+       protected function finishBootstrap () {
+               // Pop the last entry
+               $this->getStackerInstance()->popNamed('node_bootstrap');
+       }
+}
+
+// [EOF]
+?>