use Org\Mxchange\City\Factory\Manager\ManagerFactory;
use Org\Mxchange\City\Factory\State\CityStateFactory;
use Org\Mxchange\City\Generic\BaseCitySystem;
-use Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseWrapper;
+use Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseFrontend;
// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Criteria\Add\AddableCriteria;
use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
use Org\Mxchange\CoreFramework\Database\Updateable;
-use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
-use Org\Mxchange\CoreFramework\Registry\Registry;
+use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory;
+use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
+use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
+use Org\Mxchange\CoreFramework\Registry\GenericRegistry;;
use Org\Mxchange\CoreFramework\Request\Requestable;
use Org\Mxchange\CoreFramework\Response\Responseable;
+use Org\Mxchange\CoreFramework\Traits\Crypto\CryptoTrait;
+use Org\Mxchange\CoreFramework\Traits\Database\Frontend\DatabaseFrontendTrait;
+use Org\Mxchange\CoreFramework\Traits\State\StateableTrait;
/**
* A general City class
*
* @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
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseCityDaemon extends BaseCitySystem implements Updateable, AddableCriteria {
+ // Load traits
+ use CryptoTrait;
+ use DatabaseFrontendTrait;
+ use StateableTrait;
+
/**
* City types
*/
* @param $className Name of the class
* @return void
*/
- protected function __construct ($className) {
+ protected function __construct (string $className) {
// Call parent constructor
parent::__construct($className);
- // Get a wrapper instance
- $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_info_db_wrapper_class');
+ // Get a frontend instance
+ $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('city_info_db_frontend_class');
// Set it here
- $this->setWrapperInstance($wrapperInstance);
+ $this->setFrontendInstance($frontendInstance);
// Get a crypto instance
$cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
$this->setCryptoInstance($cryptoInstance);
// Add own instance to registry
- Registry::getRegistry()->addInstance('city', $this);
+ GenericRegistry::getRegistry()->addInstance('city', $this);
// Init state which sets the state to 'init'
$this->initState();
*/
public function outputConsoleTeaser () {
// Get the app instance (for shortening our code)
- $app = $this->getApplicationInstance();
+ $applicationInstance = ApplicationHelper::getSelfInstance();
// Output all lines
self::createDebugInstance(__CLASS__)->debugOutput(' ');
- self::createDebugInstance(__CLASS__)->debugOutput($app->getAppName() . ' v' . $app->getAppVersion() . ' - ' . FrameworkBootstrap::getRequestInstance()->getRequestElement('mode') . ' daemon starting');
- self::createDebugInstance(__CLASS__)->debugOutput('Copyright (c) 2015, 2016 City Developer Team');
+ self::createDebugInstance(__CLASS__)->debugOutput($applicationInstance->getAppName() . ' v' . $applicationInstance->getAppVersion() . ' - ' . FrameworkBootstrap::getRequestInstance()->getRequestElement('mode') . ' daemon starting');
+ self::createDebugInstance(__CLASS__)->debugOutput('Copyright (c) 2015 - 2023 City Developer Team');
self::createDebugInstance(__CLASS__)->debugOutput(' ');
self::createDebugInstance(__CLASS__)->debugOutput('This program comes with ABSOLUTELY NO WARRANTY; for details see docs/COPYING.');
self::createDebugInstance(__CLASS__)->debugOutput('This is free software, and you are welcome to redistribute it under certain');
assert($requestInstance instanceof Requestable);
// Add City number and type
- $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_ID , 1);
- $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_MODE, $requestInstance->getRequestElement('mode'));
+ $criteriaInstance->addCriteria(CityInformationDatabaseFrontend::DB_COLUMN_CITY_ID , 1);
+ $criteriaInstance->addCriteria(CityInformationDatabaseFrontend::DB_COLUMN_CITY_MODE, $requestInstance->getRequestElement('mode'));
// Add the City id
- $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_ID, $this->getCityId());
+ $criteriaInstance->addCriteria(CityInformationDatabaseFrontend::DB_COLUMN_CITY_ID, $this->getCityId());
}
/**
*/
public function updateDatabaseField ($fieldName, $fieldValue) {
// Unfinished
- $this->partialStub('Unfinished: fieldName=' . $fieldName . ',fieldValue=' . $fieldValue);
+ DebugMiddleware::getSelfInstance()->partialStub('Unfinished: fieldName=' . $fieldName . ',fieldValue=' . $fieldValue);
return;
// Get a critieria instance
$searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
// Add search criteria
- $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
+ $searchInstance->addCriteria(UserDatabaseFrontend::DB_COLUMN_USERNAME, $this->getUserName());
$searchInstance->setLimit(1);
// Now get another criteria
// Add the search criteria for searching for the right entry
$updateInstance->setSearchInstance($searchInstance);
- // Set wrapper class name
- $updateInstance->setWrapperConfigEntry('user_db_wrapper_class');
+ // Set frontend class name
+ $updateInstance->setFrontendConfigEntry('user_db_frontend_class');
// Remember the update in database result
$this->getResultInstance()->add2UpdateQueue($updateInstance);
*/
public function activateCityDaemon (Requestable $requestInstance, Responseable $responseInstance) {
// Get the controller here
- $controllerInstance = Registry::getRegistry()->getInstance('controller');
+ $controllerInstance = GenericRegistry::getRegistry()->getInstance('controller');
// Run all filters for the City activation
$controllerInstance->executeActivationFilters($requestInstance, $responseInstance);
*/
public function updateCityData () {
// Set some dummy configuration entries, e.g. city_status
- $this->getConfigInstance()->setConfigEntry('city_status', $this->getStateInstance()->getStateName());
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('city_status', $this->getStateInstance()->getStateName());
}
/**
*/
public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $cityData) {
// Add all data the array provides
- foreach (CityInformationDatabaseWrapper::getAllElements() as $element) {
+ foreach (CityInformationDatabaseFrontend::getAllElements() as $element) {
// Is the element there?
if (isset($cityData[$element])) {
// Add it
// Output warning message
/* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CITY[' . __METHOD__ . ':' . __LINE__ . ']: addArrayToDataSet(): Element ' . $element . ' not found in CityData array.');
}
- } // END - foreac
+ }
}
/**
* @todo 0% done
*/
public function bootstrapInitCityDaemon () {
- $this->partialStub('Please add something here.');
+ DebugMiddleware::getSelfInstance()->partialStub('Please add something here.');
}
/**
$sectionsInstance = ManagerFactory::createManagerByType('city_sections');
// Call it's method and return value
- return $sectionsInstance->isMapPendingExpansion();
+ return $sectionsInstance->isSectionPendingExpansion();
}
/**
// Call it's method and return value
$sectionsInstance->expandMaps();
}
+
}