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
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
// 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');
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
--- /dev/null
+<?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]
+?>
--- /dev/null
+<?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]
+?>
--- /dev/null
+<?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]
+?>
+ }
--- /dev/null
+<?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]
+?>
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
* 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
*
<?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
*
* @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);
}
}
--- /dev/null
+<?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]
+?>
<?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
*
* @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);
}
}
* 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
*
* 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
*
* 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
*