]> git.mxchange.org Git - hub.git/commitdiff
Development/refacturing continued:
authorRoland Häder <roland@mxchange.org>
Sun, 19 Aug 2012 13:47:56 +0000 (13:47 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 19 Aug 2012 13:47:56 +0000 (13:47 +0000)
- Added more generic (BaseFooFilter) classes for foo filter (node, chat,
  cruncher)
- Made code in method 'processMessage()' generic and moved to
  'BaseHubFilter:genericProcessMessage()' (no static call!!!)
- Added package tag filter for 'request_node_list' tag

49 files changed:
.gitattributes
application/hub/config.php
application/hub/main/filter/activation/node/class_NodeActivation
application/hub/main/filter/activation/node/class_NodeActivationSelfAnnouncementFilter.php
application/hub/main/filter/bootstrap/chat/class_ChatBootstrap
application/hub/main/filter/bootstrap/chat/class_ChatBootstrapExtraBootstrappingFilter.php
application/hub/main/filter/bootstrap/chat/class_ChatBootstrapGenericActivationFilter.php
application/hub/main/filter/bootstrap/cruncher/class_CruncherBootstrap
application/hub/main/filter/bootstrap/cruncher/class_CruncherBootstrapBufferQueueInitializerFilter.php
application/hub/main/filter/bootstrap/cruncher/class_CruncherBootstrapExtraBootstrappingFilter.php
application/hub/main/filter/bootstrap/cruncher/class_CruncherBootstrapGenericActivationFilter.php
application/hub/main/filter/bootstrap/node/class_NodeBootstrap
application/hub/main/filter/bootstrap/node/class_NodeBootstrapExtraBootstrappingFilter.php
application/hub/main/filter/bootstrap/node/class_NodeBootstrapGenerateNodeIdFilter.php
application/hub/main/filter/bootstrap/node/class_NodeBootstrapGeneratePrivateKeyFilter.php
application/hub/main/filter/bootstrap/node/class_NodeBootstrapGenerateSessionIdFilter.php
application/hub/main/filter/bootstrap/node/class_NodeBootstrapInitQueuesFilter.php
application/hub/main/filter/bootstrap/node/class_NodeBootstrapListenerPoolFilter.php
application/hub/main/filter/bootstrap/node/class_NodeBootstrapRestoreNodeListFilter.php
application/hub/main/filter/chat/class_ChatInitializationFilter.php
application/hub/main/filter/chat/class_ChatPhpRequirementsFilter.php
application/hub/main/filter/chat/class_ChatWelcomeTeaserFilter.php
application/hub/main/filter/class_
application/hub/main/filter/class_BaseChatFilter.php [new file with mode: 0644]
application/hub/main/filter/class_BaseCruncherFilter.php [new file with mode: 0644]
application/hub/main/filter/class_BaseHubFilter.php [new file with mode: 0644]
application/hub/main/filter/class_BaseNodeFilter.php [new file with mode: 0644]
application/hub/main/filter/cruncher/class_Cruncher
application/hub/main/filter/cruncher/class_CruncherInitializationFilter.php
application/hub/main/filter/cruncher/class_CruncherPhpRequirementsFilter.php
application/hub/main/filter/cruncher/class_CruncherWelcomeTeaserFilter.php
application/hub/main/filter/node/class_Node
application/hub/main/filter/node/class_NodeInitializationFilter.php
application/hub/main/filter/node/class_NodePhpRequirementsFilter.php
application/hub/main/filter/node/class_NodeWelcomeTeaserFilter.php
application/hub/main/filter/shutdown/chat/class_ChatShutdownFilter.php
application/hub/main/filter/shutdown/cruncher/class_CruncherShutdownFilter.php
application/hub/main/filter/shutdown/node/class_NodeShutdown
application/hub/main/filter/shutdown/node/class_NodeShutdownDeinitQueuesFilter.php
application/hub/main/filter/shutdown/node/class_NodeShutdownFlushNodeListFilter.php
application/hub/main/filter/shutdown/node/class_NodeShutdownNodeFilter.php
application/hub/main/filter/shutdown/node/class_NodeShutdownTaskHandlerFilter.php
application/hub/main/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php
application/hub/main/filter/tags/class_PackageAnnouncementTagFilter.php
application/hub/main/filter/tags/class_PackageRequestNodeListTagFilter.php [new file with mode: 0644]
application/hub/main/filter/tags/class_PackageSelfConnectTagFilter.php
application/hub/main/filter/task/chat/class_ChatTaskHandlerInitializerFilter.php
application/hub/main/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php
application/hub/main/filter/task/node/class_NodeTaskHandlerInitializerFilter.php

index fbcdc8f469207275085a518470fd2e2031eb72c9..2f44213fe6219974702c2db926dfa0c85d4c28e7 100644 (file)
@@ -273,6 +273,10 @@ application/hub/main/filter/chat/class_ChatInitializationFilter.php svneol=nativ
 application/hub/main/filter/chat/class_ChatPhpRequirementsFilter.php svneol=native#text/plain
 application/hub/main/filter/chat/class_ChatWelcomeTeaserFilter.php svneol=native#text/plain
 application/hub/main/filter/class_ svneol=native#text/plain
+application/hub/main/filter/class_BaseChatFilter.php svneol=native#text/plain
+application/hub/main/filter/class_BaseCruncherFilter.php svneol=native#text/plain
+application/hub/main/filter/class_BaseHubFilter.php svneol=native#text/plain
+application/hub/main/filter/class_BaseNodeFilter.php svneol=native#text/plain
 application/hub/main/filter/console/.htaccess -text svneol=unset#text/plain
 application/hub/main/filter/cruncher/.htaccess svneol=native#text/plain
 application/hub/main/filter/cruncher/class_CruncherInitializationFilter.php svneol=native#text/plain
@@ -296,6 +300,7 @@ application/hub/main/filter/tags/.htaccess -text svneol=unset#text/plain
 application/hub/main/filter/tags/answer/.htaccess -text svneol=unset#text/plain
 application/hub/main/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php svneol=native#text/plain
 application/hub/main/filter/tags/class_PackageAnnouncementTagFilter.php svneol=native#text/plain
+application/hub/main/filter/tags/class_PackageRequestNodeListTagFilter.php svneol=native#text/plain
 application/hub/main/filter/tags/class_PackageSelfConnectTagFilter.php svneol=native#text/plain
 application/hub/main/filter/task/.htaccess -text svneol=unset#text/plain
 application/hub/main/filter/task/chat/.htaccess svneol=native#text/plain
index 169e8ff82e30e33a0a58646e2a8f3274db38f80f..992dbe9cf81c443f77c80d7749b0cfb9be1ee0f8 100644 (file)
@@ -210,6 +210,9 @@ $cfg->setConfigEntry('package_tag_announcement_answer_filter', 'PackageAnnouncem
 // CFG: PACKAGE-TAG-SELF-CONNECT-FILTER
 $cfg->setConfigEntry('package_tag_self_connect_filter', 'PackageSelfConnectTagFilter');
 
+// CFG: PACKAGE-TAG-REQUEST-NODE-LIST-FILTER
+$cfg->setConfigEntry('package_tag_request_node_list_filter', 'PackageRequestNodeListTagFilter');
+
 // CFG: MESSAGE-TYPE-ANNOUNCEMENT-HANDLER-CLASS
 $cfg->setConfigEntry('message_type_announcement_handler_class', 'NodeMessageAnnouncementHandler');
 
index 891447016f3e1b34cb78739d0db31a00e179416f..3cf893fd64ec9c9288f23840b6c3a39041f6c41d 100644 (file)
@@ -21,7 +21,7 @@
  * 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 HubActivation???Filter extends BaseFilter implements Filterable {
+class HubActivation???Filter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index 85751e78618078be80724774d327866c66a0dba2..2e2a6d39fd6344445a403d874e89e305da4c5b65 100644 (file)
@@ -21,7 +21,7 @@
  * 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 NodeActivationSelfAnnouncementFilter extends BaseFilter implements Filterable {
+class NodeActivationSelfAnnouncementFilter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index b8fabd8e80aea58eaa5c82ba5fd40f9de5e8177c..810fecfdcaf8463e21e3eb3818bec212b7c69610 100644 (file)
@@ -21,7 +21,7 @@
  * 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 ChatBootstrap???Filter extends BaseFilter implements Filterable {
+class ChatBootstrap???Filter extends BaseChatFilter implements Filterable {
        /**
         * Protected constructor
         *
index 45c372f0fc12d0399d153d58605770284d15d58c..2c10143cf558cc7d83fb035b312a6bfe17fe07b6 100644 (file)
@@ -21,7 +21,7 @@
  * 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 ChatBootstrapExtraBootstrappingFilter extends BaseFilter implements Filterable {
+class ChatBootstrapExtraBootstrappingFilter extends BaseChatFilter implements Filterable {
        /**
         * Protected constructor
         *
index ced9a3450d365ec7138ea456f5e9296c1c6399d3..ef584aa222cdf130f875edcb7ab993ac7838c5b6 100644 (file)
@@ -21,7 +21,7 @@
  * 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 ChatBootstrapGenericActivationFilter extends BaseFilter implements Filterable {
+class ChatBootstrapGenericActivationFilter extends BaseChatFilter implements Filterable {
        /**
         * Protected constructor
         *
index 74225c9cebeb9769cdfd40dd9c6fc7c887d00a5b..9318434b9d0dac76823cb588468b68f628c76eb6 100644 (file)
@@ -21,7 +21,7 @@
  * 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 CruncherBootstrap???Filter extends BaseFilter implements Filterable {
+class CruncherBootstrap???Filter extends BaseCruncherFilter implements Filterable {
        /**
         * Protected constructor
         *
index 667d9496cd7da8cfd6f0d06cf45228b8187c6e07..18508d94508a3de71c5ef4e004f431413426bb27 100644 (file)
@@ -21,7 +21,7 @@
  * 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 CruncherBootstrapBufferQueueInitializerFilter extends BaseFilter implements Filterable {
+class CruncherBootstrapBufferQueueInitializerFilter extends BaseCruncherFilter implements Filterable {
        /**
         * Protected constructor
         *
index 6b010e7df7066e7277853f138df9897accf4c930..ec976f8d06e23f17d87278ac6f6c0613229a68c1 100644 (file)
@@ -21,7 +21,7 @@
  * 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 CruncherBootstrapExtraBootstrappingFilter extends BaseFilter implements Filterable {
+class CruncherBootstrapExtraBootstrappingFilter extends BaseCruncherFilter implements Filterable {
        /**
         * Protected constructor
         *
index 2faff32269305241f174e0e911f523082babc28f..f7a0f4994ba75d94c893f94a06118c497c618186 100644 (file)
@@ -21,7 +21,7 @@
  * 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 CruncherBootstrapGenericActivationFilter extends BaseFilter implements Filterable {
+class CruncherBootstrapGenericActivationFilter extends BaseCruncherFilter implements Filterable {
        /**
         * Protected constructor
         *
index 07faca5f652f6ceecc2ab1df18df5ac85820c25b..5371b8ae75a07a0cf57180648dfd8c15446c095c 100644 (file)
@@ -21,7 +21,7 @@
  * 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 NodeBootstrap???Filter extends BaseFilter implements Filterable {
+class NodeBootstrap???Filter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index 53bd64e8cfe857969c6dce945129a0c179a168cc..7a87486689f131a93fc3f3785ba167c5adb6650e 100644 (file)
@@ -21,7 +21,7 @@
  * 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 NodeBootstrapExtraBootstrappingFilter extends BaseFilter implements Filterable {
+class NodeBootstrapExtraBootstrappingFilter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index 13cc689cb1f0fdc62b6fe0a7dabdc4bb19f99dc4..e2784f9b96a2aae24abfa0875e30a82ecce703b5 100644 (file)
@@ -21,7 +21,7 @@
  * 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 NodeBootstrapGenerateNodeIdFilter extends BaseFilter implements Filterable {
+class NodeBootstrapGenerateNodeIdFilter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index ffa1d3f4b82753e332db5bfd503d9f3ec4760a04..6c70fb3940b133e8a80b08583d68d019e0a5ad39 100644 (file)
@@ -21,7 +21,7 @@
  * 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 NodeBootstrapGeneratePrivateKeyFilter extends BaseFilter implements Filterable {
+class NodeBootstrapGeneratePrivateKeyFilter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index d047ff377a90a4f7a6e18c4b42cb6d63999d86be..fd30794877731607b614b79562097d1bd235827d 100644 (file)
@@ -21,7 +21,7 @@
  * 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 NodeBootstrapGenerateSessionIdFilter extends BaseFilter implements Filterable {
+class NodeBootstrapGenerateSessionIdFilter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index 2b2ef0dd2fc4c764b35d891b506241e5d2d98f5a..63371d3e22101146ca9d29d70d4a4d17c0dbff09 100644 (file)
@@ -21,7 +21,7 @@
  * 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 NodeBootstrapInitQueuesFilter extends BaseFilter implements Filterable {
+class NodeBootstrapInitQueuesFilter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index 98147fcb008144dfeecd69392dc88a1442c2b3eb..5a7bd4c84bbad3f3a4db3120a6465f44042679b2 100644 (file)
@@ -21,7 +21,7 @@
  * 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 NodeBootstrapListenerPoolFilter extends BaseFilter implements Filterable {
+class NodeBootstrapListenerPoolFilter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index e63327c7f5d272961d7bf13be1a3f99393ff793b..79ae01a6b4c27ceef71c39cf466e3a692a43bc3f 100644 (file)
@@ -21,7 +21,7 @@
  * 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 NodeBootstrapRestoreNodeListFilter extends BaseFilter implements Filterable {
+class NodeBootstrapRestoreNodeListFilter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index eacf6deb1a77f605f02bb11f84a116b42b37d479..98971e8d3f696f4ccd8c7df8aa456199d0cf5002 100644 (file)
@@ -21,7 +21,7 @@
  * 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 ChatInitializationFilter extends BaseFilter implements Filterable {
+class ChatInitializationFilter extends BaseChatFilter implements Filterable {
        /**
         * Protected constructor
         *
index 3b5e2b3a7322701f4cbc61635285a449ec9fa01b..fafda5ea3c4937701e06f58739decb16271c1f52 100644 (file)
@@ -21,7 +21,7 @@
  * 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 ChatPhpRequirementsFilter extends BaseFilter implements Filterable {
+class ChatPhpRequirementsFilter extends BaseChatFilter implements Filterable {
        /**
         * Protected constructor
         *
index e6d57276f6585b2c70fc318297e439e9d49b08f2..8a69ee68851f3a67692070411f81b06e17ef07f5 100644 (file)
@@ -21,7 +21,7 @@
  * 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 ChatWelcomeTeaserFilter extends BaseFilter implements Filterable {
+class ChatWelcomeTeaserFilter extends BaseChatFilter implements Filterable {
        /**
         * Protected constructor
         *
index 758b734da82f9dddbbdaa4d4f5146fa873569c57..9b9c40be5a60f41e2a39c0a0a8ffecb530a74889 100644 (file)
@@ -21,7 +21,7 @@
  * 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!!!???Filter extends BaseFilter implements Filterable {
+class Hub!!!???Filter extends BaseHubFilter implements Filterable {
        /**
         * Protected constructor
         *
diff --git a/application/hub/main/filter/class_BaseChatFilter.php b/application/hub/main/filter/class_BaseChatFilter.php
new file mode 100644 (file)
index 0000000..ab63d9e
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/**
+ * A generic filter for chat sub-project
+ *
+ * @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 BaseChatFilter extends BaseHubFilter {
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Real name of class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/filter/class_BaseCruncherFilter.php b/application/hub/main/filter/class_BaseCruncherFilter.php
new file mode 100644 (file)
index 0000000..395968b
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/**
+ * A generic filter for cruncher sub-project
+ *
+ * @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 BaseCruncherFilter extends BaseHubFilter {
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Real name of class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/filter/class_BaseHubFilter.php b/application/hub/main/filter/class_BaseHubFilter.php
new file mode 100644 (file)
index 0000000..82189fa
--- /dev/null
@@ -0,0 +1,111 @@
+<?php
+/**
+ * A generic filter for hub project
+ *
+ * @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 BaseHubFilter extends BaseFilter {
+       /**
+        * Array with all data XML nodes (which hold the actual data) and their values
+        */
+       protected $dataXmlNodes = array();
+
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Real name of class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+
+       /**
+        * Processes the given raw message content. The method renderXmlContent
+        * may throw (not the method itself) several exceptions:
+        *
+        * InvalidXmlNodeException  - If an invalid XML node has been found (e.g.
+        *                            wrong/out-dated template used)
+        * XmlNodeMismatchException - Again might be caused by invalid XML node
+        *                            usage
+        * XmlParserException       - If the XML message is damaged or not
+        *                            well-formed
+        *
+        * @param       $messageType            Type of message
+        * @param       $messageContent         Raw message content
+        * @param       $packageInstance        An instance of a Receivable class
+        * @return      void
+        * @todo        Exceptions from renderXmlContent() are currently unhandled
+        */
+       protected function genericProcessMessage ($messageType, $messageContent, Receivable $packageInstance) {
+               // Get a template instance from the factory
+               $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_' . $messageType . '_template_class');
+
+               // And render the XML content (aka message)
+               $templateInstance->renderXmlContent($messageContent);
+
+               /*
+                * The template system now stores all required data as 'general'
+                * variables, so simply get them. If there is an invalid XML node
+                * inside the message, the above method call will cause exceptions.
+                */
+               foreach ($this->dataXmlNodes as $key => $dummy) {
+                       // Generate method name
+                       $methodName = 'read' . $this->convertToClassName($messageType) . 'Data';
+
+                       // Call it
+                       $value = call_user_func(array($templateInstance, $methodName), $key);
+
+                       /*
+                        * If value is NULL, a variable hasn't been found. This could mean
+                        * that *this* node is running an out-dated software or the other
+                        * peer is using an out-dated $messageType.xml template.
+                        */
+                       if (is_null($value)) {
+                               // Output a warning
+                               self::createDebugInstance(__CLASS__)->debugOutput(str_replace('_', '-', strtoupper($messageType)) . '-TAG: Found not fully supported variable ' . $key . ' - skipping.');
+
+                               // Skip this part, don't write NULLs to the array
+                               continue;
+                       } // END - if
+
+                       // Debug message
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(str_replace('_', '-', strtoupper($messageType)) . '-TAG: key=' . $key . ',value=' . $value);
+
+                       // Set it now
+                       $this->dataXmlNodes[$key] = $value;
+               } // END - foreach
+
+               // Construct an array for pushing it on next stack
+               $messageArray = array(
+                       // Message data itself
+                       NetworkPackage::MESSAGE_ARRAY_DATA => $this->dataXmlNodes,
+                       // Message type (which is $messageType)
+                       NetworkPackage::MESSAGE_ARRAY_TYPE => $messageType
+               );
+
+               // Push the processed message back on stack
+               $packageInstance->getStackerInstance()->pushNamed(NetworkPackage::STACKER_NAME_PROCESSED_MESSAGE, $messageArray);
+}
+
+// [EOF]
+?>
+       }
diff --git a/application/hub/main/filter/class_BaseNodeFilter.php b/application/hub/main/filter/class_BaseNodeFilter.php
new file mode 100644 (file)
index 0000000..c3f4ae8
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/**
+ * A generic filter for 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
+ *
+ * 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 BaseNodeFilter extends BaseHubFilter {
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Real name of class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+}
+
+// [EOF]
+?>
index f44e3661af5f2ff8814277b5704660f558275564..32ca1f5868c87d66bb2477c40fd73780f47545d4 100644 (file)
@@ -21,7 +21,7 @@
  * 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 Cruncher???Filter extends BaseFilter implements Filterable {
+class Cruncher???Filter extends BaseCruncherFilter implements Filterable {
        /**
         * Protected constructor
         *
index 0f3920e6d643100e44be9350a39a25f73141c2cb..97b9067ade3a2b7cfc990130a8d18ca7b79c88c1 100644 (file)
@@ -21,7 +21,7 @@
  * 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 CruncherInitializationFilter extends BaseFilter implements Filterable {
+class CruncherInitializationFilter extends BaseCruncherFilter implements Filterable {
        /**
         * Protected constructor
         *
index fdc2719a01334f8e91d1ee480acdad14028998ae..82beb0784ceb6e803c0db9fe5ceed3989ca4d2bf 100644 (file)
@@ -21,7 +21,7 @@
  * 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 CruncherPhpRequirementsFilter extends BaseFilter implements Filterable {
+class CruncherPhpRequirementsFilter extends BaseCruncherFilter implements Filterable {
        /**
         * Protected constructor
         *
index 23b497b252e75695814da23c759b6aa2e5140b22..f066850e00d559f103cc8526a203e454d3532a18 100644 (file)
@@ -21,7 +21,7 @@
  * 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 CruncherWelcomeTeaserFilter extends BaseFilter implements Filterable {
+class CruncherWelcomeTeaserFilter extends BaseCruncherFilter implements Filterable {
        /**
         * Protected constructor
         *
index 6bc274ead368ab3af98f5c869cca0b0d5dbb789a..eca905df1165d1f15b99135ffee2063106a3f1d3 100644 (file)
@@ -21,7 +21,7 @@
  * 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???Filter extends BaseFilter implements Filterable {
+class Node???Filter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index 6eaec8309b5cb0b333478599c004922135318113..7f2002f89d3bce4645d81fa90aa1d59486475455 100644 (file)
@@ -21,7 +21,7 @@
  * 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 NodeInitializationFilter extends BaseFilter implements Filterable {
+class NodeInitializationFilter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index 84c27cd33dd6c6d155ca89d12f8651e05d4db07b..f905e23551adaf20bc0e684c4881a8e9341f5836 100644 (file)
@@ -21,7 +21,7 @@
  * 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 NodePhpRequirementsFilter extends BaseFilter implements Filterable {
+class NodePhpRequirementsFilter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index c17b302f87de2622cf3a18b0b0e904c7741ea792..aa3e8ec722514062133017a0537cb3a509ffd02c 100644 (file)
@@ -21,7 +21,7 @@
  * 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 NodeWelcomeTeaserFilter extends BaseFilter implements Filterable {
+class NodeWelcomeTeaserFilter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index 1af852d46f138ae4e0aff53826be952b26b97c94..cc2f859aa61212a488f20daee4da9bbbeb6109ef 100644 (file)
@@ -23,7 +23,7 @@
  * 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 ChatShutdownFilter extends BaseFilter implements Filterable {
+class ChatShutdownFilter extends BaseChatFilter implements Filterable {
        /**
         * Protected constructor
         *
index 1a83c66084baa425577d4e46815aeaebae71b6fa..b8bb0bc4bb9fa13c392f7eed51a803f623994385 100644 (file)
@@ -23,7 +23,7 @@
  * 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 CruncherShutdownFilter extends BaseFilter implements Filterable {
+class CruncherShutdownFilter extends BaseCruncherFilter implements Filterable {
        /**
         * Protected constructor
         *
index 3f2078de8df891751b41babe6696796c8d5e4395..f5b0d318315d43eaee82dd142c66d7c99d630af9 100644 (file)
@@ -21,7 +21,7 @@
  * 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 HubShutdown???Filter extends BaseFilter implements Filterable {
+class HubShutdown???Filter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index bc3ff90442dac981e694c2ea7f6eed73b82ddf9f..facfedaa95c85b7959b5734de3860dd1ad805c8b 100644 (file)
@@ -21,7 +21,7 @@
  * 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 NodeShutdownDeinitQueuesFilter extends BaseFilter implements Filterable {
+class NodeShutdownDeinitQueuesFilter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index 9908b42951c5c78ffbf7faea1c5c32f9c83500a3..99fa5249f7fb5a1761a6f2528af1abbbbae0e059 100644 (file)
@@ -21,7 +21,7 @@
  * 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 NodeShutdownFlushNodeListFilter extends BaseFilter implements Filterable {
+class NodeShutdownFlushNodeListFilter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index 4bc1f8d0243c5920ce98839927e0255d2a6c8ad7..c4af0c280ba39f71a73cc4e37897dcf957be17c8 100644 (file)
@@ -23,7 +23,7 @@
  * 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 NodeShutdownNodeFilter extends BaseFilter implements Filterable {
+class NodeShutdownNodeFilter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index d3764630b3bc3a78150ee597ba2a5965783774d9..43b16b2ad69c2b06480f97c36138785f58110272 100644 (file)
@@ -21,7 +21,7 @@
  * 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 NodeShutdownTaskHandlerFilter extends BaseFilter implements Filterable {
+class NodeShutdownTaskHandlerFilter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
index 1f537d0cb25ad17941357e52815cc7f8d8cbc971..4a50e0608145722a772a87739efe71867a19bf3c 100644 (file)
  * 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 PackageAnnouncementAnswerTagFilter extends BaseFilter implements FilterablePackage {
-       /**
-        * Array with all data XML nodes (which hold the actual data) and their values
-        */
-       private $dataXmlNodes = array();
-
+class PackageAnnouncementAnswerTagFilter extends BaseNodeFilter implements FilterablePackage {
        /**
         * Protected constructor
         *
index 9b241e7f61f2e032bf283af1b5360bfc0436b526..c17b239394173d38db3b22e58c1bdf21eb6249c1 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * A AnnouncementTag filter for Package
+ * A AnnouncementTag filter for packages
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
  * 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 PackageAnnouncementTagFilter extends BaseFilter implements FilterablePackage {
-       /**
-        * Array with all data XML nodes (which hold the actual data) and their values
-        */
-       private $dataXmlNodes = array();
-
+class PackageAnnouncementTagFilter extends BaseNodeFilter implements FilterablePackage {
        /**
         * Protected constructor
         *
@@ -87,54 +82,10 @@ class PackageAnnouncementTagFilter extends BaseFilter implements FilterablePacka
         * @param       $messageContent         Raw message content
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
-        * @todo        Exceptions from renderXmlContent() are currently unhandled
         */
        public function processMessage ($messageContent, Receivable $packageInstance) {
-               // Get a template instance from the factory
-               $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_announcement_template_class');
-
-               // And render the XML content (aka message)
-               $templateInstance->renderXmlContent($messageContent);
-
-               /*
-                * The template system now stores all required data as 'general'
-                * variables, so simply get them. If there is an invalid XML node
-                * inside the message, the above method call will cause exceptions.
-                */
-               foreach ($this->dataXmlNodes as $key => $dummy) {
-                       // Get the variable from template engine
-                       $value = $templateInstance->readAnnouncementData($key);
-
-                       /*
-                        * If value is NULL, a variable hasn't been found. This could mean
-                        * that *this* node is running an out-dated software or the other
-                        * peer is using an out-dated announcement.xml template.
-                        */
-                       if (is_null($value)) {
-                               // Output a warning
-                               self::createDebugInstance(__CLASS__)->debugOutput('ANNOUNCEMENT-TAG: Found not fully supported variable ' . $key . ' - skipping.');
-
-                               // Skip this part, don't write NULLs to the array
-                               continue;
-                       } // END - if
-
-                       // Debug message
-                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('ANNOUNCEMENT-TAG: key=' . $key . ',value=' . $value);
-
-                       // Set it now
-                       $this->dataXmlNodes[$key] = $value;
-               } // END - foreach
-
-               // Construct an array for pushing it on next stack
-               $messageArray = array(
-                       // Message data itself
-                       NetworkPackage::MESSAGE_ARRAY_DATA => $this->dataXmlNodes,
-                       // Message type (which is 'announcement')
-                       NetworkPackage::MESSAGE_ARRAY_TYPE => 'announcement'
-               );
-
-               // Push the processed message back on stack
-               $packageInstance->getStackerInstance()->pushNamed(NetworkPackage::STACKER_NAME_PROCESSED_MESSAGE, $messageArray);
+               // Process message generic
+               $this->genericProcessMessage('announcement', $messageContent, $packageInstance);
        }
 }
 
diff --git a/application/hub/main/filter/tags/class_PackageRequestNodeListTagFilter.php b/application/hub/main/filter/tags/class_PackageRequestNodeListTagFilter.php
new file mode 100644 (file)
index 0000000..f97e76b
--- /dev/null
@@ -0,0 +1,75 @@
+<?php
+/**
+ * A RequestNodeListTag filter for packages
+ *
+ * @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 PackageRequestNodeListTagFilter extends BaseNodeFilter implements FilterablePackage {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this filter class
+        *
+        * @return      $filterInstance         An instance of this filter class
+        */
+       public final static function createPackageRequestNodeListTagFilter () {
+               // Get a new instance
+               $filterInstance = new PackageRequestNodeListTagFilter();
+
+               // Return the instance
+               return $filterInstance;
+       }
+
+       /**
+        * Executes the filter with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        * @throws      UnsupportedOperationException   If this method is called
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Please don't call this method
+               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
+       }
+
+       /**
+        * Processes the given raw message content.
+        *
+        * @param       $messageContent         Raw message content
+        * @param       $packageInstance        An instance of a Receivable class
+        * @return      void
+        */
+       public function processMessage ($messageContent, Receivable $packageInstance) {
+               // Process messasge generic
+               $this->genericProcessMessage('request_node_list', $messageContent, $packageInstance);
+       }
+}
+
+// [EOF]
+?>
index 81cfddf610f97ef6e87681dcf9614b3693d68809..d8fac40456ee7b7832e9ddcb1f4be8373a31118b 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * A SelfConnectTag filter for Package
+ * A SelfConnectTag filter for packages
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
  * 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 PackageSelfConnectTagFilter extends BaseFilter implements FilterablePackage {
-       /**
-        * Array with all data XML nodes (which hold the actual data) and their values
-        */
-       private $dataXmlNodes = array();
-
+class PackageSelfConnectTagFilter extends BaseNodeFilter implements FilterablePackage {
        /**
         * Protected constructor
         *
@@ -83,54 +78,10 @@ class PackageSelfConnectTagFilter extends BaseFilter implements FilterablePackag
         * @param       $messageContent         Raw message content
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
-        * @todo        Exceptions from renderXmlContent() are currently unhandled
         */
        public function processMessage ($messageContent, Receivable $packageInstance) {
-               // Get a template instance from the factory
-               $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_self_connect_template_class');
-
-               // And render the XML content (aka message)
-               $templateInstance->renderXmlContent($messageContent);
-
-               /*
-                * The template system now stores all required data as 'general'
-                * variables, so simply get them. If there is an invalid XML node
-                * inside the message, the above method call will cause exceptions.
-                */
-               foreach ($this->dataXmlNodes as $key => $dummy) {
-                       // Get the variable from template engine
-                       $value = $templateInstance->readSelfConnectData($key);
-
-                       /*
-                        * If value is NULL, a variable hasn't been found. This could mean
-                        * that *this* node is running an out-dated software or the other
-                        * peer is using an out-dated self_connect.xml template.
-                        */
-                       if (is_null($value)) {
-                               // Output a warning
-                               self::createDebugInstance(__CLASS__)->debugOutput('SELF-CONNECT-TAG: Found not fully supported variable ' . $key . ' - skipping.');
-
-                               // Skip this part, don't write NULLs to the array
-                               continue;
-                       } // END - if
-
-                       // Debug message
-                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SELF-CONNECT-TAG: key=' . $key . ',value=' . $value);
-
-                       // Set it now
-                       $this->dataXmlNodes[$key] = $value;
-               } // END - foreach
-
-               // Construct an array for pushing it on next stack
-               $messageArray = array(
-                       // Message data itself
-                       NetworkPackage::MESSAGE_ARRAY_DATA => $this->dataXmlNodes,
-                       // Message type (which is 'self_connect')
-                       NetworkPackage::MESSAGE_ARRAY_TYPE => 'self_connect'
-               );
-
-               // Push the processed message back on stack
-               $packageInstance->getStackerInstance()->pushNamed(NetworkPackage::STACKER_NAME_PROCESSED_MESSAGE, $messageArray);
+               // Process generic
+               $this->genericProcessMessage('self_connect', $messageContent, $packageInstance);
        }
 }
 
index 215eb2eda76cec5d2d4552762cd68b98d3be8bf8..db6646c3c863d5088c9f266337917e2be4da7ac5 100644 (file)
@@ -21,7 +21,7 @@
  * 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 ChatTaskHandlerInitializerFilter extends BaseFilter implements Filterable {
+class ChatTaskHandlerInitializerFilter extends BaseChatFilter implements Filterable {
        /**
         * Protected constructor
         *
index d98a2b8ab9e32a9811ce014e17e407da8173f959..b4ef8b4e00a62f77355514e274e4fcdf2f7da8b5 100644 (file)
@@ -21,7 +21,7 @@
  * 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 CruncherTaskHandlerInitializerFilter extends BaseFilter implements Filterable {
+class CruncherTaskHandlerInitializerFilter extends BaseCruncherFilter implements Filterable {
        /**
         * Protected constructor
         *
index 6d58048d91ae09e0bdbf8e26358fb2cf2efbce75..e9f9f4d54b3f686ca1e9b641f578227b38e4d815 100644 (file)
@@ -21,7 +21,7 @@
  * 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 NodeTaskHandlerInitializerFilter extends BaseFilter implements Filterable {
+class NodeTaskHandlerInitializerFilter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *