// Own namespace
namespace Org\Mxchange\City\Command;
+// Import application-specific stuff
+use Org\Mxchange\Factory\City\Daemon\CityDaemonFactory;
+
// Import framework stuff
+use Org\Mxchange\CoreFramework\Command\BaseCommand;
+use Org\Mxchange\CoreFramework\Command\Commandable;
+use Org\Mxchange\CoreFramework\Controller\Controller;
+use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
+use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry;
use Org\Mxchange\CoreFramework\Request\Requestable;
+use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver;
use Org\Mxchange\CoreFramework\Response\Responseable;
/**
*
* @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2015, 2016 City Developer Team
+ * @copyright Copyright (c) 2015 - 2023 City Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.shipsimu.org
*
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// Get a registry and the application instance from it
- $applicationInstance = Registry::getRegistry()->getInstance('app');
+ $applicationInstance = ApplicationHelper::getSelfInstance();
/*
* ----------------------- Bootstrapping phase ------------------------
* extra arguments which mostly override config entries or enable special
* features within the hub (none is ready at this development stage)
*/
- self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: Beginning with bootstrap...');
+ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage('BOOTSTRAP: Beginning with bootstrap...');
$applicationInstance->getControllerInstance()->executeBootstrapFilters($requestInstance, $responseInstance);
- self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: Bootstrap finished.');
+ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage('BOOTSTRAP: Bootstrap finished.');
// Get city instance
$cityInstance = CityDaemonFactory::createCityDaemonInstance();
$cityInstance->activateCityDaemon($requestInstance, $responseInstance);
// Get task handler instance
- $handlerInstance = Registry::getRegistry()->getInstance('task_handler');
+ $handlerInstance = ObjectRegistry::getRegistry('generic')->getInstance('task_handler');
// Debug message
- self::createDebugInstance(__CLASS__)->debugOutput('MAIN: --- Entering main loop. ---');
+ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage('MAIN: --- Entering main loop. ---');
/*
* ----------------------------- Main loop ----------------------------
while (($cityInstance->isCityActive()) && ($handlerInstance->hasTasksLeft())) {
// Handle all tasks here
$handlerInstance->handleTasks();
- } // END - while
+ }
// Debug message
- self::createDebugInstance(__CLASS__)->debugOutput('MAIN: --- Leaving main loop. ---');
+ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage('MAIN: --- Leaving main loop. ---');
}
/**
*/
public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
// Add pre filters
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_php_requirements_filter'));
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_initializer_filter'));
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_welcome_teaser_filter'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_php_requirements_filter_class'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_initializer_filter_class'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_welcome_teaser_filter_class'));
// Add bootstrap filters
- $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_bootstrap_init_daemon_filter'));
- $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_bootstrap_extra_bootstrapping_filter'));
+ $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_bootstrap_init_daemon_filter_class'));
+ $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_bootstrap_extra_bootstrapping_filter_class'));
// Add city activation filters
- $controllerInstance->addActivationFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_activation_task_handler_initializer_filter'));
+ $controllerInstance->addActivationFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_activation_task_handler_initializer_filter_class'));
// Add shutdown filters, you may want to shutdown the task handler as last one.
- $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_shutdown_task_handler_filter'));
+ $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_shutdown_task_handler_filter_class'));
// This is the last generic shutdown filter
- $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_shutdown_city_filter'));
+ $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_shutdown_city_filter_class'));
}
}