]> git.mxchange.org Git - lfdb2.git/commitdiff
Added more required filters (some not implemented) and config entries
authorRoland Häder <roland@mxchange.org>
Mon, 29 Jul 2013 00:08:03 +0000 (00:08 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 29 Jul 2013 00:08:03 +0000 (00:08 +0000)
.gitattributes
application/lfdb2/config.php
application/lfdb2/main/filter/bootstrap/server/class_ServerBootstrapListenerPoolFilter.php [new file with mode: 0644]
application/lfdb2/main/filter/shutdown/.htaccess [new file with mode: 0644]
application/lfdb2/main/filter/shutdown/server/.htaccess [new file with mode: 0644]
application/lfdb2/main/filter/shutdown/server/class_ServerShutdown [new file with mode: 0644]
application/lfdb2/main/filter/shutdown/server/class_ServerShutdownServerFilter.php [new file with mode: 0644]
application/lfdb2/main/filter/shutdown/server/class_ServerShutdownTaskHandlerFilter.php [new file with mode: 0644]
application/lfdb2/main/filter/task/.htaccess [new file with mode: 0644]
application/lfdb2/main/filter/task/server/.htaccess [new file with mode: 0644]
application/lfdb2/main/filter/task/server/class_ServerTaskHandlerInitializerFilter.php [new file with mode: 0644]

index eff759d3389426b330adcfdce08e1ddfcc8296e9..107b06f64f9cd67036ac38528114d3a727305bcf 100644 (file)
@@ -24,6 +24,7 @@ application/lfdb2/main/filter/bootstrap/.htaccess -text
 application/lfdb2/main/filter/bootstrap/server/.htaccess -text
 application/lfdb2/main/filter/bootstrap/server/class_ServerBootstrap -text
 application/lfdb2/main/filter/bootstrap/server/class_ServerBootstrapExtraBootstrappingFilter.php -text
+application/lfdb2/main/filter/bootstrap/server/class_ServerBootstrapListenerPoolFilter.php -text
 application/lfdb2/main/filter/class_BaseLfdb2Filter.php -text
 application/lfdb2/main/filter/class_BaseServerFilter.php -text
 application/lfdb2/main/filter/server/.htaccess -text
@@ -31,6 +32,14 @@ application/lfdb2/main/filter/server/class_Server -text
 application/lfdb2/main/filter/server/class_ServerInitializationFilter.php -text
 application/lfdb2/main/filter/server/class_ServerPhpRequirementsFilter.php -text
 application/lfdb2/main/filter/server/class_ServerWelcomeTeaserFilter.php -text
+application/lfdb2/main/filter/shutdown/.htaccess -text
+application/lfdb2/main/filter/shutdown/server/.htaccess -text
+application/lfdb2/main/filter/shutdown/server/class_ServerShutdown -text
+application/lfdb2/main/filter/shutdown/server/class_ServerShutdownServerFilter.php -text
+application/lfdb2/main/filter/shutdown/server/class_ServerShutdownTaskHandlerFilter.php -text
+application/lfdb2/main/filter/task/.htaccess -text
+application/lfdb2/main/filter/task/server/.htaccess -text
+application/lfdb2/main/filter/task/server/class_ServerTaskHandlerInitializerFilter.php -text
 application/lfdb2/main/resolver/.htaccess -text
 application/lfdb2/main/resolver/command/.htaccess -text
 application/lfdb2/main/resolver/command/console/.htaccess -text
index af94b709bb69b8bee01cb5b893004374765991f9..945750935d65a5ede0f450973e25777b5f6c858b 100644 (file)
@@ -45,6 +45,12 @@ $cfg->setConfigEntry('news_download_filter', 'NewsDownloadFilter');
 // CFG: NEWS-PROCESS-FILTER
 $cfg->setConfigEntry('news_process_filter', 'NewsProcessFilter');
 
+// CFG: NEWS-READER-CLASS
+$cfg->setConfigEntry('news_reader_class', 'ConsoleNewsReader');
+
+// CFG: NEWS-SERVER-LIMIT
+$cfg->setConfigEntry('news_server_limit', 5);
+
 // CFG: SERVER-PHP-REQUIREMENTS-FILTER
 $cfg->setConfigEntry('node_php_requirements_filter', 'NodePhpRequirementsFilter');
 
@@ -60,8 +66,25 @@ $cfg->setConfigEntry('server_php_requirements_filter', 'ServerPhpRequirementsFil
 // CFG: SERVER-WELCOME-TEASER-FILTER
 $cfg->setConfigEntry('server_welcome_teaser_filter', 'ServerWelcomeTeaserFilter');
 
+// ----------------------------------------------------------------------------
+//                            Bootstrapping filters
+// ----------------------------------------------------------------------------
+
 // CFG: SERVER-BOOTSTRAP-EXTRA-BOOTSTRAPPING-FILTER
 $cfg->setConfigEntry('server_bootstrap_extra_bootstrapping_filter', 'ServerBootstrapExtraBootstrappingFilter');
 
+// CFG: SERVER-BOOTSTRAP-LISTENER-POOL-FILTER
+$cfg->setConfigEntry('server_bootstrap_listener_pool_filter', 'ServerBootstrapListenerPoolFilter');
+
+// ----------------------------------------------------------------------------
+//                              Shutdown filters
+// ----------------------------------------------------------------------------
+
+// CFG: SERVER-SHUTDOWN-TASK-HANDLER-FILTER
+$cfg->setConfigEntry('server_shutdown_task_handler_filter', 'ServerShutdownTaskHandlerFilter');
+
+// CFG: SERVER-SHUTDOWN-SERVER-FILTER
+$cfg->setConfigEntry('server_shutdown_server_filter', 'ServerShutdownServerFilter');
+
 // [EOF]
 ?>
diff --git a/application/lfdb2/main/filter/bootstrap/server/class_ServerBootstrapListenerPoolFilter.php b/application/lfdb2/main/filter/bootstrap/server/class_ServerBootstrapListenerPoolFilter.php
new file mode 100644 (file)
index 0000000..5a29b9b
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/**
+ * A ListenerPool filter for bootstrapping
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2013 LFDB2 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 ServerBootstrapListenerPoolFilter extends BaseServerFilter implements Filterable {
+       /**
+        * 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 static final function createServerBootstrapListenerPoolFilter () {
+               // Get a new instance
+               $filterInstance = new ServerBootstrapListenerPoolFilter();
+
+               // 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      FilterChainException    If $serverInstance is null (no NullPointerException here)
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get server instance
+               $serverInstance = Registry::getRegistry()->getInstance('server');
+
+               // Now do something
+               $serverInstance->initializeListenerPool();
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/lfdb2/main/filter/shutdown/.htaccess b/application/lfdb2/main/filter/shutdown/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/lfdb2/main/filter/shutdown/server/.htaccess b/application/lfdb2/main/filter/shutdown/server/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/lfdb2/main/filter/shutdown/server/class_ServerShutdown b/application/lfdb2/main/filter/shutdown/server/class_ServerShutdown
new file mode 100644 (file)
index 0000000..4822e38
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+/**
+ * A ??? filter for shutting down the server.
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2013 LFDB2 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 ServerShutdown???Filter extends BaseNodeFilter implements Filterable {
+       /**
+        * 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 createServerShutdown???Filter () {
+               // Get a new instance
+               $filterInstance = new ServerShutdown???Filter();
+
+               // 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      FilterChainException    If $serverInstance is null (no NullPointerException here)
+        * @todo        0% done
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get server instance
+               $serverInstance = Registry::getRegistry()->getInstance('server');
+
+               // Now do something
+               $this->partialStub('Please implement this step.');
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/lfdb2/main/filter/shutdown/server/class_ServerShutdownServerFilter.php b/application/lfdb2/main/filter/shutdown/server/class_ServerShutdownServerFilter.php
new file mode 100644 (file)
index 0000000..abf49a3
--- /dev/null
@@ -0,0 +1,68 @@
+<?php
+/**
+ * A ShutdownServer filter for shutting down the server. This filter should be the
+ * last one in 'shutdown' chain so the hub is shutted down at the very end of
+ * its life... R.I.P. little hub...
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2013 LFDB2 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 ServerShutdownServerFilter extends BaseServerFilter implements Filterable {
+       /**
+        * 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 static final function createServerShutdownServerFilter () {
+               // Get a new instance
+               $filterInstance = new ServerShutdownServerFilter();
+
+               // 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      FilterChainException    If $serverInstance is null (no NullPointerException please)
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get server instance
+               $serverInstance = Registry::getRegistry()->getInstance('server');
+
+               // Shutdown the server. This should be the last line
+               $serverInstance->doShutdown();
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/lfdb2/main/filter/shutdown/server/class_ServerShutdownTaskHandlerFilter.php b/application/lfdb2/main/filter/shutdown/server/class_ServerShutdownTaskHandlerFilter.php
new file mode 100644 (file)
index 0000000..cec2502
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+/**
+ * A TaskHandler filter for shutting down the node.
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2013 LFDB2 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 ServerShutdownTaskHandlerFilter extends BaseServerFilter implements Filterable {
+       /**
+        * 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 static final function createServerShutdownTaskHandlerFilter () {
+               // Get a new instance
+               $filterInstance = new ServerShutdownTaskHandlerFilter();
+
+               // 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      FilterChainException    If $nodeInstance is null (no NullPointerException here)
+        * @todo        0% done
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get task handler instance
+               $handlerInstance = Registry::getRegistry()->getInstance('task_handler');
+
+               // Shutdown the task manager and all its registered tasks
+               $handlerInstance->doShutdown();
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/lfdb2/main/filter/task/.htaccess b/application/lfdb2/main/filter/task/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/lfdb2/main/filter/task/server/.htaccess b/application/lfdb2/main/filter/task/server/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/lfdb2/main/filter/task/server/class_ServerTaskHandlerInitializerFilter.php b/application/lfdb2/main/filter/task/server/class_ServerTaskHandlerInitializerFilter.php
new file mode 100644 (file)
index 0000000..757bd83
--- /dev/null
@@ -0,0 +1,142 @@
+<?php
+/**
+ * A TaskHandlerInitializer filter for servers
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2013 LFDB2 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 ServerTaskHandlerInitializerFilter extends BaseServerFilter implements Filterable {
+       /**
+        * 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 static final function createServerTaskHandlerInitializerFilter () {
+               // Get a new instance
+               $filterInstance = new ServerTaskHandlerInitializerFilter();
+
+               // 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      FilterChainException    If we need to interrupt the filter chain
+        * @todo        Maybe some more tasks needs to be added?
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               $this->partialStub('Unported.');
+               die();
+
+               // Get server instance
+               $serverInstance = Registry::getRegistry()->getInstance('server');
+
+               // Get a new task handler instance
+               $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class');
+
+               // Generate socket listener task
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('node_socket_listener_task_class');
+
+               // Network package reader, needs to be delayed a little
+               $handlerInstance->registerTask('socket_listener', $taskInstance);
+
+               // Generate package reader task
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('node_package_reader_task_class', array($nodeInstance->getListenerPoolInstance()));
+
+               // Network package reader, needs to be delayed a little
+               $handlerInstance->registerTask('network_package_reader', $taskInstance);
+
+               // Generate package writer task
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('node_package_writer_task_class');
+
+               // Register it as well
+               $handlerInstance->registerTask('network_package_writer', $taskInstance);
+
+               // Generate chunk assembler task
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('node_chunk_assembler_task_class');
+
+               // Register it as well
+               $handlerInstance->registerTask('chunk_assembler', $taskInstance);
+
+               // Generate package decoder task
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('node_package_decoder_task_class');
+
+               // Register it as well
+               $handlerInstance->registerTask('package_decoder', $taskInstance);
+
+               // Generate DHT initialization task
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('node_dht_init_task_class');
+
+               // Register it as well
+               $handlerInstance->registerTask('dht_init', $taskInstance);
+
+               // Generate DHT query task
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('node_dht_query_task_class');
+
+               // Register it as well
+               $handlerInstance->registerTask('dht_query', $taskInstance);
+
+               // Prepare a package-tags initialization task for the listeners
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('node_package_tags_init_task_class');
+
+               // Register it
+               $handlerInstance->registerTask('package_tags_init', $taskInstance);
+
+               // Prepare a self-test task for the listeners
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('node_selfconnect_task_class');
+
+               // Register it
+               $handlerInstance->registerTask('self_connect', $taskInstance);
+
+               // Prepare a update-check task
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('node_update_check_task_class');
+
+               // Register it
+               $handlerInstance->registerTask('update_check', $taskInstance);
+
+               // Get the list instance here
+               $listInstance = $nodeInstance->getListenerPoolInstance()->getPoolEntriesInstance();
+
+               // Prepare a ping task
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('node_ping_task_class', array($listInstance));
+
+               // Register it
+               $handlerInstance->registerTask('ping', $taskInstance);
+
+               // Put the task handler in registry
+               Registry::getRegistry()->addInstance('task_handler', $handlerInstance);
+       }
+}
+
+// [EOF]
+?>