From: Roland Häder Date: Thu, 5 Nov 2020 23:03:47 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0072999fbd0ea82ee7d4a2e2934ab2f8cf67efc8;p=hub.git Continued: - introduced abstract classes BaseCruncherProducer and BaseMinerProducer as the cruncher won't have a miner registry key ready. - added missing namespaces - imported missing classes/interfaces Signed-off-by: Roland Häder --- diff --git a/application/hub/class_ApplicationHelper.php b/application/hub/class_ApplicationHelper.php index 11a15027d..df604326b 100644 --- a/application/hub/class_ApplicationHelper.php +++ b/application/hub/class_ApplicationHelper.php @@ -11,7 +11,6 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Loader\ClassLoader; use Org\Mxchange\CoreFramework\Manager\ManageableApplication; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Registry\Registerable; use Org\Mxchange\CoreFramework\Template\CompileableTemplate; diff --git a/application/hub/classes/compressor/decorator/class_NetworkPackageCompressorDecorator.php b/application/hub/classes/compressor/decorator/class_NetworkPackageCompressorDecorator.php index 56c4e946b..d2a5ac585 100644 --- a/application/hub/classes/compressor/decorator/class_NetworkPackageCompressorDecorator.php +++ b/application/hub/classes/compressor/decorator/class_NetworkPackageCompressorDecorator.php @@ -5,7 +5,7 @@ namespace Org\Shipsimu\Hub\Network\Compressor\Package; // Import application-specific stuff use Org\Shipsimu\Hub\Generic\BaseHubSystem; -// Import framework-specific stuff +// Import framework stuff use Org\Mxchange\CoreFramework\Compressor\Compressor; /** diff --git a/application/hub/classes/cruncher/class_BaseHubCruncher.php b/application/hub/classes/cruncher/class_BaseHubCruncher.php index 5e6c50ef4..15771d133 100644 --- a/application/hub/classes/cruncher/class_BaseHubCruncher.php +++ b/application/hub/classes/cruncher/class_BaseHubCruncher.php @@ -3,6 +3,7 @@ namespace Org\Shipsimu\Hub\Cruncher; // Import application-specific stuff +use Org\Shipsimu\Hub\Factory\State\Cruncher\CruncherStateFactory; use Org\Shipsimu\Hub\Generic\BaseHubSystem; // Import framework stuff diff --git a/application/hub/classes/cruncher/mcrypt/.htaccess b/application/hub/classes/cruncher/mcrypt/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/application/hub/classes/cruncher/mcrypt/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/hub/classes/cruncher/mcrypt/class_HubMcryptCruncher.php b/application/hub/classes/cruncher/mcrypt/class_HubMcryptCruncher.php deleted file mode 100644 index 4ceaabda8..000000000 --- a/application/hub/classes/cruncher/mcrypt/class_HubMcryptCruncher.php +++ /dev/null @@ -1,156 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2011 - 2014 - 2018 Hub Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class HubMcryptCruncher extends BaseHubCruncher implements CruncherHelper, Registerable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - - // Set version number - $this->setVersion('0.0.0'); - } - - /** - * Creates an instance of this hub-cruncher class - * - * @return $cruncherInstance An instance of this hub-cruncher class - */ - public final static function createHubMcryptCruncher () { - // Get a new instance - $cruncherInstance = new HubMcryptCruncher(); - - // Return the instance - return $cruncherInstance; - } - - /** - * This method fills the in-buffer with (a) test unit(s) which are mainly - * used for development of the crunching part. They must be enabled in - * configuration, or else your cruncher runs out of WUs and waits for more - * to show up. - * - * In this method we already know that the in-buffer is going depleted so - * no need to double-check it here. - * - * @return void - */ - protected function fillInBufferQueueWithTestUnits () { - // Are test units enabled? - if ($this->getConfigInstance()->getConfigEntry('cruncher_test_units_enabled') == 'N') { - // They are disabled, so skip any further steps - return; - } elseif ($this->getStateInstance()->isCruncherStateVirgin()) { - // No virgin crunchers please, because they usually have no test units ready for crunching - return; - } - - // Get a test-unit generator instance - $generatorInstance = ObjectFactory::createObjectByConfiguredName('cruncher_test_unit_generator_class'); - - // We don't need an iterator here because we just need to generate some test units - for ($idx = 0; $idx < $this->getConfigInstance()->getConfigEntry('cruncher_max_text_unit_amount'); $idx++) { - // Get a test unit from it - $unitInstance = $generatorInstance->generateNextUnitInstance(); - - // ... and finally queue it to the in-buffer queue - $this->queueUnitInstanceToInBuffer($unitInstance); - } // END - for - } - - /** - * This method fills the in-buffer with (real) WUs which will be crunched - * and the result be sent back to the key producer instance. - * - * @return void - */ - protected function fillInBufferQueueWithWorkUnits () { - // This cruncher's state must not be one of these: 'virgin' - if ($this->getStateInstance()->isCruncherStateVirgin()) { - // We can silently skip here, until the generation is finished - return; - } // END - if - - // @TODO Implement this method - $this->partialStub('Please implement this method.'); - } - - /** - * Method to "bootstrap" the cruncher. This step does also apply provided - * command-line arguments stored in the request instance. No buffer queue - * will be initialized here, we only do "general" things here. - * - * @return void - * @todo Implement this method - */ - public function doBootstrapping () { - $this->partialStub('Please implement this method.'); - } - - /** - * Outputs the console teaser. This should only be executed on startup or - * full restarts. This method generates some space around the teaser. - * - * @return void - */ - public function outputConsoleTeaser () { - // Output all lines - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(' '); - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MCrypt Cruncher v' . $this->getVersion() . ' is starting ...'); - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Copyright (c) 2011 - 2014 - 2018 Hub Developer Team'); - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(' '); - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('This program comes with ABSOLUTELY NO WARRANTY; for details see docs/COPYING.'); - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('This is free software, and you are welcome to redistribute it under certain'); - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('conditions; see docs/COPYING for details.'); - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(' '); - } - - /** - * Add some cruncher-specific filters - * - * @param $controllerInstance An object of a Controller instance - * @param $responseInstance An object of a Responseable instance - * @return void - * @todo 0% done - */ - public function addExtraFilters (Controller $controllerInstance, Responseable $responseInstance) { - // Add some filters here - $this->partialStub('Please add some cruncher-specific filters, if required.'); - } -} - -// [EOF] -?> diff --git a/application/hub/classes/cruncher/openssl/.htaccess b/application/hub/classes/cruncher/openssl/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/classes/cruncher/openssl/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/classes/cruncher/openssl/class_HubOpenSslCruncher.php b/application/hub/classes/cruncher/openssl/class_HubOpenSslCruncher.php new file mode 100644 index 000000000..455ee4e1b --- /dev/null +++ b/application/hub/classes/cruncher/openssl/class_HubOpenSslCruncher.php @@ -0,0 +1,158 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2011 - 2014 - 2018 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class HubOpenSslCruncher extends BaseHubCruncher implements CruncherHelper, Registerable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set version number + $this->setVersion('0.0.0'); + } + + /** + * Creates an instance of this hub-cruncher class + * + * @return $cruncherInstance An instance of this hub-cruncher class + */ + public final static function createHubOpenSslCruncher () { + // Get a new instance + $cruncherInstance = new HubOpenSslCruncher(); + + // Return the instance + return $cruncherInstance; + } + + /** + * This method fills the in-buffer with (a) test unit(s) which are mainly + * used for development of the crunching part. They must be enabled in + * configuration, or else your cruncher runs out of WUs and waits for more + * to show up. + * + * In this method we already know that the in-buffer is going depleted so + * no need to double-check it here. + * + * @return void + */ + protected function fillInBufferQueueWithTestUnits () { + // Are test units enabled? + if ($this->getConfigInstance()->getConfigEntry('cruncher_test_units_enabled') == 'N') { + // They are disabled, so skip any further steps + return; + } elseif ($this->getStateInstance()->isCruncherStateVirgin()) { + // No virgin crunchers please, because they usually have no test units ready for crunching + return; + } + + // Get a test-unit generator instance + $generatorInstance = ObjectFactory::createObjectByConfiguredName('cruncher_test_unit_generator_class'); + + // We don't need an iterator here because we just need to generate some test units + for ($idx = 0; $idx < $this->getConfigInstance()->getConfigEntry('cruncher_max_text_unit_amount'); $idx++) { + // Get a test unit from it + $unitInstance = $generatorInstance->generateNextUnitInstance(); + + // ... and finally queue it to the in-buffer queue + $this->queueUnitInstanceToInBuffer($unitInstance); + } // END - for + } + + /** + * This method fills the in-buffer with (real) WUs which will be crunched + * and the result be sent back to the key producer instance. + * + * @return void + */ + protected function fillInBufferQueueWithWorkUnits () { + // This cruncher's state must not be one of these: 'virgin' + if ($this->getStateInstance()->isCruncherStateVirgin()) { + // We can silently skip here, until the generation is finished + return; + } // END - if + + // @TODO Implement this method + $this->partialStub('Please implement this method.'); + } + + /** + * Method to "bootstrap" the cruncher. This step does also apply provided + * command-line arguments stored in the request instance. No buffer queue + * will be initialized here, we only do "general" things here. + * + * @return void + * @todo Implement this method + */ + public function doBootstrapping () { + $this->partialStub('Please implement this method.'); + } + + /** + * Outputs the console teaser. This should only be executed on startup or + * full restarts. This method generates some space around the teaser. + * + * @return void + */ + public function outputConsoleTeaser () { + // Output all lines + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(' '); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('OpenSSL Cruncher v' . $this->getVersion() . ' is starting ...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Copyright (c) 2011 - 2014 - 2018 Hub Developer Team'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(' '); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('This program comes with ABSOLUTELY NO WARRANTY; for details see docs/COPYING.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('This is free software, and you are welcome to redistribute it under certain'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('conditions; see docs/COPYING for details.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(' '); + } + + /** + * Add some cruncher-specific filters + * + * @param $controllerInstance An object of a Controller instance + * @param $responseInstance An object of a Responseable instance + * @return void + * @todo 0% done + */ + public function addExtraFilters (Controller $controllerInstance, Responseable $responseInstance) { + // Add some filters here + $this->partialStub('Please add some cruncher-specific filters, if required.'); + } + +} diff --git a/application/hub/classes/database/frontend/cruncher/class_CruncherUnitDatabaseWrapper.php b/application/hub/classes/database/frontend/cruncher/class_CruncherUnitDatabaseWrapper.php index 850d7ea78..fcffd06fe 100644 --- a/application/hub/classes/database/frontend/cruncher/class_CruncherUnitDatabaseWrapper.php +++ b/application/hub/classes/database/frontend/cruncher/class_CruncherUnitDatabaseWrapper.php @@ -4,6 +4,8 @@ namespace Org\Shipsimu\Hub\Database\Frontend\Cruncher\Unit; // Import application-specific stuff use Org\Shipsimu\Hub\Database\Frontend\BaseHubDatabaseWrapper; +use Org\Shipsimu\Hub\Database\Frontend\Unit\UnitDatabaseWrapper; +use Org\Shipsimu\Hub\Producer\Cruncher\Unit\BaseUnitProducer; // Import framework stuff use Org\Mxchange\CoreFramework\Factory\ObjectFactory; diff --git a/application/hub/classes/discovery/recipient/class_BaseRecipientDiscovery.php b/application/hub/classes/discovery/recipient/class_BaseRecipientDiscovery.php index 1573c1433..3c71dc22e 100644 --- a/application/hub/classes/discovery/recipient/class_BaseRecipientDiscovery.php +++ b/application/hub/classes/discovery/recipient/class_BaseRecipientDiscovery.php @@ -2,7 +2,7 @@ // Own namespace namespace Org\Shipsimu\Hub\Discovery\Recipient; -// Import framework-specific stuff +// Import framework stuff use Org\Shipsimu\Hub\Discovery\Node\BaseNodeDiscovery; use Org\Shipsimu\Hub\Discovery\Recipient\DiscoverableRecipient; use Org\Shipsimu\Hub\Factory\Lists\Recipient\RecipientListFactory; diff --git a/application/hub/classes/factories/source/units/class_UnitSourceFactory.php b/application/hub/classes/factories/source/units/class_UnitSourceFactory.php index 5fcf24915..fff207404 100644 --- a/application/hub/classes/factories/source/units/class_UnitSourceFactory.php +++ b/application/hub/classes/factories/source/units/class_UnitSourceFactory.php @@ -1,6 +1,6 @@ getInstance('cruncher'); diff --git a/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapBufferQueueInitializerFilter.php b/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapBufferQueueInitializerFilter.php index 2c7f5a340..f9c00574f 100644 --- a/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapBufferQueueInitializerFilter.php +++ b/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapBufferQueueInitializerFilter.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Filter\Bootstrap\Cruncher\Queue; +// Import application-specific stuff +use Org\Shipsimu\Hub\Cruncher\Filter\BaseCruncherFilter; + // Import framework stuff use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; diff --git a/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapExtraBootstrappingFilter.php b/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapExtraBootstrappingFilter.php index edd80bfdd..bf44749c6 100644 --- a/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapExtraBootstrappingFilter.php +++ b/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapExtraBootstrappingFilter.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Filter\Bootstrap\Cruncher\Extra; +// Import application-specific stuff +use Org\Shipsimu\Hub\Cruncher\Filter\BaseCruncherFilter; + // Import framework stuff use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; diff --git a/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapGenericActivationFilter.php b/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapGenericActivationFilter.php index 69bee2f80..2ec30086b 100644 --- a/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapGenericActivationFilter.php +++ b/application/hub/classes/filter/bootstrap/cruncher/class_CruncherBootstrapGenericActivationFilter.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Filter\Bootstrap\Cruncher\Activation; +// Import application-specific stuff +use Org\Shipsimu\Hub\Cruncher\Filter\BaseCruncherFilter; + // Import framework stuff use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; diff --git a/application/hub/classes/filter/cruncher/class_CruncherInitializationFilter.php b/application/hub/classes/filter/cruncher/class_CruncherInitializationFilter.php index 029628f1e..2457a7f5f 100644 --- a/application/hub/classes/filter/cruncher/class_CruncherInitializationFilter.php +++ b/application/hub/classes/filter/cruncher/class_CruncherInitializationFilter.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Cruncher\Filter\Initialization; +// Import application-specific stuff +use Org\Shipsimu\Hub\Cruncher\Filter\BaseCruncherFilter; + // Import framework stuff use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Filter\Filterable; @@ -77,12 +80,12 @@ class CruncherInitializationFilter extends BaseCruncherFilter implements Filtera } // Now convert the cruncher-mode in a class name - $className = 'Hub' . self::convertToClassName($cruncherMode) . 'Cruncher'; + $configEntry = sprintf('hub_%s_cruncher_mode_class', $cruncherMode); // And try to instance it try { // Get an instance - $cruncherInstance = ObjectFactory::createObjectByName($className); + $cruncherInstance = ObjectFactory::createObjectByConfiguredName($configEntry); // Get a registry $applicationInstance = GenericRegistry::getRegistry()->getInstance('application'); diff --git a/application/hub/classes/filter/cruncher/class_CruncherPhpRequirementsFilter.php b/application/hub/classes/filter/cruncher/class_CruncherPhpRequirementsFilter.php index 8e476e503..718fc0b5a 100644 --- a/application/hub/classes/filter/cruncher/class_CruncherPhpRequirementsFilter.php +++ b/application/hub/classes/filter/cruncher/class_CruncherPhpRequirementsFilter.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Cruncher\Filter\Requirements; +// Import application-specific stuff +use Org\Shipsimu\Hub\Cruncher\Filter\BaseCruncherFilter; + // Import framework stuff use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Request\Requestable; diff --git a/application/hub/classes/filter/cruncher/class_CruncherWelcomeTeaserFilter.php b/application/hub/classes/filter/cruncher/class_CruncherWelcomeTeaserFilter.php index 6ce151b2a..92b5e8dc8 100644 --- a/application/hub/classes/filter/cruncher/class_CruncherWelcomeTeaserFilter.php +++ b/application/hub/classes/filter/cruncher/class_CruncherWelcomeTeaserFilter.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Cruncher\Filter\WelcomeTeaser; +// Import application-specific stuff +use Org\Shipsimu\Hub\Cruncher\Filter\BaseCruncherFilter; + // Import framework stuff use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; diff --git a/application/hub/classes/filter/shutdown/cruncher/class_CruncherShutdownFilter.php b/application/hub/classes/filter/shutdown/cruncher/class_CruncherShutdownFilter.php index 8d2a1e9bb..3c94ef7cc 100644 --- a/application/hub/classes/filter/shutdown/cruncher/class_CruncherShutdownFilter.php +++ b/application/hub/classes/filter/shutdown/cruncher/class_CruncherShutdownFilter.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Filter\Shutdown\Cruncher; +// Import application-specific stuff +use Org\Shipsimu\Hub\Cruncher\Filter\BaseCruncherFilter; + // Import framework stuff use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; diff --git a/application/hub/classes/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php b/application/hub/classes/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php index 4422e11ba..0f4e3d108 100644 --- a/application/hub/classes/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php +++ b/application/hub/classes/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Filter\Initializer\Cruncher\Handler\Task; +// Import application-specific stuff +use Org\Shipsimu\Hub\Cruncher\Filter\BaseCruncherFilter; + // Import framework stuff use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Filter\Filterable; diff --git a/application/hub/classes/handler/data/answer-status/class_BaseAnswerStatusHandler.php b/application/hub/classes/handler/data/answer-status/class_BaseAnswerStatusHandler.php index a6b72ad74..e0c13216a 100644 --- a/application/hub/classes/handler/data/answer-status/class_BaseAnswerStatusHandler.php +++ b/application/hub/classes/handler/data/answer-status/class_BaseAnswerStatusHandler.php @@ -2,7 +2,7 @@ // Own namespace namespace Org\Shipsimu\Hub\Handler\Status\Answer; -// Import framework-specific stuff +// Import framework stuff use Org\Shipsimu\Hub\Handler\Data\BaseDataHandler; /** diff --git a/application/hub/classes/helper/messages/crypto/class_CryptoRandomUnitMessageHelper.php b/application/hub/classes/helper/messages/crypto/class_CryptoRandomUnitMessageHelper.php index bb952e00a..71c999992 100644 --- a/application/hub/classes/helper/messages/crypto/class_CryptoRandomUnitMessageHelper.php +++ b/application/hub/classes/helper/messages/crypto/class_CryptoRandomUnitMessageHelper.php @@ -3,7 +3,12 @@ namespace Org\Shipsimu\Hub\Helper\Crypto\Message\RandomUnit; // Import application-specific stuff -use Org\Shipsimu\Hub\Factory\Source\Unit\UnitSourceFactory; +use Org\Shipsimu\Hub\Factory\Crawler\Source\Unit\UnitSourceFactory; +use Org\Shipsimu\Hub\Helper\Message\BaseMessageHelper; +use Org\Shipsimu\Hub\Helper\Message\MessageHelper; + +// Import framework stuff +use Org\Mxchange\CoreFramework\Factory\ObjectFactory; /** * A CryptoRandom message helper @@ -42,7 +47,7 @@ class CryptoRandomUnitMessageHelper extends BaseMessageHelper implements Message * Creates an instance of this class * * @param $sourceType Type of the source - * @return $messageInstance An instance of a UnitHelper class + * @return $messageInstance An instance of a MessageHelper class */ public final static function createCryptoRandomUnitMessageHelper ($sourceType) { // Get new instance diff --git a/application/hub/classes/helper/work_units/cruncher/class_CruncherTestUnitHelper.php b/application/hub/classes/helper/work_units/cruncher/class_CruncherTestUnitHelper.php index 399911687..9a16298fd 100644 --- a/application/hub/classes/helper/work_units/cruncher/class_CruncherTestUnitHelper.php +++ b/application/hub/classes/helper/work_units/cruncher/class_CruncherTestUnitHelper.php @@ -1,4 +1,11 @@ * @version 0.0.0 diff --git a/application/hub/classes/producer/class_BaseProducer.php b/application/hub/classes/producer/class_BaseProducer.php index a12b53714..c90269965 100644 --- a/application/hub/classes/producer/class_BaseProducer.php +++ b/application/hub/classes/producer/class_BaseProducer.php @@ -66,12 +66,6 @@ abstract class BaseProducer extends BaseHubSystem { // Initialize all producers $this->initProducer(); - // Get miner instance - $minerInstance = GenericRegistry::getRegistry()->getInstance('miner'); - - // Change state to next state - $minerInstance->blockProducerHasInitialized($this); - // Initialize work queue (out-going, produced items) $this->initWorkQueue(); } diff --git a/application/hub/classes/producer/cruncher/class_BaseCruncherProducer.php b/application/hub/classes/producer/cruncher/class_BaseCruncherProducer.php new file mode 100644 index 000000000..7efeeb97d --- /dev/null +++ b/application/hub/classes/producer/cruncher/class_BaseCruncherProducer.php @@ -0,0 +1,51 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2018 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 . + */ +abstract class BaseCruncherProducer extends BaseProducer { + /** + * Protected constructor + * + * @param $className Complete class name + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + + // Get cruncher instance + $cruncherInstance = GenericRegistry::getRegistry()->getInstance('cruncher'); + + // Change state to next state + $cruncherInstance->blockProducerHasInitialized($this); + } + +} diff --git a/application/hub/classes/producer/cruncher/class_BaseKeyProducer.php b/application/hub/classes/producer/cruncher/class_BaseKeyProducer.php deleted file mode 100644 index 0a6d7354b..000000000 --- a/application/hub/classes/producer/cruncher/class_BaseKeyProducer.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2018 Hub Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -abstract class BaseKeyProducer extends BaseProducer { - /** - * Protected constructor - * - * @param $className Name of the class - * @return void - */ - protected function __construct ($className) { - // Call parent constructor - parent::__construct($className); - - // Init key producer - } - -} diff --git a/application/hub/classes/producer/cruncher/class_BaseUnitProducer.php b/application/hub/classes/producer/cruncher/class_BaseUnitProducer.php deleted file mode 100644 index 395649cdb..000000000 --- a/application/hub/classes/producer/cruncher/class_BaseUnitProducer.php +++ /dev/null @@ -1,55 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2018 Hub Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -abstract class BaseUnitProducer extends BaseProducer { - /** - * Work/test unit status - */ - const UNIT_STATUS_AVAILABLE = 'available'; // Available for crunching - const UNIT_STATUS_PENDING = 'pending'; // Is being crunched at the moment - const UNIT_STATUS_DONE = 'done'; // Is already crunched/finished - - /** - * Work or test unit? - */ - const UNIT_TYPE_TEST_UNIT = 'test_unit'; - const UNIT_TYPE_TEST_WORK = 'work_unit'; - - /** - * Protected constructor - * - * @param $className Name of the class - * @return void - */ - protected function __construct ($className) { - // Call parent constructor - parent::__construct($className); - } - -} diff --git a/application/hub/classes/producer/cruncher/keys/class_BaseKeyProducer.php b/application/hub/classes/producer/cruncher/keys/class_BaseKeyProducer.php new file mode 100644 index 000000000..309e06d3b --- /dev/null +++ b/application/hub/classes/producer/cruncher/keys/class_BaseKeyProducer.php @@ -0,0 +1,44 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2018 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +abstract class BaseKeyProducer extends BaseCruncherProducer { + /** + * Protected constructor + * + * @param $className Name of the class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + + // Init key producer + } + +} diff --git a/application/hub/classes/producer/cruncher/keys/class_CruncherKeyProducer.php b/application/hub/classes/producer/cruncher/keys/class_CruncherKeyProducer.php deleted file mode 100644 index 44a008c71..000000000 --- a/application/hub/classes/producer/cruncher/keys/class_CruncherKeyProducer.php +++ /dev/null @@ -1,137 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2011 - 2014 - 2018 Hub Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class CruncherKeyProducer extends BaseKeyProducer implements KeyProducer, Registerable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @return $producerInstance An instance of a Producer class - */ - public final static function createCruncherKeyProducer () { - // Get new instance - $producerInstance = new CruncherKeyProducer(); - - // Get a helper instance, we now only need this for the key iterator - $helperInstance = ObjectFactory::createObjectByConfiguredName('crypto_random_message_helper_class', array('test')); - - // Next get an iterator, again the helper will do that for us - $iteratorInstance = $helperInstance->getKeyIterator(); - - // Set it in the producer - $producerInstance->setIteratorInstance($iteratorInstance); - - // Return the prepared instance - return $producerInstance; - } - - /** - * Initializes the producer. This method satisfies the abstract BaseProducer - * class. - * - * @return void - * @todo Find something for init phase of this key producer - */ - protected function initProducer () { - } - - /** - * Initializes the executor, whatever it does. - * - * @return void - * @todo 0% done - */ - public function initExecutor (Stateable $stateInstance) { - $this->partialStub('Maybe implement this method?'); - } - - /** - * Produces some keys and pushes them onto the queue - * - * @param $stateInstance An instance of a Stateable instance - * @return void - * @todo ~30% done - */ - public function produceKeys (Stateable $stateInstance) { - // Is this cruncher virgin? - if (!$stateInstance->isCruncherStateVirgin()) { - // This cruncher is not virgin, so skip it - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PRODUCER: The cruncher is not virgin. stateInstance=' . $stateInstance->__toString() . ''); - return; - } elseif (!$this->getIteratorInstance()->valid()) { - // This producer's iterator has finished its assignment - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PRODUCER: Finished creating keys. iteratorInstance=' . $this->getIteratorInstance()->__toString() . ''); - return; - } - - /* - * Now we need to create an iterator, just as for the work units, - * to create new keys from the encrypted message. The iterator will - * not iterate over an object nor a collection. It will instead - * encapsulate the "key production" into a class and not in a simple - * for() loop. These keys then needs to be bundled into test units - * and stored to database for later re-usage. - */ - - /* - * Get current key (which is not the key of the iterator) This is always - * an ASCII string. - */ - $currentKey = $this->getIteratorInstance()->current(); - - // Add it to the out-going work queue - $this->addValueToOutgoingQueue($currentKey); - - // Is the per-work unit limit reached? - if ($this->isOutgoingQueueLimitReached('cruncher_per_unit_key_limit')) { - // @TODO Send the produced key bundle to the unit producer's input queue - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('currentKey(b64)="' . base64_encode($currentKey) . '" needs to be processed.'); - - // At last re-init the stack - $this->initOutgoingQueue(); - } // END - if - - // Continue with next one - $this->getIteratorInstance()->next(); - } -} diff --git a/application/hub/classes/producer/cruncher/keys/cruncher/.htaccess b/application/hub/classes/producer/cruncher/keys/cruncher/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/classes/producer/cruncher/keys/cruncher/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/classes/producer/cruncher/keys/cruncher/class_CruncherKeyProducer.php b/application/hub/classes/producer/cruncher/keys/cruncher/class_CruncherKeyProducer.php new file mode 100644 index 000000000..7f36ee430 --- /dev/null +++ b/application/hub/classes/producer/cruncher/keys/cruncher/class_CruncherKeyProducer.php @@ -0,0 +1,139 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2011 - 2014 - 2018 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class CruncherKeyProducer extends BaseKeyProducer implements KeyProducer, Registerable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $producerInstance An instance of a Producer class + */ + public final static function createCruncherKeyProducer () { + // Get new instance + $producerInstance = new CruncherKeyProducer(); + + // Get a helper instance, we now only need this for the key iterator + $helperInstance = ObjectFactory::createObjectByConfiguredName('crypto_random_message_helper_class', array('test')); + + // Next get an iterator, again the helper will do that for us + $iteratorInstance = $helperInstance->getKeyIterator(); + + // Set it in the producer + $producerInstance->setIteratorInstance($iteratorInstance); + + // Return the prepared instance + return $producerInstance; + } + + /** + * Initializes the producer. This method satisfies the abstract BaseProducer + * class. + * + * @return void + * @todo Find something for init phase of this key producer + */ + protected function initProducer () { + $this->partialStub('Maybe add something here?'); + } + + /** + * Initializes the executor, whatever it does. + * + * @return void + * @todo 0% done + */ + public function initExecutor (Stateable $stateInstance) { + $this->partialStub('Maybe implement this method?'); + } + + /** + * Produces some keys and pushes them onto the queue + * + * @param $stateInstance An instance of a Stateable instance + * @return void + * @todo ~30% done + */ + public function produceKeys (Stateable $stateInstance) { + // Is this cruncher virgin? + if (!$stateInstance->isCruncherStateVirgin()) { + // This cruncher is not virgin, so skip it + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PRODUCER: The cruncher is not virgin. stateInstance=' . $stateInstance->__toString() . ''); + return; + } elseif (!$this->getIteratorInstance()->valid()) { + // This producer's iterator has finished its assignment + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PRODUCER: Finished creating keys. iteratorInstance=' . $this->getIteratorInstance()->__toString() . ''); + return; + } + + /* + * Now we need to create an iterator, just as for the work units, + * to create new keys from the encrypted message. The iterator will + * not iterate over an object nor a collection. It will instead + * encapsulate the "key production" into a class and not in a simple + * for() loop. These keys then needs to be bundled into test units + * and stored to database for later re-usage. + */ + + /* + * Get current key (which is not the key of the iterator) This is always + * an ASCII string. + */ + $currentKey = $this->getIteratorInstance()->current(); + + // Add it to the out-going work queue + $this->addValueToOutgoingQueue($currentKey); + + // Is the per-work unit limit reached? + if ($this->isOutgoingQueueLimitReached('cruncher_per_unit_key_limit')) { + // @TODO Send the produced key bundle to the unit producer's input queue + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('currentKey(b64)="' . base64_encode($currentKey) . '" needs to be processed.'); + + // At last re-init the stack + $this->initOutgoingQueue(); + } // END - if + + // Continue with next one + $this->getIteratorInstance()->next(); + } +} diff --git a/application/hub/classes/producer/cruncher/work_units/class_BaseUnitProducer.php b/application/hub/classes/producer/cruncher/work_units/class_BaseUnitProducer.php new file mode 100644 index 000000000..68f4ef9b7 --- /dev/null +++ b/application/hub/classes/producer/cruncher/work_units/class_BaseUnitProducer.php @@ -0,0 +1,55 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2018 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +abstract class BaseUnitProducer extends BaseCruncherProducer { + /** + * Work/test unit status + */ + const UNIT_STATUS_AVAILABLE = 'available'; // Available for crunching + const UNIT_STATUS_PENDING = 'pending'; // Is being crunched at the moment + const UNIT_STATUS_DONE = 'done'; // Is already crunched/finished + + /** + * Work or test unit? + */ + const UNIT_TYPE_TEST_UNIT = 'test_unit'; + const UNIT_TYPE_TEST_WORK = 'work_unit'; + + /** + * Protected constructor + * + * @param $className Name of the class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + +} diff --git a/application/hub/classes/producer/cruncher/work_units/class_CruncherTestUnitProducer.php b/application/hub/classes/producer/cruncher/work_units/class_CruncherTestUnitProducer.php deleted file mode 100644 index 63a954567..000000000 --- a/application/hub/classes/producer/cruncher/work_units/class_CruncherTestUnitProducer.php +++ /dev/null @@ -1,130 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2011 - 2014 - 2018 Hub Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class CruncherTestUnitProducer extends BaseUnitProducer implements UnitProducer, Registerable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @return $producerInstance An instance of a Producer class - */ - public final static function createCruncherTestUnitProducer () { - // Get new instance - $producerInstance = new CruncherTestUnitProducer(); - - // Test units have a helper class that wraps the source - $helperInstance = ObjectFactory::createObjectByConfiguredName('crypto_random_message_helper_class', array('test')); - - // So set it in the producer - $producerInstance->setHelperInstance($helperInstance); - - // Return the prepared instance - return $producerInstance; - } - - /** - * Initializes the producer. This method satisfies the abstract BaseProducer - * class. - * - * @return void - */ - protected function initProducer () { - // Get a XML template instance - $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('cruncher_test_unit_producer_template_class'); - - // Load the template - $templateInstance->loadXmlTemplate(); - - // Render the XML content - $templateInstance->renderXmlContent(); - - // And set it in this cruncher - $this->setTemplateInstance($templateInstance); - } - - /** - * Prepares the produces of some test units and pushes them onto the queue - * - * @param $stateInstance An instance of a Stateable instance - * @return void - * @todo ~60% done - */ - public function initUnitProduction (Stateable $stateInstance) { - // First get a database wrapper because we want to permanently store test units - $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('cruncher_unit_db_wrapper_class'); - - // Do we have some entries? - if ($wrapperInstance->isTestUnitProduced()) { - // Entries found - // @TODO Unfinished work here - $this->debugInstance(sprintf('[%s:%d]: stateInstance=%s - Unfinished!', __METHOD__, __LINE__, $stateInstance->__toString())); - - // The state must be changed because ... - $stateInstance->someFooStateChange(); - } else { - // Get an encrypted, random message from our source - $encryptedMessage = $this->getHelperInstance()->generateRandomMessage(); - - // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PRODUCER: An encrypted, random message has been generated. Generating keys ...'); - - // Set the encrypted message in the template instance - $this->getTemplateInstance()->assignVariable('encrypted_message', $encryptedMessage); - - // The state must be changed because we have a new message - $stateInstance->encryptedMessageGenerated(); - } - } - - /** - * Initializes the executor, whatever it does. - * - * @return void - * @todo Maybe unfinished - */ - public function initExecutor (Stateable $stateInstance) { - $this->partialStub('Maybe implement this method?'); - } -} diff --git a/application/hub/classes/producer/cruncher/work_units/cruncher/.htaccess b/application/hub/classes/producer/cruncher/work_units/cruncher/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/classes/producer/cruncher/work_units/cruncher/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/classes/producer/cruncher/work_units/cruncher/class_CruncherTestUnitProducer.php b/application/hub/classes/producer/cruncher/work_units/cruncher/class_CruncherTestUnitProducer.php new file mode 100644 index 000000000..45cf0b017 --- /dev/null +++ b/application/hub/classes/producer/cruncher/work_units/cruncher/class_CruncherTestUnitProducer.php @@ -0,0 +1,131 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2011 - 2014 - 2018 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class CruncherTestUnitProducer extends BaseUnitProducer implements UnitProducer, Registerable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $producerInstance An instance of a Producer class + */ + public final static function createCruncherTestUnitProducer () { + // Get new instance + $producerInstance = new CruncherTestUnitProducer(); + + // Test units have a helper class that wraps the source + $helperInstance = ObjectFactory::createObjectByConfiguredName('crypto_random_message_helper_class', array('test')); + + // So set it in the producer + $producerInstance->setHelperInstance($helperInstance); + + // Return the prepared instance + return $producerInstance; + } + + /** + * Initializes the producer. This method satisfies the abstract BaseProducer + * class. + * + * @return void + */ + protected function initProducer () { + // Get a XML template instance + $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('cruncher_test_unit_producer_template_class'); + + // Load the template + $templateInstance->loadXmlTemplate(); + + // Render the XML content + $templateInstance->renderXmlContent(); + + // And set it in this cruncher + $this->setTemplateInstance($templateInstance); + } + + /** + * Prepares the produces of some test units and pushes them onto the queue + * + * @param $stateInstance An instance of a Stateable instance + * @return void + * @todo ~60% done + */ + public function initUnitProduction (Stateable $stateInstance) { + // First get a database wrapper because we want to permanently store test units + $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('cruncher_unit_db_wrapper_class'); + + // Do we have some entries? + if ($wrapperInstance->isTestUnitProduced()) { + // Entries found + // @TODO Unfinished work here + $this->debugInstance(sprintf('[%s:%d]: stateInstance=%s - Unfinished!', __METHOD__, __LINE__, $stateInstance->__toString())); + + // The state must be changed because ... + $stateInstance->someFooStateChange(); + } else { + // Get an encrypted, random message from our source + $encryptedMessage = $this->getHelperInstance()->generateRandomMessage(); + + // Debug message + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PRODUCER: An encrypted, random message has been generated. Generating keys ...'); + + // Set the encrypted message in the template instance + $this->getTemplateInstance()->assignVariable('encrypted_message', $encryptedMessage); + + // The state must be changed because we have a new message + $stateInstance->encryptedMessageGenerated(); + } + } + + /** + * Initializes the executor, whatever it does. + * + * @return void + * @todo Maybe unfinished + */ + public function initExecutor (Stateable $stateInstance) { + $this->partialStub('Maybe implement this method?'); + } +} diff --git a/application/hub/classes/producer/miner/blocks/class_BaseBlockProducer.php b/application/hub/classes/producer/miner/blocks/class_BaseBlockProducer.php new file mode 100644 index 000000000..1e0bd9b10 --- /dev/null +++ b/application/hub/classes/producer/miner/blocks/class_BaseBlockProducer.php @@ -0,0 +1,45 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2014 - 2018 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +abstract class BaseBlockProducer extends BaseMinerProducer { + /** + * Block status + */ + + /** + * Protected constructor + * + * @param $className Name of the class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + +} diff --git a/application/hub/classes/producer/miner/blocks/class_MinerRealGenesisBlockProducer.php b/application/hub/classes/producer/miner/blocks/class_MinerRealGenesisBlockProducer.php deleted file mode 100644 index f85425427..000000000 --- a/application/hub/classes/producer/miner/blocks/class_MinerRealGenesisBlockProducer.php +++ /dev/null @@ -1,107 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2011 - 2014 - 2018 Hub Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class MinerRealGenesisBlockProducer extends BaseBlockProducer implements BlockProducer, Registerable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @return $producerInstance An instance of a Producer class - */ - public final static function createMinerRealGenesisBlockProducer () { - // Get new instance - $producerInstance = new MinerRealGenesisBlockProducer(); - - // Get a (minable) hash block instance - $minableInstance = ObjectFactory::createObjectByConfiguredName('miner_real_hash_block_class'); - - // Set it here - $producerInstance->setMinableInstance($minableInstance); - - // Return the prepared instance - return $producerInstance; - } - - /** - * Initializes the producer. This method satisfies the abstract BaseProducer - * class. - * - * @return void - * @todo 0% done - */ - protected function initProducer () { - $this->partialStub('Please implement this method.'); - } - - /** - * Initializes the executor, whatever it does. - * - * @return void - * @todo 0% done - */ - public function initExecutor (Stateable $stateInstance) { - $this->partialStub('Please implement this method.'); - } - - /** - * Prepares the produces of some test units and pushes them onto the queue - * - * @param $stateInstance An instance of a Stateable instance - * @return void - * @todo ~5% done - */ - public function prepareBlockProduction (Stateable $stateInstance) { - // The state must be 'booting' - $stateInstance->validateMinerStateIsBooting(); - - /* - * Now that the miner is booting a genesis block for real mining can be - * created. - */ - } -} - -// [EOF] -?> diff --git a/application/hub/classes/producer/miner/blocks/class_MinerTestGenesisBlockProducer.php b/application/hub/classes/producer/miner/blocks/class_MinerTestGenesisBlockProducer.php deleted file mode 100644 index 1c5b16f97..000000000 --- a/application/hub/classes/producer/miner/blocks/class_MinerTestGenesisBlockProducer.php +++ /dev/null @@ -1,106 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2011 - 2014 - 2018 Hub Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class MinerTestGenesisBlockProducer extends BaseBlockProducer implements BlockProducer, Registerable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @return $producerInstance An instance of a Producer class - */ - public final static function createMinerTestGenesisBlockProducer () { - // Get new instance - $producerInstance = new MinerTestGenesisBlockProducer(); - - // Get a (minable) hash block instance - $minableInstance = ObjectFactory::createObjectByConfiguredName('miner_test_hash_block_class'); - - // Set it here - $producerInstance->setMinableInstance($minableInstance); - - // Return the prepared instance - return $producerInstance; - } - - /** - * Initializes the producer. This method satisfies the abstract BaseProducer - * class. - * - * @return void - * @todo 0% done - */ - protected function initProducer () { - $this->partialStub('Please implement this method.'); - } - - /** - * Initializes the executor, whatever it does. - * - * @return void - * @todo 0% done - */ - public function initExecutor (Stateable $stateInstance) { - $this->partialStub('Please implement this method.'); - } - - /** - * Prepares the produces of some test units and pushes them onto the queue - * - * @param $stateInstance An instance of a Stateable instance - * @return void - * @todo ~5% done - */ - public function prepareBlockProduction (Stateable $stateInstance) { - // The state must be 'booting' - $stateInstance->validateMinerStateIsBooting(); - - /* - * Now that the miner is booting a "genesis" block for testing purposes - * can be created. The real "genesis" block will be created differently - * to this. - */ - } - -} diff --git a/application/hub/classes/producer/miner/blocks/miner/.htaccess b/application/hub/classes/producer/miner/blocks/miner/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/classes/producer/miner/blocks/miner/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/classes/producer/miner/blocks/miner/class_MinerRealGenesisBlockProducer.php b/application/hub/classes/producer/miner/blocks/miner/class_MinerRealGenesisBlockProducer.php new file mode 100644 index 000000000..6d4420e53 --- /dev/null +++ b/application/hub/classes/producer/miner/blocks/miner/class_MinerRealGenesisBlockProducer.php @@ -0,0 +1,107 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2011 - 2014 - 2018 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class MinerRealGenesisBlockProducer extends BaseBlockProducer implements BlockProducer, Registerable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $producerInstance An instance of a Producer class + */ + public final static function createMinerRealGenesisBlockProducer () { + // Get new instance + $producerInstance = new MinerRealGenesisBlockProducer(); + + // Get a (minable) hash block instance + $minableInstance = ObjectFactory::createObjectByConfiguredName('miner_real_hash_block_class'); + + // Set it here + $producerInstance->setMinableInstance($minableInstance); + + // Return the prepared instance + return $producerInstance; + } + + /** + * Initializes the producer. This method satisfies the abstract BaseProducer + * class. + * + * @return void + * @todo 0% done + */ + protected function initProducer () { + $this->partialStub('Please implement this method.'); + } + + /** + * Initializes the executor, whatever it does. + * + * @return void + * @todo 0% done + */ + public function initExecutor (Stateable $stateInstance) { + $this->partialStub('Please implement this method.'); + } + + /** + * Prepares the produces of some test units and pushes them onto the queue + * + * @param $stateInstance An instance of a Stateable instance + * @return void + * @todo ~5% done + */ + public function prepareBlockProduction (Stateable $stateInstance) { + // The state must be 'booting' + $stateInstance->validateMinerStateIsBooting(); + + /* + * Now that the miner is booting a genesis block for real mining can be + * created. + */ + } +} + +// [EOF] +?> diff --git a/application/hub/classes/producer/miner/blocks/miner/class_MinerTestGenesisBlockProducer.php b/application/hub/classes/producer/miner/blocks/miner/class_MinerTestGenesisBlockProducer.php new file mode 100644 index 000000000..f092c4647 --- /dev/null +++ b/application/hub/classes/producer/miner/blocks/miner/class_MinerTestGenesisBlockProducer.php @@ -0,0 +1,106 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2011 - 2014 - 2018 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class MinerTestGenesisBlockProducer extends BaseBlockProducer implements BlockProducer, Registerable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $producerInstance An instance of a Producer class + */ + public final static function createMinerTestGenesisBlockProducer () { + // Get new instance + $producerInstance = new MinerTestGenesisBlockProducer(); + + // Get a (minable) hash block instance + $minableInstance = ObjectFactory::createObjectByConfiguredName('miner_test_hash_block_class'); + + // Set it here + $producerInstance->setMinableInstance($minableInstance); + + // Return the prepared instance + return $producerInstance; + } + + /** + * Initializes the producer. This method satisfies the abstract BaseProducer + * class. + * + * @return void + * @todo 0% done + */ + protected function initProducer () { + $this->partialStub('Please implement this method.'); + } + + /** + * Initializes the executor, whatever it does. + * + * @return void + * @todo 0% done + */ + public function initExecutor (Stateable $stateInstance) { + $this->partialStub('Please implement this method.'); + } + + /** + * Prepares the produces of some test units and pushes them onto the queue + * + * @param $stateInstance An instance of a Stateable instance + * @return void + * @todo ~5% done + */ + public function prepareBlockProduction (Stateable $stateInstance) { + // The state must be 'booting' + $stateInstance->validateMinerStateIsBooting(); + + /* + * Now that the miner is booting a "genesis" block for testing purposes + * can be created. The real "genesis" block will be created differently + * to this. + */ + } + +} diff --git a/application/hub/classes/producer/miner/class_BaseBlockProducer.php b/application/hub/classes/producer/miner/class_BaseBlockProducer.php deleted file mode 100644 index eeec00821..000000000 --- a/application/hub/classes/producer/miner/class_BaseBlockProducer.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2014 - 2018 Hub Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -abstract class BaseBlockProducer extends BaseProducer { - /** - * Block status - */ - - /** - * Protected constructor - * - * @param $className Name of the class - * @return void - */ - protected function __construct ($className) { - // Call parent constructor - parent::__construct($className); - } - -} diff --git a/application/hub/classes/producer/miner/class_BaseMinerProducer.php b/application/hub/classes/producer/miner/class_BaseMinerProducer.php new file mode 100644 index 000000000..55365c43a --- /dev/null +++ b/application/hub/classes/producer/miner/class_BaseMinerProducer.php @@ -0,0 +1,48 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2018 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 . + */ +abstract class BaseMinerProducer extends BaseProducer { + /** + * Protected constructor + * + * @param $className Complete class name + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + + // Get miner instance + $minerInstance = GenericRegistry::getRegistry()->getInstance('miner'); + + // Change state to next state + $minerInstance->blockProducerHasInitialized($this); + } + +} diff --git a/application/hub/classes/states/cruncher/init/class_CruncherInitState.php b/application/hub/classes/states/cruncher/init/class_CruncherInitState.php index 5cb6832e9..0ab4cc83d 100644 --- a/application/hub/classes/states/cruncher/init/class_CruncherInitState.php +++ b/application/hub/classes/states/cruncher/init/class_CruncherInitState.php @@ -1,6 +1,10 @@ setConfigEntry('task_miner_block_fetcher_interval_delay', 1000); $cfg->setConfigEntry('task_miner_block_fetcher_max_runs', 0); // CFG: MINER-TEST-GENESIS-BLOCK-PRODUCER-TASK-CLASS -$cfg->setConfigEntry('miner_test_genesis_block_producer_task_class', 'Org\Shipsimu\Hub\Miner\Task\Producer\Block\Genesis\MinerTestGenesisBlockProducerTask'); +$cfg->setConfigEntry('miner_test_genesis_block_producer_task_class', 'Org\Shipsimu\Hub\Miner\Task\Producer\Miner\Block\Genesis\MinerTestGenesisBlockProducerTask'); // CFG: TASK-MINER-TEST-GENESIS-BLOCK-PRODUCER-STARTUP-DELAY $cfg->setConfigEntry('task_miner_test_genesis_block_producer_startup_delay', 1000); @@ -1020,7 +1020,7 @@ $cfg->setConfigEntry('task_miner_test_genesis_block_producer_interval_delay', 10 $cfg->setConfigEntry('task_miner_test_genesis_block_producer_max_runs', 0); // CFG: MINER-REAL-GENESIS-BLOCK-PRODUCER-TASK-CLASS -$cfg->setConfigEntry('miner_real_genesis_block_producer_task_class', 'Org\Shipsimu\Hub\Miner\Task\Producer\Block\Genesis\MinerRealGenesisBlockProducerTask'); +$cfg->setConfigEntry('miner_real_genesis_block_producer_task_class', 'Org\Shipsimu\Hub\Miner\Task\Producer\Miner\Block\Genesis\MinerRealGenesisBlockProducerTask'); // CFG: TASK-MINER-REAL-GENESIS-BLOCK-PRODUCER-STARTUP-DELAY $cfg->setConfigEntry('task_miner_real_genesis_block_producer_startup_delay', 500); @@ -1044,10 +1044,10 @@ $cfg->setConfigEntry('task_miner_node_communicator_interval_delay', 250); $cfg->setConfigEntry('task_miner_node_communicator_max_runs', 0); // CFG: MINER-TEST-GENESIS-BLOCK-PRODUCER-CLASS -$cfg->setConfigEntry('miner_test_genesis_block_producer_class', 'Org\Shipsimu\Hub\miner\Producer\Block\Genesis\MinerTestGenesisBlockProducer'); +$cfg->setConfigEntry('miner_test_genesis_block_producer_class', 'Org\Shipsimu\Hub\miner\Producer\Miner\Block\Genesis\MinerTestGenesisBlockProducer'); // CFG: MINER-REAL-GENESIS-BLOCK-PRODUCER-CLASS -$cfg->setConfigEntry('miner_real_genesis_block_producer_class', 'Org\Shipsimu\Hub\Miner\Producer\Block\Genesis\MinerRealGenesisBlockProducer'); +$cfg->setConfigEntry('miner_real_genesis_block_producer_class', 'Org\Shipsimu\Hub\Miner\Producer\Miner\Block\Genesis\MinerRealGenesisBlockProducer'); // CFG: MINER-NODE-COMMUNICATOR-CLASS $cfg->setConfigEntry('miner_node_communicator_class', 'Org\Shipsimu\Hub\Miner\Communicator\Node\MinerNodeCommunicator'); @@ -1065,8 +1065,11 @@ $cfg->setConfigEntry('hub_coin_miner_mode_class', 'Org\Shipsimu\Hub\Miner\HubCoi // Cruncher configuration /////////////////////////////////////////////////////////////////////////////// -// CFG: CRUNCHER-DEFAULT-MODE (can be only 'mcrypt' at the moment) -$cfg->setConfigEntry('cruncher_default_mode', 'mcrypt'); +// CFG: CRUNCHER-DEFAULT-MODE (can be only 'openssl' at the moment) +$cfg->setConfigEntry('cruncher_default_mode', 'openssl'); + +// CFG: HUB-OPENSSL-CRUNCHER-MODE-CLASS +$cfg->setConfigEntry('hub_openssl_cruncher_mode_class', 'Org\Shipsimu\Hub\Cruncher\OpenSsl\HubOpenSslCruncher'); // CFG: CRUNCHER-BUFFER-STACKER-CLASS $cfg->setConfigEntry('cruncher_buffer_stacker_class', 'Org\Mxchange\CoreFramework\Stacker\FiFoStacker'); @@ -1075,31 +1078,31 @@ $cfg->setConfigEntry('cruncher_buffer_stacker_class', 'Org\Mxchange\CoreFramewor $cfg->setConfigEntry('hub_console_cmd_cruncher_resolver_class', 'Org\Shipsimu\Hub\Resolver\Command\HubConsoleCommandResolver'); // CFG: CRUNCHER-PHP-REQUIREMENTS-FILTER -$cfg->setConfigEntry('cruncher_php_requirements_filter_class', 'CruncherPhpRequirementsFilter'); +$cfg->setConfigEntry('cruncher_php_requirements_filter_class', 'Org\Shipsimu\Hub\Cruncher\Filter\Requirements\CruncherPhpRequirementsFilter'); // CFG: CRUNCHER-INITIALIZER-FILTER -$cfg->setConfigEntry('cruncher_initializer_filter_class', 'CruncherInitializationFilter'); +$cfg->setConfigEntry('cruncher_initializer_filter_class', 'Org\Shipsimu\Hub\Cruncher\Filter\Initialization\CruncherInitializationFilter'); // CFG: CRUNCHER-BOOTSTRAP-TASK-HANDLER-INITIALIZER-FILTER -$cfg->setConfigEntry('cruncher_bootstrap_task_handler_initializer_filter_class', 'CruncherTaskHandlerInitializerFilter'); +$cfg->setConfigEntry('cruncher_bootstrap_task_handler_initializer_filter_class', 'Org\Shipsimu\Hub\Filter\Initializer\Cruncher\Handler\Task\CruncherTaskHandlerInitializerFilter'); // CFG: CRUNCHER-BOOTSTRAP-EXTRA-BOOTSTRAPPING-FILTER -$cfg->setConfigEntry('cruncher_bootstrap_extra_bootstrapping_filter_class', 'CruncherBootstrapExtraBootstrappingFilter'); +$cfg->setConfigEntry('cruncher_bootstrap_extra_bootstrapping_filter_class', 'Org\Shipsimu\Hub\Filter\Bootstrap\Cruncher\Extra\CruncherBootstrapExtraBootstrappingFilter'); // CFG: CRUNCHER-BOOTSTRAP-BUFFER-QUEUE-INITIALIZER-FILTER -$cfg->setConfigEntry('cruncher_bootstrap_buffer_queue_initializer_filter_class', 'CruncherBootstrapBufferQueueInitializerFilter'); +$cfg->setConfigEntry('cruncher_bootstrap_buffer_queue_initializer_filter_class', 'Org\Shipsimu\Hub\Filter\Bootstrap\Cruncher\Queue\CruncherBootstrapBufferQueueInitializerFilter'); // CFG: CRUNCHER-BOOTSTRAP-GENERIC-ACTIVATION-FILTER -$cfg->setConfigEntry('cruncher_bootstrap_generic_activation_filter_class', 'CruncherBootstrapGenericActivationFilter'); +$cfg->setConfigEntry('cruncher_bootstrap_generic_activation_filter_class', 'Org\Shipsimu\Hub\Filter\Bootstrap\Cruncher\Activation\CruncherBootstrapGenericActivationFilter'); // CFG: CRUNCHER-WELCOME-TEASER-FILTER -$cfg->setConfigEntry('cruncher_welcome_teaser_filter_class', 'CruncherWelcomeTeaserFilter'); +$cfg->setConfigEntry('cruncher_welcome_teaser_filter_class', 'Org\Shipsimu\Hub\Cruncher\Filter\WelcomeTeaser\CruncherWelcomeTeaserFilter'); // CFG: CRUNCHER-SHUTDOWN-FILTER -$cfg->setConfigEntry('cruncher_shutdown_filter_class', 'CruncherShutdownFilter'); +$cfg->setConfigEntry('cruncher_shutdown_filter_class', 'Org\Shipsimu\Hub\Filter\Shutdown\Cruncher\CruncherShutdownFilter'); // CFG: CRUNCHER-WORK-UNIT-FETCHER-TASK-CLASS -$cfg->setConfigEntry('cruncher_work_unit_fetcher_task_class', 'CruncherWorkUnitFetcherTask'); +$cfg->setConfigEntry('cruncher_work_unit_fetcher_task_class', 'Org\Shipsimu\Hub\Cruncher\Task\Fetcher\WorkUnit\CruncherWorkUnitFetcherTask'); // CFG: TASK-CRUNCHER-WORK-UNIT-FETCHER-STARTUP-DELAY $cfg->setConfigEntry('task_cruncher_work_unit_fetcher_startup_delay', 1000); @@ -1111,7 +1114,7 @@ $cfg->setConfigEntry('task_cruncher_work_unit_fetcher_interval_delay', 10); $cfg->setConfigEntry('task_cruncher_work_unit_fetcher_max_runs', 0); // CFG: CRUNCHER-TEST-UNIT-PRODUCER-TASK-CLASS -$cfg->setConfigEntry('cruncher_test_unit_producer_task_class', 'CruncherTestUnitProducerTask'); +$cfg->setConfigEntry('cruncher_test_unit_producer_task_class', 'Org\Shipsimu\Hub\Cruncher\Task\Producer\Unit\CruncherTestUnitProducerTask'); // CFG: TASK-CRUNCHER-TEST-UNIT-PRODUCER-STARTUP-DELAY $cfg->setConfigEntry('task_cruncher_test_unit_producer_startup_delay', 500); @@ -1123,7 +1126,7 @@ $cfg->setConfigEntry('task_cruncher_test_unit_producer_interval_delay', 1000*60* $cfg->setConfigEntry('task_cruncher_test_unit_producer_max_runs', 0); // CFG: CRUNCHER-KEY-PRODUCER-TASK-CLASS -$cfg->setConfigEntry('cruncher_key_producer_task_class', 'CruncherKeyProducerTask'); +$cfg->setConfigEntry('cruncher_key_producer_task_class', 'Org\Shipsimu\Hub\Cruncher\Producer\Key\CruncherKeyProducerTask'); // CFG: TASK-CRUNCHER-KEY-PRODUCER-STARTUP-DELAY $cfg->setConfigEntry('task_cruncher_key_producer_startup_delay', 750); @@ -1141,19 +1144,19 @@ $cfg->setConfigEntry('cruncher_test_units_enabled', 'Y'); $cfg->setConfigEntry('cruncher_in_buffer_min_threshold', 3); // CFG: CRUNCHER-TEST-UNIT-GENERATOR-CLASS -$cfg->setConfigEntry('cruncher_test_unit_generator_class', 'CruncherTestUnitHelper'); +$cfg->setConfigEntry('cruncher_test_unit_generator_class', 'Org\Shipsimu\Hub\Cruncher\Helper\WorkUnit\Test\CruncherTestUnitHelper'); // CFG: CRUNCHER-MAX-TEST-UNIT-AMOUNT $cfg->setConfigEntry('cruncher_max_text_unit_amount', 10); // CFG: CRUNCHER-TEST-UNIT-PRODUCER-CLASS -$cfg->setConfigEntry('cruncher_test_unit_producer_class', 'CruncherTestUnitProducer'); +$cfg->setConfigEntry('cruncher_test_unit_producer_class', 'Org\Shipsimu\Hub\Cruncher\Producer\Cruncher\Unit\CruncherTestUnitProducer'); // CFG: CRUNCHER-KEY-PRODUCER-CLASS -$cfg->setConfigEntry('cruncher_key_producer_class', 'CruncherKeyProducer'); +$cfg->setConfigEntry('cruncher_key_producer_class', 'Org\Shipsimu\Hub\Producer\Cruncher\Key\CruncherKeyProducer'); // CFG: CRUNCHER-TEST-UNIT-PRODUCER-TEMPLATE-CLASS -$cfg->setConfigEntry('cruncher_test_unit_producer_template_class', 'XmlCruncherTestUnitTemplateEngine'); +$cfg->setConfigEntry('cruncher_test_unit_producer_template_class', 'Org\Shipsimu\Hub\Cruncher\Template\Engine\Xml\TestUnit\XmlCruncherTestUnitTemplateEngine'); // CFG: CRUNCHER-MESSAGE-TEMPLATE-EXTENSION $cfg->setConfigEntry('cruncher_message_template_extension', '.xml'); @@ -1177,13 +1180,13 @@ $cfg->setConfigEntry('stacker_outgoing_queue_max_size', 2000); $cfg->setConfigEntry('cruncher_test_unit_max_count', 1000); // CFG: CRUNCHER-UNIT-DB-WRAPPER-CLASS -$cfg->setConfigEntry('cruncher_unit_db_wrapper_class', 'CruncherUnitDatabaseWrapper'); +$cfg->setConfigEntry('cruncher_unit_db_wrapper_class', 'Org\Shipsimu\Hub\Database\Frontend\Cruncher\Unit\CruncherUnitDatabaseWrapper'); // CFG: CRUNCHER-RANDOM-SECRET-MESSAGE-LENGTH $cfg->setConfigEntry('random_secret_message_length', 100); // CFG: TEST-UNIT-PRODUCER-KEY-ITERATOR-CLASS -$cfg->setConfigEntry('test_unit_producer_key_iterator_class', 'TestUnitKeyProducerIterator'); +$cfg->setConfigEntry('test_unit_producer_key_iterator_class', 'Org\Shipsimu\Hub\Iterator\Producer\Key\TestUnit\TestUnitKeyProducerIterator'); // CFG: WORK-UNIT-PRODUCER-KEY-ITERATOR-CLASS $cfg->setConfigEntry('work_unit_producer_key_iterator_class', 'WorkUnitKeyProducerIterator'); @@ -1192,16 +1195,16 @@ $cfg->setConfigEntry('work_unit_producer_key_iterator_class', 'WorkUnitKeyProduc $cfg->setConfigEntry('test_unit_random_secret_key_length', 8 * 32); // CFG: TEST-UNIT-SOURCE-CLASS -$cfg->setConfigEntry('test_unit_source_class', 'TestUnitSource'); +$cfg->setConfigEntry('test_unit_source_class', 'Org\Shipsimu\Hub\Crawler\Source\Unit\TestUnitSource'); // CFG: CRYPTO-RANDOM-MESSAGE-HELPER-CLASS -$cfg->setConfigEntry('crypto_random_message_helper_class', 'CryptoRandomUnitMessageHelper'); +$cfg->setConfigEntry('crypto_random_message_helper_class', 'Org\Shipsimu\Hub\Helper\Crypto\Message\RandomUnit\CryptoRandomUnitMessageHelper'); // CFG: CRUNCHER-INIT-STATE-CLASS -$cfg->setConfigEntry('cruncher_init_state_class', 'CruncherInitState'); +$cfg->setConfigEntry('cruncher_init_state_class', 'Org\Shipsimu\Hub\Cruncher\State\Initialization\CruncherInitState'); // CFG: CRUNCHER-VIRGIN-STATE-CLASS -$cfg->setConfigEntry('cruncher_virgin_state_class', 'CruncherVirginState'); +$cfg->setConfigEntry('cruncher_virgin_state_class', 'Org\Shipsimu\Hub\Cruncher\State\Virgin\CruncherVirginState'); // CFG: CRUNCHER-PER-UNIT-KEY-LIMIT $cfg->setConfigEntry('cruncher_per_unit_key_limit', 1000); diff --git a/application/hub/interfaces/producer/keys/class_KeyProducer.php b/application/hub/interfaces/producer/keys/class_KeyProducer.php index 442689922..e6a011797 100644 --- a/application/hub/interfaces/producer/keys/class_KeyProducer.php +++ b/application/hub/interfaces/producer/keys/class_KeyProducer.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Producer\Key; +// Import application-specific stuff +use Org\Shipsimu\Hub\Producer\Producer; + // Import framework stuff use Org\Mxchange\CoreFramework\Executor\Executor; use Org\Mxchange\CoreFramework\State\Stateable; diff --git a/application/hub/interfaces/producer/work_units/class_UnitProducer.php b/application/hub/interfaces/producer/work_units/class_UnitProducer.php index b4cba7371..242af0fa5 100644 --- a/application/hub/interfaces/producer/work_units/class_UnitProducer.php +++ b/application/hub/interfaces/producer/work_units/class_UnitProducer.php @@ -2,6 +2,9 @@ // Own namespace namespace Org\Shipsimu\Hub\Producer\Unit; +// Import application-specific stuff +use Org\Shipsimu\Hub\Producer\Producer; + // Import framework stuff use Org\Mxchange\CoreFramework\Executor\Executor; use Org\Mxchange\CoreFramework\State\Stateable;